@schukai/monster 4.148.9 → 4.149.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/package.json +1 -1
- package/source/components/accessibility/stylesheet/locale-picker.mjs +61 -1
- package/source/components/content/image-editor.mjs +79 -11
- package/source/components/content/style/copy.pcss +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/stylesheet/fetch-box.mjs +1 -1
- package/source/components/content/stylesheet/viewer.mjs +61 -1
- package/source/components/data/kpi-tile.mjs +5 -3
- package/source/components/data/metric-graph.mjs +22 -20
- package/source/components/data/metric.mjs +20 -18
- package/source/components/data/style/kpi-tile.pcss +65 -43
- package/source/components/data/style/metric-graph.pcss +35 -18
- package/source/components/data/style/metric.pcss +35 -28
- package/source/components/data/stylesheet/kpi-tile.mjs +61 -1
- package/source/components/data/stylesheet/metric-graph.mjs +61 -1
- package/source/components/data/stylesheet/metric.mjs +61 -1
- package/source/components/datatable/columnbar.mjs +4 -2
- package/source/components/datatable/datatable.mjs +73 -15
- package/source/components/datatable/filter/date-range.mjs +61 -61
- package/source/components/datatable/filter/date-time.mjs +5 -1
- package/source/components/datatable/filter/range.mjs +3 -3
- package/source/components/datatable/filter/select-operator.mjs +7 -1
- package/source/components/datatable/filter/text-operator.mjs +11 -3
- package/source/components/datatable/filter.mjs +16 -0
- package/source/components/datatable/pagination.mjs +2 -2
- package/source/components/datatable/style/column-bar.pcss +115 -23
- package/source/components/datatable/style/datatable.pcss +257 -29
- package/source/components/datatable/style/embedded-pagination.pcss +63 -34
- package/source/components/datatable/style/filter-button.pcss +1 -1
- package/source/components/datatable/style/filter-controls-defaults.pcss +49 -3
- package/source/components/datatable/style/filter-select.pcss +4 -1
- package/source/components/datatable/style/filter.pcss +18 -1
- package/source/components/datatable/stylesheet/change-button.mjs +61 -1
- package/source/components/datatable/stylesheet/column-bar.mjs +69 -1
- package/source/components/datatable/stylesheet/dataset.mjs +61 -1
- package/source/components/datatable/stylesheet/datatable.mjs +71 -1
- package/source/components/datatable/stylesheet/embedded-pagination.mjs +1 -1
- package/source/components/datatable/stylesheet/filter-button.mjs +1 -1
- package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +1 -1
- package/source/components/datatable/stylesheet/filter-select.mjs +61 -1
- package/source/components/datatable/stylesheet/filter.mjs +61 -1
- package/source/components/datatable/stylesheet/pagination.mjs +67 -1
- package/source/components/datatable/stylesheet/save-button.mjs +61 -1
- package/source/components/datatable/stylesheet/status.mjs +61 -1
- package/source/components/form/action-button.mjs +2 -1
- package/source/components/form/button-bar.mjs +7 -2
- package/source/components/form/context-error.mjs +4 -3
- package/source/components/form/context-help.mjs +10 -4
- package/source/components/form/context-hint.mjs +1 -1
- package/source/components/form/context-info.mjs +1 -1
- package/source/components/form/context-note.mjs +1 -1
- package/source/components/form/context-success.mjs +1 -1
- package/source/components/form/context-warning.mjs +1 -1
- package/source/components/form/control-bar.mjs +300 -14
- package/source/components/form/credential-button.mjs +4 -2
- package/source/components/form/digits.mjs +28 -1
- package/source/components/form/field-set.mjs +30 -0
- package/source/components/form/login.mjs +13 -10
- package/source/components/form/password.mjs +6 -0
- package/source/components/form/popper-button.mjs +1 -1
- package/source/components/form/quantity.mjs +14 -6
- package/source/components/form/register-wizard.mjs +46 -26
- package/source/components/form/select.mjs +17 -10
- package/source/components/form/sheet.mjs +13 -2
- package/source/components/form/style/action-button.pcss +131 -5
- package/source/components/form/style/button-bar.pcss +204 -3
- package/source/components/form/style/control-bar.pcss +254 -26
- package/source/components/form/style/digits.pcss +7 -6
- package/source/components/form/style/input-group.pcss +65 -1
- package/source/components/form/style/login.pcss +1 -1
- package/source/components/form/style/mixin/field-set-layout.pcss +8 -0
- package/source/components/form/style/password.pcss +25 -1
- package/source/components/form/style/popper-button.pcss +1 -0
- package/source/components/form/style/quantity.pcss +11 -20
- package/source/components/form/style/select.pcss +52 -7
- package/source/components/form/style/sheet.pcss +70 -1
- package/source/components/form/style/state-button.pcss +5 -2
- package/source/components/form/style/toggle-switch.pcss +7 -4
- package/source/components/form/stylesheet/action-button.mjs +63 -1
- package/source/components/form/stylesheet/button-bar.mjs +153 -1
- package/source/components/form/stylesheet/button.mjs +61 -1
- package/source/components/form/stylesheet/control-bar.mjs +163 -1
- package/source/components/form/stylesheet/digits.mjs +1 -1
- package/source/components/form/stylesheet/field-layout.mjs +1 -1
- package/source/components/form/stylesheet/field-set.mjs +1 -1
- package/source/components/form/stylesheet/form.mjs +1 -1
- package/source/components/form/stylesheet/input-group.mjs +15 -1
- package/source/components/form/stylesheet/login.mjs +1 -1
- package/source/components/form/stylesheet/password.mjs +7 -1
- package/source/components/form/stylesheet/popper-button.mjs +61 -1
- package/source/components/form/stylesheet/quantity.mjs +1 -1
- package/source/components/form/stylesheet/register-wizard.mjs +1 -1
- package/source/components/form/stylesheet/select.mjs +3 -1
- package/source/components/form/stylesheet/sheet.mjs +1 -1
- package/source/components/form/stylesheet/state-button.mjs +3 -1
- package/source/components/form/stylesheet/toggle-switch.mjs +1 -1
- package/source/components/form/stylesheet/wizard.mjs +1 -1
- package/source/components/form/util/floating-ui.mjs +35 -7
- package/source/components/host/call-button.mjs +3 -1
- package/source/components/host/stylesheet/call-button.mjs +61 -1
- package/source/components/host/stylesheet/host.mjs +1 -1
- package/source/components/host/stylesheet/toggle-button.mjs +61 -1
- package/source/components/layout/full-screen.mjs +31 -23
- package/source/components/layout/iframe.mjs +5 -1
- package/source/components/layout/popper.mjs +34 -4
- package/source/components/layout/style/full-screen.pcss +94 -23
- package/source/components/layout/style/split-panel.pcss +57 -5
- package/source/components/layout/style/tabs.pcss +277 -47
- package/source/components/layout/style/vertical-tabs.pcss +147 -0
- package/source/components/layout/stylesheet/collapse.mjs +61 -1
- package/source/components/layout/stylesheet/details.mjs +61 -1
- package/source/components/layout/stylesheet/full-screen.mjs +23 -1
- package/source/components/layout/stylesheet/overlay.mjs +1 -1
- package/source/components/layout/stylesheet/panel.mjs +1 -1
- package/source/components/layout/stylesheet/slider.mjs +1 -1
- package/source/components/layout/stylesheet/split-panel.mjs +17 -1
- package/source/components/layout/stylesheet/tabs.mjs +97 -1
- package/source/components/layout/stylesheet/vertical-tabs.mjs +33 -95
- package/source/components/layout/tabs.mjs +63 -0
- package/source/components/layout/vertical-tabs.mjs +63 -0
- package/source/components/navigation/stylesheet/site-navigation.mjs +1 -1
- package/source/components/navigation/stylesheet/table-of-content.mjs +1 -1
- package/source/components/navigation/stylesheet/wizard-navigation.mjs +1 -1
- package/source/components/navigation/table-of-content.mjs +13 -0
- package/source/components/notify/style/notify.pcss +1 -2
- package/source/components/notify/stylesheet/message.mjs +1 -1
- package/source/components/notify/stylesheet/notify.mjs +1 -1
- package/source/components/state/style/log.pcss +1 -0
- package/source/components/state/style/state.pcss +5 -1
- package/source/components/state/stylesheet/log.mjs +1 -1
- package/source/components/state/stylesheet/state.mjs +7 -1
- package/source/components/style/button.css +61 -205
- package/source/components/style/button.pcss +78 -34
- package/source/components/style/common.css +1 -170
- package/source/components/style/common.pcss +5 -9
- package/source/components/style/form.css +1 -49
- package/source/components/style/form.pcss +24 -6
- package/source/components/style/link.css +1 -39
- package/source/components/style/link.pcss +8 -16
- package/source/components/style/mixin/button.pcss +19 -10
- package/source/components/style/mixin/property.pcss +8 -0
- package/source/components/style/mixin/skeleton.pcss +11 -5
- package/source/components/style/normalize.css +1 -144
- package/source/components/style/normalize.pcss +5 -5
- package/source/components/style/property.css +1 -387
- package/source/components/style/skeleton.css +1 -198
- package/source/components/style/skeleton.pcss +8 -2
- package/source/components/style/theme-modern.css +74 -0
- package/source/components/style/theme-modern.pcss +498 -0
- package/source/components/stylesheet/button.mjs +61 -1
- package/source/components/stylesheet/common.mjs +1 -1
- package/source/components/stylesheet/form.mjs +1 -1
- package/source/components/stylesheet/link.mjs +1 -1
- package/source/components/stylesheet/normalize.mjs +1 -1
- package/source/components/stylesheet/property.mjs +1 -1
- package/source/components/stylesheet/skeleton.mjs +1 -1
- package/source/components/stylesheet/theme-modern.mjs +110 -0
- package/source/components/time/stylesheet/day.mjs +61 -1
- package/source/components/time/stylesheet/month-calendar.mjs +61 -1
- package/source/components/time/timeline/stylesheet/appointment.mjs +61 -1
- package/source/components/time/timeline/stylesheet/segment.mjs +61 -1
- package/source/components/tree-menu/style/tree-menu.pcss +26 -37
- package/source/components/tree-menu/stylesheet/tree-menu.mjs +1 -1
- package/test/cases/components/content/image-editor.mjs +19 -0
- package/test/cases/components/datatable/accessibility-defaults.mjs +112 -0
- package/test/cases/components/datatable/filter-availability.mjs +37 -0
- package/test/cases/components/datatable/filter-date-range-layout.mjs +40 -0
- package/test/cases/components/datatable/filter-select-operator.mjs +118 -0
- package/test/cases/components/datatable/mobile-layout.mjs +203 -0
- package/test/cases/components/datatable/responsive-breakpoint.mjs +41 -0
- package/test/cases/components/datatable/selection.mjs +149 -0
- package/test/cases/components/form/action-button-style.mjs +85 -0
- package/test/cases/components/form/button-bar.mjs +222 -3
- package/test/cases/components/form/context-theme-colors.mjs +59 -0
- package/test/cases/components/form/control-bar.mjs +228 -3
- package/test/cases/components/form/control-heights.mjs +103 -0
- package/test/cases/components/form/digits-accessibility.mjs +65 -0
- package/test/cases/components/form/field-set.mjs +54 -0
- package/test/cases/components/form/floating-ui.mjs +74 -0
- package/test/cases/components/form/input-group.mjs +61 -28
- package/test/cases/components/form/login.mjs +47 -0
- package/test/cases/components/form/password.mjs +63 -0
- package/test/cases/components/form/popper-button.mjs +30 -15
- package/test/cases/components/form/quantity-accessibility.mjs +46 -0
- package/test/cases/components/form/register-wizard.mjs +79 -0
- package/test/cases/components/form/select.mjs +94 -2
- package/test/cases/components/form/sheet.mjs +56 -2
- package/test/cases/components/host/toggle-button.mjs +50 -0
- package/test/cases/components/layout/full-screen.mjs +60 -0
- package/test/cases/components/layout/iframe-accessibility.mjs +44 -0
- package/test/cases/components/layout/popper.mjs +128 -0
- package/test/cases/components/layout/slit-panel.mjs +30 -1
- package/test/cases/components/layout/tabs.mjs +93 -0
- package/test/cases/components/navigation/table-of-content.mjs +18 -0
- package/test/cases/components/state/state-style.mjs +31 -0
- package/test/cases/components/style/action-menu.mjs +74 -0
- package/test/cases/components/style/form-controls.mjs +37 -0
- package/test/cases/components/style/kpi-tile.mjs +60 -0
- package/test/cases/components/style/legacy-theme-compatibility.mjs +137 -0
- package/test/cases/components/style/metric-layout.mjs +94 -0
- package/test/cases/components/style/skeleton.mjs +69 -0
- package/test/cases/components/style/theme-component-catalog.mjs +853 -0
- package/test/cases/components/style/theme-modern.mjs +439 -0
- package/test/cases/components/style/theme-review-regressions.mjs +41 -0
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import { instanceSymbol } from "../../constants.mjs";
|
|
16
16
|
import { registerCustomElement } from "../../dom/customelement.mjs";
|
|
17
17
|
import { ContextHelpStyleSheet } from "./stylesheet/context-help.mjs";
|
|
18
|
+
import { ThemeStyleSheet } from "../stylesheet/theme.mjs";
|
|
18
19
|
import { ContextBase } from "./context-base.mjs";
|
|
19
20
|
|
|
20
21
|
export { ContextHelp };
|
|
@@ -62,6 +63,9 @@ class ContextHelp extends ContextBase {
|
|
|
62
63
|
main: getTemplate(),
|
|
63
64
|
},
|
|
64
65
|
mode: "auto",
|
|
66
|
+
classes: {
|
|
67
|
+
button: "monster-theme-primary-1 monster-theme-background-inherit",
|
|
68
|
+
},
|
|
65
69
|
});
|
|
66
70
|
}
|
|
67
71
|
|
|
@@ -76,7 +80,7 @@ class ContextHelp extends ContextBase {
|
|
|
76
80
|
* @return {CSSStyleSheet[]}
|
|
77
81
|
*/
|
|
78
82
|
static getCSSStyleSheet() {
|
|
79
|
-
return [ContextHelpStyleSheet];
|
|
83
|
+
return [ContextHelpStyleSheet, ThemeStyleSheet];
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
|
|
@@ -89,13 +93,15 @@ function getTemplate() {
|
|
|
89
93
|
return `
|
|
90
94
|
<div data-monster-role="control" part="control">
|
|
91
95
|
|
|
92
|
-
<div data-monster-role="button"
|
|
96
|
+
<div data-monster-role="button"
|
|
97
|
+
data-monster-attributes="class path:classes.button"
|
|
98
|
+
part="button"><svg class="hidden"
|
|
93
99
|
xmlns="http://www.w3.org/2000/svg"
|
|
94
100
|
width="1.2em"
|
|
95
101
|
height="1.2em"
|
|
102
|
+
fill="currentColor"
|
|
96
103
|
viewBox="0 0 16 16">
|
|
97
|
-
<path
|
|
98
|
-
d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.496 6.033h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286a.237.237 0 0 0 .241.247zm2.325 6.443c.61 0 1.029-.394 1.029-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94 0 .533.425.927 1.01.927z"/>
|
|
104
|
+
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.496 6.033h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286a.237.237 0 0 0 .241.247zm2.325 6.443c.61 0 1.029-.394 1.029-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94 0 .533.425.927 1.01.927z"/>
|
|
99
105
|
</svg></div>
|
|
100
106
|
|
|
101
107
|
<div data-monster-role="popper" part="popper" tabindex="-1" class="monster-color-primary-1">
|
|
@@ -98,6 +98,7 @@ const popperElementSymbol = Symbol("popperElement");
|
|
|
98
98
|
* @type {symbol}
|
|
99
99
|
*/
|
|
100
100
|
const closeEventHandler = Symbol("closeEventHandler");
|
|
101
|
+
const escapeEventHandler = Symbol("escapeEventHandler");
|
|
101
102
|
|
|
102
103
|
/**
|
|
103
104
|
* @private
|
|
@@ -281,6 +282,7 @@ class ControlBar extends CustomElement {
|
|
|
281
282
|
* @property {Object} templates Template definitions
|
|
282
283
|
* @property {string} templates.main Main template
|
|
283
284
|
* @property {Object} labels
|
|
285
|
+
* @property {string} labels.moreActions="More actions" Accessible label for the responsive overflow switch
|
|
284
286
|
* @property {Object} layout Responsive layout configuration.
|
|
285
287
|
* @property {string} layout.alignment=left Main-row alignment. Supported values are `left`, `right` and `center`.
|
|
286
288
|
* @property {string|undefined} layout.stackedAlignment Alignment used while the configured stacked breakpoint matches.
|
|
@@ -296,7 +298,9 @@ class ControlBar extends CustomElement {
|
|
|
296
298
|
templates: {
|
|
297
299
|
main: getTemplate(),
|
|
298
300
|
},
|
|
299
|
-
labels: {
|
|
301
|
+
labels: {
|
|
302
|
+
moreActions: "More actions",
|
|
303
|
+
},
|
|
300
304
|
layout: {
|
|
301
305
|
alignment: "left",
|
|
302
306
|
stackedAlignment: undefined,
|
|
@@ -333,6 +337,7 @@ class ControlBar extends CustomElement {
|
|
|
333
337
|
suppressResize: false,
|
|
334
338
|
itemInlineSizes: new WeakMap(),
|
|
335
339
|
joinedInlineOffsets: new WeakMap(),
|
|
340
|
+
joinedBorderRadiusStyles: new Map(),
|
|
336
341
|
};
|
|
337
342
|
|
|
338
343
|
initControlReferences.call(this);
|
|
@@ -406,6 +411,7 @@ class ControlBar extends CustomElement {
|
|
|
406
411
|
// close on outside ui-events
|
|
407
412
|
document.addEventListener(type, this[closeEventHandler]);
|
|
408
413
|
}
|
|
414
|
+
document.addEventListener("keydown", this[escapeEventHandler]);
|
|
409
415
|
|
|
410
416
|
scheduleLayout.call(this, { measure: true, layout: true, observe: true });
|
|
411
417
|
}
|
|
@@ -440,6 +446,7 @@ class ControlBar extends CustomElement {
|
|
|
440
446
|
for (const [, type] of Object.entries(["click", "touch"])) {
|
|
441
447
|
document.removeEventListener(type, this[closeEventHandler]);
|
|
442
448
|
}
|
|
449
|
+
document.removeEventListener("keydown", this[escapeEventHandler]);
|
|
443
450
|
|
|
444
451
|
if (typeof this[layoutFrameSymbol] === "number") {
|
|
445
452
|
cancelAnimationFrame(this[layoutFrameSymbol]);
|
|
@@ -449,6 +456,7 @@ class ControlBar extends CustomElement {
|
|
|
449
456
|
if (this[layoutStateSymbol]) {
|
|
450
457
|
this[layoutStateSymbol].scheduled = false;
|
|
451
458
|
}
|
|
459
|
+
restoreJoinedBorderRadii.call(this);
|
|
452
460
|
|
|
453
461
|
disconnectResizeObserver.call(this);
|
|
454
462
|
defuseLayoutChangedEvent.call(this);
|
|
@@ -528,11 +536,17 @@ function isElementSelfHidden(element) {
|
|
|
528
536
|
}
|
|
529
537
|
|
|
530
538
|
const computedStyle = getComputedStyle(element);
|
|
539
|
+
// A positioned popper is hidden until Floating UI has placed it. Slotted
|
|
540
|
+
// controls inherit that temporary visibility and are not self-hidden.
|
|
541
|
+
const visibilityIsInheritedFromSlot =
|
|
542
|
+
computedStyle.visibility === "hidden" &&
|
|
543
|
+
element.assignedSlot instanceof HTMLSlotElement &&
|
|
544
|
+
getComputedStyle(element.assignedSlot).visibility === "hidden";
|
|
531
545
|
return (
|
|
532
546
|
element.hidden === true ||
|
|
533
547
|
element.hasAttribute("hidden") ||
|
|
534
548
|
computedStyle.display === "none" ||
|
|
535
|
-
computedStyle.visibility === "hidden"
|
|
549
|
+
(computedStyle.visibility === "hidden" && !visibilityIsInheritedFromSlot)
|
|
536
550
|
);
|
|
537
551
|
}
|
|
538
552
|
|
|
@@ -583,6 +597,18 @@ function initEventHandler() {
|
|
|
583
597
|
}
|
|
584
598
|
hide.call(self);
|
|
585
599
|
};
|
|
600
|
+
self[escapeEventHandler] = (event) => {
|
|
601
|
+
if (
|
|
602
|
+
event.key !== "Escape" ||
|
|
603
|
+
self[popperElementSymbol]?.style.display !== STYLE_DISPLAY_MODE_BLOCK
|
|
604
|
+
) {
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
event.preventDefault();
|
|
609
|
+
hide.call(self);
|
|
610
|
+
self[switchElementSymbol]?.focus();
|
|
611
|
+
};
|
|
586
612
|
|
|
587
613
|
if (self[controlBarSlotElementSymbol]) {
|
|
588
614
|
self[controlBarSlotElementSymbol].addEventListener("slotchange", () => {
|
|
@@ -1025,9 +1051,7 @@ function isControlItemVisible(item) {
|
|
|
1025
1051
|
*/
|
|
1026
1052
|
function normalizeSpacerOverflowLayout(layout, orderedItems) {
|
|
1027
1053
|
if (
|
|
1028
|
-
!layout.itemsToMoveToPopper.some(
|
|
1029
|
-
(item) => !isControlBarSpacerElement(item),
|
|
1030
|
-
)
|
|
1054
|
+
!layout.itemsToMoveToPopper.some((item) => !isControlBarSpacerElement(item))
|
|
1031
1055
|
) {
|
|
1032
1056
|
return layout;
|
|
1033
1057
|
}
|
|
@@ -1245,8 +1269,14 @@ function updateJoinedBorders(layout, shouldShowSwitch) {
|
|
|
1245
1269
|
|
|
1246
1270
|
const marginLeftByElement = new Map();
|
|
1247
1271
|
const marginTopByElement = new Map();
|
|
1272
|
+
const hasMainSpacing = hasButtonBarSpacing.call(
|
|
1273
|
+
this,
|
|
1274
|
+
"--monster-button-bar-gap",
|
|
1275
|
+
);
|
|
1248
1276
|
|
|
1249
|
-
|
|
1277
|
+
if (!hasMainSpacing) {
|
|
1278
|
+
collectInlineJoinedBorders.call(this, mainItems, marginLeftByElement);
|
|
1279
|
+
}
|
|
1250
1280
|
for (const item of [...mainItems, ...layout.itemsToMoveToPopper]) {
|
|
1251
1281
|
collectInlineJoinedBorders.call(
|
|
1252
1282
|
this,
|
|
@@ -1254,11 +1284,13 @@ function updateJoinedBorders(layout, shouldShowSwitch) {
|
|
|
1254
1284
|
marginLeftByElement,
|
|
1255
1285
|
);
|
|
1256
1286
|
}
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1287
|
+
if (!hasButtonBarSpacing.call(this, "--monster-button-bar-popper-gap")) {
|
|
1288
|
+
collectBlockJoinedBorders.call(
|
|
1289
|
+
this,
|
|
1290
|
+
layout.itemsToMoveToPopper,
|
|
1291
|
+
marginTopByElement,
|
|
1292
|
+
);
|
|
1293
|
+
}
|
|
1262
1294
|
updateSpacerLineWidths.call(this, mainItems, "inline", "right", "left");
|
|
1263
1295
|
updateSpacerLineWidths.call(
|
|
1264
1296
|
this,
|
|
@@ -1267,11 +1299,38 @@ function updateJoinedBorders(layout, shouldShowSwitch) {
|
|
|
1267
1299
|
"bottom",
|
|
1268
1300
|
"top",
|
|
1269
1301
|
);
|
|
1270
|
-
|
|
1302
|
+
const offsetsChanged = applyJoinedBorderOffsets.call(
|
|
1271
1303
|
this,
|
|
1272
1304
|
marginLeftByElement,
|
|
1273
1305
|
marginTopByElement,
|
|
1274
1306
|
);
|
|
1307
|
+
const radiiChanged = updateJoinedBorderRadii.call(
|
|
1308
|
+
this,
|
|
1309
|
+
mainItems,
|
|
1310
|
+
[...mainItems, ...layout.itemsToMoveToPopper],
|
|
1311
|
+
!hasMainSpacing,
|
|
1312
|
+
);
|
|
1313
|
+
return offsetsChanged || radiiChanged;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Keep joined-border behavior as the default while allowing a spaced modern
|
|
1318
|
+
* button bar to clear the layout engine's negative overlap offsets.
|
|
1319
|
+
*
|
|
1320
|
+
* @private
|
|
1321
|
+
* @param {string} property
|
|
1322
|
+
* @return {boolean}
|
|
1323
|
+
*/
|
|
1324
|
+
function hasButtonBarSpacing(property) {
|
|
1325
|
+
if (this.tagName !== "MONSTER-BUTTON-BAR") {
|
|
1326
|
+
return false;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
return (
|
|
1330
|
+
getComputedCssPixels(
|
|
1331
|
+
getComputedStyle(this).getPropertyValue(property).trim(),
|
|
1332
|
+
) > 0
|
|
1333
|
+
);
|
|
1275
1334
|
}
|
|
1276
1335
|
|
|
1277
1336
|
/**
|
|
@@ -1347,6 +1406,198 @@ function collectInlineJoinedBorders(elements, marginLeftByElement) {
|
|
|
1347
1406
|
}
|
|
1348
1407
|
}
|
|
1349
1408
|
|
|
1409
|
+
/**
|
|
1410
|
+
* Remove only the touching corner radii of horizontally joined controls.
|
|
1411
|
+
* Outer corners and controls separated by a configured button-bar gap keep
|
|
1412
|
+
* their component-defined radius.
|
|
1413
|
+
*
|
|
1414
|
+
* @private
|
|
1415
|
+
* @param {HTMLElement[]} mainItems
|
|
1416
|
+
* @param {HTMLElement[]} allItems
|
|
1417
|
+
* @param {boolean} joinMainItems
|
|
1418
|
+
* @return {boolean}
|
|
1419
|
+
*/
|
|
1420
|
+
function updateJoinedBorderRadii(mainItems, allItems, joinMainItems) {
|
|
1421
|
+
const propertiesByElement = new Map();
|
|
1422
|
+
|
|
1423
|
+
if (joinMainItems) {
|
|
1424
|
+
collectInlineJoinedBorderRadii.call(this, mainItems, propertiesByElement);
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
for (const item of allItems) {
|
|
1428
|
+
collectInlineJoinedBorderRadii.call(
|
|
1429
|
+
this,
|
|
1430
|
+
getContainedControlElements(item),
|
|
1431
|
+
propertiesByElement,
|
|
1432
|
+
);
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
return applyJoinedBorderRadii.call(this, propertiesByElement);
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
/**
|
|
1439
|
+
* @private
|
|
1440
|
+
* @param {HTMLElement[]} elements
|
|
1441
|
+
* @param {Map<HTMLElement, Set<string>>} propertiesByElement
|
|
1442
|
+
* @return {void}
|
|
1443
|
+
*/
|
|
1444
|
+
function collectInlineJoinedBorderRadii(elements, propertiesByElement) {
|
|
1445
|
+
const visibleElements = elements.filter(
|
|
1446
|
+
(element) =>
|
|
1447
|
+
element instanceof HTMLElement && !isElementSelfHidden(element),
|
|
1448
|
+
);
|
|
1449
|
+
|
|
1450
|
+
for (let i = 1; i < visibleElements.length; i++) {
|
|
1451
|
+
const previous = visibleElements[i - 1];
|
|
1452
|
+
const current = visibleElements[i];
|
|
1453
|
+
const overlap = getBorderOverlap(
|
|
1454
|
+
getVisualBorderWidth.call(this, previous, "right"),
|
|
1455
|
+
getVisualBorderWidth.call(this, current, "left"),
|
|
1456
|
+
);
|
|
1457
|
+
|
|
1458
|
+
if (overlap <= 0) {
|
|
1459
|
+
continue;
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
addJoinedBorderRadiusProperties(
|
|
1463
|
+
propertiesByElement,
|
|
1464
|
+
getVisualBorderElement.call(this, previous, "right"),
|
|
1465
|
+
["border-top-right-radius", "border-bottom-right-radius"],
|
|
1466
|
+
);
|
|
1467
|
+
addJoinedBorderRadiusProperties(
|
|
1468
|
+
propertiesByElement,
|
|
1469
|
+
getVisualBorderElement.call(this, current, "left"),
|
|
1470
|
+
["border-top-left-radius", "border-bottom-left-radius"],
|
|
1471
|
+
);
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
/**
|
|
1476
|
+
* @private
|
|
1477
|
+
* @param {Map<HTMLElement, Set<string>>} propertiesByElement
|
|
1478
|
+
* @param {HTMLElement} element
|
|
1479
|
+
* @param {string[]} properties
|
|
1480
|
+
* @return {void}
|
|
1481
|
+
*/
|
|
1482
|
+
function addJoinedBorderRadiusProperties(
|
|
1483
|
+
propertiesByElement,
|
|
1484
|
+
element,
|
|
1485
|
+
properties,
|
|
1486
|
+
) {
|
|
1487
|
+
if (!(element instanceof HTMLElement)) {
|
|
1488
|
+
return;
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
let elementProperties = propertiesByElement.get(element);
|
|
1492
|
+
if (!(elementProperties instanceof Set)) {
|
|
1493
|
+
elementProperties = new Set();
|
|
1494
|
+
propertiesByElement.set(element, elementProperties);
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
for (const property of properties) {
|
|
1498
|
+
elementProperties.add(property);
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
/**
|
|
1503
|
+
* @private
|
|
1504
|
+
* @param {Map<HTMLElement, Set<string>>} propertiesByElement
|
|
1505
|
+
* @return {boolean}
|
|
1506
|
+
*/
|
|
1507
|
+
function applyJoinedBorderRadii(propertiesByElement) {
|
|
1508
|
+
const originals = this[layoutStateSymbol]?.joinedBorderRadiusStyles;
|
|
1509
|
+
if (!(originals instanceof Map)) {
|
|
1510
|
+
return false;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
let changed = false;
|
|
1514
|
+
|
|
1515
|
+
for (const [element, elementOriginals] of [...originals]) {
|
|
1516
|
+
const desiredProperties = propertiesByElement.get(element);
|
|
1517
|
+
for (const [property, original] of [...elementOriginals]) {
|
|
1518
|
+
if (desiredProperties?.has(property)) {
|
|
1519
|
+
continue;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
changed =
|
|
1523
|
+
restoreInlineStyleProperty(element, property, original) || changed;
|
|
1524
|
+
elementOriginals.delete(property);
|
|
1525
|
+
}
|
|
1526
|
+
if (elementOriginals.size === 0) {
|
|
1527
|
+
originals.delete(element);
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
for (const [element, properties] of propertiesByElement) {
|
|
1532
|
+
let elementOriginals = originals.get(element);
|
|
1533
|
+
if (!(elementOriginals instanceof Map)) {
|
|
1534
|
+
elementOriginals = new Map();
|
|
1535
|
+
originals.set(element, elementOriginals);
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
for (const property of properties) {
|
|
1539
|
+
if (!elementOriginals.has(property)) {
|
|
1540
|
+
elementOriginals.set(property, {
|
|
1541
|
+
value: element.style.getPropertyValue(property),
|
|
1542
|
+
priority: element.style.getPropertyPriority(property),
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
if (
|
|
1546
|
+
element.style.getPropertyValue(property) !== "0px" ||
|
|
1547
|
+
element.style.getPropertyPriority(property) !== ""
|
|
1548
|
+
) {
|
|
1549
|
+
element.style.setProperty(property, "0px");
|
|
1550
|
+
changed = true;
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
return changed;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
/**
|
|
1559
|
+
* @private
|
|
1560
|
+
* @return {void}
|
|
1561
|
+
*/
|
|
1562
|
+
function restoreJoinedBorderRadii() {
|
|
1563
|
+
const originals = this[layoutStateSymbol]?.joinedBorderRadiusStyles;
|
|
1564
|
+
if (!(originals instanceof Map)) {
|
|
1565
|
+
return;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
for (const [element, elementOriginals] of originals) {
|
|
1569
|
+
for (const [property, original] of elementOriginals) {
|
|
1570
|
+
restoreInlineStyleProperty(element, property, original);
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
originals.clear();
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
/**
|
|
1577
|
+
* @private
|
|
1578
|
+
* @param {HTMLElement} element
|
|
1579
|
+
* @param {string} property
|
|
1580
|
+
* @param {{value: string, priority: string}} original
|
|
1581
|
+
* @return {boolean}
|
|
1582
|
+
*/
|
|
1583
|
+
function restoreInlineStyleProperty(element, property, original) {
|
|
1584
|
+
const currentValue = element.style.getPropertyValue(property);
|
|
1585
|
+
const currentPriority = element.style.getPropertyPriority(property);
|
|
1586
|
+
if (
|
|
1587
|
+
currentValue === original.value &&
|
|
1588
|
+
currentPriority === original.priority
|
|
1589
|
+
) {
|
|
1590
|
+
return false;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
if (original.value === "") {
|
|
1594
|
+
element.style.removeProperty(property);
|
|
1595
|
+
} else {
|
|
1596
|
+
element.style.setProperty(property, original.value, original.priority);
|
|
1597
|
+
}
|
|
1598
|
+
return true;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1350
1601
|
/**
|
|
1351
1602
|
* @private
|
|
1352
1603
|
* @param {HTMLElement[]} elements
|
|
@@ -1555,6 +1806,15 @@ function calculateControlBarDimensions() {
|
|
|
1555
1806
|
);
|
|
1556
1807
|
}
|
|
1557
1808
|
|
|
1809
|
+
const hostContentWidth = getElementContentWidth(this);
|
|
1810
|
+
if (hostContentWidth > 0) {
|
|
1811
|
+
const measuredSpace = this[dimensionsSymbol].getVia("data.space", 0);
|
|
1812
|
+
this[dimensionsSymbol].setVia(
|
|
1813
|
+
"data.space",
|
|
1814
|
+
Math.min(measuredSpace, hostContentWidth),
|
|
1815
|
+
);
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1558
1818
|
this[dimensionsSymbol].setVia("data.visible", !(containerWidth === 0));
|
|
1559
1819
|
this[dimensionsSymbol].setVia("data.containerWidth", containerWidth);
|
|
1560
1820
|
this[dimensionsSymbol].setVia(
|
|
@@ -1628,6 +1888,25 @@ function calculateControlBarDimensions() {
|
|
|
1628
1888
|
this[dimensionsSymbol].setVia("data.itemReferences", itemReferences);
|
|
1629
1889
|
}
|
|
1630
1890
|
|
|
1891
|
+
/**
|
|
1892
|
+
* @private
|
|
1893
|
+
* @param {HTMLElement} element
|
|
1894
|
+
* @return {number}
|
|
1895
|
+
*/
|
|
1896
|
+
function getElementContentWidth(element) {
|
|
1897
|
+
if (!(element instanceof HTMLElement) || element.clientWidth <= 0) {
|
|
1898
|
+
return 0;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
const computedStyle = getComputedStyle(element);
|
|
1902
|
+
return Math.max(
|
|
1903
|
+
0,
|
|
1904
|
+
element.clientWidth -
|
|
1905
|
+
getComputedCssPixels(computedStyle.paddingLeft) -
|
|
1906
|
+
getComputedCssPixels(computedStyle.paddingRight),
|
|
1907
|
+
);
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1631
1910
|
/**
|
|
1632
1911
|
* @private
|
|
1633
1912
|
* @return {number}
|
|
@@ -1936,6 +2215,7 @@ function toggle() {
|
|
|
1936
2215
|
*/
|
|
1937
2216
|
function hide() {
|
|
1938
2217
|
this[popperElementSymbol].style.display = "none";
|
|
2218
|
+
this[switchElementSymbol]?.setAttribute("aria-expanded", "false");
|
|
1939
2219
|
removeAttributeToken(this[controlElementSymbol], "class", "open");
|
|
1940
2220
|
}
|
|
1941
2221
|
|
|
@@ -1954,6 +2234,7 @@ function show() {
|
|
|
1954
2234
|
|
|
1955
2235
|
this[popperElementSymbol].style.visibility = "hidden";
|
|
1956
2236
|
this[popperElementSymbol].style.display = STYLE_DISPLAY_MODE_BLOCK;
|
|
2237
|
+
this[switchElementSymbol]?.setAttribute("aria-expanded", "true");
|
|
1957
2238
|
|
|
1958
2239
|
addAttributeToken(this[controlElementSymbol], "class", "open");
|
|
1959
2240
|
|
|
@@ -2303,7 +2584,12 @@ function getTemplate() {
|
|
|
2303
2584
|
<div part="popper-nav" data-monster-role="popper-nav"
|
|
2304
2585
|
tabindex="-1">
|
|
2305
2586
|
<button part="popper-switch" data-monster-role="switch"
|
|
2306
|
-
class="monster-button-outline-tertiary hidden"
|
|
2587
|
+
class="monster-button-outline-tertiary hidden"
|
|
2588
|
+
type="button"
|
|
2589
|
+
aria-controls="monster-control-bar-popper"
|
|
2590
|
+
aria-expanded="false"
|
|
2591
|
+
data-monster-attributes="aria-label path:labels.moreActions"
|
|
2592
|
+
hidden>
|
|
2307
2593
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
|
|
2308
2594
|
viewBox="0 0 16 16">
|
|
2309
2595
|
<path d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"/>
|
|
@@ -2311,7 +2597,7 @@ function getTemplate() {
|
|
|
2311
2597
|
</button>
|
|
2312
2598
|
</div>
|
|
2313
2599
|
</div>
|
|
2314
|
-
<div data-monster-role="popper">
|
|
2600
|
+
<div id="monster-control-bar-popper" data-monster-role="popper">
|
|
2315
2601
|
<slot name="popper"></slot>
|
|
2316
2602
|
</div>
|
|
2317
2603
|
</div>`;
|
|
@@ -130,7 +130,8 @@ class CredentialButton extends PopperButton {
|
|
|
130
130
|
label: labels.button,
|
|
131
131
|
}),
|
|
132
132
|
layout: {
|
|
133
|
-
containerStyle:
|
|
133
|
+
containerStyle:
|
|
134
|
+
"box-sizing: border-box; width: min(24rem, calc(100vw - 2rem));",
|
|
134
135
|
submitStyle: "margin-top: var(--monster-space-4);",
|
|
135
136
|
},
|
|
136
137
|
url: "",
|
|
@@ -712,8 +713,9 @@ function getContentTemplate(labels) {
|
|
|
712
713
|
data-monster-attributes="data-monster-option-placeholder path:placeholder.password,
|
|
713
714
|
data-monster-option-autocomplete path:autocomplete.password">
|
|
714
715
|
</monster-password>
|
|
715
|
-
<p part="description">${description}</p>
|
|
716
|
+
<p class="grid-span-full" part="description">${description}</p>
|
|
716
717
|
<monster-message-state-button
|
|
718
|
+
class="grid-span-full"
|
|
717
719
|
data-monster-role="submit-button"
|
|
718
720
|
part="submit-button"
|
|
719
721
|
data-monster-attributes="style path:layout.submitStyle">
|
|
@@ -126,6 +126,9 @@ class Digits extends CustomControl {
|
|
|
126
126
|
* @property {string} templates.main Main template
|
|
127
127
|
* @property {number} digits Number of digits
|
|
128
128
|
* @property {string} characterSet Character set for the digits, which are allowed
|
|
129
|
+
* @property {Object} labels Accessible labels
|
|
130
|
+
* @property {string} labels.group="Verification code" Label for the group
|
|
131
|
+
* @property {string} labels.digit="Digit {index} of {count}" Label template for each digit
|
|
129
132
|
*/
|
|
130
133
|
get defaults() {
|
|
131
134
|
return Object.assign({}, super.defaults, {
|
|
@@ -135,6 +138,10 @@ class Digits extends CustomControl {
|
|
|
135
138
|
|
|
136
139
|
digits: 6,
|
|
137
140
|
characterSet: "0123456789",
|
|
141
|
+
labels: {
|
|
142
|
+
group: "Verification code",
|
|
143
|
+
digit: "Digit {index} of {count}",
|
|
144
|
+
},
|
|
138
145
|
|
|
139
146
|
digitsControls: [],
|
|
140
147
|
value: null,
|
|
@@ -186,6 +193,8 @@ function initOptionObserver() {
|
|
|
186
193
|
|
|
187
194
|
let lastValue = this.getOption("value");
|
|
188
195
|
let lastDigits = this.getOption("digits");
|
|
196
|
+
let lastGroupLabel = this.getOption("labels.group");
|
|
197
|
+
let lastDigitLabel = this.getOption("labels.digit");
|
|
189
198
|
|
|
190
199
|
self.attachObserver(
|
|
191
200
|
new Observer(function () {
|
|
@@ -198,6 +207,15 @@ function initOptionObserver() {
|
|
|
198
207
|
lastDigits = self.getOption("digits");
|
|
199
208
|
updateDigitControls.call(self);
|
|
200
209
|
}
|
|
210
|
+
|
|
211
|
+
if (
|
|
212
|
+
lastGroupLabel !== self.getOption("labels.group") ||
|
|
213
|
+
lastDigitLabel !== self.getOption("labels.digit")
|
|
214
|
+
) {
|
|
215
|
+
lastGroupLabel = self.getOption("labels.group");
|
|
216
|
+
lastDigitLabel = self.getOption("labels.digit");
|
|
217
|
+
updateDigitControls.call(self);
|
|
218
|
+
}
|
|
201
219
|
}),
|
|
202
220
|
);
|
|
203
221
|
}
|
|
@@ -212,6 +230,9 @@ function updateDigitControls() {
|
|
|
212
230
|
|
|
213
231
|
const values =
|
|
214
232
|
this.getOption("value") == null ? "" : String(this.getOption("value"));
|
|
233
|
+
const digitLabel = String(
|
|
234
|
+
this.getOption("labels.digit", "Digit {index} of {count}"),
|
|
235
|
+
);
|
|
215
236
|
|
|
216
237
|
if (this[digitsElementSymbol]) {
|
|
217
238
|
this[digitsElementSymbol].style.gridTemplateColumns =
|
|
@@ -221,6 +242,9 @@ function updateDigitControls() {
|
|
|
221
242
|
for (let i = 0; i < digits; i++) {
|
|
222
243
|
controls.push({
|
|
223
244
|
value: values[i] ?? "",
|
|
245
|
+
label: digitLabel
|
|
246
|
+
.replaceAll("{index}", String(i + 1))
|
|
247
|
+
.replaceAll("{count}", String(digits)),
|
|
224
248
|
});
|
|
225
249
|
}
|
|
226
250
|
|
|
@@ -392,11 +416,14 @@ function getTemplate() {
|
|
|
392
416
|
<template id="digit">
|
|
393
417
|
<input maxlength="1"
|
|
394
418
|
data-monster-attributes="
|
|
395
|
-
value path:digit.value
|
|
419
|
+
value path:digit.value,
|
|
420
|
+
aria-label path:digit.label">
|
|
396
421
|
</template>
|
|
397
422
|
|
|
398
423
|
<div data-monster-role="control" part="control" data-monster-attributes="class path:classes.control">
|
|
399
424
|
<div part="digits" data-monster-role="digits"
|
|
425
|
+
role="group"
|
|
426
|
+
data-monster-attributes="aria-label path:labels.group"
|
|
400
427
|
data-monster-insert="digit path:digitsControls"
|
|
401
428
|
tabindex="-1"></div>
|
|
402
429
|
</div>`;
|