@sbb-esta/lyne-elements-dev 5.12.0-dev.1793097642 → 5.12.0-dev.1793108079

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,24 +1,68 @@
1
1
  import { __esDecorate, __runInitializers } from "tslib";
2
- import { MutationController } from "@lit-labs/observers/mutation-controller.js";
3
2
  import { ResizeController } from "@lit-labs/observers/resize-controller.js";
4
3
  import { html, isServer, nothing, unsafeCSS } from "lit";
5
4
  import { property, state } from "lit/decorators.js";
6
5
  import { ref } from "lit/directives/ref.js";
7
6
  import { until } from "lit/directives/until.js";
8
- import { SbbDisabledMixin, SbbEscapableOverlayController, SbbFormAssociatedMixin, SbbLanguageController, SbbNegativeMixin, SbbOpenCloseBaseElement, SbbPropertyWatcherController, SbbReadonlyMixin, SbbRequiredMixin, SbbUpdateSchedulerMixin, forceType, getNextElementIndex, getOverride, handleDistinctChange, i18nSelectionRequired, isEventOnElement, isNextjs, isSafari, isZeroAnimationDuration, popoverResetStyles, scrollbarStyles, setOrRemoveAttribute, setOverlayPosition } from "./core.js";
7
+ import { SbbDisabledMixin, SbbElement, SbbEscapableOverlayController, SbbFormAssociatedMixin, SbbLanguageController, SbbNegativeMixin, SbbOpenCloseBaseElement, SbbPropertyWatcherController, SbbReadonlyMixin, SbbRequiredMixin, SbbUpdateSchedulerMixin, forceType, getNextElementIndex, getOverride, handleDistinctChange, i18nMultipleSelectionPossible, i18nSelectionRequired, isEventOnElement, isNextjs, isZeroAnimationDuration, popoverResetStyles, scrollbarStyles, setOrRemoveAttribute, setOverlayPosition } from "./core.js";
9
8
  import { optionPanelStyles } from "./option.pure.js";
10
9
 
10
+ // src/elements/select/select-trigger.scss?inline
11
+ var select_trigger_default = ":host {\n display: block;\n width: 100% !important;\n height: var(--sbb-size-element-xs) !important;\n}\n\n:host(:is(:state(in-form-field),[state--in-form-field])) {\n top: 0;\n}\n";
12
+
13
+ // src/elements/select/select-trigger.component.ts
14
+ /**
15
+ * @internal
16
+ * Internal component used as the select trigger.
17
+ *
18
+ * A dedicated component is required to leverage ElementInternals to associate
19
+ * elements across Shadow DOM boundaries.
20
+ *
21
+ * @slot - Use the unnamed slot to add content
22
+ */
23
+ var SbbSelectTriggerElement = class extends SbbElement {
24
+ static {
25
+ this.elementName = "sbb-select-trigger";
26
+ }
27
+ static {
28
+ this.role = "combobox";
29
+ }
30
+ static {
31
+ this.styles = [unsafeCSS(select_trigger_default)];
32
+ }
33
+ set select(select) {
34
+ if (select === this._select) return;
35
+ if (this._selectPropertyWatcher) this.removeController(this._selectPropertyWatcher);
36
+ this.internals.ariaControlsElements = null;
37
+ this._select = select;
38
+ if (!this._select) return;
39
+ this._selectPropertyWatcher = new SbbPropertyWatcherController(this, () => this._select, { required: (s) => this.internals.ariaRequired = s.required ? `${s.required}` : null });
40
+ const overlay = this._select.shadowRoot.querySelector(".sbb-option-panel__overlay");
41
+ this.internals.ariaControlsElements = [overlay];
42
+ }
43
+ get select() {
44
+ return this._select;
45
+ }
46
+ constructor() {
47
+ super();
48
+ this._select = null;
49
+ this._selectPropertyWatcher = null;
50
+ this.internals.ariaExpanded = "false";
51
+ }
52
+ connectedCallback() {
53
+ super.connectedCallback();
54
+ this.toggleState("in-form-field", !!this.closest("sbb-form-field"));
55
+ }
56
+ render() {
57
+ return html`<slot></slot>`;
58
+ }
59
+ };
60
+
11
61
  // src/elements/select/select.scss?inline
12
62
  var select_default = ":host {\n --sbb-select-placeholder-fallback-color: var(--sbb-color-metal);\n --sbb-select-placeholder-fallback-color: light-dark(\n var(--sbb-color-metal),\n var(--sbb-color-smoke)\n );\n --sbb-options-panel-internal-z-index: var(\n --sbb-select-z-index,\n var(--sbb-overlay-default-z-index)\n );\n display: block;\n}\n\n:host([negative]) {\n --sbb-select-placeholder-fallback-color: var(--sbb-color-5);\n}\n\n.sbb-select__trigger {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n cursor: var(--sbb-cursor-default);\n height: calc(1em * var(--sbb-typo-line-height-text));\n}\n:host(:not(:is(:state(has-display-value),[state--has-display-value]))) .sbb-select__trigger {\n color: var(--sbb-select-placeholder-color, var(--sbb-select-placeholder-fallback-color));\n -webkit-text-fill-color: var(--sbb-select-placeholder-color, var(--sbb-select-placeholder-fallback-color));\n}\n";
13
63
 
14
64
  // src/elements/select/select.component.ts
15
65
  /**
16
- * On Safari, the aria role 'listbox' must be on the host element, or else VoiceOver won't work at all.
17
- * On the other hand, JAWS and NVDA need the role to be an "immediate parent" to the options, or else optgroups won't work.
18
- */
19
- const ariaRoleOnHost = isSafari;
20
- let nextId = 0;
21
- /**
22
66
  * It displays a panel with selectable options.
23
67
  *
24
68
  * @slot - Use the unnamed slot to add options.
@@ -184,9 +228,6 @@ let SbbSelectElement = (() => {
184
228
  static {
185
229
  this.elementName = "sbb-select";
186
230
  }
187
- static {
188
- this.role = ariaRoleOnHost ? "listbox" : null;
189
- }
190
231
  static {
191
232
  this.styles = [
192
233
  popoverResetStyles,
@@ -195,6 +236,9 @@ let SbbSelectElement = (() => {
195
236
  unsafeCSS(select_default)
196
237
  ];
197
238
  }
239
+ static {
240
+ this.elementDependencies = [SbbSelectTriggerElement];
241
+ }
198
242
  static {
199
243
  this.events = {
200
244
  change: "change",
@@ -206,6 +250,9 @@ let SbbSelectElement = (() => {
206
250
  close: "close"
207
251
  };
208
252
  }
253
+ static get observedAttributes() {
254
+ return super.observedAttributes.concat("aria-label", "aria-labelledby", "aria-describedby");
255
+ }
209
256
  #placeholder_accessor_storage;
210
257
  /** The placeholder used if no value has been selected. */
211
258
  get placeholder() {
@@ -311,15 +358,14 @@ let SbbSelectElement = (() => {
311
358
  })()
312
359
  }));
313
360
  this._originElement = null;
314
- this._triggerElement = null;
315
361
  this._escapableOverlayController = new SbbEscapableOverlayController(this);
316
- this._overlayId = `sbb-select-${++nextId}`;
317
362
  this._activeItemIndex = -1;
318
363
  this._searchString = "";
319
364
  this._didLoad = false;
320
365
  this._isPointerDownEventOnMenu = false;
321
366
  this._languageController = new SbbLanguageController(this);
322
367
  this._isValueManuallyAssigned = false;
