@sbb-esta/lyne-elements 3.12.0 → 3.12.1

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.
@@ -1,90 +1,89 @@
1
- var H = (a) => {
2
- throw TypeError(a);
1
+ var Y = (i) => {
2
+ throw TypeError(i);
3
3
  };
4
- var G = (a, o, l) => o.has(a) || H("Cannot " + l);
5
- var c = (a, o, l) => (G(a, o, "read from private field"), l ? l.call(a) : o.get(a)), p = (a, o, l) => o.has(a) ? H("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(a) : o.set(a, l), n = (a, o, l, d) => (G(a, o, "write to private field"), d ? d.call(a, l) : o.set(a, l), l);
6
- import { __esDecorate as u, __runInitializers as b } from "tslib";
7
- import { MutationController as ee } from "@lit-labs/observers/mutation-controller.js";
8
- import { ResizeController as te } from "@lit-labs/observers/resize-controller.js";
9
- import { css as se, isServer as ie, html as k, nothing as O } from "lit";
10
- import { customElement as ae, property as w, state as oe } from "lit/decorators.js";
11
- import { ref as A } from "lit/directives/ref.js";
12
- import { until as J } from "lit/directives/until.js";
13
- import { getNextElementIndex as re } from "../core/a11y.js";
14
- import { SbbOpenCloseBaseElement as le } from "../core/base-elements.js";
15
- import { SbbEscapableOverlayController as ne, SbbLanguageController as be } from "../core/controllers.js";
16
- import { forceType as C, handleDistinctChange as Q, getOverride as de } from "../core/decorators.js";
17
- import { isLean as he, setOrRemoveAttribute as S, isZeroAnimationDuration as ce, isNextjs as W, isSafari as pe } from "../core/dom.js";
18
- import { i18nSelectionRequired as ue } from "../core/i18n.js";
19
- import { SbbUpdateSchedulerMixin as ve, SbbDisabledMixin as _e, SbbNegativeMixin as ge, SbbHydrationMixin as fe, SbbRequiredMixin as me, SbbReadonlyMixin as ye, SbbFormAssociatedMixin as we } from "../core/mixins.js";
20
- import { isEventOnElement as X, setOverlayPosition as xe, overlayGapFixCorners as ke } from "../core/overlay.js";
21
- const Ee = se`*,:before,:after{box-sizing:border-box}.sbb-gap-fix-wrapper{position:relative;overflow:hidden;width:var(--sbb-options-panel-border-radius);height:var(--sbb-options-panel-border-radius);background-color:transparent}.sbb-gap-fix-corner{position:absolute;border-radius:50%;border:calc(var(--sbb-options-panel-border-radius) / 2) solid var(--sbb-options-panel-background-color);width:calc(var(--sbb-options-panel-border-radius) * 3);height:calc(var(--sbb-options-panel-border-radius) * 3);bottom:calc(var(--sbb-options-panel-border-radius) / 2 * -1)}.sbb-gap-fix-corner#left{left:calc(var(--sbb-options-panel-border-radius) / 2 * -1)}:host(:dir(rtl)) .sbb-gap-fix-corner#left{right:calc(var(--sbb-options-panel-border-radius) / 2 * -1);left:unset}.sbb-gap-fix-corner#right{right:calc(var(--sbb-options-panel-border-radius) / 2 * -1)}:host(:dir(rtl)) .sbb-gap-fix-corner#right{left:calc(var(--sbb-options-panel-border-radius) / 2 * -1);right:unset}:host{--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: color-mix(in srgb, var(--sbb-color-black) 30%, transparent);--sbb-scrollbar-color: light-dark( color-mix(in srgb, var(--sbb-color-black) 30%, transparent), color-mix(in srgb, var(--sbb-color-white) 30%, transparent) );--sbb-scrollbar-color-hover: color-mix(in srgb, var(--sbb-color-black) 60%, transparent);--sbb-scrollbar-color-hover: light-dark( color-mix(in srgb, var(--sbb-color-black) 60%, transparent), color-mix(in srgb, var(--sbb-color-white) 60%, transparent) );--sbb-scrollbar-track-color: transparent;--sbb-options-panel-position-x: 0;--sbb-options-panel-position-y: 0;--sbb-options-panel-active-option-y: 0;--sbb-options-panel-max-height: calc(85vh - var(--sbb-spacing-fixed-8x));--sbb-options-panel-min-height: var(--sbb-options-panel-origin-height);--sbb-options-panel-visibility: visible;--sbb-options-panel-width: fit-content;--sbb-options-panel-border-radius: var(--sbb-border-radius-4x);--sbb-options-panel-options-border-radius: 0 0 var(--sbb-options-panel-border-radius) var(--sbb-options-panel-border-radius);--sbb-options-panel-animation-duration: var( --sbb-disable-animation-duration, var(--sbb-animation-duration-4x) );--sbb-options-panel-animation-timing-function: ease;--sbb-options-panel-gap-fix-opacity: 0;--sbb-options-panel-gap-fix-transform: none;--sbb-options-panel-gap-fix-top: calc( var(--sbb-options-panel-position-y) - var(--sbb-options-panel-border-radius) );--sbb-options-panel-background-color: var(--sbb-background-color-1);--sbb-options-panel-padding-block: var(--sbb-spacing-fixed-2x);--sbb-options-panel-divider-margin-block: var(--sbb-spacing-fixed-3x);--sbb-focus-outline-color: var(--sbb-focus-outline-color-default);--sbb-focus-outline-color: light-dark( var(--sbb-focus-outline-color-default), var(--sbb-focus-outline-color-dark) );--sbb-options-panel-internal-z-index: var( --sbb-select-z-index, var(--sbb-overlay-default-z-index) );--sbb-select-placeholder-fallback-color: var(--sbb-color-metal);--sbb-select-placeholder-fallback-color: light-dark( var(--sbb-color-metal), var(--sbb-color-smoke) );display:block}:host([size=s]){--sbb-options-panel-padding-block: var(--sbb-spacing-fixed-1x)}:host([negative]){--sbb-scrollbar-color: color-mix(in srgb, var(--sbb-color-white) 30%, transparent);--sbb-scrollbar-color-hover: color-mix(in srgb, var(--sbb-color-white) 60%, transparent);--sbb-options-panel-background-color: var(--sbb-background-color-1-negative);--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark);--sbb-select-placeholder-fallback-color: var(--sbb-color-5)}:host(:not([data-state])),:host([data-state=closed]){--sbb-options-panel-visibility: hidden}:host([data-state=opening]){--sbb-options-panel-animation-name: open}:host([data-state=closing]){--sbb-options-panel-animation-name: close}:host([data-state=opened]),:host([data-state=opening]){--sbb-options-panel-gap-fix-opacity: 1}:host([data-options-panel-position=below]){--sbb-options-panel-animation-transform: translateY( calc((var(--sbb-options-panel-origin-height) / 2) * -1) )}:host([data-options-panel-position=above]){--sbb-options-panel-options-border-radius: var(--sbb-options-panel-border-radius) var(--sbb-options-panel-border-radius) 0 0;--sbb-options-panel-gap-fix-top: var(--sbb-options-panel-max-height);--sbb-options-panel-gap-fix-transform: rotate(180deg);--sbb-options-panel-animation-transform: translateY( calc(var(--sbb-options-panel-origin-height) / 2) )}::slotted(sbb-divider){margin-block:var(--sbb-options-panel-divider-margin-block)}:host([preserve-icon-space]){--sbb-option-icon-container-display: block}.sbb-select__trigger{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:default;height:calc(1em * var(--sbb-typo-line-height-body-text))}.sbb-select__trigger--placeholder{color:var(--sbb-select-placeholder-color, var(--sbb-select-placeholder-fallback-color));-webkit-text-fill-color:var(--sbb-select-placeholder-color, var(--sbb-select-placeholder-fallback-color))}.sbb-select__container{position:fixed;pointer-events:none;inset:0;z-index:var(--sbb-options-panel-internal-z-index)}.sbb-select__container[popover]{margin:0;padding:0;border:none;width:auto;height:auto;background-color:transparent}.sbb-select__gap-fix{display:flex;justify-content:space-between;position:fixed;visibility:var(--sbb-options-panel-visibility);opacity:var(--sbb-options-panel-gap-fix-opacity);background-color:transparent;width:var(--sbb-options-panel-width);height:var(--sbb-options-panel-border-radius);top:var(--sbb-options-panel-gap-fix-top);left:var(--sbb-options-panel-position-x);transform:var(--sbb-options-panel-gap-fix-transform);transition:opacity var(--sbb-options-panel-animation-duration) var(--sbb-options-panel-animation-timing-function)}.sbb-select__panel{display:block;position:absolute;visibility:var(--sbb-options-panel-visibility);overflow:hidden;background-color:transparent;border:none;border-radius:var(--sbb-options-panel-border-radius);top:var(--sbb-options-panel-position-y);left:var(--sbb-options-panel-position-x);width:var(--sbb-options-panel-width);transition:box-shadow var(--sbb-options-panel-animation-duration) var(--sbb-options-panel-animation-timing-function)}.sbb-select__panel:before,.sbb-select__panel:after{content:"";display:none;position:relative;width:100%;height:var(--sbb-options-panel-origin-height);background-color:transparent;border-radius:var(--sbb-options-panel-border-radius);pointer-events:none;transition:box-shadow var(--sbb-options-panel-animation-duration) var(--sbb-options-panel-animation-timing-function);z-index:1}:host([data-options-panel-position=below]) .sbb-select__panel{inset-block-start:calc(var(--sbb-options-panel-position-y) - var(--sbb-options-panel-origin-height))}:host(:is([data-state=opened],[data-state=opening])) .sbb-select__panel{box-shadow:var(--sbb-shadow-elevation-level-5-shadow-2-offset-x) var(--sbb-shadow-elevation-level-5-shadow-2-offset-y) var(--sbb-shadow-elevation-level-5-shadow-2-blur) var(--sbb-shadow-elevation-level-5-shadow-2-spread) var(--sbb-shadow-color-hard-2),var(--sbb-shadow-elevation-level-5-shadow-1-offset-x) var(--sbb-shadow-elevation-level-5-shadow-1-offset-y) var(--sbb-shadow-elevation-level-5-shadow-1-blur) var(--sbb-shadow-elevation-level-5-shadow-1-spread) var(--sbb-shadow-color-hard-1)}:host(:is([data-state=opened],[data-state=opening])[negative]) .sbb-select__panel{box-shadow:var(--sbb-shadow-elevation-level-5-shadow-2-offset-x) var(--sbb-shadow-elevation-level-5-shadow-2-offset-y) var(--sbb-shadow-elevation-level-5-shadow-2-blur) var(--sbb-shadow-elevation-level-5-shadow-2-spread) var(--sbb-shadow-color-hard-2-negative),var(--sbb-shadow-elevation-level-5-shadow-1-offset-x) var(--sbb-shadow-elevation-level-5-shadow-1-offset-y) var(--sbb-shadow-elevation-level-5-shadow-1-blur) var(--sbb-shadow-elevation-level-5-shadow-1-spread) var(--sbb-shadow-color-hard-1-negative)}:host([data-options-panel-position=below]) .sbb-select__panel:before{display:block}:host([data-options-panel-position=above]) .sbb-select__panel:after{display:block}:host(:is([data-state=opened],[data-state=opening])[data-option-panel-origin-borderless]) .sbb-select__panel:before,:host(:is([data-state=opened],[data-state=opening])[data-option-panel-origin-borderless]) .sbb-select__panel:after{box-shadow:var(--sbb-shadow-elevation-level-5-shadow-2-offset-x) var(--sbb-shadow-elevation-level-5-shadow-2-offset-y) var(--sbb-shadow-elevation-level-5-shadow-2-blur) var(--sbb-shadow-elevation-level-5-shadow-2-spread) var(--sbb-shadow-color-hard-2),var(--sbb-shadow-elevation-level-5-shadow-1-offset-x) var(--sbb-shadow-elevation-level-5-shadow-1-offset-y) var(--sbb-shadow-elevation-level-5-shadow-1-blur) var(--sbb-shadow-elevation-level-5-shadow-1-spread) var(--sbb-shadow-color-hard-1)}:host(:is([data-state=opened],[data-state=opening])[data-option-panel-origin-borderless][negative]) .sbb-select__panel:before,:host(:is([data-state=opened],[data-state=opening])[data-option-panel-origin-borderless][negative]) .sbb-select__panel:after{box-shadow:var(--sbb-shadow-elevation-level-5-shadow-2-offset-x) var(--sbb-shadow-elevation-level-5-shadow-2-offset-y) var(--sbb-shadow-elevation-level-5-shadow-2-blur) var(--sbb-shadow-elevation-level-5-shadow-2-spread) var(--sbb-shadow-color-hard-2-negative),var(--sbb-shadow-elevation-level-5-shadow-1-offset-x) var(--sbb-shadow-elevation-level-5-shadow-1-offset-y) var(--sbb-shadow-elevation-level-5-shadow-1-blur) var(--sbb-shadow-elevation-level-5-shadow-1-spread) var(--sbb-shadow-color-hard-1-negative)}.sbb-select__wrapper{overflow:hidden}.sbb-select__options{background-color:var(--sbb-options-panel-background-color);padding-block:var(--sbb-options-panel-padding-block);padding-inline:0;border-radius:var(--sbb-options-panel-options-border-radius);max-height:var(--sbb-options-panel-max-height);min-height:var(--sbb-options-panel-min-height);pointer-events:all;overflow-y:auto;animation-name:var(--sbb-options-panel-animation-name);animation-duration:var(--sbb-options-panel-animation-duration);animation-timing-function:var(--sbb-options-panel-animation-timing-function);--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x)}.sbb-select__options::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-select__options::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-select__options::-webkit-scrollbar-thumb{background-color:var(--sbb-scrollbar-color, currentcolor);border:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width))) solid transparent;border-radius:var(--sbb-border-radius-4x);background-clip:padding-box}.sbb-select__options::-webkit-scrollbar-thumb:hover{background-color:var(--sbb-scrollbar-color-hover, currentcolor);border-width:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width-hover)))}.sbb-select__options::-webkit-scrollbar-button,.sbb-select__options::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-select__options{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}@media(forced-colors:active){.sbb-select__options{border:var(--sbb-border-width-1x) solid CanvasText;border-block-start:none}}@keyframes open{0%{transform:var(--sbb-options-panel-animation-transform);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes close{0%{transform:translateY(0);opacity:1}to{transform:var(--sbb-options-panel-animation-transform);opacity:0}}`, E = pe;
22
- let Oe = 0, Ne = (() => {
23
- var v, _, g, f, m, y, r;
24
- let a = [ae("sbb-select")], o, l = [], d, D = ve(_e(ge(fe(me(ye(we(le))))))), I, z = [], V = [], L, P = [], $ = [], R, T = [], U = [], q, M = [], F = [], B, N = [], K = [], j, Y = [], Z = [];
25
- return r = class extends D {
4
+ var Z = (i, a, r) => a.has(i) || Y("Cannot " + r);
5
+ var m = (i, a, r) => (Z(i, a, "read from private field"), r ? r.call(i) : a.get(i)), y = (i, a, r) => a.has(i) ? Y("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(i) : a.set(i, r), n = (i, a, r, b) => (Z(i, a, "write to private field"), b ? b.call(i, r) : a.set(i, r), r);
6
+ import { __esDecorate as p, __runInitializers as l } from "tslib";
7
+ import { MutationController as X } from "@lit-labs/observers/mutation-controller.js";
8
+ import { ResizeController as ee } from "@lit-labs/observers/resize-controller.js";
9
+ import { css as te, isServer as se, html as x, nothing as E } from "lit";
10
+ import { customElement as ie, property as w, state as ae } from "lit/decorators.js";
11
+ import { ref as O } from "lit/directives/ref.js";
12
+ import { until as H } from "lit/directives/until.js";
13
+ import { getNextElementIndex as oe } from "../core/a11y.js";
14
+ import { SbbOpenCloseBaseElement as re } from "../core/base-elements.js";
15
+ import { SbbEscapableOverlayController as le, SbbLanguageController as ne } from "../core/controllers.js";
16
+ import { forceType as A, handleDistinctChange as J, getOverride as be } from "../core/decorators.js";
17
+ import { isLean as de, setOrRemoveAttribute as C, isZeroAnimationDuration as ce, isNextjs as G, isSafari as he } from "../core/dom.js";
18
+ import { i18nSelectionRequired as pe } from "../core/i18n.js";
19
+ import { SbbUpdateSchedulerMixin as ue, SbbDisabledMixin as ve, SbbNegativeMixin as _e, SbbHydrationMixin as ge, SbbRequiredMixin as fe, SbbReadonlyMixin as me, SbbFormAssociatedMixin as ye } from "../core/mixins.js";
20
+ import { isEventOnElement as Q, setOverlayPosition as we, overlayGapFixCorners as xe } from "../core/overlay.js";
21
+ const ke = te`*,:before,:after{box-sizing:border-box}.sbb-gap-fix-wrapper{position:relative;overflow:hidden;width:var(--sbb-options-panel-border-radius);height:var(--sbb-options-panel-border-radius);background-color:transparent}.sbb-gap-fix-corner{position:absolute;border-radius:50%;border:calc(var(--sbb-options-panel-border-radius) / 2) solid var(--sbb-options-panel-background-color);width:calc(var(--sbb-options-panel-border-radius) * 3);height:calc(var(--sbb-options-panel-border-radius) * 3);bottom:calc(var(--sbb-options-panel-border-radius) / 2 * -1)}.sbb-gap-fix-corner#left{left:calc(var(--sbb-options-panel-border-radius) / 2 * -1)}:host(:dir(rtl)) .sbb-gap-fix-corner#left{right:calc(var(--sbb-options-panel-border-radius) / 2 * -1);left:unset}.sbb-gap-fix-corner#right{right:calc(var(--sbb-options-panel-border-radius) / 2 * -1)}:host(:dir(rtl)) .sbb-gap-fix-corner#right{left:calc(var(--sbb-options-panel-border-radius) / 2 * -1);right:unset}:host{--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: color-mix(in srgb, var(--sbb-color-black) 30%, transparent);--sbb-scrollbar-color: light-dark( color-mix(in srgb, var(--sbb-color-black) 30%, transparent), color-mix(in srgb, var(--sbb-color-white) 30%, transparent) );--sbb-scrollbar-color-hover: color-mix(in srgb, var(--sbb-color-black) 60%, transparent);--sbb-scrollbar-color-hover: light-dark( color-mix(in srgb, var(--sbb-color-black) 60%, transparent), color-mix(in srgb, var(--sbb-color-white) 60%, transparent) );--sbb-scrollbar-track-color: transparent;--sbb-options-panel-position-x: 0;--sbb-options-panel-position-y: 0;--sbb-options-panel-active-option-y: 0;--sbb-options-panel-max-height: calc(85vh - var(--sbb-spacing-fixed-8x));--sbb-options-panel-min-height: var(--sbb-options-panel-origin-height);--sbb-options-panel-visibility: visible;--sbb-options-panel-width: fit-content;--sbb-options-panel-border-radius: var(--sbb-border-radius-4x);--sbb-options-panel-options-border-radius: 0 0 var(--sbb-options-panel-border-radius) var(--sbb-options-panel-border-radius);--sbb-options-panel-animation-duration: var( --sbb-disable-animation-duration, var(--sbb-animation-duration-4x) );--sbb-options-panel-animation-timing-function: ease;--sbb-options-panel-gap-fix-opacity: 0;--sbb-options-panel-gap-fix-transform: none;--sbb-options-panel-gap-fix-top: calc( var(--sbb-options-panel-position-y) - var(--sbb-options-panel-border-radius) );--sbb-options-panel-background-color: var(--sbb-background-color-1);--sbb-options-panel-padding-block: var(--sbb-spacing-fixed-2x);--sbb-options-panel-divider-margin-block: var(--sbb-spacing-fixed-3x);--sbb-focus-outline-color: var(--sbb-focus-outline-color-default);--sbb-focus-outline-color: light-dark( var(--sbb-focus-outline-color-default), var(--sbb-focus-outline-color-dark) );--sbb-options-panel-internal-z-index: var( --sbb-select-z-index, var(--sbb-overlay-default-z-index) );--sbb-select-placeholder-fallback-color: var(--sbb-color-metal);--sbb-select-placeholder-fallback-color: light-dark( var(--sbb-color-metal), var(--sbb-color-smoke) );display:block}:host([size=s]){--sbb-options-panel-padding-block: var(--sbb-spacing-fixed-1x)}:host([negative]){--sbb-scrollbar-color: color-mix(in srgb, var(--sbb-color-white) 30%, transparent);--sbb-scrollbar-color-hover: color-mix(in srgb, var(--sbb-color-white) 60%, transparent);--sbb-options-panel-background-color: var(--sbb-background-color-1-negative);--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark);--sbb-select-placeholder-fallback-color: var(--sbb-color-5)}:host(:not([data-state])),:host([data-state=closed]){--sbb-options-panel-visibility: hidden}:host([data-state=opening]){--sbb-options-panel-animation-name: open}:host([data-state=closing]){--sbb-options-panel-animation-name: close}:host([data-state=opened]),:host([data-state=opening]){--sbb-options-panel-gap-fix-opacity: 1}:host([data-options-panel-position=below]){--sbb-options-panel-animation-transform: translateY( calc((var(--sbb-options-panel-origin-height) / 2) * -1) )}:host([data-options-panel-position=above]){--sbb-options-panel-options-border-radius: var(--sbb-options-panel-border-radius) var(--sbb-options-panel-border-radius) 0 0;--sbb-options-panel-gap-fix-top: var(--sbb-options-panel-max-height);--sbb-options-panel-gap-fix-transform: rotate(180deg);--sbb-options-panel-animation-transform: translateY( calc(var(--sbb-options-panel-origin-height) / 2) )}::slotted(sbb-divider){margin-block:var(--sbb-options-panel-divider-margin-block)}:host([preserve-icon-space]){--sbb-option-icon-container-display: block}.sbb-select__trigger{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:default;height:calc(1em * var(--sbb-typo-line-height-body-text))}.sbb-select__trigger--placeholder{color:var(--sbb-select-placeholder-color, var(--sbb-select-placeholder-fallback-color));-webkit-text-fill-color:var(--sbb-select-placeholder-color, var(--sbb-select-placeholder-fallback-color))}.sbb-select__container{position:fixed;pointer-events:none;inset:0;z-index:var(--sbb-options-panel-internal-z-index)}.sbb-select__container[popover]{margin:0;padding:0;border:none;width:auto;height:auto;background-color:transparent}.sbb-select__gap-fix{display:flex;justify-content:space-between;position:fixed;visibility:var(--sbb-options-panel-visibility);opacity:var(--sbb-options-panel-gap-fix-opacity);background-color:transparent;width:var(--sbb-options-panel-width);height:var(--sbb-options-panel-border-radius);top:var(--sbb-options-panel-gap-fix-top);left:var(--sbb-options-panel-position-x);transform:var(--sbb-options-panel-gap-fix-transform);transition:opacity var(--sbb-options-panel-animation-duration) var(--sbb-options-panel-animation-timing-function)}.sbb-select__panel{display:block;position:absolute;visibility:var(--sbb-options-panel-visibility);overflow:hidden;background-color:transparent;border:none;border-radius:var(--sbb-options-panel-border-radius);top:var(--sbb-options-panel-position-y);left:var(--sbb-options-panel-position-x);width:var(--sbb-options-panel-width);transition:box-shadow var(--sbb-options-panel-animation-duration) var(--sbb-options-panel-animation-timing-function)}.sbb-select__panel:before,.sbb-select__panel:after{content:"";display:none;position:relative;width:100%;height:var(--sbb-options-panel-origin-height);background-color:transparent;border-radius:var(--sbb-options-panel-border-radius);pointer-events:none;transition:box-shadow var(--sbb-options-panel-animation-duration) var(--sbb-options-panel-animation-timing-function);z-index:1}:host([data-options-panel-position=below]) .sbb-select__panel{inset-block-start:calc(var(--sbb-options-panel-position-y) - var(--sbb-options-panel-origin-height))}:host(:is([data-state=opened],[data-state=opening])) .sbb-select__panel{box-shadow:var(--sbb-shadow-elevation-level-5-shadow-2-offset-x) var(--sbb-shadow-elevation-level-5-shadow-2-offset-y) var(--sbb-shadow-elevation-level-5-shadow-2-blur) var(--sbb-shadow-elevation-level-5-shadow-2-spread) var(--sbb-shadow-color-hard-2),var(--sbb-shadow-elevation-level-5-shadow-1-offset-x) var(--sbb-shadow-elevation-level-5-shadow-1-offset-y) var(--sbb-shadow-elevation-level-5-shadow-1-blur) var(--sbb-shadow-elevation-level-5-shadow-1-spread) var(--sbb-shadow-color-hard-1)}:host(:is([data-state=opened],[data-state=opening])[negative]) .sbb-select__panel{box-shadow:var(--sbb-shadow-elevation-level-5-shadow-2-offset-x) var(--sbb-shadow-elevation-level-5-shadow-2-offset-y) var(--sbb-shadow-elevation-level-5-shadow-2-blur) var(--sbb-shadow-elevation-level-5-shadow-2-spread) var(--sbb-shadow-color-hard-2-negative),var(--sbb-shadow-elevation-level-5-shadow-1-offset-x) var(--sbb-shadow-elevation-level-5-shadow-1-offset-y) var(--sbb-shadow-elevation-level-5-shadow-1-blur) var(--sbb-shadow-elevation-level-5-shadow-1-spread) var(--sbb-shadow-color-hard-1-negative)}:host([data-options-panel-position=below]) .sbb-select__panel:before{display:block}:host([data-options-panel-position=above]) .sbb-select__panel:after{display:block}:host(:is([data-state=opened],[data-state=opening])[data-option-panel-origin-borderless]) .sbb-select__panel:before,:host(:is([data-state=opened],[data-state=opening])[data-option-panel-origin-borderless]) .sbb-select__panel:after{box-shadow:var(--sbb-shadow-elevation-level-5-shadow-2-offset-x) var(--sbb-shadow-elevation-level-5-shadow-2-offset-y) var(--sbb-shadow-elevation-level-5-shadow-2-blur) var(--sbb-shadow-elevation-level-5-shadow-2-spread) var(--sbb-shadow-color-hard-2),var(--sbb-shadow-elevation-level-5-shadow-1-offset-x) var(--sbb-shadow-elevation-level-5-shadow-1-offset-y) var(--sbb-shadow-elevation-level-5-shadow-1-blur) var(--sbb-shadow-elevation-level-5-shadow-1-spread) var(--sbb-shadow-color-hard-1)}:host(:is([data-state=opened],[data-state=opening])[data-option-panel-origin-borderless][negative]) .sbb-select__panel:before,:host(:is([data-state=opened],[data-state=opening])[data-option-panel-origin-borderless][negative]) .sbb-select__panel:after{box-shadow:var(--sbb-shadow-elevation-level-5-shadow-2-offset-x) var(--sbb-shadow-elevation-level-5-shadow-2-offset-y) var(--sbb-shadow-elevation-level-5-shadow-2-blur) var(--sbb-shadow-elevation-level-5-shadow-2-spread) var(--sbb-shadow-color-hard-2-negative),var(--sbb-shadow-elevation-level-5-shadow-1-offset-x) var(--sbb-shadow-elevation-level-5-shadow-1-offset-y) var(--sbb-shadow-elevation-level-5-shadow-1-blur) var(--sbb-shadow-elevation-level-5-shadow-1-spread) var(--sbb-shadow-color-hard-1-negative)}.sbb-select__wrapper{overflow:hidden}.sbb-select__options{background-color:var(--sbb-options-panel-background-color);padding-block:var(--sbb-options-panel-padding-block);padding-inline:0;border-radius:var(--sbb-options-panel-options-border-radius);max-height:var(--sbb-options-panel-max-height);min-height:var(--sbb-options-panel-min-height);pointer-events:all;overflow-y:auto;animation-name:var(--sbb-options-panel-animation-name);animation-duration:var(--sbb-options-panel-animation-duration);animation-timing-function:var(--sbb-options-panel-animation-timing-function);--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x)}.sbb-select__options::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-select__options::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-select__options::-webkit-scrollbar-thumb{background-color:var(--sbb-scrollbar-color, currentcolor);border:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width))) solid transparent;border-radius:var(--sbb-border-radius-4x);background-clip:padding-box}.sbb-select__options::-webkit-scrollbar-thumb:hover{background-color:var(--sbb-scrollbar-color-hover, currentcolor);border-width:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width-hover)))}.sbb-select__options::-webkit-scrollbar-button,.sbb-select__options::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-select__options{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}@media(forced-colors:active){.sbb-select__options{border:var(--sbb-border-width-1x) solid CanvasText;border-block-start:none}}@keyframes open{0%{transform:var(--sbb-options-panel-animation-transform);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes close{0%{transform:translateY(0);opacity:1}to{transform:var(--sbb-options-panel-animation-transform);opacity:0}}`, k = he;
22
+ let Ee = 0, Ne = (() => {
23
+ var u, v, _, g, f, o;
24
+ let i = [ie("sbb-select")], a, r = [], b, S = ue(ve(_e(ge(fe(me(ye(re))))))), I = [], V, D = [], z = [], L, P = [], $ = [], M, R = [], T = [], F, U, q = [], N = [], B, K = [], j = [];
25
+ return o = class extends S {
26
26
  constructor() {
27
27
  super();
28
- p(this, v);
29
- p(this, _);
30
- p(this, g);
31
- p(this, f);
32
- p(this, m);
33
- p(this, y);
34
- n(this, v, b(this, z, "")), n(this, _, (b(this, V), b(this, P, !1))), n(this, g, (b(this, $), b(this, T, !1))), n(this, f, (b(this, U), b(this, M, null))), n(this, m, (b(this, F), b(this, N, he() ? "s" : "m"))), n(this, y, (b(this, K), b(this, Y, null))), this._originResizeObserver = (b(this, Z), new te(this, {
28
+ y(this, u);
29
+ y(this, v);
30
+ y(this, _);
31
+ y(this, g);
32
+ y(this, f);
33
+ n(this, u, (l(this, I), l(this, D, ""))), n(this, v, (l(this, z), l(this, P, !1))), n(this, _, (l(this, $), l(this, R, !1))), this._value = (l(this, T), null), n(this, g, l(this, q, de() ? "s" : "m")), n(this, f, (l(this, N), l(this, K, null))), this._originResizeObserver = (l(this, j), new ee(this, {
35
34
  target: null,
36
35
  skipInitial: !0,
37
36
  callback: () => {
38
37
  this.isOpen && this._setOverlayPosition();
39
38
  }
40
- })), this._escapableOverlayController = new ne(this), this._overlayId = `sbb-select-${++Oe}`, this._activeItemIndex = -1, this._searchString = "", this._didLoad = !1, this._isPointerDownEventOnMenu = !1, this._languageController = new be(this), this._pointerDownListener = (e) => {
41
- this._isPointerDownEventOnMenu = X(this._overlay, e);
39
+ })), this._escapableOverlayController = new le(this), this._overlayId = `sbb-select-${++Ee}`, this._activeItemIndex = -1, this._searchString = "", this._didLoad = !1, this._isPointerDownEventOnMenu = !1, this._languageController = new ne(this), this._isValueManuallyAssigned = !1, this._pointerDownListener = (e) => {
40
+ this._isPointerDownEventOnMenu = Q(this._overlay, e);
42
41
  }, this._closeOnBackdropClick = (e) => {
43
- !this._isPointerDownEventOnMenu && !X(this._overlay, e) && this.close();
44
- }, this.addEventListener?.("optionselectionchange", (e) => this._onOptionChanged(e)), this.addEventListener?.("optionLabelChanged", (e) => this._onOptionLabelChanged(e)), this.addEventListener?.("click", (e) => {
42
+ !this._isPointerDownEventOnMenu && !Q(this._overlay, e) && this.close();
43
+ }, this.addEventListener?.("optionselectionchange", (e) => this._onOptionChanged(e)), this.addEventListener?.("optionLabelChanged", (e) => this._onOptionLabelChanged(e)), this.addEventListener?.("ɵoptgroupslotchange", () => this._onSlotChange(), { capture: !0 }), this.addEventListener?.("click", (e) => {
45
44
  const t = e.target;
46
45
  t.localName === "sbb-option" ? !this.multiple && !t.disabled && (this.close(), this.focus()) : this._toggleOpening();
47
- }), this.addController(new ee(this, {
46
+ }), this.addController(new X(this, {
48
47
  config: { attributeFilter: ["aria-labelledby", "aria-label", "aria-describedby"] },
49
48
  callback: () => this._syncAriaLabels()
50
49
  }));
51
50
  }
52
51
  /** The placeholder used if no value has been selected. */
53
52
  get placeholder() {
54
- return c(this, v);
53
+ return m(this, u);
55
54
  }
56
55
  set placeholder(e) {
57
- n(this, v, e);
56
+ n(this, u, e);
58
57
  }
59
58
  /** Whether the select allows for multiple selection. */
60
59
  get multiple() {
61
- return c(this, _);
60
+ return m(this, v);
62
61
  }
63
62
  set multiple(e) {
64
- n(this, _, e);
63
+ n(this, v, e);
65
64
  }
66
65
  get disabled() {
67
- return c(this, g);
66
+ return m(this, _);
68
67
  }
69
68
  set disabled(e) {
70
- n(this, g, e);
69
+ n(this, _, e);
71
70
  }
72
71
  /** Value of the form element. */
73
- get value() {
74
- return c(this, f);
75
- }
76
72
  set value(e) {
77
- n(this, f, e);
73
+ this._value = e, this._updateOptionsFromValue(), this._isValueManuallyAssigned = !0;
74
+ }
75
+ get value() {
76
+ return this._value;
78
77
  }
79
78
  /**
80
79
  * Size variant, either m or s.
81
80
  * @default 'm' / 's' (lean)
82
81
  */
83
82
  get size() {
84
- return c(this, m);
83
+ return m(this, g);
85
84
  }
86
85
  set size(e) {
87
- n(this, m, e);
86
+ n(this, g, e);
88
87
  }
89
88
  /**
90
89
  * Form type of element.
@@ -95,10 +94,10 @@ let Oe = 0, Ne = (() => {
95
94
  }
96
95
  /** The value displayed by the component. */
97
96
  get _displayValue() {
98
- return c(this, y);
97
+ return m(this, f);
99
98
  }
100
99
  set _displayValue(e) {
101
- n(this, y, e);
100
+ n(this, f, e);
102
101
  }
103
102
  /**
104
103
  * The 'combobox' input element
@@ -107,19 +106,19 @@ let Oe = 0, Ne = (() => {
107
106
  get inputElement() {
108
107
  return this._triggerElement;
109
108
  }
110
- /** Gets all the SbbOptionElement projected in the select. */
111
- get _options() {
112
- return Array.from(this.querySelectorAll?.("sbb-option") ?? []);
113
- }
114
- get _filteredOptions() {
115
- return this._options.filter((e) => !e.disabled && !e.hasAttribute("data-group-disabled"));
109
+ /** Returns all SbbOptionElements from this sbb-select instance. */
110
+ get options() {
111
+ const e = [];
112
+ return this.querySelectorAll?.("sbb-option").forEach((t) => {
113
+ customElements.upgrade(t), e.push(t);
114
+ }), e;
116
115
  }
117
116
  _syncAriaLabels() {
118
- !this._triggerElement || ie || (S(this._triggerElement, "aria-labelledby", this.getAttribute("aria-labelledby")), S(this._triggerElement, "aria-label", this.getAttribute("aria-label")), S(this._triggerElement, "aria-describedby", this.getAttribute("aria-describedby")), !this.getAttribute("aria-label") && !this.getAttribute("aria-labelledby") && this.internals.labels.length && this._triggerElement?.setAttribute("aria-label", Array.from(this.internals.labels).map((e) => e.textContent).join(", ")));
117
+ !this._triggerElement || se || (C(this._triggerElement, "aria-labelledby", this.getAttribute("aria-labelledby")), C(this._triggerElement, "aria-label", this.getAttribute("aria-label")), C(this._triggerElement, "aria-describedby", this.getAttribute("aria-describedby")), !this.getAttribute("aria-label") && !this.getAttribute("aria-labelledby") && this.internals.labels.length && this._triggerElement?.setAttribute("aria-label", Array.from(this.internals.labels).map((e) => e.textContent).join(", ")));
119
118
  }
120
119
  /** Opens the selection panel. */
121
120
  open() {
122
- this.state !== "closed" || !this._overlay || this._options.length === 0 || this.disabled || this.formDisabled || !this.dispatchBeforeOpenEvent() || (this.shadowRoot?.querySelector(".sbb-select__container")?.showPopover?.(), this.state = "opening", this.toggleAttribute("data-expanded", !0), this._setOverlayPosition(), this._isZeroAnimationDuration() && this._handleOpening());
121
+ this.state !== "closed" || !this._overlay || this.options.length === 0 || this.disabled || this.formDisabled || !this.dispatchBeforeOpenEvent() || (this.shadowRoot?.querySelector(".sbb-select__container")?.showPopover?.(), this.state = "opening", this.toggleAttribute("data-expanded", !0), this._setOverlayPosition(), this._isZeroAnimationDuration() && this._handleOpening());
123
122
  }
124
123
  /** Closes the selection panel. */
125
124
  close() {
@@ -132,6 +131,9 @@ let Oe = 0, Ne = (() => {
132
131
  getDisplayValue() {
133
132
  return this._displayValue ?? "";
134
133
  }
134
+ _selectableOptions() {
135
+ return this.options.filter((e) => !e.disabled && !e.hasAttribute("data-group-disabled"));
136
+ }
135
137
  /** Listens to option changes. */
136
138
  _onOptionChanged(e) {
137
139
  const t = e.target;
@@ -140,10 +142,11 @@ let Oe = 0, Ne = (() => {
140
142
  /** Listens to option changes. */
141
143
  _onOptionLabelChanged(e) {
142
144
  const t = e.target, s = this._getSelected();
143
- !Array.isArray(s) && t !== s || Array.isArray(s) && !s.includes(t) || this._updateDisplayValue(s);
145
+ !Array.isArray(s) && t !== s || Array.isArray(s) && !s.includes(t) || this._updateDisplayValue();
144
146
  }
145
- _updateDisplayValue(e) {
146
- Array.isArray(e) ? this._displayValue = e.map((t) => t.textContent).join(", ") || null : e ? this._displayValue = e?.textContent?.trim() || null : this._displayValue = null, this.dispatchEvent(new Event("displayvaluechange", { bubbles: !0, composed: !0 }));
147
+ _updateDisplayValue() {
148
+ const e = this._getSelected();
149
+ Array.isArray(e) ? this._displayValue = e.map((t) => t.textContent?.trim()).join(", ") || null : e ? this._displayValue = e?.textContent?.trim() || null : this._displayValue = null, this.dispatchEvent(new Event("displayvaluechange", { bubbles: !0, composed: !0 }));
147
150
  }
148
151
  /**
149
152
  * The `value` property should be adapted when the `multiple` property changes:
@@ -151,7 +154,7 @@ let Oe = 0, Ne = (() => {
151
154
  * - if it changes to false, the first available option is set as 'value' otherwise it's set to null.
152
155
  */
153
156
  _onMultipleChanged(e) {
154
- e ? this.value = this.value !== null && this.value !== void 0 ? [this.value] : [] : Array.isArray(this.value) && (this.value = this.value.length ? this.value[0] : null);
157
+ e ? this._value = this._isValueManuallyAssigned || this.value != null ? [this.value] : [] : Array.isArray(this.value) && (this._value = this.value.length ? this.value[0] : null), this._updateDisplayValue();
155
158
  }
156
159
  /**
157
160
  * If the `disabled` or the `readonly` properties are set, and the panel is open, close it.
@@ -159,20 +162,8 @@ let Oe = 0, Ne = (() => {
159
162
  _closeOnDisabledReadonlyChanged(e) {
160
163
  this.isOpen && e && this.close();
161
164
  }
162
- /** Sets the _displayValue by checking the internal sbb-options and setting the correct `selected` value on them. */
163
- _onValueChanged(e) {
164
- const t = this._filteredOptions;
165
- if (Array.isArray(e)) {
166
- t.filter((i) => !e.includes(i.value)).forEach((i) => i.selected = !1);
167
- const s = t.filter((i) => e.includes(i.value));
168
- s.forEach((i) => i.selected = !0), this._updateDisplayValue(s);
169
- } else {
170
- const s = t.find((i) => i.value === e) ?? null;
171
- s && (s.selected = !0), t.filter((i) => (i.value ?? i.getAttribute("value")) !== e).forEach((i) => i.selected = !1), this._updateDisplayValue(s);
172
- }
173
- }
174
165
  firstUpdated(e) {
175
- super.firstUpdated(e), W() || (this.startUpdate(), this._setupSelect());
166
+ super.firstUpdated(e), G() || (this.startUpdate(), this._setupSelect());
176
167
  }
177
168
  /** @internal */
178
169
  focus() {
@@ -189,10 +180,10 @@ let Oe = 0, Ne = (() => {
189
180
  * @internal We need to override this due to a hydration issue with Next.js.
190
181
  */
191
182
  removeAttribute(e) {
192
- W() && e === "defer-hydration" && !this._didLoad && this.updateComplete.then(() => this._setupSelect()), super.removeAttribute(e);
183
+ G() && e === "defer-hydration" && !this._didLoad && this.updateComplete.then(() => this._setupSelect()), super.removeAttribute(e);
193
184
  }
194
185
  connectedCallback() {
195
- super.connectedCallback(), E && (this.id ||= this._overlayId);
186
+ super.connectedCallback(), k && (this.id ||= this._overlayId);
196
187
  const e = this.closest?.("sbb-form-field") ?? this.closest?.("[data-form-field]");
197
188
  e && (this.negative = e.hasAttribute("negative")), this._syncProperties(), this._syncAriaLabels(), this._didLoad && (this._setupOrigin(), this._setupTrigger());
198
189
  }
@@ -200,7 +191,7 @@ let Oe = 0, Ne = (() => {
200
191
  super.requestUpdate(e, t, s), !e && this.hasUpdated && setTimeout(() => this._syncAriaLabels());
201
192
  }
202
193
  willUpdate(e) {
203
- super.willUpdate(e), e.has("value") && (this._didLoad || this.value) && this._onValueChanged(this.value), (e.has("negative") || e.has("multiple")) && this._syncProperties(), e.has("readOnly") && this._closeOnDisabledReadonlyChanged(this.readOnly);
194
+ super.willUpdate(e), (e.has("negative") || e.has("multiple")) && this._syncProperties(), e.has("readOnly") && this._closeOnDisabledReadonlyChanged(this.readOnly);
204
195
  }
205
196
  disconnectedCallback() {
206
197
  super.disconnectedCallback(), this.prepend(this._triggerElement), this._openPanelEventsController?.abort();
@@ -216,12 +207,19 @@ let Oe = 0, Ne = (() => {
216
207
  * @internal
217
208
  */
218
209
  formStateRestoreCallback(e, t) {
219
- typeof e == "string" || e == null ? this.value = e ?? null : e instanceof FormData && this._readFormData(e).then((s) => {
220
- this.value = this.multiple ? s : s[0];
221
- });
210
+ try {
211
+ const { value: s, manuallyAssigned: h } = JSON.parse(e);
212
+ if ((Array.isArray(s) ? s : [s]).some((d) => d !== null && typeof d == "object")) {
213
+ console.warn(`Restoring complex objects is not supported for sbb-select with state ${e}`);
214
+ return;
215
+ }
216
+ this._isValueManuallyAssigned = h, this._value = s, this._updateOptionsFromValue();
217
+ } catch {
218
+ console.warn(`Failed to restore sbb-select with state ${e}`);
219
+ }
222
220
  }
223
- async _readFormData(e) {
224
- return Promise.all(e.getAll(this.name).map(async (t) => t instanceof Blob ? JSON.parse(await t.text()) : t));
221
+ formState() {
222
+ return JSON.stringify({ value: this.value, manuallyAssigned: this._isValueManuallyAssigned });
225
223
  }
226
224
  _syncProperties() {
227
225
  this.querySelectorAll?.("sbb-divider, sbb-option-hint").forEach((e) => e.negative = this.negative), this.querySelectorAll?.("sbb-option, sbb-optgroup").forEach((e) => {
@@ -232,7 +230,7 @@ let Oe = 0, Ne = (() => {
232
230
  return super.shouldValidate(e) || e === "value" || e === "required";
233
231
  }
234
232
  validate() {
235
- super.validate(), this.required && this._options.every((e) => e.value !== this.value) ? this.setValidityFlag("valueMissing", ue[this._languageController.current]) : this.removeValidityFlag("valueMissing");
233
+ super.validate(), this.required && (this.options.every((e) => e.value !== this.value) || !this._isValueManuallyAssigned && this.value == null) ? this.setValidityFlag("valueMissing", pe[this._languageController.current]) : this.removeValidityFlag("valueMissing");
236
234
  }
237
235
  _setupSelect() {
238
236
  this._setupOrigin(), this._setupTrigger(), this._didLoad = !0, this.completeUpdate();
@@ -250,7 +248,7 @@ let Oe = 0, Ne = (() => {
250
248
  this.parentElement.insertBefore?.(this._triggerElement, this);
251
249
  }
252
250
  _setOverlayPosition() {
253
- xe(this._overlay, this._originElement, this._optionContainer, this.shadowRoot.querySelector(".sbb-select__container"), this);
251
+ we(this._overlay, this._originElement, this._optionContainer, this.shadowRoot.querySelector(".sbb-select__container"), this);
254
252
  }
255
253
  // In rare cases it can be that the animationEnd event is triggered twice.
256
254
  // To avoid entering a corrupt state, exit when state is not expected.
@@ -265,11 +263,11 @@ let Oe = 0, Ne = (() => {
265
263
  }
266
264
  /** When an option is selected, updates the displayValue; it also closes the select if not `multiple`. */
267
265
  _onOptionSelected(e) {
268
- this.multiple ? this.value ? Array.isArray(this.value) && !this.value.includes(e.value) && (this.value = [...this.value, e.value]) : this.value = [e.value] : (this._filteredOptions.filter((t) => t.id !== e.id).forEach((t) => t.selected = !1), this.value = e.value), this._dispatchInputEvents();
266
+ this.multiple ? this.value ? Array.isArray(this.value) && !this.value.includes(e.value) && (this._value = [...this.value, e.value]) : this._value = [e.value] : this._value = e.value, this._updateOptionsFromValue(), this._dispatchInputEvents();
269
267
  }
270
268
  /** When an option is unselected in `multiple`, removes it from value and updates displayValue. */
271
269
  _onOptionDeselected(e) {
272
- this.multiple && Array.isArray(this.value) && (this.value = this.value.filter((t) => t !== e.value), this._dispatchInputEvents());
270
+ this.multiple && Array.isArray(this.value) && (this._value = this.value.filter((t) => t !== e.value), this._updateOptionsFromValue(), this._dispatchInputEvents());
273
271
  }
274
272
  _dispatchInputEvents() {
275
273
  this.dispatchEvent(new InputEvent("input", {
@@ -330,7 +328,7 @@ let Oe = 0, Ne = (() => {
330
328
  break;
331
329
  case "End":
332
330
  case "PageDown":
333
- e.preventDefault(), this._setNextActiveOption(e, this._filteredOptions.length - 1);
331
+ e.preventDefault(), this._setNextActiveOption(e, this._selectableOptions().length - 1);
334
332
  break;
335
333
  }
336
334
  }
@@ -340,28 +338,28 @@ let Oe = 0, Ne = (() => {
340
338
  }
341
339
  _setNextActiveOptionByText(e) {
342
340
  typeof this._searchTimeout == typeof setTimeout && clearTimeout(this._searchTimeout), this._searchTimeout = setTimeout(() => this._searchString = "", 1e3), this._searchString += e.key;
343
- const t = this._activeItemIndex + 1, s = [
344
- ...this._filteredOptions.slice(t),
345
- ...this._filteredOptions.slice(0, t)
346
- ], i = s.find((h) => h.textContent?.toLowerCase().indexOf(this._searchString.toLowerCase()) === 0);
347
- if (i)
348
- this._setNextActiveOption(e, this._filteredOptions.indexOf(i));
341
+ const t = this._activeItemIndex + 1, s = this._selectableOptions(), h = [
342
+ ...s.slice(t),
343
+ ...s.slice(0, t)
344
+ ], c = h.find((d) => d.textContent?.toLowerCase().indexOf(this._searchString.toLowerCase()) === 0);
345
+ if (c)
346
+ this._setNextActiveOption(e, s.indexOf(c));
349
347
  else if (this._searchString.length > 1 && new RegExp(`^${this._searchString.charAt(0)}*$`).test(this._searchString)) {
350
- const h = s.find((x) => x.textContent?.toLowerCase().indexOf(this._searchString[0].toLowerCase()) === 0);
351
- h && this._setNextActiveOption(e, this._filteredOptions.indexOf(h));
348
+ const d = h.find((W) => W.textContent?.toLowerCase().indexOf(this._searchString[0].toLowerCase()) === 0);
349
+ d && this._setNextActiveOption(e, s.indexOf(d));
352
350
  } else
353
351
  clearTimeout(this._searchTimeout), this._searchString = "";
354
352
  }
355
353
  _selectByKeyboard() {
356
- const e = this._filteredOptions[this._activeItemIndex];
354
+ const e = this._selectableOptions()[this._activeItemIndex];
357
355
  this.multiple ? e?.selectViaUserInteraction(!e.selected) : this.close();
358
356
  }
359
357
  _setNextActiveOption(e, t) {
360
- const s = this._filteredOptions;
358
+ const s = this._selectableOptions();
361
359
  if (s.length === 0)
362
360
  return;
363
- const i = t ?? re(e, this._activeItemIndex, s.length), h = s[i], x = s[this._activeItemIndex];
364
- this._setActiveElement(h, x), this.multiple ? e?.shiftKey && h.selectViaUserInteraction(!h.selected) : this._setSelectedElement(h, x), this._activeItemIndex = i;
361
+ const h = t ?? oe(e, this._activeItemIndex, s.length), c = s[h], d = s[this._activeItemIndex];
362
+ this._setActiveElement(c, d), this.multiple ? e?.shiftKey && c.selectViaUserInteraction(!c.selected) : this._setSelectedElement(c, d), this._activeItemIndex = h;
365
363
  }
366
364
  _setActiveElement(e, t = null, s = !0) {
367
365
  e.setActive(!0), e.scrollIntoView({ block: "nearest" }), s && this._triggerElement.setAttribute("aria-activedescendant", e.id), t && t !== e && t.setActive(!1);
@@ -370,22 +368,32 @@ let Oe = 0, Ne = (() => {
370
368
  e.selectViaUserInteraction(!0), t && t !== e && t.selectViaUserInteraction(!1);
371
369
  }
372
370
  _resetActiveElement() {
373
- const e = this._filteredOptions[this._activeItemIndex];
371
+ const e = this._selectableOptions()[this._activeItemIndex];
374
372
  e && e.setActive(!1), this._activeItemIndex = -1, this._triggerElement.removeAttribute("aria-activedescendant");
375
373
  }
376
- _setValueFromSelected() {
374
+ _updateOptionsFromValue() {
375
+ const e = Array.isArray(this.value) ? this.value : [this.value];
376
+ for (const t of this.options)
377
+ t.selected = e.includes(t.value), t.selected;
378
+ this._updateDisplayValue(), Array.isArray(this.value) || (this._activeItemIndex = this._selectableOptions().findIndex((t) => t.value === this.value));
379
+ }
380
+ _updateValueFromOptions() {
377
381
  const e = this._getSelected();
378
382
  if (Array.isArray(e)) {
379
383
  if (e && e.length > 0) {
380
384
  const t = [];
381
385
  for (const s of e)
382
386
  t.push(s.value);
383
- this.value = t;
387
+ this._value = t;
384
388
  }
385
- } else e ? (this._activeItemIndex = this._filteredOptions.findIndex((t) => t === e), this.value = e.value) : this.value && this._onValueChanged(this.value);
389
+ } else e && (this._activeItemIndex = this._selectableOptions().findIndex((t) => t === e), this._value = e.value);
390
+ this._updateDisplayValue();
391
+ }
392
+ _onSlotChange() {
393
+ this._isValueManuallyAssigned ? this._updateOptionsFromValue() : this._updateValueFromOptions();
386
394
  }
387
395
  _getSelected() {
388
- return this.multiple ? this._filteredOptions.filter((e) => e.selected) : this._filteredOptions.find((e) => e.selected) ?? null;
396
+ return this.multiple ? this.options.filter((e) => e.selected) : this.options.find((e) => e.selected) ?? null;
389
397
  }
390
398
  _toggleOpening() {
391
399
  if (!(this.disabled || this.formDisabled || this.readOnly))
@@ -404,15 +412,15 @@ let Oe = 0, Ne = (() => {
404
412
  return [this._deferredDisplayValue(e), e];
405
413
  }
406
414
  async _deferredDisplayValue(e) {
407
- return this.hydrationRequired && await this.hydrationComplete, this._displayValue ? k`${this._displayValue}` : e;
415
+ return this.hydrationRequired && await this.hydrationComplete, this._displayValue ? x`${this._displayValue}` : e;
408
416
  }
409
417
  render() {
410
- return k`
418
+ return x`
411
419
  <!-- This element is visually hidden and will be appended to the light DOM to allow screen
412
420
  readers to work properly -->
413
421
  <div
414
422
  class="sbb-screen-reader-only sbb-select-trigger"
415
- tabindex=${this.disabled || this.formDisabled ? O : "0"}
423
+ tabindex=${this.disabled || this.formDisabled ? E : "0"}
416
424
  role="combobox"
417
425
  aria-haspopup="listbox"
418
426
  aria-expanded="false"
@@ -421,55 +429,55 @@ let Oe = 0, Ne = (() => {
421
429
  aria-owns=${this._overlayId}
422
430
  @keydown=${this._onKeyDown}
423
431
  @click=${this._toggleOpening}
424
- ${A((e) => this._triggerElement = e)}
432
+ ${O((e) => this._triggerElement = e)}
425
433
  >
426
- ${J(...this._spreadDeferredDisplayValue(k`<span>${this.placeholder}</span>`))}
434
+ ${H(...this._spreadDeferredDisplayValue(x`<span>${this.placeholder}</span>`))}
427
435
  </div>
428
436
 
429
437
  <!-- Visually display the value -->
430
438
  <div class="sbb-select__trigger" aria-hidden="true">
431
- ${J(...this._spreadDeferredDisplayValue(k`<span class="sbb-select__trigger--placeholder">${this.placeholder}</span>`))}
439
+ ${H(...this._spreadDeferredDisplayValue(x`<span class="sbb-select__trigger--placeholder">${this.placeholder}</span>`))}
432
440
  </div>
433
441
 
434
442
  <div class="sbb-select__gap-fix"></div>
435
443
  <div class="sbb-select__container" popover="manual">
436
- <div class="sbb-select__gap-fix">${ke()}</div>
444
+ <div class="sbb-select__gap-fix">${xe()}</div>
437
445
  <div
438
446
  @animationend=${this._onAnimationEnd}
439
447
  class="sbb-select__panel"
440
- ${A((e) => this._overlay = e)}
448
+ ${O((e) => this._overlay = e)}
441
449
  >
442
450
  <div class="sbb-select__wrapper">
443
451
  <div
444
- id=${E ? O : this._overlayId}
452
+ id=${k ? E : this._overlayId}
445
453
  class="sbb-select__options"
446
- role=${E ? O : "listbox"}
454
+ role=${k ? E : "listbox"}
447
455
  ?aria-multiselectable=${this.multiple}
448
- ${A((e) => this._optionContainer = e)}
456
+ ${O((e) => this._optionContainer = e)}
449
457
  >
450
- <slot @slotchange=${this._setValueFromSelected}></slot>
458
+ <slot @slotchange=${this._onSlotChange}></slot>
451
459
  </div>
452
460
  </div>
453
461
  </div>
454
462
  </div>
455
463
  `;
456
464
  }
457
- }, v = new WeakMap(), _ = new WeakMap(), g = new WeakMap(), f = new WeakMap(), m = new WeakMap(), y = new WeakMap(), d = r, (() => {
458
- const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(D[Symbol.metadata] ?? null) : void 0;
459
- I = [C(), w()], L = [C(), Q((t, s) => t._onMultipleChanged(s)), w({ reflect: !0, type: Boolean })], R = [C(), Q((t, s) => t._closeOnDisabledReadonlyChanged(s)), w({ reflect: !0, type: Boolean }), de((t, s) => s || t.isDisabledExternally())], q = [w()], B = [w({ reflect: !0 })], j = [oe()], u(r, null, I, { kind: "accessor", name: "placeholder", static: !1, private: !1, access: { has: (t) => "placeholder" in t, get: (t) => t.placeholder, set: (t, s) => {
465
+ }, u = new WeakMap(), v = new WeakMap(), _ = new WeakMap(), g = new WeakMap(), f = new WeakMap(), b = o, (() => {
466
+ const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(S[Symbol.metadata] ?? null) : void 0;
467
+ V = [A(), w()], L = [A(), J((t, s) => t._onMultipleChanged(s)), w({ reflect: !0, type: Boolean })], M = [A(), J((t, s) => t._closeOnDisabledReadonlyChanged(s)), w({ reflect: !0, type: Boolean }), be((t, s) => s || t.isDisabledExternally())], F = [w()], U = [w({ reflect: !0 })], B = [ae()], p(o, null, V, { kind: "accessor", name: "placeholder", static: !1, private: !1, access: { has: (t) => "placeholder" in t, get: (t) => t.placeholder, set: (t, s) => {
460
468
  t.placeholder = s;
461
- } }, metadata: e }, z, V), u(r, null, L, { kind: "accessor", name: "multiple", static: !1, private: !1, access: { has: (t) => "multiple" in t, get: (t) => t.multiple, set: (t, s) => {
469
+ } }, metadata: e }, D, z), p(o, null, L, { kind: "accessor", name: "multiple", static: !1, private: !1, access: { has: (t) => "multiple" in t, get: (t) => t.multiple, set: (t, s) => {
462
470
  t.multiple = s;
463
- } }, metadata: e }, P, $), u(r, null, R, { kind: "accessor", name: "disabled", static: !1, private: !1, access: { has: (t) => "disabled" in t, get: (t) => t.disabled, set: (t, s) => {
471
+ } }, metadata: e }, P, $), p(o, null, M, { kind: "accessor", name: "disabled", static: !1, private: !1, access: { has: (t) => "disabled" in t, get: (t) => t.disabled, set: (t, s) => {
464
472
  t.disabled = s;
465
- } }, metadata: e }, T, U), u(r, null, q, { kind: "accessor", name: "value", static: !1, private: !1, access: { has: (t) => "value" in t, get: (t) => t.value, set: (t, s) => {
473
+ } }, metadata: e }, R, T), p(o, null, F, { kind: "setter", name: "value", static: !1, private: !1, access: { has: (t) => "value" in t, set: (t, s) => {
466
474
  t.value = s;
467
- } }, metadata: e }, M, F), u(r, null, B, { kind: "accessor", name: "size", static: !1, private: !1, access: { has: (t) => "size" in t, get: (t) => t.size, set: (t, s) => {
475
+ } }, metadata: e }, null, I), p(o, null, U, { kind: "accessor", name: "size", static: !1, private: !1, access: { has: (t) => "size" in t, get: (t) => t.size, set: (t, s) => {
468
476
  t.size = s;
469
- } }, metadata: e }, N, K), u(r, null, j, { kind: "accessor", name: "_displayValue", static: !1, private: !1, access: { has: (t) => "_displayValue" in t, get: (t) => t._displayValue, set: (t, s) => {
477
+ } }, metadata: e }, q, N), p(o, null, B, { kind: "accessor", name: "_displayValue", static: !1, private: !1, access: { has: (t) => "_displayValue" in t, get: (t) => t._displayValue, set: (t, s) => {
470
478
  t._displayValue = s;
471
- } }, metadata: e }, Y, Z), u(null, o = { value: d }, a, { kind: "class", name: d.name, metadata: e }, null, l), d = o.value, e && Object.defineProperty(d, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
472
- })(), r.role = E ? "listbox" : null, r.styles = Ee, r.events = {
479
+ } }, metadata: e }, K, j), p(null, a = { value: b }, i, { kind: "class", name: b.name, metadata: e }, null, r), b = a.value, e && Object.defineProperty(b, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
480
+ })(), o.role = k ? "listbox" : null, o.styles = ke, o.events = {
473
481
  change: "change",
474
482
  input: "input",
475
483
  displayvaluechange: "displayvaluechange",
@@ -477,7 +485,7 @@ let Oe = 0, Ne = (() => {
477
485
  open: "open",
478
486
  beforeclose: "beforeclose",
479
487
  close: "close"
480
- }, b(d, l), d;
488
+ }, l(b, r), b;
481
489
  })();
482
490
  export {
483
491
  Ne as SbbSelectElement