@sbb-esta/lyne-elements-dev 5.15.0-dev.1796054560 → 5.15.0-dev.1796137118
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/carousel.pure.js +6 -6
- package/clock.pure.js +11 -11
- package/core.js +10 -10
- package/custom-elements.json +282 -99
- package/development/carousel/carousel-list/carousel-list.component.d.ts +1 -0
- package/development/carousel.pure.js +4 -3
- package/development/clock/clock.component.d.ts +1 -0
- package/development/clock.pure.js +14 -16
- package/development/core/controllers/host-styles-controller.d.ts +14 -0
- package/development/core/mixins/dynamic-styleheet-mixin.d.ts +1 -0
- package/development/core.d.ts +2 -1
- package/development/core.js +134 -95
- package/development/flip-card/flip-card/flip-card.component.d.ts +1 -0
- package/development/flip-card.pure.js +3 -2
- package/development/menu/menu/menu.component.d.ts +1 -0
- package/development/menu.pure.js +3 -4
- package/development/mini-calendar/mini-calendar-month/mini-calendar-month.component.d.ts +1 -0
- package/development/mini-calendar.pure.js +3 -2
- package/development/navigation/navigation-marker/navigation-marker.component.d.ts +1 -0
- package/development/navigation.pure.js +3 -2
- package/development/notification/notification.component.d.ts +1 -0
- package/development/notification.pure.js +3 -2
- package/development/popover/popover-base/popover-base.d.ts +1 -0
- package/development/popover.pure.js +3 -5
- package/development/sidebar/sidebar-container/sidebar-container.component.d.ts +2 -1
- package/development/sidebar.pure.js +7 -5
- package/development/slider/slider.component.d.ts +1 -0
- package/development/slider.pure.js +3 -2
- package/development/stepper/stepper/stepper.component.d.ts +1 -0
- package/development/stepper.pure.js +6 -5
- package/development/tabs/tab-group/tab-group.component.d.ts +1 -0
- package/development/tabs/tab-nav-bar/tab-nav-bar.component.d.ts +1 -0
- package/development/tabs.pure.js +8 -6
- package/development/toggle/toggle/toggle.component.d.ts +1 -0
- package/development/toggle.pure.js +4 -4
- package/development/tooltip/tooltip.component.d.ts +2 -1
- package/development/tooltip.pure.js +7 -4
- package/development/train.pure.js +4 -17
- package/flip-card.pure.js +8 -8
- package/menu.pure.js +8 -8
- package/mini-calendar.pure.js +5 -5
- package/navigation.pure.js +12 -12
- package/notification.pure.js +4 -4
- package/package.json +2 -2
- package/popover.pure.js +5 -5
- package/sidebar.pure.js +11 -11
- package/slider.pure.js +3 -3
- package/stepper.pure.js +7 -7
- package/tabs.pure.js +11 -11
- package/toggle.pure.js +4 -4
- package/tooltip.pure.js +2 -2
- package/train.pure.js +24 -29
|
@@ -3,7 +3,7 @@ import { ResizeController } from "@lit-labs/observers/resize-controller.js";
|
|
|
3
3
|
import { html, isServer, unsafeCSS } from "lit";
|
|
4
4
|
import { property, state } from "lit/decorators.js";
|
|
5
5
|
import { ref } from "lit/directives/ref.js";
|
|
6
|
-
import { IS_FOCUSABLE_QUERY, NumberOrNull, SbbEscapableOverlayController, SbbFocusTrapController, SbbLanguageController, SbbMediaQueryPointerCoarse, SbbNegativeMixin, SbbOpenCloseBaseElement, SbbPropertyWatcherController, forceType, getElementPosition, i18nClosePopover, idReference, isEventOnElement, isFakeMousedownFromScreenReader, isZeroAnimationDuration, popoverResetStyles, readConfig, removeAriaOverlayTriggerProperties, sbbInputModalityDetector, scrollbarStyles, setAriaOverlayTriggerProperties, ɵstateController } from "./core.js";
|
|
6
|
+
import { IS_FOCUSABLE_QUERY, NumberOrNull, SbbEscapableOverlayController, SbbFocusTrapController, SbbHostStylesController, SbbLanguageController, SbbMediaQueryPointerCoarse, SbbNegativeMixin, SbbOpenCloseBaseElement, SbbPropertyWatcherController, forceType, getElementPosition, i18nClosePopover, idReference, isEventOnElement, isFakeMousedownFromScreenReader, isZeroAnimationDuration, popoverResetStyles, readConfig, removeAriaOverlayTriggerProperties, sbbInputModalityDetector, scrollbarStyles, setAriaOverlayTriggerProperties, ɵstateController } from "./core.js";
|
|
7
7
|
import { SbbSecondaryButtonElement } from "./button.pure.js";
|
|
8
8
|
|
|
9
9
|
// src/elements/popover/popover-base/popover-base.scss?inline
|
|
@@ -35,6 +35,7 @@ let SbbPopoverBaseElement = (() => {
|
|
|
35
35
|
this.#trigger_accessor_storage = __runInitializers(this, _trigger_initializers, null);
|
|
36
36
|
this._nextFocusedElement = __runInitializers(this, _trigger_extraInitializers);
|
|
37
37
|
this._skipCloseFocus = false;
|
|
38
|
+
this._hostStyles = new SbbHostStylesController(this);
|
|
38
39
|
this._resizeController = new ResizeController(this, {
|
|
39
40
|
target: null,
|
|
40
41
|
callback: () => this._setPopoverPosition()
|
|
@@ -244,10 +245,7 @@ let SbbPopoverBaseElement = (() => {
|
|
|
244
245
|
const borderRadius = parseFloat(getComputedStyle(this.overlay).borderTopLeftRadius) || 0;
|
|
245
246
|
const rawArrowXPosition = triggerRect.left - clampedLeft + triggerRect.width / 2 - ARROW_SIZE / 2;
|
|
246
247
|
const arrowXPosition = Math.max(borderRadius, Math.min(rawArrowXPosition, popoverWidth - borderRadius - ARROW_SIZE));
|
|
247
|
-
this.
|
|
248
|
-
this.style.setProperty("--_sbb-popover-position-y", `${popoverPosition.top}px`);
|
|
249
|
-
this.style.setProperty("--_sbb-popover-arrow-position-x", `${arrowXPosition}px`);
|
|
250
|
-
this.style.setProperty("--_sbb-popover-max-height", popoverPosition.maxHeight);
|
|
248
|
+
this._hostStyles.set("--_sbb-popover-position-x", `${clampedLeft}px`).set("--_sbb-popover-position-y", `${popoverPosition.top}px`).set("--_sbb-popover-arrow-position-x", `${arrowXPosition}px`).set("--_sbb-popover-max-height", popoverPosition.maxHeight);
|
|
251
249
|
}
|
|
252
250
|
dispatchBeforeCloseEvent(detail) {
|
|
253
251
|
const closeTarget = detail?.closeTarget ?? null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CSSResultGroup, type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
-
import { SbbElement } from '../../core.ts';
|
|
2
|
+
import { SbbElement, SbbHostStylesController } from '../../core.ts';
|
|
3
3
|
import type { SbbSidebarElement } from '../sidebar/sidebar.component.ts';
|
|
4
4
|
/**
|
|
5
5
|
* This is the parent component to one or two `<sbb-sidebar>`s that validates the state internally
|
|
@@ -17,6 +17,7 @@ export declare class SbbSidebarContainerElement extends SbbElement {
|
|
|
17
17
|
/** The sidebar child with the `end` position. */
|
|
18
18
|
get end(): SbbSidebarElement | null;
|
|
19
19
|
private _forcedClosedSidebars;
|
|
20
|
+
protected hostStyles: SbbHostStylesController;
|
|
20
21
|
connectedCallback(): void;
|
|
21
22
|
disconnectedCallback(): void;
|
|
22
23
|
protected firstUpdated(changedProperties: PropertyValues<this>): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html, isServer, unsafeCSS } from "lit";
|
|
2
2
|
import { SbbSecondaryButtonElement } from "./button.pure.js";
|
|
3
|
-
import { SbbAnimationCompleteMixin, SbbElement, SbbEscapableOverlayController, SbbFocusTrapController, SbbLanguageController, SbbOpenCloseBaseElement, forceType, handleDistinctChange, hostScrollbarStyles, i18nCloseSidebar, isZeroAnimationDuration, scrollbarStyles, ɵstateController } from "./core.js";
|
|
3
|
+
import { SbbAnimationCompleteMixin, SbbElement, SbbEscapableOverlayController, SbbFocusTrapController, SbbHostStylesController, SbbLanguageController, SbbOpenCloseBaseElement, forceType, handleDistinctChange, hostScrollbarStyles, i18nCloseSidebar, isZeroAnimationDuration, scrollbarStyles, ɵstateController } from "./core.js";
|
|
4
4
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
5
5
|
import { eventOptions, property } from "lit/decorators.js";
|
|
6
6
|
import { SbbTitleBase } from "./title.pure.js";
|
|
@@ -75,6 +75,7 @@ var SbbSidebarContainerElement = class extends SbbElement {
|
|
|
75
75
|
constructor() {
|
|
76
76
|
super(...arguments);
|
|
77
77
|
this._forcedClosedSidebars = /* @__PURE__ */ new WeakSet();
|
|
78
|
+
this.hostStyles = new SbbHostStylesController(this);
|
|
78
79
|
}
|
|
79
80
|
static {
|
|
80
81
|
this.elementName = "sbb-sidebar-container";
|
|
@@ -474,7 +475,7 @@ let SbbSidebarElement = (() => {
|
|
|
474
475
|
}
|
|
475
476
|
disconnectedCallback() {
|
|
476
477
|
super.disconnectedCallback();
|
|
477
|
-
this.container?.
|
|
478
|
+
this.container?.["hostStyles"].delete(this._buildCssWidthVar());
|
|
478
479
|
this._container = null;
|
|
479
480
|
if (!isServer) {
|
|
480
481
|
if (window.navigation) window.navigation.removeEventListener("navigate", this._closeOnNavigation);
|
|
@@ -563,12 +564,13 @@ let SbbSidebarElement = (() => {
|
|
|
563
564
|
_updateSidebarWidth(oldPosition) {
|
|
564
565
|
const container = this.container;
|
|
565
566
|
if (!container) return;
|
|
566
|
-
|
|
567
|
+
const containerHostStylesMap = container["hostStyles"];
|
|
568
|
+
if (oldPosition) containerHostStylesMap.delete(this._buildCssWidthVar(oldPosition));
|
|
567
569
|
const width = this.offsetWidth;
|
|
568
570
|
if (!width) return;
|
|
569
571
|
const newValue = `${width}px`;
|
|
570
|
-
if (
|
|
571
|
-
|
|
572
|
+
if (containerHostStylesMap.get(this._buildCssWidthVar()) === newValue) return;
|
|
573
|
+
containerHostStylesMap.set(this._buildCssWidthVar(), newValue);
|
|
572
574
|
}
|
|
573
575
|
_buildCssWidthVar(position = this.position) {
|
|
574
576
|
return `--_sbb-sidebar-container-${position}-width`;
|
|
@@ -45,6 +45,7 @@ export declare class SbbSliderElement extends SbbSliderElement_base {
|
|
|
45
45
|
get type(): string;
|
|
46
46
|
/** Reference to the inner HTMLInputElement with type='range'. */
|
|
47
47
|
private _rangeInput?;
|
|
48
|
+
private _hostStyles;
|
|
48
49
|
constructor();
|
|
49
50
|
connectedCallback(): void;
|
|
50
51
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
@@ -2,7 +2,7 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
2
2
|
import { html, nothing, unsafeCSS } from "lit";
|
|
3
3
|
import { property } from "lit/decorators.js";
|
|
4
4
|
import { ref } from "lit/directives/ref.js";
|
|
5
|
-
import { SbbDisabledMixin, SbbElement, SbbFormAssociatedMixin, SbbReadonlyMixin, forceType } from "./core.js";
|
|
5
|
+
import { SbbDisabledMixin, SbbElement, SbbFormAssociatedMixin, SbbHostStylesController, SbbReadonlyMixin, forceType } from "./core.js";
|
|
6
6
|
import { SbbIconElement } from "./icon.pure.js";
|
|
7
7
|
|
|
8
8
|
// src/elements/slider/slider.scss?inline
|
|
@@ -216,6 +216,7 @@ let SbbSliderElement = (() => {
|
|
|
216
216
|
this.#endIcon_accessor_storage = (__runInitializers(this, _startIcon_extraInitializers), __runInitializers(this, _endIcon_initializers, ""));
|
|
217
217
|
/** Reference to the inner HTMLInputElement with type='range'. */
|
|
218
218
|
this._rangeInput = __runInitializers(this, _endIcon_extraInitializers);
|
|
219
|
+
this._hostStyles = new SbbHostStylesController(this);
|
|
219
220
|
this.addEventListener?.("keydown", (e) => this._handleKeydown(e));
|
|
220
221
|
}
|
|
221
222
|
connectedCallback() {
|
|
@@ -225,7 +226,7 @@ let SbbSliderElement = (() => {
|
|
|
225
226
|
willUpdate(changedProperties) {
|
|
226
227
|
super.willUpdate(changedProperties);
|
|
227
228
|
if (changedProperties.has("readOnly")) this.internals.ariaReadOnly = Boolean(this.readOnly).toString();
|
|
228
|
-
this.
|
|
229
|
+
this._hostStyles.set("--_sbb-slider-value-fraction", `${this._valueFraction()}`);
|
|
229
230
|
}
|
|
230
231
|
/**
|
|
231
232
|
* The reset value is the attribute value (the setup value). If not present, calculates the default.
|
|
@@ -29,6 +29,7 @@ export declare class SbbStepperElement extends SbbElement {
|
|
|
29
29
|
static readonly events: {
|
|
30
30
|
readonly stepchange: "stepchange";
|
|
31
31
|
};
|
|
32
|
+
private _hostStyles;
|
|
32
33
|
/**
|
|
33
34
|
* If the sbb-stepper is used in a sbb-dialog, the marker on the selected element will not appear,
|
|
34
35
|
* because the calculations are done when the dialog is closed, so the marker has a width of 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { html, unsafeCSS } from "lit";
|
|
2
|
-
import { NumberOrNull, SbbButtonBaseElement, SbbDisabledMixin, SbbElement, SbbMediaMatcherController, SbbMediaQueryBreakpointLargeAndAbove, SbbMediaQueryBreakpointSmallAndAbove, SbbMediaQueryBreakpointUltraAndAbove, SbbMediaQueryBreakpointZeroAndAbove, SbbPropertyWatcherController, appendAriaElements, forceType, getNextElementIndex, isArrowKeyPressed, removeAriaElements } from "./core.js";
|
|
2
|
+
import { NumberOrNull, SbbButtonBaseElement, SbbDisabledMixin, SbbElement, SbbHostStylesController, SbbMediaMatcherController, SbbMediaQueryBreakpointLargeAndAbove, SbbMediaQueryBreakpointSmallAndAbove, SbbMediaQueryBreakpointUltraAndAbove, SbbMediaQueryBreakpointZeroAndAbove, SbbPropertyWatcherController, appendAriaElements, forceType, getNextElementIndex, isArrowKeyPressed, removeAriaElements } from "./core.js";
|
|
3
3
|
import { SbbIconNameMixin } from "./icon.pure.js";
|
|
4
4
|
import { ResizeController } from "@lit-labs/observers/resize-controller.js";
|
|
5
5
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
@@ -534,13 +534,14 @@ let SbbStepperElement = (() => {
|
|
|
534
534
|
}
|
|
535
535
|
constructor() {
|
|
536
536
|
super();
|
|
537
|
+
this._hostStyles = (__runInitializers(this, _instanceExtraInitializers), new SbbHostStylesController(this));
|
|
537
538
|
/**
|
|
538
539
|
* If the sbb-stepper is used in a sbb-dialog, the marker on the selected element will not appear,
|
|
539
540
|
* because the calculations are done when the dialog is closed, so the marker has a width of 0;
|
|
540
541
|
* the same happens for the stepper height.
|
|
541
542
|
* We need to recalculate it when the element becomes visible.
|
|
542
543
|
*/
|
|
543
|
-
this._observer =
|
|
544
|
+
this._observer = new IntersectionController(this, {
|
|
544
545
|
target: null,
|
|
545
546
|
callback: (entries) => {
|
|
546
547
|
entries.forEach((e) => {
|
|
@@ -550,7 +551,7 @@ let SbbStepperElement = (() => {
|
|
|
550
551
|
}
|
|
551
552
|
});
|
|
552
553
|
}
|
|
553
|
-
})
|
|
554
|
+
});
|
|
554
555
|
this.#linear_accessor_storage = __runInitializers(this, _linear_initializers, false);
|
|
555
556
|
this._horizontalFrom = (__runInitializers(this, _linear_extraInitializers), null);
|
|
556
557
|
this.#orientation_accessor_storage = __runInitializers(this, _orientation_initializers, "horizontal");
|
|
@@ -638,7 +639,7 @@ let SbbStepperElement = (() => {
|
|
|
638
639
|
_setMarkerSize() {
|
|
639
640
|
if (!this._loaded || !this.selected || this.selectedIndex === void 0 || !this.selected.label) return;
|
|
640
641
|
const offset = this.orientation === "horizontal" ? this.selected.label.offsetLeft + this.selected.label.offsetWidth : this._calculateLabelOffsetTop();
|
|
641
|
-
this.
|
|
642
|
+
this._hostStyles.set("--sbb-stepper-marker-size", `${offset}px`);
|
|
642
643
|
}
|
|
643
644
|
/**
|
|
644
645
|
* Sets the stepper height based on the height of the provided step.
|
|
@@ -646,7 +647,7 @@ let SbbStepperElement = (() => {
|
|
|
646
647
|
_setStepperHeight(step) {
|
|
647
648
|
if (step && step.shadowRoot) {
|
|
648
649
|
const innerElement = step.shadowRoot.querySelector(".sbb-step");
|
|
649
|
-
if (innerElement) this.
|
|
650
|
+
if (innerElement) this._hostStyles.set("--sbb-stepper-content-height", `${innerElement.offsetHeight}px`);
|
|
650
651
|
}
|
|
651
652
|
}
|
|
652
653
|
_calculateLabelOffsetTop() {
|
|
@@ -15,6 +15,7 @@ export declare class SbbTabNavBarElement extends SbbTabNavBarElement_base {
|
|
|
15
15
|
* Size variant, either s (lean theme default), l (standard theme default) or xl.
|
|
16
16
|
*/
|
|
17
17
|
accessor size: 's' | 'l' | 'xl' | null;
|
|
18
|
+
private _hostStyles;
|
|
18
19
|
private _resizeController;
|
|
19
20
|
private _listElement;
|
|
20
21
|
private _onTabGroupElementResize;
|
package/development/tabs.pure.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ResizeController } from "@lit-labs/observers/resize-controller.js";
|
|
|
3
3
|
import { html, unsafeCSS } from "lit";
|
|
4
4
|
import { property } from "lit/decorators.js";
|
|
5
5
|
import { ref } from "lit/directives/ref.js";
|
|
6
|
-
import { SbbDisabledMixin, SbbElement, SbbNamedSlotListMixin, SbbPropertyWatcherController, forceType, getNextElementIndex, hostScrollbarStyles, isArrowKeyPressed, omitEmptyConverter, ɵstateController } from "./core.js";
|
|
6
|
+
import { SbbDisabledMixin, SbbElement, SbbHostStylesController, SbbNamedSlotListMixin, SbbPropertyWatcherController, forceType, getNextElementIndex, hostScrollbarStyles, isArrowKeyPressed, omitEmptyConverter, ɵstateController } from "./core.js";
|
|
7
7
|
import { html as html$1, unsafeStatic } from "lit/static-html.js";
|
|
8
8
|
import { SbbIconNameMixin } from "./icon.pure.js";
|
|
9
9
|
|
|
@@ -192,6 +192,7 @@ let SbbTabGroupElement = (() => {
|
|
|
192
192
|
}
|
|
193
193
|
constructor() {
|
|
194
194
|
super();
|
|
195
|
+
this._hostStyles = new SbbHostStylesController(this);
|
|
195
196
|
this._tabGroupResizeObserver = new ResizeController(this, {
|
|
196
197
|
target: null,
|
|
197
198
|
skipInitial: true,
|
|
@@ -267,7 +268,7 @@ let SbbTabGroupElement = (() => {
|
|
|
267
268
|
tabLabels.forEach((tabLabel) => {
|
|
268
269
|
ɵstateController(tabLabel)?.toggle("has-divider", tabLabel === tabLabels[0] || tabLabel.offsetLeft === tabLabels[0].offsetLeft);
|
|
269
270
|
});
|
|
270
|
-
this.
|
|
271
|
+
this._hostStyles.set("--sbb-tab-group-width", `${this._tabGroupElement.clientWidth}px`);
|
|
271
272
|
}
|
|
272
273
|
_handleKeyDown(evt) {
|
|
273
274
|
const enabledTabs = this._enabledTabs();
|
|
@@ -284,7 +285,7 @@ let SbbTabGroupElement = (() => {
|
|
|
284
285
|
* @internal
|
|
285
286
|
*/
|
|
286
287
|
setTabContentHeight(contentHeight) {
|
|
287
|
-
this.
|
|
288
|
+
this._hostStyles.set("--sbb-tab-content-height", `${contentHeight}px`);
|
|
288
289
|
}
|
|
289
290
|
render() {
|
|
290
291
|
return html`
|
|
@@ -552,10 +553,11 @@ let SbbTabNavBarElement = (() => {
|
|
|
552
553
|
super(...arguments);
|
|
553
554
|
this.listChildLocalNames = ["a"];
|
|
554
555
|
this.#size_accessor_storage = __runInitializers(this, _size_initializers, null);
|
|
555
|
-
this.
|
|
556
|
+
this._hostStyles = (__runInitializers(this, _size_extraInitializers), new SbbHostStylesController(this));
|
|
557
|
+
this._resizeController = new ResizeController(this, {
|
|
556
558
|
target: null,
|
|
557
559
|
callback: () => this._onTabGroupElementResize()
|
|
558
|
-
})
|
|
560
|
+
});
|
|
559
561
|
this._listElement = null;
|
|
560
562
|
}
|
|
561
563
|
static {
|
|
@@ -609,7 +611,7 @@ let SbbTabNavBarElement = (() => {
|
|
|
609
611
|
this.listChildren.forEach((anchor) => {
|
|
610
612
|
anchor.assignedSlot?.parentElement?.toggleAttribute("data-has-divider", anchor === this.listChildren[0] || anchor.offsetLeft === this.listChildren[0].offsetLeft);
|
|
611
613
|
});
|
|
612
|
-
this.
|
|
614
|
+
this._hostStyles.set("--sbb-tab-group-width", `${this._listElement?.clientWidth}px`);
|
|
613
615
|
}
|
|
614
616
|
firstUpdated(changedProperties) {
|
|
615
617
|
super.firstUpdated(changedProperties);
|
|
@@ -31,6 +31,7 @@ export declare class SbbToggleElement<T = string> extends SbbToggleElement_base
|
|
|
31
31
|
set value(value: T | null);
|
|
32
32
|
get value(): T | null;
|
|
33
33
|
private _fallbackValue;
|
|
34
|
+
private _hostStyles;
|
|
34
35
|
/** The child instances of sbb-toggle-option as an array. */
|
|
35
36
|
get options(): SbbToggleOptionElement<T>[];
|
|
36
37
|
constructor();
|
|
@@ -2,7 +2,7 @@ import { __esDecorate, __runInitializers } from "tslib";
|
|
|
2
2
|
import { ResizeController } from "@lit-labs/observers/resize-controller.js";
|
|
3
3
|
import { html, isServer, unsafeCSS } from "lit";
|
|
4
4
|
import { property } from "lit/decorators.js";
|
|
5
|
-
import { SbbDisabledMixin, SbbElement, SbbFormAssociatedMixin, forceType, interactivityChecker } from "./core.js";
|
|
5
|
+
import { SbbDisabledMixin, SbbElement, SbbFormAssociatedMixin, SbbHostStylesController, forceType, interactivityChecker } from "./core.js";
|
|
6
6
|
import { SbbIconNameMixin } from "./icon.pure.js";
|
|
7
7
|
|
|
8
8
|
// src/elements/toggle/toggle-option/toggle-option.scss?inline
|
|
@@ -290,6 +290,7 @@ let SbbToggleElement = (() => {
|
|
|
290
290
|
this.#even_accessor_storage = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _even_initializers, false));
|
|
291
291
|
this.#size_accessor_storage = (__runInitializers(this, _even_extraInitializers), __runInitializers(this, _size_initializers, null));
|
|
292
292
|
this._fallbackValue = (__runInitializers(this, _size_extraInitializers), null);
|
|
293
|
+
this._hostStyles = new SbbHostStylesController(this);
|
|
293
294
|
this.addEventListener?.("input", () => this._handleInput(), { passive: true });
|
|
294
295
|
this.addEventListener?.("keydown", (e) => this._handleKeyDown(e));
|
|
295
296
|
}
|
|
@@ -342,8 +343,7 @@ let SbbToggleElement = (() => {
|
|
|
342
343
|
const pillLeft = isFirstChecked ? "0px" : `${firstOption.clientWidth}px`;
|
|
343
344
|
const pillRight = isFirstChecked ? `${this.clientWidth - firstOption.clientWidth}px` : "0px";
|
|
344
345
|
if (pillRight === "0px" && pillLeft === "0px") return;
|
|
345
|
-
this.
|
|
346
|
-
this.style?.setProperty("--sbb-toggle-option-right", pillRight);
|
|
346
|
+
this._hostStyles.set("--sbb-toggle-option-left", pillLeft).set("--sbb-toggle-option-right", pillRight);
|
|
347
347
|
this.offsetWidth;
|
|
348
348
|
this.internals.states.add("initialized");
|
|
349
349
|
}
|
|
@@ -400,7 +400,7 @@ let SbbToggleElement = (() => {
|
|
|
400
400
|
}));
|
|
401
401
|
}
|
|
402
402
|
render() {
|
|
403
|
-
return html
|
|
403
|
+
return html`<slot @slotchange=${this._updateToggle}></slot>`;
|
|
404
404
|
}
|
|
405
405
|
};
|
|
406
406
|
})();
|
|
@@ -6,7 +6,7 @@ import { SbbOpenCloseBaseElement } from '../core.ts';
|
|
|
6
6
|
export interface SbbTooltipDefaultPositions {
|
|
7
7
|
readonly tooltipPositions: string[];
|
|
8
8
|
}
|
|
9
|
-
declare const SbbTooltipElement_base: import("../core.ts").AbstractConstructor<import("../core.ts").
|
|
9
|
+
declare const SbbTooltipElement_base: import("../core.ts").AbstractConstructor<import("../core.ts").SbbDisabledMixinType> & typeof SbbOpenCloseBaseElement;
|
|
10
10
|
/**
|
|
11
11
|
* It displays text content within a tooltip.
|
|
12
12
|
*
|
|
@@ -69,6 +69,7 @@ export declare class SbbTooltipElement extends SbbTooltipElement_base {
|
|
|
69
69
|
private _triggerElement;
|
|
70
70
|
private _triggerAbortController?;
|
|
71
71
|
private _openStateController;
|
|
72
|
+
private _hostStyles;
|
|
72
73
|
private _escapableOverlayController;
|
|
73
74
|
private _overlayController;
|
|
74
75
|
private _openTimeout?;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
2
|
import { html, isServer, unsafeCSS } from "lit";
|
|
3
3
|
import { property } from "lit/decorators.js";
|
|
4
|
-
import { NumberOrNull, SbbDisabledMixin,
|
|
4
|
+
import { NumberOrNull, SbbDisabledMixin, SbbEscapableOverlayController, SbbHostStylesController, SbbOpenCloseBaseElement, SbbOverlayPositionController, appendAriaElements, forceType, idReference, isAndroid, isIOS, isZeroAnimationDuration, popoverResetStyles, queueDomContentLoaded, readConfig, removeAriaElements, sbbInputModalityDetector, sbbOverlayOutsidePointerEventListener } from "./core.js";
|
|
5
5
|
|
|
6
6
|
// src/elements/tooltip/tooltip.scss?inline
|
|
7
7
|
var tooltip_default = ":host {\n --sbb-tooltip-max-width: min(\n 25rem,\n calc(100vw - var(--sbb-spacing-fixed-2x))\n );\n --sbb-tooltip-animation-duration: var(\n --sbb-disable-animation-duration,\n var(--sbb-animation-duration-4x)\n );\n position-area: var(--sbb-overlay-position-area);\n position-try-fallbacks: var(--sbb-overlay-position-try-fallbacks);\n display: none;\n position: fixed;\n pointer-events: var(--sbb-tooltip-pointer-events, all);\n z-index: var(--sbb-tooltip-z-index, var(--sbb-overlay-default-z-index));\n animation-name: var(--sbb-tooltip-animation-name);\n animation-duration: var(--sbb-tooltip-animation-duration);\n animation-timing-function: var(--sbb-tooltip-animation-easing);\n font-size: var(--sbb-tooltip-font-size);\n letter-spacing: var(--sbb-letter-spacing-text);\n line-height: var(--sbb-typo-line-height-text);\n}\n\n:host(:is(:is(:state(state-opening),[state--state-opening]), :is(:state(state-opened),[state--state-opened]), :is(:state(state-closing),[state--state-closing]))) {\n --sbb-tooltip-animation-name: open;\n display: block;\n}\n\n:host(:is(:state(state-closing),[state--state-closing])) {\n --sbb-tooltip-animation-name: close;\n --sbb-tooltip-pointer-events: none;\n}\n\n:host(:is([data-position~=block-end], [data-position~=bottom], [data-position^=end])) {\n padding-block-start: var(--sbb-tooltip-gap);\n}\n\n:host(:is([data-position~=block-start], [data-position~=top], [data-position^=start])) {\n padding-block-end: var(--sbb-tooltip-gap);\n}\n\n:host(:is([data-position~=inline-start],\n[data-position~=inline-end],\n[data-position~=left],\n[data-position~=right],\n[data-position$=\" start\"],\n[data-position$=\" end\"])) {\n padding-inline: var(--sbb-tooltip-gap);\n}\n\n.sbb-tooltip {\n box-shadow: var(--sbb-box-shadow-level-5-soft);\n border: var(--sbb-border-width-1x) solid var(--sbb-tooltip-border-color);\n border-radius: var(--sbb-tooltip-border-radius);\n padding: var(--sbb-tooltip-padding);\n color: var(--sbb-tooltip-color);\n background-color: var(--sbb-tooltip-background-color);\n min-width: var(--sbb-tooltip-min-width);\n max-width: var(--sbb-tooltip-max-width);\n}\n\n@keyframes open {\n from {\n opacity: 0;\n translate: var(--sbb-tooltip-animation-translate);\n }\n to {\n opacity: 1;\n translate: 0;\n }\n}\n@keyframes close {\n from {\n opacity: 1;\n translate: 0;\n }\n to {\n opacity: 0;\n translate: var(--sbb-tooltip-animation-translate);\n }\n}\n";
|
|
@@ -26,7 +26,7 @@ const tooltipTriggers = /* @__PURE__ */ new WeakMap();
|
|
|
26
26
|
* component is set to `var(--sbb-overlay-default-z-index)` with a value of `1000`.
|
|
27
27
|
*/
|
|
28
28
|
let SbbTooltipElement = (() => {
|
|
29
|
-
let _classSuper =
|
|
29
|
+
let _classSuper = SbbDisabledMixin(SbbOpenCloseBaseElement);
|
|
30
30
|
let _instanceExtraInitializers = [];
|
|
31
31
|
let _trigger_decorators;
|
|
32
32
|
let _trigger_initializers = [];
|
|
@@ -205,6 +205,7 @@ let SbbTooltipElement = (() => {
|
|
|
205
205
|
this._openDelay = __runInitializers(this, _trigger_extraInitializers);
|
|
206
206
|
this._positions = [];
|
|
207
207
|
this._triggerElement = null;
|
|
208
|
+
this._hostStyles = new SbbHostStylesController(this);
|
|
208
209
|
this._escapableOverlayController = new SbbEscapableOverlayController(this);
|
|
209
210
|
this._overlayController = new SbbOverlayPositionController(this);
|
|
210
211
|
this._isOutsidePointerListenerConnected = false;
|
|
@@ -288,8 +289,10 @@ let SbbTooltipElement = (() => {
|
|
|
288
289
|
const positions = this._positions.length ? this._positions : this.trigger?.tooltipPositions;
|
|
289
290
|
if (positions?.length) {
|
|
290
291
|
const positionTryFallbacks = positions.slice(1).join(", ");
|
|
291
|
-
this.
|
|
292
|
-
|
|
292
|
+
this._hostStyles.set("--sbb-overlay-position-area", positions[0]);
|
|
293
|
+
if (positionTryFallbacks.length) this._hostStyles.set("--sbb-overlay-position-try-fallbacks", positionTryFallbacks);
|
|
294
|
+
else this._hostStyles.delete("--sbb-overlay-position-try-fallbacks");
|
|
295
|
+
} else this._hostStyles.clear();
|
|
293
296
|
}
|
|
294
297
|
}
|
|
295
298
|
firstUpdated(changedProperties) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { html,
|
|
2
|
-
import { SbbButtonBaseElement, SbbElement, SbbLanguageController, SbbLinkBaseElement, SbbNamedSlotListMixin, SbbPropertyWatcherController, forceType, handleDistinctChange, hostScrollbarStyles, i18nAdditionalWagonInformationHeading, i18nAnd, i18nBlockedPassage, i18nClass, i18nClosedCompartmentLabel, i18nCouchetteWagonLabel, i18nLocomotiveLabel, i18nRestaurantWagonLabel, i18nSector, i18nSectorShort, i18nSleepingWagonLabel, i18nTrain, i18nTrains, i18nWagonLabel, i18nWagonLabelNumber, i18nWagonsLabel, omitEmptyConverter } from "./core.js";
|
|
1
|
+
import { html, nothing, unsafeCSS } from "lit";
|
|
2
|
+
import { SbbButtonBaseElement, SbbElement, SbbHostStylesController, SbbLanguageController, SbbLinkBaseElement, SbbNamedSlotListMixin, SbbPropertyWatcherController, forceType, handleDistinctChange, hostScrollbarStyles, i18nAdditionalWagonInformationHeading, i18nAnd, i18nBlockedPassage, i18nClass, i18nClosedCompartmentLabel, i18nCouchetteWagonLabel, i18nLocomotiveLabel, i18nRestaurantWagonLabel, i18nSector, i18nSectorShort, i18nSleepingWagonLabel, i18nTrain, i18nTrains, i18nWagonLabel, i18nWagonLabelNumber, i18nWagonsLabel, omitEmptyConverter } from "./core.js";
|
|
3
3
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
4
4
|
import { property, state } from "lit/decorators.js";
|
|
5
5
|
import { ref } from "lit/directives/ref.js";
|
|
@@ -550,21 +550,13 @@ const SbbTrainWagonMixin = (superClass) => {
|
|
|
550
550
|
this.#additionalAccessibilityText_accessor_storage = (__runInitializers(this, _label_extraInitializers), __runInitializers(this, _additionalAccessibilityText_initializers, ""));
|
|
551
551
|
this.#_view_accessor_storage = (__runInitializers(this, _additionalAccessibilityText_extraInitializers), __runInitializers(this, __view_initializers, null));
|
|
552
552
|
this._language = (__runInitializers(this, __view_extraInitializers), new SbbLanguageController(this));
|
|
553
|
-
this.
|
|
553
|
+
this._hostStyles = new SbbHostStylesController(this);
|
|
554
554
|
this.addController(new SbbPropertyWatcherController(this, () => this.closest("sbb-train-formation"), { view: (t) => {
|
|
555
555
|
if (this._view) this.internals.states.delete(`view-${this._view}`);
|
|
556
556
|
this._view = t.view;
|
|
557
557
|
if (this._view) this.internals.states.add(`view-${this._view}`);
|
|
558
558
|
} }));
|
|
559
559
|
}
|
|
560
|
-
createRenderRoot() {
|
|
561
|
-
const renderRoot = super.createRenderRoot();
|
|
562
|
-
if (!isServer) {
|
|
563
|
-
this._clipStyleSheet = new CSSStyleSheet();
|
|
564
|
-
renderRoot.adoptedStyleSheets.push(this._clipStyleSheet);
|
|
565
|
-
}
|
|
566
|
-
return renderRoot;
|
|
567
|
-
}
|
|
568
560
|
_sectorChanged() {
|
|
569
561
|
/** @internal */
|
|
570
562
|
this.dispatchEvent(new Event("sectorchange", {
|
|
@@ -619,12 +611,7 @@ const SbbTrainWagonMixin = (superClass) => {
|
|
|
619
611
|
</span>`)} `;
|
|
620
612
|
const path = this._wagonShape();
|
|
621
613
|
const availableIconRows = this.label ? 3 : 4;
|
|
622
|
-
this.
|
|
623
|
-
--_sbb-train-wagon-clip-shape: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 84 36' fill='black'%3E%3Cpath d='${path}' /%3E%3C/svg%3E");
|
|
624
|
-
--_sbb-train-wagon-clip-shape-compartment: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${this.orientation === "vertical" ? 36 : 84} ${this.orientation === "vertical" ? 84 : 36}' fill='black'%3E%3Cpath d='${path}'${this.orientation === "vertical" ? ` transform='rotate(-90, 0, 0) scale(-1, 1)'` : ""} /%3E%3C/svg%3E");
|
|
625
|
-
--_sbb-train-wagon-attributes-icon-columns: ${Math.ceil(this.listChildren.length / availableIconRows)};
|
|
626
|
-
--_sbb-train-wagon-attributes-icon-rows: ${availableIconRows};
|
|
627
|
-
}`);
|
|
614
|
+
this._hostStyles.set("--_sbb-train-wagon-clip-shape", `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 84 36' fill='black'%3E%3Cpath d='${path}' /%3E%3C/svg%3E")`).set("--_sbb-train-wagon-clip-shape-compartment", `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 ${this.orientation === "vertical" ? 36 : 84} ${this.orientation === "vertical" ? 84 : 36}' fill='black'%3E%3Cpath d='${path}'${this.orientation === "vertical" ? ` transform='rotate(-90, 0, 0) scale(-1, 1)'` : ""} /%3E%3C/svg%3E")`).set("--_sbb-train-wagon-attributes-icon-columns", `${Math.ceil(this.listChildren.length / availableIconRows)}`).set("--_sbb-train-wagon-attributes-icon-rows", `${availableIconRows}`);
|
|
628
615
|
return html$1`
|
|
629
616
|
<div class="sbb-train-wagon">
|
|
630
617
|
${when(listEntriesCount > 1, () => html$1`<ul aria-label=${this._wagonTypeLabel()} class="sbb-train-wagon__compartment">
|
package/flip-card.pure.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import{MutationController as e}from"@lit-labs/observers/mutation-controller.js";import{html as t,isServer as n,nothing as r,unsafeCSS as i}from"lit";import{IS_FOCUSABLE_QUERY as a,SbbElement as o,
|
|
2
|
-
`,
|
|
1
|
+
import{MutationController as e}from"@lit-labs/observers/mutation-controller.js";import{html as t,isServer as n,nothing as r,unsafeCSS as i}from"lit";import{IS_FOCUSABLE_QUERY as a,SbbElement as o,SbbHostStylesController as s,SbbLanguageController as c,SbbPropertyWatcherController as l,buttonResetStyles as u,forceType as d,i18nFlipCard as f,i18nReverseCard as p,screenReaderOnlyStyles as m,ɵstateController as h}from"./core.js";import{__esDecorate as g,__runInitializers as _}from"tslib";import{property as v,state as y}from"lit/decorators.js";import{ResizeController as b}from"@lit-labs/observers/resize-controller.js";import{until as x}from"lit/directives/until.js";import{SbbSecondaryButtonStaticElement as S}from"./button.pure.js";var C=`:host{--sbb-focus-outline-color:var(--sbb-focus-outline-color-dark);--sbb-flip-card-details-transition-delay:var(--sbb-disable-animation-duration,var(--sbb-animation-duration-5x));--sbb-flip-card-details-padding-block-end:calc(var(--sbb-flip-card-padding) + var(--sbb-flip-card-padding-block-end) + var(--sbb-button-min-height-size-s));pointer-events:none;color:var(--sbb-color-milk);opacity:var(--sbb-flip-card-details-opacity,0);transform:translateY(var(--sbb-flip-card-details-translate-y));transition-property:transform,opacity;transition-duration:var(--sbb-flip-card-details-transition-duration);display:block;position:absolute}:host(:is(:state(flipped),[state--flipped])){transition-delay:var(--sbb-flip-card-details-transition-delay), var(--sbb-flip-card-details-transition-delay)}.sbb-flip-card-details{padding:var(--sbb-flip-card-padding);padding-block-end:var(--sbb-flip-card-details-padding-block-end);overflow:hidden}
|
|
2
|
+
`,w=class extends o{static{this.elementName=`sbb-flip-card-details`}static{this.styles=[i(C)]}constructor(){super(),this.addController(new e(this,{config:{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`href`,`tabindex`,`disabled`,`inert`]},callback:()=>this._checkForSlottedActions()}))}connectedCallback(){super.connectedCallback(),this.slot||=`details`}_checkForSlottedActions(){Array.from(this.querySelectorAll?.(a)??[]).forEach(e=>e.classList.toggle(`sbb-action`,!0))}render(){return t`
|
|
3
3
|
<div class="sbb-flip-card-details">
|
|
4
4
|
<slot></slot>
|
|
5
5
|
</div>
|
|
6
|
-
`}},
|
|
7
|
-
`;let
|
|
6
|
+
`}},T=`:host{min-height:var(--sbb-flip-card-min-height);pointer-events:var(--sbb-flip-card-summary-pointer-events,all);opacity:var(--sbb-flip-card-summary-opacity,1);border-radius:var(--sbb-flip-card-border-radius);width:100%;height:100%;transition:all var(--sbb-flip-card-summary-transition-duration) ease-out;transition-delay:var(--sbb-flip-card-summary-transition-delay);grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1fr);display:grid;overflow:hidden}@media (width>=37.5rem){:host([image-alignment=after]){grid-template-rows:1fr;grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=64rem){:host([image-alignment=after]){grid-template-rows:1fr;grid-template-columns:repeat(2,minmax(0,1fr))}}::slotted(sbb-title){padding-inline:var(--sbb-flip-card-padding);padding-block:var(--sbb-flip-card-padding) var(--sbb-flip-card-padding-block-end);grid-area:1/1/2/2;margin:0}@media (width>=37.5rem){:host([image-alignment=after]) ::slotted(sbb-title){grid-area:1/1/2/3}}@media (width>=64rem){:host([image-alignment=after]) ::slotted(sbb-title){grid-area:1/1/2/2}}::slotted(:not([slot=image])){transform:translateY(var(--sbb-flip-card-translate-title-y-hover,0));transition:transform var(--sbb-disable-animation-duration,var(--sbb-animation-duration-2x)) var(--sbb-animation-easing)}.sbb-flip-card-summary--image-wrapper{grid-area:2/1/3/2}@media (width>=37.5rem){:host([image-alignment=after]) .sbb-flip-card-summary--image-wrapper{grid-area:1/3/2/4}}@media (width>=64rem){:host([image-alignment=after]) .sbb-flip-card-summary--image-wrapper{grid-area:1/2/2/3}}::slotted([slot=image]){width:100%;height:100%}
|
|
7
|
+
`;let E=(()=>{let e=o,n,r=[],a=[];return class extends e{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(e[Symbol.metadata]??null):void 0;n=[v({attribute:`image-alignment`,reflect:!0})],g(this,null,n,{kind:`accessor`,name:`imageAlignment`,static:!1,private:!1,access:{has:e=>`imageAlignment`in e,get:e=>e.imageAlignment,set:(e,t)=>{e.imageAlignment=t}},metadata:t},r,a),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.elementName=`sbb-flip-card-summary`}static{this.styles=[i(T)]}#e=_(this,r,`after`);get imageAlignment(){return this.#e}set imageAlignment(e){this.#e=e}connectedCallback(){super.connectedCallback(),this.slot||=`summary`}render(){return t`
|
|
8
8
|
<slot></slot>
|
|
9
9
|
<div class="sbb-flip-card-summary--image-wrapper">
|
|
10
10
|
<slot name="image"></slot>
|
|
11
11
|
</div>
|
|
12
|
-
`}constructor(){super(...arguments),
|
|
13
|
-
`;let
|
|
12
|
+
`}constructor(){super(...arguments),_(this,a)}}})();var D=`:host{--sbb-flip-card-summary-transition-duration:var(--sbb-disable-animation-duration,var(--sbb-animation-duration-5x));--sbb-flip-card-summary-transition-delay:var(--sbb-disable-animation-duration,var(--sbb-animation-duration-2x));--sbb-flip-card-details-transition-duration:var(--sbb-disable-animation-duration,var(--sbb-animation-duration-4x));display:block;position:relative}@media (any-hover:hover){:host(:hover){--sbb-flip-card-background-color:light-dark(color-mix(in srgb, var(--sbb-color-cloud) 80%, transparent),var(--sbb-color-iron));--sbb-flip-card-translate-title-y-hover:-.0625rem}}:host(:is(:state(flipped),[state--flipped])){--sbb-flip-card-toggle-icon-transform:rotate(45deg);--sbb-flip-card-details-transition-duration:var(--sbb-disable-animation-duration,var(--sbb-animation-duration-2x));--sbb-flip-card-summary-transition-delay:0s}:host(:is(:state(flipped),[state--flipped])) ::slotted(sbb-flip-card-summary){--sbb-flip-card-summary-opacity:0;--sbb-flip-card-summary-pointer-events:none}:host(:is(:state(flipped),[state--flipped])) ::slotted(sbb-flip-card-details){--sbb-flip-card-details-opacity:1;--sbb-flip-card-details-translate-y:0}@media (width>=37.5rem) and (width<64rem){:host(:is(:state(image-alignment-after),[state--image-alignment-after])){--sbb-flip-card-min-height:15rem}}@media (width>=90rem){:host(:is(:state(image-alignment-after),[state--image-alignment-after])){--sbb-flip-card-min-height:25rem}}.sbb-flip-card{height:100%;min-height:var(--sbb-flip-card-min-height);background-color:var(--sbb-flip-card-background-color);border-radius:var(--sbb-flip-card-border-radius);transition:all var(--sbb-flip-card-summary-transition-duration) ease-out, min-height var(--sbb-flip-card-details-transition-duration);transition-delay:var(--sbb-flip-card-summary-transition-delay);cursor:var(--sbb-cursor-pointer);flex-flow:column wrap;display:flex;position:relative}:host(:is(:state(flipped),[state--flipped])) .sbb-flip-card{min-height:max(var(--sbb-flip-card-min-height), var(--sbb-flip-card-details-height))}@media (forced-colors:active){.sbb-flip-card:after{content:"";border:var(--sbb-flip-card-border) solid CanvasText;border-radius:var(--sbb-flip-card-border-radius);pointer-events:none;position:absolute;inset:0}}@media (forced-colors:active) and (any-hover:hover){:host(:hover) .sbb-flip-card:after{border-color:highlight}}.sbb-flip-card:before{content:"";opacity:0;pointer-events:none;background-color:var(--sbb-color-midnight);background-color:light-dark(var(--sbb-color-midnight),var(--sbb-color-iron));width:var(--sbb-flip-card-button-dimensions);height:var(--sbb-flip-card-button-dimensions);transition:var(--sbb-disable-animation-duration,var(--sbb-animation-duration-3x)) ease-out;border-radius:16rem;position:absolute;inset-block-end:var(--sbb-flip-card-padding);inset-inline-start:var(--sbb-flip-card-padding)}:host(:is(:state(flipped),[state--flipped])) .sbb-flip-card:before{opacity:1;border-radius:var(--sbb-flip-card-border-radius);width:100%;height:100%;transition-duration:var(--sbb-disable-animation-duration,var(--sbb-animation-duration-5x));inset-block-end:0;inset-inline-start:0}.sbb-flip-card--toggle-button{position:absolute;inset-block-end:var(--sbb-flip-card-padding);inset-inline-start:var(--sbb-flip-card-padding)}:host(:is(:state(flipped),[state--flipped])) .sbb-flip-card--toggle-button{--sbb-focus-outline-color:var(--sbb-focus-outline-color-dark)}.sbb-flip-card--toggle-button-icon{transform:var(--sbb-flip-card-toggle-icon-transform,none);transition:transform var(--sbb-flip-card-summary-transition-duration) ease-out}.sbb-flip-card-button{border-radius:var(--sbb-flip-card-border-radius);width:100%;cursor:var(--sbb-cursor-pointer);position:absolute;inset:0}.sbb-flip-card-button:focus-visible{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style,solid) var(--sbb-focus-outline-width)}
|
|
13
|
+
`;let O=(()=>{let e=o,C,w=[],T=[],E,O=[],k=[];return class extends e{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(e[Symbol.metadata]??null):void 0;C=[d(),v({attribute:`accessibility-label`})],E=[y()],g(this,null,C,{kind:`accessor`,name:`accessibilityLabel`,static:!1,private:!1,access:{has:e=>`accessibilityLabel`in e,get:e=>e.accessibilityLabel,set:(e,t)=>{e.accessibilityLabel=t}},metadata:t},w,T),g(this,null,E,{kind:`accessor`,name:`_flipped`,static:!1,private:!1,access:{has:e=>`_flipped`in e,get:e=>e._flipped,set:(e,t)=>{e._flipped=t}},metadata:t},O,k),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.elementName=`sbb-flip-card`}static{this.elementDependencies=[S]}static{this.styles=[u,m,i(D)]}static{this.events={flip:`flip`}}#e;get accessibilityLabel(){return this.#e}set accessibilityLabel(e){this.#e=e}get summary(){return this.querySelector?.(`sbb-flip-card-summary`)}get details(){return this.querySelector?.(`sbb-flip-card-details`)}get _detailsContentElement(){return this.details?.shadowRoot?.querySelector(`.sbb-flip-card-details`)??null}get isFlipped(){return this._flipped}#t;get _flipped(){return this.#t}set _flipped(e){this.#t=e}constructor(){super(),this.#e=_(this,w,``),this.#t=(_(this,T),_(this,O,!1)),this._language=(_(this,k),new c(this)),this._hostStyles=new s(this),this._cardDetailsResizeObserver=new b(this,{target:null,skipInitial:!0,callback:()=>this._setCardDetailsHeight()}),this.addEventListener?.(`click`,e=>{e.target!==this&&e.target?.matches?.(a)||this.toggle()}),this.addController(new l(this,()=>this.summary,{imageAlignment:e=>{this._previousImageAlignment&&this.internals.states.delete(`image-alignment-${this._previousImageAlignment}`),this._previousImageAlignment=e.imageAlignment,this._previousImageAlignment&&this.internals.states.add(`image-alignment-${this._previousImageAlignment}`)}}))}toggle(){this._flipped=!this._flipped;let e=this._detailsContentElement;this._flipped&&e?(this._setCardDetailsHeight(),this._cardDetailsResizeObserver.observe(e)):e&&this._cardDetailsResizeObserver.unobserve(e),this.toggleState(`flipped`,this._flipped),h(this.details)?.toggle(`flipped`,this._flipped),this.summary.inert=this._flipped,this.details.inert=!this._flipped,this.dispatchEvent(new Event(`flip`,{bubbles:!0,composed:!0}))}_setCardDetailsHeight(){let e=Math.floor(this._detailsContentElement.offsetHeight);this._hostStyles.set(`--sbb-flip-card-details-height`,`${e}px`)}async _accessibilityLabel(){return n?``:(await this.hydrationComplete,this._flipped?p[this._language.current]:`${(this.accessibilityLabel?this.accessibilityLabel:this.summary?.textContent?.trim())??``}, ${f[this._language.current]}`)}focus(e){this.shadowRoot?.querySelector(`.sbb-flip-card-button`)?.focus(e)}render(){return t`
|
|
14
14
|
<div class="sbb-flip-card">
|
|
15
15
|
<button
|
|
16
16
|
class="sbb-flip-card-button"
|
|
17
17
|
aria-expanded=${this._flipped.toString()}
|
|
18
18
|
type="button"
|
|
19
19
|
>
|
|
20
|
-
<span class="sbb-screen-reader-only">${
|
|
20
|
+
<span class="sbb-screen-reader-only">${x(this._accessibilityLabel(),r)}</span>
|
|
21
21
|
</button>
|
|
22
22
|
<slot name="summary" @slotchange=${()=>this.summary.inert=this._flipped}></slot>
|
|
23
23
|
<slot name="details" @slotchange=${()=>this.details.inert=!this._flipped}></slot>
|
|
@@ -29,4 +29,4 @@ import{MutationController as e}from"@lit-labs/observers/mutation-controller.js";
|
|
|
29
29
|
></sbb-icon>
|
|
30
30
|
</sbb-secondary-button-static>
|
|
31
31
|
</div>
|
|
32
|
-
`}}})();export{
|
|
32
|
+
`}}})();export{w as SbbFlipCardDetailsElement,O as SbbFlipCardElement,E as SbbFlipCardSummaryElement};
|