368
+ this._restoreFocusOnClose = false;
323
369
  this._pointerDownListener = (event) => {
324
370
  this._isPointerDownEventOnMenu = isEventOnElement(this._overlay, event);
325
371
  };
@@ -330,28 +376,23 @@ let SbbSelectElement = (() => {
330
376
  this.addEventListener?.("optionLabelChanged", (e) => this._onOptionLabelChanged(e));
331
377
  /** Forces the sbb-select to update his value. */
332
378
  this.addEventListener?.("ɵoptionvaluechange", () => this._updateValueOptionState());
333
- this.addEventListener?.("ɵoptgroupslotchange", () => this._updateValueOptionState(), { capture: true });
379
+ this.addEventListener?.("ɵoptgroupslotchange", () => this._handleSlotchange(), { capture: true });
380
+ this.addEventListener?.("focusin", (e) => this._onFocusIn(e));
334
381
  this.addEventListener?.("click", (e) => {
335
382
  const target = e.target;
336
383
  if (target.localName === "sbb-option") {
337
- if (!this.multiple && !target.disabled) {
338
- this.close();
339
- this.focus();
340
- }
384
+ if (!this.multiple && !target.disabled) this._close(true);
341
385
  } else this._toggleOpening();
342
386
  });
343
- this.addController(new MutationController(this, {
344
- config: { attributeFilter: [
345
- "aria-labelledby",
346
- "aria-label",
347
- "aria-describedby"
348
- ] },
349
- callback: () => this._syncAriaLabels()
350
- }));
351
387
  this.addController(new SbbPropertyWatcherController(this, () => this.closest("sbb-form-field"), { negative: (e) => {
352
388
  this.negative = e.negative;
353
389
  this._syncNegative();
354
390
  } }));
391
+ this.addEventListener("keydown", (e) => this._onKeyDown(e));
392
+ }
393
+ attributeChangedCallback(name, _old, value) {
394
+ if (name === "aria-label" || name === "aria-labelledby" || name === "aria-describedby") this._syncAriaLabels();
395
+ else super.attributeChangedCallback(name, _old, value);
355
396
  }
356
397
  _syncAriaLabels() {
357
398
  if (!this._triggerElement || isServer) return;
@@ -365,6 +406,7 @@ let SbbSelectElement = (() => {
365
406
  if (this.state === "opening" || this.state === "opened" || !this._overlay || this.options.length === 0 || this.disabled || this.formDisabled || !this.dispatchBeforeOpenEvent()) return;
366
407
  this.shadowRoot?.querySelector("[popover]")?.showPopover?.();
367
408
  this.state = "opening";
409
+ if (this._triggerElement) this._triggerElement["internals"].ariaExpanded = "true";
368
410
  this.internals.states.add("expanded");
369
411
  this._setOverlayPosition();
370
412
  this._escapableOverlayController.connect();
@@ -373,7 +415,15 @@ let SbbSelectElement = (() => {
373
415
  }
374
416
  /** Closes the selection panel. */
375
417
  close() {
418
+ this._close();
419
+ }
420
+ /**
421
+ * @param restoreFocus Whether the focus should be returned to the trigger, even if it's not within the select
422
+ * (e.g. when an option was selected by assistive technologies without receiving focus).
423
+ */
424
+ _close(restoreFocus = false) {
376
425
  if (this.state === "closing" || this.state === "closed" || !this.dispatchBeforeCloseEvent()) return;
426
+ this._restoreFocusOnClose = restoreFocus;
377
427
  this.state = "closing";
378
428
  this.internals.states.delete("expanded");
379
429
  this._openPanelEventsController?.abort();
@@ -434,6 +484,10 @@ let SbbSelectElement = (() => {
434
484
  firstUpdated(changedProperties) {
435
485
  super.firstUpdated(changedProperties);
436
486
  this._updateValueOptionState();
487
+ if (this._triggerElement) {
488
+ this._syncAriaLabels();
489
+ this._triggerElement.select = this;
490
+ }
437
491
  if (!isNextjs()) {
438
492
  this.startUpdate();
439
493
  this._setupSelect();
@@ -459,7 +513,6 @@ let SbbSelectElement = (() => {
459
513
  }
460
514
  connectedCallback() {
461
515
  super.connectedCallback();
462
- if (ariaRoleOnHost) this.id ||= this._overlayId;
463
516
  this._syncNegative();
464
517
  this._syncAriaLabels();
465
518
  if (this._didLoad) {
@@ -543,7 +596,7 @@ let SbbSelectElement = (() => {
543
596
  if (this.parentElement && this._triggerElement) this.parentElement.insertBefore?.(this._triggerElement, this);
544
597
  }
545
598
  _setOverlayPosition() {
546
- if (!this._originElement) return;
599
+ if (!this._originElement || !this._overlay) return;
547
600
  setOverlayPosition(this._overlay, this._originElement, this._overlay, this.shadowRoot.querySelector(".sbb-option-panel__overlay-container"), this);
548
601
  }
549
602
  _onAnimationEnd(event) {
@@ -552,19 +605,31 @@ let SbbSelectElement = (() => {
552
605
  }
553
606
  _handleOpening() {
554
607
  this.state = "opened";
555
- this._triggerElement?.setAttribute("aria-expanded", "true");
556
608
  if (this._originElement) this._resizeObserver.observe(this._originElement);
557
609
  this.dispatchOpenEvent();
558
610
  }
559
611
  _handleClosing() {
612
+ const restoreFocus = this._restoreFocusOnClose || this._isFocusWithin();
613
+ this._restoreFocusOnClose = false;
560
614
  this.state = "closed";
561
615
  this.shadowRoot?.querySelector("[popover]")?.hidePopover?.();
562
- this._triggerElement?.setAttribute("aria-expanded", "false");
616
+ if (this._triggerElement) this._triggerElement["internals"].ariaExpanded = "false";
563
617
  this._resetActiveElement();
564
- this._overlay.scrollTop = 0;
618
+ if (restoreFocus) this.focus();
619
+ if (this._overlay) this._overlay.scrollTop = 0;
565
620
  this._escapableOverlayController.disconnect();
566
621
  this.dispatchCloseEvent();
567
622
  }
623
+ /**
624
+ * Whether the focus is still within the select (trigger, panel or an option).
625
+ * In this case (e.g. closing by selection or Escape), the focus should be restored to the trigger.
626
+ * If the focus is somewhere else (e.g. moved away by Tab, by clicking another control or an empty area,
627
+ * or the select was closed programmatically), the focus must not be moved.
628
+ */
629
+ _isFocusWithin() {
630
+ const activeElement = this.getRootNode().activeElement;
631
+ return !!activeElement && (activeElement === this._triggerElement || this.contains(activeElement));
632
+ }
568
633
  /** When an option is selected, updates the displayValue; it also closes the select if not `multiple`. */
569
634
  _onOptionSelected(option) {
570
635
  if (!this.multiple) this._value = option.value;
@@ -675,7 +740,10 @@ let SbbSelectElement = (() => {
675
740
  _selectByKeyboard() {
676
741
  const activeOption = this._selectableOptions()[this._activeItemIndex];
677
742
  if (this.multiple) activeOption?.["selectViaUserInteraction"](!activeOption.selected);
678
- else this.close();
743
+ else {
744
+ if (activeOption && !activeOption.selected) activeOption["selectViaUserInteraction"](true);
745
+ this.close();
746
+ }
679
747
  }
680
748
  _setNextActiveOption(event, index) {
681
749
  const filteredOptions = this._selectableOptions();
@@ -683,26 +751,35 @@ let SbbSelectElement = (() => {
683
751
  const nextIndex = index ?? getNextElementIndex(event, this._activeItemIndex, filteredOptions.length);
684
752
  const nextOption = filteredOptions[nextIndex];
685
753
  const activeOption = filteredOptions[this._activeItemIndex];
754
+ this._activeItemIndex = nextIndex;
686
755
  this._setActiveElement(nextOption, activeOption);
687
- if (!this.multiple) this._setSelectedElement(nextOption, activeOption);
756
+ if (!this.multiple) nextOption["selectViaUserInteraction"](true);
688
757
  else if (event?.shiftKey) nextOption["selectViaUserInteraction"](!nextOption.selected);
689
- this._activeItemIndex = nextIndex;
690
758
  }
691
- _setActiveElement(nextActiveOption, lastActiveOption = null, setActiveDescendant = true) {
692
- nextActiveOption.setActive(true);
759
+ _setActiveElement(nextActiveOption, lastActiveOption = null) {
760
+ nextActiveOption.focus({ preventScroll: true });
693
761
  nextActiveOption.scrollIntoView({ block: "nearest" });
694
- if (setActiveDescendant) this._triggerElement.ariaActiveDescendantElement = nextActiveOption;
695
- if (lastActiveOption && !this.compareWith(lastActiveOption.value, nextActiveOption.value)) lastActiveOption.setActive(false);
762
+ nextActiveOption.setActive(true);
763
+ if (lastActiveOption && lastActiveOption !== nextActiveOption) lastActiveOption.setActive(false);
696
764
  }
697
- _setSelectedElement(nextActiveOption, lastActiveOption) {
698
- nextActiveOption["selectViaUserInteraction"](true);
699
- if (lastActiveOption && !this.compareWith(lastActiveOption.value, nextActiveOption.value)) lastActiveOption["selectViaUserInteraction"](false);
765
+ /**
766
+ * Synchronizes the active index when an option receives focus (e.g. by pointer).
767
+ * Moving the focus must never change the selection.
768
+ */
769
+ _onFocusIn(event) {
770
+ const target = event.target;
771
+ if (target?.localName !== "sbb-option") return;
772
+ const selectableOptions = this._selectableOptions();
773
+ const focusedOption = target;
774
+ const index = selectableOptions.indexOf(focusedOption);
775
+ if (index === -1) return;
776
+ this._activeItemIndex = index;
777
+ selectableOptions.forEach((option) => option.setActive(false));
700
778
  }
701
779
  _resetActiveElement() {
702
780
  const activeElement = this._selectableOptions()[this._activeItemIndex];
703
781
  if (activeElement) activeElement.setActive(false);
704
782
  this._activeItemIndex = -1;
705
- if (this._triggerElement) this._triggerElement.ariaActiveDescendantElement = null;
706
783
  }
707
784
  _updateOptionsFromValue() {
708
785
  const value = Array.isArray(this.value) ? this.value : [this.value];
@@ -731,6 +808,10 @@ let SbbSelectElement = (() => {
731
808
  }
732
809
  this._updateDisplayValue();
733
810
  }
811
+ _handleSlotchange() {
812
+ this.options.forEach((o) => o.tabIndex = -1);
813
+ this._updateValueOptionState();
814
+ }
734
815
  _updateValueOptionState() {
735
816
  if (this._isValueManuallyAssigned) this._updateOptionsFromValue();
736
817
  else this._updateValueFromOptions();
@@ -741,14 +822,15 @@ let SbbSelectElement = (() => {
741
822
  }
742
823
  _toggleOpening() {
743
824
  if (this.disabled || this.formDisabled || this.readOnly) return;
744
- this._triggerElement?.focus();
745
825
  switch (this.state) {
746
826
  case "opening":
747
827
  case "opened":
748
828
  this.close();
749
829
  break;
750
830
  case "closing":
751
- case "closed": this.open();
831
+ case "closed":
832
+ this.focus();
833
+ this.open();
752
834
  }
753
835
  }
754
836
  _spreadDeferredDisplayValue(placeholder) {
@@ -759,41 +841,33 @@ let SbbSelectElement = (() => {
759
841
  return this._displayValue ? html`${this._displayValue}` : placeholder;
760
842
  }
761
843
  render() {
844
+ const displayValue = until(...this._spreadDeferredDisplayValue(html`${this.placeholder}`));
762
845
  return html`
763
846
  <!-- This element is visually hidden and will be appended to the light DOM to allow screen
764
847
  readers to work properly -->
765
- <div
766
- class="sbb-screen-reader-only sbb-select-trigger"
848
+ <sbb-select-trigger
849
+ class="sbb-screen-reader-only"
767
850
  tabindex=${this.disabled || this.formDisabled ? nothing : "0"}
768
- role="combobox"
769
- aria-haspopup="listbox"
770
- aria-expanded="false"
771
- aria-required=${this.required.toString()}
772
- aria-controls=${this._overlayId}
773
- aria-owns=${this._overlayId}
774
851
  @keydown=${this._onKeyDown}
775
852
  @click=${this._toggleOpening}
776
853
  ${ref((ref) => this._triggerElement = ref)}
777
854
  >
778
- ${until(...this._spreadDeferredDisplayValue(html`${this.placeholder}`))}
779
- </div>
855
+ ${displayValue}${this.multiple && !this.disabled && !this.readOnly ? html`<p>${i18nMultipleSelectionPossible[this._languageController.current]}</p>` : nothing}
856
+ </sbb-select-trigger>
780
857
 
781
858
  <!-- Visually display the value -->
782
- <div class="sbb-select__trigger" aria-hidden="true">
783
- ${until(...this._spreadDeferredDisplayValue(html`${this.placeholder}`))}
784
- </div>
859
+ <div class="sbb-select__trigger" aria-hidden="true">${displayValue}</div>
785
860
 
786
861
  <div class="sbb-option-panel__overlay-container sbb-popover-reset" popover="manual">
787
862
  <div
788
863
  class="sbb-option-panel__overlay ${this.negative ? "sbb-scrollbar-negative" : "sbb-scrollbar"}"
789
- id=${!ariaRoleOnHost ? this._overlayId : nothing}
790
- role=${!ariaRoleOnHost ? "listbox" : nothing}
791
- ?aria-multiselectable=${this.multiple}
864
+ role="listbox"
865
+ aria-multiselectable=${this.multiple ? "true" : nothing}
792
866
  tabindex="-1"
793
867
  @animationend=${this._onAnimationEnd}
794
868
  ${ref((dialogRef) => this._overlay = dialogRef)}
795
869
  >
796
- <slot @slotchange=${this._updateValueOptionState}></slot>
870
+ <slot @slotchange=${this._handleSlotchange}></slot>
797
871
  </div>
798
872
  </div>
799
873
  `;
@@ -801,4 +875,4 @@ let SbbSelectElement = (() => {
801
875
  };
802
876
  })();
803
877
 
804
- export { SbbSelectElement };
878
+ export { SbbSelectElement, SbbSelectTriggerElement };
package/index.d.ts CHANGED
@@ -50,7 +50,7 @@ import { SbbPopoverCloseButtonElement, SbbPopoverElement } from "./popover.js";
50
50
  import { SbbRadioButtonElement } from "./radio-button.js";
51
51
  import { SbbRadioButtonGroupElement } from "./radio-button-group.js";
52
52
  import { SbbRadioButtonPanelElement } from "./radio-button-panel.js";
53
- import { SbbSelectElement } from "./select.js";
53
+ import { SbbSelectElement, SbbSelectTriggerElement } from "./select.js";
54
54
  import { SbbSelectionActionPanelElement } from "./selection-action-panel.js";
55
55
  import { SbbSelectionExpansionPanelElement } from "./selection-expansion-panel.js";
56
56
  import { SbbSidebarCloseButtonElement, SbbSidebarContainerElement, SbbSidebarContentElement, SbbSidebarElement, SbbSidebarTitleElement } from "./sidebar.js";
@@ -204,6 +204,7 @@ declare global {
204
204
  var SbbSecondaryButtonLinkElement: SbbSecondaryButtonLinkElement;
205
205
  var SbbSecondaryButtonStaticElement: SbbSecondaryButtonStaticElement;
206
206
  var SbbSelectElement: SbbSelectElement;
207
+ var SbbSelectTriggerElement: SbbSelectTriggerElement;
207
208
  var SbbSelectionActionPanelElement: SbbSelectionActionPanelElement;
208
209
  var SbbSelectionExpansionPanelElement: SbbSelectionExpansionPanelElement;
209
210
  var SbbSidebarCloseButtonElement: SbbSidebarCloseButtonElement;
package/index.js CHANGED
@@ -50,7 +50,7 @@ import { SbbPopoverCloseButtonElement, SbbPopoverElement } from "./popover.js";
50
50
  import { SbbRadioButtonElement } from "./radio-button.js";
51
51
  import { SbbRadioButtonGroupElement } from "./radio-button-group.js";
52
52
  import { SbbRadioButtonPanelElement } from "./radio-button-panel.js";
53
- import { SbbSelectElement } from "./select.js";
53
+ import { SbbSelectElement, SbbSelectTriggerElement } from "./select.js";
54
54
  import { SbbSelectionActionPanelElement } from "./selection-action-panel.js";
55
55
  import { SbbSelectionExpansionPanelElement } from "./selection-expansion-panel.js";
56
56
  import { SbbSidebarCloseButtonElement, SbbSidebarContainerElement, SbbSidebarContentElement, SbbSidebarElement, SbbSidebarTitleElement } from "./sidebar.js";
@@ -204,6 +204,7 @@ globalThis.SbbSecondaryButtonElement = SbbSecondaryButtonElement;
204
204
  globalThis.SbbSecondaryButtonLinkElement = SbbSecondaryButtonLinkElement;
205
205
  globalThis.SbbSecondaryButtonStaticElement = SbbSecondaryButtonStaticElement;
206
206
  globalThis.SbbSelectElement = SbbSelectElement;
207
+ globalThis.SbbSelectTriggerElement = SbbSelectTriggerElement;
207
208
  globalThis.SbbSelectionActionPanelElement = SbbSelectionActionPanelElement;
208
209
  globalThis.SbbSelectionExpansionPanelElement = SbbSelectionExpansionPanelElement;
209
210
  globalThis.SbbSidebarCloseButtonElement = SbbSidebarCloseButtonElement;
@@ -3364,14 +3364,6 @@ sbb-message > [slot=image] :is(sbb-image, img):not(.sbb-figure-overlap-image) {
3364
3364
  --sbb-option-white-space: nowrap;
3365
3365
  }
3366
3366
 
3367
- .sbb-select-trigger {
3368
- width: 100%;
3369
- height: var(--sbb-size-element-xs);
3370
- }
3371
- sbb-form-field .sbb-select-trigger {
3372
- top: 0;
3373
- }
3374
-
3375
3367
  sbb-sidebar:has(sbb-sidebar-title) {
3376
3368
  --_sbb-sidebar-padding-block-start: 0;
3377
3369
  }
@@ -3384,14 +3384,6 @@ sbb-message > [slot=image] :is(sbb-image, img):not(.sbb-figure-overlap-image) {
3384
3384
  --sbb-option-white-space: nowrap;
3385
3385
  }
3386
3386
 
3387
- .sbb-select-trigger {
3388
- width: 100%;
3389
- height: var(--sbb-size-element-xs);
3390
- }
3391
- sbb-form-field .sbb-select-trigger {
3392
- top: 0;
3393
- }
3394
-
3395
3387
  sbb-sidebar:has(sbb-sidebar-title) {
3396
3388
  --_sbb-sidebar-padding-block-start: 0;
3397
3389
  }
package/lean-theme.css CHANGED
@@ -3384,14 +3384,6 @@ sbb-message > [slot=image] :is(sbb-image, img):not(.sbb-figure-overlap-image) {
3384
3384
  --sbb-option-white-space: nowrap;
3385
3385
  }
3386
3386
 
3387
- .sbb-select-trigger {
3388
- width: 100%;
3389
- height: var(--sbb-size-element-xs);
3390
- }
3391
- sbb-form-field .sbb-select-trigger {
3392
- top: 0;
3393
- }
3394
-
3395
3387
  sbb-sidebar:has(sbb-sidebar-title) {
3396
3388
  --_sbb-sidebar-padding-block-start: 0;
3397
3389
  }
@@ -3364,14 +3364,6 @@ sbb-message > [slot=image] :is(sbb-image, img):not(.sbb-figure-overlap-image) {
3364
3364
  --sbb-option-white-space: nowrap;
3365
3365
  }
3366
3366
 
3367
- .sbb-select-trigger {
3368
- width: 100%;
3369
- height: var(--sbb-size-element-xs);
3370
- }
3371
- sbb-form-field .sbb-select-trigger {
3372
- top: 0;
3373
- }
3374
-
3375
3367
  sbb-sidebar:has(sbb-sidebar-title) {
3376
3368
  --_sbb-sidebar-padding-block-start: 0;
3377
3369
  }
package/option.pure.js CHANGED
@@ -14,7 +14,7 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{html as n,not
14
14
  <slot></slot>
15
15
  </span>
16
16
  `}};const E=i(`:host{--sbb-options-panel-position-x:0;--sbb-options-panel-position-y:0;--sbb-options-pointer-events:all;--_sbb-options-panel-max-height:min(var(--sbb-options-panel-max-height-calculated), var(--sbb-options-panel-max-height,100000em));--sbb-options-panel-min-height:1em;--sbb-options-panel-animation-duration:var(--sbb-disable-animation-duration,var(--sbb-animation-duration-4x));--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));font-weight:400}:host([negative]){--sbb-options-panel-box-shadow:var(--sbb-box-shadow-level-9-hard-negative);--sbb-options-panel-background-color:var(--sbb-background-color-2-negative);--sbb-focus-outline-color:var(--sbb-focus-outline-color-dark)}:host(:not(:is(:state(state-opening),[state--state-opening]),:is(:state(state-opened),[state--state-opened]),:is(:state(state-closing),[state--state-closing]))),:host(:is(:state(state-closed),[state--state-closed])){--sbb-options-panel-visibility:hidden;--sbb-options-pointer-events:none}:host(:is(:state(state-opening),[state--state-opening])){--sbb-options-panel-animation-name:open}:host(:is(:state(state-closing),[state--state-closing])){--sbb-options-panel-animation-name:close}:host(:is(:state(options-panel-position-below),[state--options-panel-position-below])){--sbb-options-panel-animation-translate:var(--sbb-spacing-fixed-2x)}:host(:is(:state(options-panel-position-above),[state--options-panel-position-above])){--sbb-options-panel-animation-translate:calc(-1 * var(--sbb-spacing-fixed-2x));--_sbb-options-panel-offset:calc(-1 * var(--sbb-options-panel-offset))}:host([preserve-icon-space]){--sbb-option-icon-container-display:block}::slotted(sbb-divider){margin-block:var(--sbb-options-panel-divider-margin-block)}.sbb-option-panel__overlay-container{pointer-events:none;z-index:var(--sbb-options-panel-internal-z-index);position:fixed;inset:0}.sbb-option-panel__overlay-container:after{content:"";top:var(--sbb-options-panel-origin-position-y);left:var(--sbb-options-panel-origin-position-x);width:var(--sbb-options-panel-width);height:var(--sbb-options-panel-origin-height);border-radius:var(--sbb-options-panel-border-radius);transition:box-shadow var(--sbb-options-panel-animation-duration) var(--sbb-options-panel-animation-timing-function);background-color:#0000;display:block;position:absolute}:host(:is(:is(:state(state-opened),[state--state-opened]),:is(:state(state-opening),[state--state-opening])):is(:state(option-panel-origin-borderless),[state--option-panel-origin-borderless])) .sbb-option-panel__overlay-container:after{box-shadow:var(--sbb-options-panel-box-shadow)}.sbb-option-panel__overlay{visibility:var(--sbb-options-panel-visibility,visible);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,fit-content);transition:box-shadow var(--sbb-options-panel-animation-duration) var(--sbb-options-panel-animation-timing-function);box-shadow:var(--sbb-options-panel-box-shadow);background-color:var(--sbb-options-panel-background-color);padding-block:var(--sbb-options-panel-padding-block);max-height:var(--_sbb-options-panel-max-height);min-height:var(--sbb-options-panel-min-height);pointer-events:var(--sbb-options-pointer-events);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);border:none;margin-block-start:var(--_sbb-options-panel-offset,var(--sbb-options-panel-offset));padding-inline:0;display:block;position:absolute;overflow:hidden auto}@media (forced-colors:active){.sbb-option-panel__overlay{border:var(--sbb-border-width-1x) solid CanvasText}}@keyframes open{0%{translate:0 var(--sbb-options-panel-animation-translate);opacity:0}to{opacity:1;translate:0}}@keyframes close{0%{opacity:1;translate:0}to{translate:0 var(--sbb-options-panel-animation-translate);opacity:0}}
17
- `),D=m,O={childList:!0,subtree:!0,characterData:!0};let k=(()=>{let i=s(v(c)),l=[],d,m,y,b=[],x=[],S,C=[],w=[],T,E=[],k=[],A,j=[],M=[],N,P=[],F=[],I,L=[],R=[];return class extends i{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;d=[a()],m=[a({type:Boolean})],y=[o()],S=[o()],T=[o()],A=[o()],N=[o()],I=[o()],e(this,null,d,{kind:`setter`,name:`value`,static:!1,private:!1,access:{has:e=>`value`in e,set:(e,t)=>{e.value=t}},metadata:t},null,l),e(this,null,m,{kind:`setter`,name:`selected`,static:!1,private:!1,access:{has:e=>`selected`in e,set:(e,t)=>{e.selected=t}},metadata:t},null,l),e(this,null,y,{kind:`accessor`,name:`disabledFromGroup`,static:!1,private:!1,access:{has:e=>`disabledFromGroup`in e,get:e=>e.disabledFromGroup,set:(e,t)=>{e.disabledFromGroup=t}},metadata:t},b,x),e(this,null,S,{kind:`accessor`,name:`groupLabel`,static:!1,private:!1,access:{has:e=>`groupLabel`in e,get:e=>e.groupLabel,set:(e,t)=>{e.groupLabel=t}},metadata:t},C,w),e(this,null,T,{kind:`accessor`,name:`label`,static:!1,private:!1,access:{has:e=>`label`in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:t},E,k),e(this,null,A,{kind:`accessor`,name:`disableLabelHighlight`,static:!1,private:!1,access:{has:e=>`disableLabelHighlight`in e,get:e=>e.disableLabelHighlight,set:(e,t)=>{e.disableLabelHighlight=t}},metadata:t},j,M),e(this,null,N,{kind:`accessor`,name:`_highlightString`,static:!1,private:!1,access:{has:e=>`_highlightString`in e,get:e=>e._highlightString,set:(e,t)=>{e._highlightString=t}},metadata:t},P,F),e(this,null,I,{kind:`accessor`,name:`_inertAriaGroups`,static:!1,private:!1,access:{has:e=>`_inertAriaGroups`in e,get:e=>e._inertAriaGroups,set:(e,t)=>{e._inertAriaGroups=t}},metadata:t},L,R),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.events={optionselected:`optionselected`}}static{this.styles=[h]}set value(e){typeof e==`string`?(this.setAttribute(`value`,`${e}`),this._value=null):this._value=e,this.dispatchEvent(new Event(`ɵoptionvaluechange`,{bubbles:!0}))}get value(){return this._value??this.getAttribute(`value`)}set selected(e){this.toggleAttribute(`selected`,e),this._updateAriaSelected()}get selected(){return this.hasAttribute(`selected`)}#e;get disabledFromGroup(){return this.#e}set disabledFromGroup(e){this.#e=e}#t;get groupLabel(){return this.#t}set groupLabel(e){this.#t=e}#n;get label(){return this.#n}set label(e){this.#n=e}#r;get disableLabelHighlight(){return this.#r}set disableLabelHighlight(e){this.#r=e}#i;get _highlightString(){return this.#i}set _highlightString(e){this.#i=e}#a;get _inertAriaGroups(){return this.#a}set _inertAriaGroups(e){this.#a=e}constructor(){super(),this._value=(t(this,l),null),this.#e=t(this,b,!1),this.#t=(t(this,x),t(this,C,``)),this.#n=(t(this,w),t(this,E,void 0)),this.#r=(t(this,k),t(this,j,!1)),this.#i=(t(this,M),t(this,P,null)),this.#a=(t(this,F),t(this,L,!1)),this._previousSize=(t(this,R),null),this.addEventListener?.(`click`,e=>this.selectByClick(e),{passive:!0}),this.addController(new _(this,{config:O,callback:()=>{this.handleHighlightState(),this.dispatchEvent(new Event(`optionLabelChanged`,{bubbles:!0}))}})),this.addController(new u(this,()=>this.closest(`sbb-autocomplete, sbb-autocomplete-grid`),{negative:e=>this.toggleState(`negative`,e.negative)})),this.addController(new u(this,()=>this.closest(`sbb-autocomplete, sbb-autocomplete-grid, sbb-select`),{size:e=>{this._previousSize&&this.internals.states.delete(`size-${this._previousSize}`),this._previousSize=e.size,this._previousSize&&this.internals.states.add(`size-${this._previousSize}`)}})),D&&(this.hydrationRequired?this.hydrationComplete.then(()=>this._inertAriaGroups=D):this._inertAriaGroups=D)}attributeChangedCallback(e,t,n){(e!==`value`||t!==n)&&super.attributeChangedCallback(e,t,n)}highlight(e){this._highlightString=e}selectViaUserInteraction(e){this.selected=e,this.selected&&this.dispatchEvent(new Event(`optionselected`,{bubbles:!0,composed:!0}))}requestUpdate(e,t,n){super.requestUpdate(e,t,n),(e===`disabled`||e===`disabledFromGroup`)&&(this.toggleState(`disabled`,this.disabled||this.disabledFromGroup),g(this,`tabindex`,f&&!this.disabled&&!this.disabledFromGroup?0:null),this.updateAriaDisabled())}firstUpdated(e){super.firstUpdated(e),this._updateAriaSelected()}updateDisableHighlight(e){this.disableLabelHighlight=e,this.toggleState(`disable-highlight`,e)}setActive(e){this.toggleState(`active`,e)}updateAriaDisabled(){this.internals.ariaDisabled=this.disabled||this.disabledFromGroup?`true`:null,this.dispatchEvent(new Event(`ɵdisabledchange`,{bubbles:!0}))}_updateAriaSelected(){this.internals.ariaSelected=`${this.selected}`}handleHighlightState(){let e=Array.from(this.childNodes??[]).filter(e=>e.nodeType!==Node.COMMENT_NODE&&(!(e instanceof Element)||e.slot!==`icon`)),t=e.filter(e=>e.nodeType===Node.TEXT_NODE);t.length===0||e.filter(e=>!(e instanceof Element)||e.localName!==`template`).length!==t.length?this.updateDisableHighlight(!0):this.label=t.map(e=>e.wholeText).filter(e=>e.trim()).join(``)}getHighlightedLabel(){if(!this._highlightString||!this._highlightString.trim())return n`${this.label}`;let e=this.label.toLowerCase().indexOf(this._highlightString.toLowerCase());if(e===-1)return n`${this.label}`;let t=this.label.substring(0,e),r=this.label.substring(e,e+this._highlightString.length),i=this.label.substring(e+this._highlightString.length);return n`
17
+ `),D=m,O={childList:!0,subtree:!0,characterData:!0};let k=(()=>{let i=s(v(c)),l=[],d,m,y,b=[],x=[],S,C=[],w=[],T,E=[],k=[],A,j=[],M=[],N,P=[],F=[],I,L=[],R=[];return class extends i{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;d=[a()],m=[a({type:Boolean})],y=[o()],S=[o()],T=[o()],A=[o()],N=[o()],I=[o()],e(this,null,d,{kind:`setter`,name:`value`,static:!1,private:!1,access:{has:e=>`value`in e,set:(e,t)=>{e.value=t}},metadata:t},null,l),e(this,null,m,{kind:`setter`,name:`selected`,static:!1,private:!1,access:{has:e=>`selected`in e,set:(e,t)=>{e.selected=t}},metadata:t},null,l),e(this,null,y,{kind:`accessor`,name:`disabledFromGroup`,static:!1,private:!1,access:{has:e=>`disabledFromGroup`in e,get:e=>e.disabledFromGroup,set:(e,t)=>{e.disabledFromGroup=t}},metadata:t},b,x),e(this,null,S,{kind:`accessor`,name:`groupLabel`,static:!1,private:!1,access:{has:e=>`groupLabel`in e,get:e=>e.groupLabel,set:(e,t)=>{e.groupLabel=t}},metadata:t},C,w),e(this,null,T,{kind:`accessor`,name:`label`,static:!1,private:!1,access:{has:e=>`label`in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:t},E,k),e(this,null,A,{kind:`accessor`,name:`disableLabelHighlight`,static:!1,private:!1,access:{has:e=>`disableLabelHighlight`in e,get:e=>e.disableLabelHighlight,set:(e,t)=>{e.disableLabelHighlight=t}},metadata:t},j,M),e(this,null,N,{kind:`accessor`,name:`_highlightString`,static:!1,private:!1,access:{has:e=>`_highlightString`in e,get:e=>e._highlightString,set:(e,t)=>{e._highlightString=t}},metadata:t},P,F),e(this,null,I,{kind:`accessor`,name:`_inertAriaGroups`,static:!1,private:!1,access:{has:e=>`_inertAriaGroups`in e,get:e=>e._inertAriaGroups,set:(e,t)=>{e._inertAriaGroups=t}},metadata:t},L,R),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.events={optionselected:`optionselected`}}static{this.styles=[h]}set value(e){typeof e==`string`?(this.setAttribute(`value`,`${e}`),this._value=null):this._value=e,this.dispatchEvent(new Event(`ɵoptionvaluechange`,{bubbles:!0}))}get value(){return this._value??this.getAttribute(`value`)}set selected(e){this.toggleAttribute(`selected`,e),this._updateAriaSelected()}get selected(){return this.hasAttribute(`selected`)}#e;get disabledFromGroup(){return this.#e}set disabledFromGroup(e){this.#e=e}#t;get groupLabel(){return this.#t}set groupLabel(e){this.#t=e}#n;get label(){return this.#n}set label(e){this.#n=e}#r;get disableLabelHighlight(){return this.#r}set disableLabelHighlight(e){this.#r=e}#i;get _highlightString(){return this.#i}set _highlightString(e){this.#i=e}#a;get _inertAriaGroups(){return this.#a}set _inertAriaGroups(e){this.#a=e}constructor(){super(),this._value=(t(this,l),null),this.#e=t(this,b,!1),this.#t=(t(this,x),t(this,C,``)),this.#n=(t(this,w),t(this,E,void 0)),this.#r=(t(this,k),t(this,j,!1)),this.#i=(t(this,M),t(this,P,null)),this.#a=(t(this,F),t(this,L,!1)),this._previousSize=(t(this,R),null),this.addEventListener?.(`click`,e=>this.selectByClick(e),{passive:!0}),this.addController(new _(this,{config:O,callback:()=>{this.handleHighlightState(),this.dispatchEvent(new Event(`optionLabelChanged`,{bubbles:!0}))}})),this.addController(new u(this,()=>this.closest(`sbb-autocomplete, sbb-autocomplete-grid`),{negative:e=>this.toggleState(`negative`,e.negative)})),this.addController(new u(this,()=>this.closest(`sbb-autocomplete, sbb-autocomplete-grid, sbb-select`),{size:e=>{this._previousSize&&this.internals.states.delete(`size-${this._previousSize}`),this._previousSize=e.size,this._previousSize&&this.internals.states.add(`size-${this._previousSize}`)}})),D&&(this.hydrationRequired?this.hydrationComplete.then(()=>this._inertAriaGroups=D):this._inertAriaGroups=D)}attributeChangedCallback(e,t,n){(e!==`value`||t!==n)&&super.attributeChangedCallback(e,t,n)}highlight(e){this._highlightString=e}selectViaUserInteraction(e){this.selected=e,this.selected&&this.dispatchEvent(new Event(`optionselected`,{bubbles:!0,composed:!0}))}requestUpdate(e,t,n){super.requestUpdate(e,t,n),(e===`disabled`||e===`disabledFromGroup`)&&(this.toggleState(`disabled`,this.disabled||this.disabledFromGroup),this.closest?.(`sbb-select`)||g(this,`tabindex`,f&&!this.disabled&&!this.disabledFromGroup?0:null),this.updateAriaDisabled())}firstUpdated(e){super.firstUpdated(e),this._updateAriaSelected()}updateDisableHighlight(e){this.disableLabelHighlight=e,this.toggleState(`disable-highlight`,e)}setActive(e){this.toggleState(`active`,e)}updateAriaDisabled(){this.internals.ariaDisabled=this.disabled||this.disabledFromGroup?`true`:null,this.dispatchEvent(new Event(`ɵdisabledchange`,{bubbles:!0}))}_updateAriaSelected(){this.internals.ariaSelected=`${this.selected}`}handleHighlightState(){let e=Array.from(this.childNodes??[]).filter(e=>e.nodeType!==Node.COMMENT_NODE&&(!(e instanceof Element)||e.slot!==`icon`)),t=e.filter(e=>e.nodeType===Node.TEXT_NODE);t.length===0||e.filter(e=>!(e instanceof Element)||e.localName!==`template`).length!==t.length?this.updateDisableHighlight(!0):this.label=t.map(e=>e.wholeText).filter(e=>e.trim()).join(``)}getHighlightedLabel(){if(!this._highlightString||!this._highlightString.trim())return n`${this.label}`;let e=this.label.toLowerCase().indexOf(this._highlightString.toLowerCase());if(e===-1)return n`${this.label}`;let t=this.label.substring(0,e),r=this.label.substring(e,e+this._highlightString.length),i=this.label.substring(e+this._highlightString.length);return n`
18
18
  <span class="sbb-option__label--highlight">${t}</span><span>${r}</span
19
19
  ><span class="sbb-option__label--highlight">${i}</span>
20
20
  `}renderIcon(){return n`<span class="sbb-option__icon"> ${this.renderIconSlot()} </span>`}renderLabel(){return this.label&&!this.disableLabelHighlight?this.getHighlightedLabel():r}renderTick(){return r}render(){return n`
@@ -31,7 +31,7 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{html as n,not
31
31
  </span>
32
32
  ${this.renderTick()}
33
33
  </div>
34
- `}}})();var A=`:host{--sbb-focus-outline-offset:var(--sbb-option-focus-outline-offset);background-color:var(--sbb-option-background-color);font-size:var(--sbb-option-font-size);letter-spacing:var(--sbb-letter-spacing-text);display:block}:host(:is(:state(negative),[state--negative])){--sbb-option-color:var(--sbb-color-3-negative);--sbb-option-icon-color:var(--sbb-color-5);--sbb-option-background-color-hover:var(--sbb-color-midnight);--sbb-option-background-color-active:var(--sbb-background-color-4-negative);--sbb-option-disabled-border-color:var(--sbb-border-color-5);--sbb-option-disabled-background-color:var(--sbb-background-color-3-negative);--sbb-focus-outline-color:var(--sbb-focus-outline-color-dark)}:host(:is(:state(size-s),[state--size-s])){--sbb-option-min-height:var(--sbb-size-element-xxs);--sbb-option-focus-outline-offset:calc(-1 * var(--sbb-spacing-fixed-1x));--sbb-option-focus-outline-inset:0 var(--sbb-spacing-fixed-1x)}:host(:is(:state(size-m),[state--size-m])){--sbb-option-min-height:var(--sbb-size-element-s);--sbb-option-focus-outline-offset:inherit;--sbb-option-focus-outline-inset:var(--sbb-spacing-fixed-1x)}@media (any-hover:hover){:host(:hover:not(:is(:state(disabled),[state--disabled]))){--sbb-option-background-color:var(--sbb-option-background-color-hover)}}:host(:active:not(:is(:state(disabled),[state--disabled]))){--sbb-option-background-color:var(--sbb-option-background-color-active)}:host(:not(:is(:state(disable-highlight),[state--disable-highlight]))) .sbb-option__label slot{display:none}:host(:is(:state(disabled),[state--disabled])){--sbb-option-cursor:var(--sbb-cursor-default)}@media (forced-colors:active){:host(:is(:state(disabled),[state--disabled])){--sbb-option-color:GrayText}}:host(:is(:state(variant-select),[state--variant-select])){--sbb-option-column-gap:var(--sbb-spacing-fixed-2x);--sbb-option-justify-content:space-between}:host(:is(:state(variant-select),[state--variant-select]):is(:state(multiple),[state--multiple])){--sbb-option-justify-content:start}:host(:is(:state(active),[state--active])){--sbb-option-focus-outline-display:block}:host(:not(:is(:state(disabled),[state--disabled]))) .sbb-option__label--highlight{font-weight:700}@media (forced-colors:active){:host(:not(:is(:state(disabled),[state--disabled]))) .sbb-option__label--highlight{color:highlight}}.sbb-option{min-height:var(--sbb-option-min-height);align-items:center;column-gap:var(--sbb-option-column-gap);padding-inline:var(--sbb-option-padding-inline);justify-content:var(--sbb-option-justify-content);color:var(--sbb-option-color);cursor:var(--sbb-option-cursor);-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:var(--sbb-option-color);display:flex;position:relative}.sbb-option:after{content:"";display:var(--sbb-option-focus-outline-display,none);inset:var(--sbb-option-focus-outline-inset);pointer-events:none;border:var(--sbb-focus-outline-width) solid var(--sbb-focus-outline-color);border-radius:var(--sbb-option-border-radius);position:absolute}:host(:is(:state(disabled),[state--disabled]):not(:is(:state(multiple),[state--multiple]))) .sbb-option{z-index:0;position:relative}:host(:is(:state(disabled),[state--disabled]):not(:is(:state(multiple),[state--multiple]))) .sbb-option:before{content:"";display:var(--sbb-option-disabled-display,block);inset:var(--sbb-option-disabled-inset);border:var(--sbb-border-width-1x) dashed var(--sbb-option-disabled-border-color);border-radius:var(--sbb-option-disabled-border-radius);background-color:var(--sbb-option-disabled-background-color);z-index:-1;position:absolute}@media (forced-colors:active){:host(:is(:state(disabled),[state--disabled]):not(:is(:state(multiple),[state--multiple]))) .sbb-option:before{border-color:graytext}}.sbb-option__icon{min-width:var(--sbb-size-icon-ui-small);min-height:var(--sbb-size-icon-ui-small);color:var(--sbb-option-icon-color);display:flex}:host(:not(:is(:state(slotted-icon),[state--slotted-icon]),:is(:state(has-icon-name),[state--has-icon-name]))) .sbb-option__icon{display:var(--sbb-option-icon-container-display,none)}.sbb-option__label{text-overflow:var(--sbb-option-text-overflow);overflow:var(--sbb-option-overflow);white-space:var(--sbb-option-white-space,initial)}
34
+ `}}})();var A=`:host{--sbb-focus-outline-offset:var(--sbb-option-focus-outline-offset);background-color:var(--sbb-option-background-color);font-size:var(--sbb-option-font-size);letter-spacing:var(--sbb-letter-spacing-text);display:block;outline:none!important}:host(:is(:state(negative),[state--negative])){--sbb-option-color:var(--sbb-color-3-negative);--sbb-option-icon-color:var(--sbb-color-5);--sbb-option-background-color-hover:var(--sbb-color-midnight);--sbb-option-background-color-active:var(--sbb-background-color-4-negative);--sbb-option-disabled-border-color:var(--sbb-border-color-5);--sbb-option-disabled-background-color:var(--sbb-background-color-3-negative);--sbb-focus-outline-color:var(--sbb-focus-outline-color-dark)}:host(:is(:state(size-s),[state--size-s])){--sbb-option-min-height:var(--sbb-size-element-xxs);--sbb-option-focus-outline-offset:calc(-1 * var(--sbb-spacing-fixed-1x));--sbb-option-focus-outline-inset:0 var(--sbb-spacing-fixed-1x)}:host(:is(:state(size-m),[state--size-m])){--sbb-option-min-height:var(--sbb-size-element-s);--sbb-option-focus-outline-offset:inherit;--sbb-option-focus-outline-inset:var(--sbb-spacing-fixed-1x)}@media (any-hover:hover){:host(:hover:not(:is(:state(disabled),[state--disabled]))){--sbb-option-background-color:var(--sbb-option-background-color-hover)}}:host(:active:not(:is(:state(disabled),[state--disabled]))){--sbb-option-background-color:var(--sbb-option-background-color-active)}:host(:not(:is(:state(disable-highlight),[state--disable-highlight]))) .sbb-option__label slot{display:none}:host(:is(:state(disabled),[state--disabled])){--sbb-option-cursor:var(--sbb-cursor-default)}@media (forced-colors:active){:host(:is(:state(disabled),[state--disabled])){--sbb-option-color:GrayText}}:host(:is(:state(variant-select),[state--variant-select])){--sbb-option-column-gap:var(--sbb-spacing-fixed-2x);--sbb-option-justify-content:space-between}:host(:is(:state(variant-select),[state--variant-select]):is(:state(multiple),[state--multiple])){--sbb-option-justify-content:start}:host(:is(:state(active),[state--active])){--sbb-option-focus-outline-display:block}:host(:not(:is(:state(disabled),[state--disabled]))) .sbb-option__label--highlight{font-weight:700}@media (forced-colors:active){:host(:not(:is(:state(disabled),[state--disabled]))) .sbb-option__label--highlight{color:highlight}}.sbb-option{min-height:var(--sbb-option-min-height);align-items:center;column-gap:var(--sbb-option-column-gap);padding-inline:var(--sbb-option-padding-inline);justify-content:var(--sbb-option-justify-content);color:var(--sbb-option-color);cursor:var(--sbb-option-cursor);-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:var(--sbb-option-color);display:flex;position:relative}.sbb-option:after{content:"";display:var(--sbb-option-focus-outline-display,none);inset:var(--sbb-option-focus-outline-inset);pointer-events:none;border:var(--sbb-focus-outline-width) solid var(--sbb-focus-outline-color);border-radius:var(--sbb-option-border-radius);position:absolute}:host(:is(:state(disabled),[state--disabled]):not(:is(:state(multiple),[state--multiple]))) .sbb-option{z-index:0;position:relative}:host(:is(:state(disabled),[state--disabled]):not(:is(:state(multiple),[state--multiple]))) .sbb-option:before{content:"";display:var(--sbb-option-disabled-display,block);inset:var(--sbb-option-disabled-inset);border:var(--sbb-border-width-1x) dashed var(--sbb-option-disabled-border-color);border-radius:var(--sbb-option-disabled-border-radius);background-color:var(--sbb-option-disabled-background-color);z-index:-1;position:absolute}@media (forced-colors:active){:host(:is(:state(disabled),[state--disabled]):not(:is(:state(multiple),[state--multiple]))) .sbb-option:before{border-color:graytext}}.sbb-option__icon{min-width:var(--sbb-size-icon-ui-small);min-height:var(--sbb-size-icon-ui-small);color:var(--sbb-option-icon-color);display:flex}:host(:not(:is(:state(slotted-icon),[state--slotted-icon]),:is(:state(has-icon-name),[state--has-icon-name]))) .sbb-option__icon{display:var(--sbb-option-icon-container-display,none)}.sbb-option__label{text-overflow:var(--sbb-option-text-overflow);overflow:var(--sbb-option-overflow);white-space:var(--sbb-option-white-space,initial)}
35
35
  `,j=class extends k{static{this.elementName=`sbb-option`}static{this.elementDependencies=[y]}static{this.role=`option`}static{this.styles=[i(A)]}static{this.events={optionselectionchange:`optionselectionchange`,optionselected:`optionselected`}}set _variant(e){this._variantInternal&&this.internals.states.delete(`variant-${this._variantInternal}`),this._variantInternal=e,this._variantInternal&&this.internals.states.add(`variant-${this._variantInternal}`)}get _variant(){return this._variantInternal??null}constructor(){super(),this.addController(new u(this,()=>this.closest(`sbb-optgroup`),{disabled:e=>this.disabledFromGroup=e.disabled,label:e=>this.groupLabel=e.label})),this.addController(new u(this,()=>this.closest(`sbb-select`),{multiple:e=>{this.toggleState(`multiple`,e.multiple),this.requestUpdate()},negative:e=>this._handleNegativeChange(e)}))}_isMultiple(){return!this.hydrationRequired&&this.matches?.(`:is(:state(multiple),[state--multiple])`)}_handleNegativeChange(e){this.toggleState(`negative`,e.negative),this.requestUpdate()}connectedCallback(){super.connectedCallback(),this.hydrationRequired?this.hydrationComplete.then(()=>this._init()):this._init()}_init(){this._setVariantByContext(),this.handleHighlightState()}selectByClick(e){this.disabled||this.disabledFromGroup?e.stopPropagation():this._isMultiple()?(e.stopPropagation(),this.selectViaUserInteraction(!this.selected)):this.selectViaUserInteraction(!0)}selectViaUserInteraction(e){super.selectViaUserInteraction(e),this.dispatchEvent(new Event(`optionselectionchange`,{bubbles:!0,composed:!0}))}_setVariantByContext(){this.closest?.(`sbb-autocomplete`)?this._variant=`autocomplete`:this.closest?.(`sbb-select`)&&(this._variant=`select`)}handleHighlightState(){this._variant===`autocomplete`?super.handleHighlightState():this.updateDisableHighlight(!0)}renderIcon(){return n`
36
36
  <!-- Icon -->
37
37
  ${this._isMultiple()?r:n` <span class="sbb-option__icon"> ${this.renderIconSlot()} </span>`}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@sbb-esta/lyne-elements-dev",
3
- "version": "5.12.0-dev.1793097642",
3
+ "version": "5.12.0-dev.1793108079",
4
4
  "description": "Lyne Design System",
5
5
  "keywords": [
6
6
  "design system",
7
7
  "web components",
8
8
  "lit",
9
- "https://github.com/sbb-design-systems/lyne-components/commit/b15256b836ddea759e073385e16b02cef3857f32"
9
+ "https://github.com/sbb-design-systems/lyne-components/commit/5f4d2c088b9409dee75899578069176ca20a21b6"
10
10
  ],
11
11
  "type": "module",
12
12
  "exports": {
package/safety-theme.css CHANGED
@@ -3384,14 +3384,6 @@ sbb-message > [slot=image] :is(sbb-image, img):not(.sbb-figure-overlap-image) {
3384
3384
  --sbb-option-white-space: nowrap;
3385
3385
  }
3386
3386
 
3387
- .sbb-select-trigger {
3388
- width: 100%;
3389
- height: var(--sbb-size-element-xs);
3390
- }
3391
- sbb-form-field .sbb-select-trigger {
3392
- top: 0;
3393
- }
3394
-
3395
3387
  sbb-sidebar:has(sbb-sidebar-title) {
3396
3388
  --_sbb-sidebar-padding-block-start: 0;
3397
3389
  }
@@ -8,17 +8,3 @@ $theme: 'standard' !default;
8
8
  var(--sbb-color-smoke)
9
9
  );
10
10
  }
11
-
12
- @mixin rules {
13
- // We set some dimension to the selects trigger element in order that the screen reader's outline box looks more accurate.
14
- .sbb-select-trigger {
15
- width: 100%;
16
-
17
- // We set the smallest possible height (zero breakpoint, size s)
18
- height: var(--sbb-size-element-xs);
19
-
20
- sbb-form-field & {
21
- top: 0;
22
- }
23
- }
24
- }
package/select.js CHANGED
@@ -1 +1 @@
1
- import{SbbSelectElement as e}from"./select.pure.js";export*from"./select.pure.js";e.define();
1
+ import{SbbSelectElement as e,SbbSelectTriggerElement as t}from"./select.pure.js";export*from"./select.pure.js";e.define(),t.define();