@sbb-esta/lyne-elements 4.6.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autocomplete/autocomplete-base-element.js +34 -34
- package/chip/chip-group/chip-group.component.js +69 -49
- package/core/styles/core.scss +45 -73
- package/core/styles/mixins/overlay.scss +25 -15
- package/core/styles/mixins/pearl-chain-bullet.scss +12 -6
- package/core.css +113 -49
- package/custom-elements.json +351 -225
- package/datepicker/common/datepicker-button.js +18 -14
- package/datepicker/datepicker-next-day/datepicker-next-day.component.js +18 -26
- package/datepicker/datepicker-previous-day/datepicker-previous-day.component.js +20 -28
- package/development/autocomplete/autocomplete-base-element.d.ts +2 -0
- package/development/autocomplete/autocomplete-base-element.d.ts.map +1 -1
- package/development/autocomplete/autocomplete-base-element.js +37 -34
- package/development/calendar/calendar/calendar.component.d.ts +1 -1
- package/development/calendar/calendar/calendar.component.d.ts.map +1 -1
- package/development/calendar/calendar/calendar.component.js +1 -1
- package/development/calendar/calendar-day/calendar-day.component.d.ts +1 -1
- package/development/calendar/calendar-day/calendar-day.component.d.ts.map +1 -1
- package/development/calendar/calendar-day/calendar-day.component.js +1 -1
- package/development/chip/chip-group/chip-group.component.d.ts +6 -0
- package/development/chip/chip-group/chip-group.component.d.ts.map +1 -1
- package/development/chip/chip-group/chip-group.component.js +33 -4
- package/development/container/container/container.component.d.ts +2 -0
- package/development/container/container/container.component.d.ts.map +1 -1
- package/development/container/container/container.component.js +1 -1
- package/development/datepicker/common/datepicker-button.d.ts +3 -1
- package/development/datepicker/common/datepicker-button.d.ts.map +1 -1
- package/development/datepicker/common/datepicker-button.js +8 -4
- package/development/datepicker/datepicker-next-day/datepicker-next-day.component.d.ts +1 -1
- package/development/datepicker/datepicker-next-day/datepicker-next-day.component.d.ts.map +1 -1
- package/development/datepicker/datepicker-next-day/datepicker-next-day.component.js +3 -12
- package/development/datepicker/datepicker-previous-day/datepicker-previous-day.component.d.ts +1 -1
- package/development/datepicker/datepicker-previous-day/datepicker-previous-day.component.d.ts.map +1 -1
- package/development/datepicker/datepicker-previous-day/datepicker-previous-day.component.js +3 -12
- package/development/dialog/dialog/dialog.component.js +24 -37
- package/development/dialog/dialog-actions/dialog-actions.component.js +2 -2
- package/development/dialog/dialog-close-button/dialog-close-button.component.js +2 -2
- package/development/footer/footer.component.js +4 -19
- package/development/form-field/form-field/form-field.component.js +2 -1
- package/development/mini-calendar/mini-calendar-month/mini-calendar-month.component.d.ts +1 -1
- package/development/mini-calendar/mini-calendar-month/mini-calendar-month.component.d.ts.map +1 -1
- package/development/mini-calendar/mini-calendar-month/mini-calendar-month.component.js +2 -2
- package/development/option/optgroup/optgroup-base-element.js +4 -13
- package/development/option/option/option-base-element.d.ts.map +1 -1
- package/development/option/option/option-base-element.js +12 -14
- package/development/option/option/option.component.js +4 -28
- package/development/option/option-hint/option-hint.component.d.ts.map +1 -1
- package/development/option/option-hint/option-hint.component.js +11 -26
- package/development/select/select.component.js +11 -16
- package/development/status/status.component.d.ts.map +1 -1
- package/development/status/status.component.js +20 -26
- package/dialog/dialog/dialog.component.js +19 -19
- package/dialog/dialog-actions/dialog-actions.component.js +6 -6
- package/dialog/dialog-close-button/dialog-close-button.component.js +9 -9
- package/footer/footer.component.js +22 -22
- package/form-field/form-field/form-field.component.js +1 -1
- package/mini-calendar/mini-calendar-month/mini-calendar-month.component.js +1 -1
- package/off-brand-theme.css +113 -49
- package/option/optgroup/optgroup-base-element.js +22 -22
- package/option/option/option-base-element.js +11 -13
- package/option/option/option.component.js +15 -15
- package/option/option-hint/option-hint.component.js +16 -18
- package/package.json +1 -1
- package/safety-theme.css +113 -49
- package/select/select.component.js +18 -18
- package/standard-theme.css +113 -49
- package/status/status.component.js +27 -29
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
var it = (n) => {
|
|
2
2
|
throw TypeError(n);
|
|
3
3
|
};
|
|
4
|
-
var st = (n,
|
|
5
|
-
var p = (n,
|
|
4
|
+
var st = (n, a, l) => a.has(n) || it("Cannot " + l);
|
|
5
|
+
var p = (n, a, l) => (st(n, a, "read from private field"), l ? l.call(n) : a.get(n)), b = (n, a, l) => a.has(n) ? it("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(n) : a.set(n, l), s = (n, a, l, w) => (st(n, a, "write to private field"), w ? w.call(n, l) : a.set(n, l), l);
|
|
6
6
|
import { __esDecorate as c, __runInitializers as o } from "tslib";
|
|
7
|
-
import { ResizeController as
|
|
7
|
+
import { ResizeController as at } from "@lit-labs/observers/resize-controller.js";
|
|
8
8
|
import { css as lt, isServer as k, nothing as ot, html as pt } from "lit";
|
|
9
9
|
import { property as h } from "lit/decorators.js";
|
|
10
10
|
import { ref as nt } from "lit/directives/ref.js";
|
|
11
11
|
import { SbbOpenCloseBaseElement as bt } from "../core/base-elements.js";
|
|
12
12
|
import { SbbEscapableOverlayController as ct, SbbPropertyWatcherController as ht } from "../core/controllers.js";
|
|
13
|
-
import { idReference as
|
|
13
|
+
import { idReference as rt, forceType as x } from "../core/decorators.js";
|
|
14
14
|
import { isLean as dt, isZeroAnimationDuration as gt, isSafari as ut } from "../core/dom.js";
|
|
15
15
|
import { SbbNegativeMixin as vt, SbbHydrationMixin as _t } from "../core/mixins.js";
|
|
16
16
|
import { isEventOnElement as S, removeAriaComboBoxAttributes as mt, setOverlayPosition as ft, overlayGapFixCorners as Ot } from "../core/overlay.js";
|
|
17
17
|
import { boxSizingStyles as yt } from "../core/styles.js";
|
|
18
|
-
const xt = lt`.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-max-height: min( var(--sbb-options-panel-max-height-calculated), var(--sbb-options-panel-max-height, 100000em) );--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-pointer-events: all;--sbb-options-panel-internal-z-index: var( --sbb-autocomplete-z-index, var(--sbb-overlay-default-z-index) );display:none}:host([size=s]){--sbb-options-panel-padding-block: var(--sbb-spacing-fixed-1x)}:host(:is(:is(:state(state-opening),[state--state-opening]),:is(:state(state-opened),[state--state-opened]),:is(:state(state-closing),[state--state-closing]))){display:block}: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)}: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(state-opened),[state--state-opened])),:host(:is(:state(state-opening),[state--state-opening])){--sbb-options-panel-gap-fix-opacity: 1}:host(:is(:state(options-panel-position-below),[state--options-panel-position-below])){--sbb-options-panel-animation-transform: translateY( calc((var(--sbb-options-panel-origin-height) / 2) * -1) )}:host(:is(:state(options-panel-position-above),[state--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) )}:host([preserve-icon-space]){--sbb-option-icon-container-display: block}::slotted(sbb-divider){margin-block:var(--sbb-options-panel-divider-margin-block)}.sbb-autocomplete__container{position:fixed;pointer-events:none;inset:0;z-index:var(--sbb-options-panel-internal-z-index)}.sbb-autocomplete__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-autocomplete__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-autocomplete__panel:before,.sbb-autocomplete__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(:is(:state(options-panel-position-below),[state--options-panel-position-below])) .sbb-autocomplete__panel{inset-block-start:calc(var(--sbb-options-panel-position-y) - var(--sbb-options-panel-origin-height))}:host(:is(:is(:state(state-opened),[state--state-opened]),:is(:state(state-opening),[state--state-opening]))) .sbb-autocomplete__panel{box-shadow:var(--sbb-box-shadow-level-5-hard)}:host(:is(:is(:state(state-opened),[state--state-opened]),:is(:state(state-opening),[state--state-opening]))[negative]) .sbb-autocomplete__panel{box-shadow:var(--sbb-box-shadow-level-5-hard-negative)}:host(:is(:state(options-panel-position-below),[state--options-panel-position-below])) .sbb-autocomplete__panel:before{display:block}:host(:is(:state(options-panel-position-above),[state--options-panel-position-above])) .sbb-autocomplete__panel:after{display:block}: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-autocomplete__panel:before,: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-autocomplete__panel:after{box-shadow:var(--sbb-box-shadow-level-5-hard)}: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])[negative]) .sbb-autocomplete__panel:before,: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])[negative]) .sbb-autocomplete__panel:after{box-shadow:var(--sbb-box-shadow-level-5-hard-negative)}.sbb-autocomplete__wrapper{overflow:hidden}.sbb-autocomplete__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-autocomplete__options::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-autocomplete__options::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-autocomplete__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-autocomplete__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-autocomplete__options::-webkit-scrollbar-button,.sbb-autocomplete__options::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-autocomplete__options{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}.sbb-autocomplete__options{pointer-events:var(--sbb-options-pointer-events)}@media(forced-colors:active){.sbb-autocomplete__options{border:var(--sbb-border-width-1x) solid CanvasText;border-top: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}}`, C = ut;
|
|
18
|
+
const Et = lt`.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-max-height: min( var(--sbb-options-panel-max-height-calculated), var(--sbb-options-panel-max-height, 100000em) );--sbb-options-panel-min-height: var(--sbb-options-panel-origin-height);--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-gap-fix-top: calc( var(--sbb-options-panel-position-y) - var(--sbb-options-panel-border-radius) );--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-pointer-events: all;--sbb-options-panel-internal-z-index: var( --sbb-autocomplete-z-index, var(--sbb-overlay-default-z-index) );display:none}:host([size=s]){--sbb-options-panel-padding-block: var(--sbb-spacing-fixed-1x)}:host([size=m]){--sbb-options-panel-padding-block: var(--sbb-spacing-fixed-2x)}:host(:is(:is(:state(state-opening),[state--state-opening]),:is(:state(state-opened),[state--state-opened]),:is(:state(state-closing),[state--state-closing]))){display:block}: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)}: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(state-opened),[state--state-opened])),:host(:is(:state(state-opening),[state--state-opening])){--sbb-options-panel-gap-fix-opacity: 1}:host(:is(:state(options-panel-position-below),[state--options-panel-position-below])){--sbb-options-panel-animation-transform: translateY( calc((var(--sbb-options-panel-origin-height) / 2) * -1) )}:host(:is(:state(options-panel-position-above),[state--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) )}:host([preserve-icon-space]){--sbb-option-icon-container-display: block}::slotted(sbb-divider){margin-block:var(--sbb-options-panel-divider-margin-block)}.sbb-autocomplete__container{position:fixed;pointer-events:none;inset:0;z-index:var(--sbb-options-panel-internal-z-index)}.sbb-autocomplete__gap-fix{display:flex;justify-content:space-between;position:fixed;visibility:var(--sbb-options-panel-visibility, visible);opacity:var(--sbb-options-panel-gap-fix-opacity, 0);background-color:transparent;width:var(--sbb-options-panel-width, fit-content);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, none);transition:opacity var(--sbb-options-panel-animation-duration) var(--sbb-options-panel-animation-timing-function)}.sbb-autocomplete__panel{display:block;position:absolute;visibility:var(--sbb-options-panel-visibility, "visible");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, fit-content);transition:box-shadow var(--sbb-options-panel-animation-duration) var(--sbb-options-panel-animation-timing-function)}.sbb-autocomplete__panel:before,.sbb-autocomplete__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(:is(:state(options-panel-position-below),[state--options-panel-position-below])) .sbb-autocomplete__panel{inset-block-start:calc(var(--sbb-options-panel-position-y) - var(--sbb-options-panel-origin-height))}:host(:is(:is(:state(state-opened),[state--state-opened]),:is(:state(state-opening),[state--state-opening]))) .sbb-autocomplete__panel{box-shadow:var(--sbb-box-shadow-level-5-hard)}:host(:is(:is(:state(state-opened),[state--state-opened]),:is(:state(state-opening),[state--state-opening]))[negative]) .sbb-autocomplete__panel{box-shadow:var(--sbb-box-shadow-level-5-hard-negative)}:host(:is(:state(options-panel-position-below),[state--options-panel-position-below])) .sbb-autocomplete__panel:before{display:block}:host(:is(:state(options-panel-position-above),[state--options-panel-position-above])) .sbb-autocomplete__panel:after{display:block}: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-autocomplete__panel:before,: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-autocomplete__panel:after{box-shadow:var(--sbb-box-shadow-level-5-hard)}: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])[negative]) .sbb-autocomplete__panel:before,: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])[negative]) .sbb-autocomplete__panel:after{box-shadow:var(--sbb-box-shadow-level-5-hard-negative)}.sbb-autocomplete__wrapper{overflow:hidden}.sbb-autocomplete__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-autocomplete__options::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-autocomplete__options::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-autocomplete__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-autocomplete__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-autocomplete__options::-webkit-scrollbar-button,.sbb-autocomplete__options::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-autocomplete__options{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}.sbb-autocomplete__options{pointer-events:var(--sbb-options-pointer-events)}@media(forced-colors:active){.sbb-autocomplete__options{border:var(--sbb-border-width-1x) solid CanvasText;border-top: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}}`, C = ut;
|
|
19
19
|
let Bt = (() => {
|
|
20
|
-
var d, g, u, v, _, m, f, O, y,
|
|
21
|
-
let n = vt(_t(bt)),
|
|
22
|
-
return
|
|
20
|
+
var d, g, u, v, _, m, f, O, y, E, r;
|
|
21
|
+
let n = vt(_t(bt)), a, l = [], w = [], z, I = [], P = [], F, q = [], D = [], L, U = [], B = [], N, W = [], V = [], R, M = [], T = [], $, j = [], H = [], Y, Z = [], K = [], G, J = [], Q = [], X, tt = [], et = [];
|
|
22
|
+
return r = class extends n {
|
|
23
23
|
constructor() {
|
|
24
24
|
super();
|
|
25
25
|
b(this, d);
|
|
@@ -31,8 +31,8 @@ let Bt = (() => {
|
|
|
31
31
|
b(this, f);
|
|
32
32
|
b(this, O);
|
|
33
33
|
b(this, y);
|
|
34
|
-
b(this,
|
|
35
|
-
s(this, d, o(this, l, null)), s(this, g, (o(this, w), o(this, I, null))), s(this, u, (o(this, P), o(this,
|
|
34
|
+
b(this, E);
|
|
35
|
+
s(this, d, o(this, l, null)), s(this, g, (o(this, w), o(this, I, null))), s(this, u, (o(this, P), o(this, q, !1))), s(this, v, (o(this, D), o(this, U, !1))), s(this, _, (o(this, B), o(this, W, null))), s(this, m, (o(this, V), o(this, M, dt() ? "s" : "m"))), s(this, f, (o(this, T), o(this, j, !1))), s(this, O, (o(this, H), o(this, Z, !1))), s(this, y, (o(this, K), o(this, J, !1))), s(this, E, (o(this, Q), o(this, tt, "auto"))), this._triggerElement = o(this, et), this.activeOption = null, this.pendingAutoSelectedOption = null, this._originResizeObserver = new at(this, {
|
|
36
36
|
target: null,
|
|
37
37
|
skipInitial: !0,
|
|
38
38
|
callback: () => {
|
|
@@ -41,7 +41,7 @@ let Bt = (() => {
|
|
|
41
41
|
}), this._triggerAttributeObserver = k ? null : new MutationObserver((t) => {
|
|
42
42
|
const e = t[0].target;
|
|
43
43
|
(e.hasAttribute("disabled") || e.hasAttribute("readonly")) && this.close();
|
|
44
|
-
}), this._isPointerDownEventOnMenu = !1, this._escapableOverlayController = new ct(this), this._optionsCount = 0, this._lastUserInput = null, this._pointerDownListener = (t) => {
|
|
44
|
+
}), this._isPointerDownEventOnMenu = !1, this._escapableOverlayController = new ct(this), this._optionsCount = 0, this._lastUserInput = null, this._isCustomChangeEvent = !1, this._pointerDownListener = (t) => {
|
|
45
45
|
this._isPointerDownEventOnMenu = S(this._overlay, t);
|
|
46
46
|
}, this._closeOnBackdropClick = (t) => {
|
|
47
47
|
!this._isPointerDownEventOnMenu && !S(this._overlay, t) && !S(this.originElement, t) && this.close();
|
|
@@ -144,10 +144,10 @@ let Bt = (() => {
|
|
|
144
144
|
* @default 'auto'
|
|
145
145
|
*/
|
|
146
146
|
get position() {
|
|
147
|
-
return p(this,
|
|
147
|
+
return p(this, E);
|
|
148
148
|
}
|
|
149
149
|
set position(t) {
|
|
150
|
-
s(this,
|
|
150
|
+
s(this, E, t);
|
|
151
151
|
}
|
|
152
152
|
/** Returns the element where the autocomplete overlay is attached to. */
|
|
153
153
|
get originElement() {
|
|
@@ -206,7 +206,7 @@ let Bt = (() => {
|
|
|
206
206
|
this.pendingAutoSelectedOption = t, this._setInputValue(t);
|
|
207
207
|
}
|
|
208
208
|
_setValueAndDispatchEvents(t, e = !1) {
|
|
209
|
-
this.options.filter((i) => i.id !== t.id && i.selected).forEach((i) => i.selected = !1), this.pendingAutoSelectedOption = null, this.triggerElement && (this._setInputValue(t), this.triggerElement.dispatchEvent(new Event("change", { bubbles: !0 })), this.triggerElement.dispatchEvent(new InputEvent("input", { bubbles: !0, composed: !0 })), this._lastUserInput = null, this.triggerElement.dispatchEvent(new CustomEvent("inputAutocomplete", {
|
|
209
|
+
this.options.filter((i) => i.id !== t.id && i.selected).forEach((i) => i.selected = !1), this.pendingAutoSelectedOption = null, this.triggerElement && (this._setInputValue(t), this._isCustomChangeEvent = !0, this.triggerElement.dispatchEvent(new Event("change", { bubbles: !0 })), this.triggerElement.dispatchEvent(new InputEvent("input", { bubbles: !0, composed: !0 })), this._lastUserInput = null, this.triggerElement.dispatchEvent(new CustomEvent("inputAutocomplete", {
|
|
210
210
|
detail: { option: t }
|
|
211
211
|
})), e || this.triggerElement.focus());
|
|
212
212
|
}
|
|
@@ -249,12 +249,16 @@ let Bt = (() => {
|
|
|
249
249
|
}), this.triggerElement.addEventListener("input", (i) => {
|
|
250
250
|
const A = i.target.value;
|
|
251
251
|
A && this.open(), this._highlightOptions(A), this._lastUserInput = A, this.pendingAutoSelectedOption = null;
|
|
252
|
-
}, { signal: this._triggerAbortController.signal }), this.triggerElement.addEventListener("
|
|
252
|
+
}, { signal: this._triggerAbortController.signal }), this.triggerElement.addEventListener("change", (i) => {
|
|
253
|
+
this.requireSelection && !this._isCustomChangeEvent && i.stopImmediatePropagation(), this._isCustomChangeEvent = !1;
|
|
254
|
+
}, { signal: this._triggerAbortController.signal, capture: !0 }), this.triggerElement.addEventListener("keydown", (i) => this._closedPanelKeyboardInteraction(i), {
|
|
253
255
|
signal: this._triggerAbortController.signal,
|
|
254
256
|
// We need key event to run before any other subscription to guarantee a correct
|
|
255
257
|
// interaction with other components (necessary for the 'sbb-chip-group' use case).
|
|
256
258
|
capture: !0
|
|
257
|
-
})
|
|
259
|
+
}), this.triggerElement.addEventListener("blur", (i) => {
|
|
260
|
+
this.contains(i.relatedTarget) || (this.autoSelectActiveOptionOnBlur && this.activeOption && this._lastUserInput && this.triggerElement?.value && (this.activeOption.selected = !0, this._setValueAndDispatchEvents(this.activeOption, !0)), this.requireSelection && this.triggerElement && this._lastUserInput && (Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value").set.call(this.triggerElement, ""), this._highlightOptions(""), this._isCustomChangeEvent = !0, this.triggerElement.dispatchEvent(new Event("change", { bubbles: !0 })), this.triggerElement.dispatchEvent(new InputEvent("input", { bubbles: !0, composed: !0 }))), this.close());
|
|
261
|
+
}, { signal: this._triggerAbortController.signal, capture: !0 });
|
|
258
262
|
}
|
|
259
263
|
// Set overlay position, width and max height
|
|
260
264
|
_setOverlayPosition(t = this.originElement) {
|
|
@@ -272,7 +276,7 @@ let Bt = (() => {
|
|
|
272
276
|
this.state = "opened", this.originElement && this._originResizeObserver.observe(this.originElement), this.triggerElement?.setAttribute("aria-expanded", "true"), this.dispatchOpenEvent();
|
|
273
277
|
}
|
|
274
278
|
_handleClosing() {
|
|
275
|
-
this.state = "closed", this.hidePopover?.(), this.triggerElement?.setAttribute("aria-expanded", "false"), this.
|
|
279
|
+
this.state = "closed", this.hidePopover?.(), this.triggerElement?.setAttribute("aria-expanded", "false"), this.resetActiveElement(), this._optionContainer.scrollTop = 0, this._escapableOverlayController.disconnect(), this.dispatchCloseEvent();
|
|
276
280
|
}
|
|
277
281
|
_attachOpenPanelEvents() {
|
|
278
282
|
this._openPanelEventsController = new AbortController(), document.addEventListener("scroll", () => this._setOverlayPosition(), {
|
|
@@ -297,10 +301,6 @@ let Bt = (() => {
|
|
|
297
301
|
// We need key event to run before any other subscription to guarantee a correct
|
|
298
302
|
// interaction with other components (necessary for the 'sbb-chip-group' use case).
|
|
299
303
|
capture: !0
|
|
300
|
-
}), this.triggerElement?.addEventListener("blur", (t) => {
|
|
301
|
-
this.contains(t.relatedTarget) || (this.autoSelectActiveOptionOnBlur && this.activeOption && this._lastUserInput && this.triggerElement?.value && (this.activeOption.selected = !0, this._setValueAndDispatchEvents(this.activeOption, !0)), this.close());
|
|
302
|
-
}, {
|
|
303
|
-
signal: this._openPanelEventsController.signal
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
306
|
_closedPanelKeyboardInteraction(t) {
|
|
@@ -341,30 +341,30 @@ let Bt = (() => {
|
|
|
341
341
|
</div>
|
|
342
342
|
`;
|
|
343
343
|
}
|
|
344
|
-
}, d = new WeakMap(), g = new WeakMap(), u = new WeakMap(), v = new WeakMap(), _ = new WeakMap(), m = new WeakMap(), f = new WeakMap(), O = new WeakMap(), y = new WeakMap(),
|
|
344
|
+
}, d = new WeakMap(), g = new WeakMap(), u = new WeakMap(), v = new WeakMap(), _ = new WeakMap(), m = new WeakMap(), f = new WeakMap(), O = new WeakMap(), y = new WeakMap(), E = new WeakMap(), (() => {
|
|
345
345
|
const t = typeof Symbol == "function" && Symbol.metadata ? Object.create(n[Symbol.metadata] ?? null) : void 0;
|
|
346
|
-
|
|
346
|
+
a = [rt(), h()], z = [rt(), h()], F = [x(), h({ attribute: "preserve-icon-space", reflect: !0, type: Boolean })], L = [x(), h({ attribute: "auto-active-first-option", type: Boolean })], N = [h({ attribute: !1 })], R = [h({ reflect: !0 })], $ = [x(), h({ attribute: "auto-select-active-option", type: Boolean })], Y = [x(), h({ attribute: "auto-select-active-option-on-blur", type: Boolean })], G = [x(), h({ attribute: "require-selection", type: Boolean })], X = [h()], c(r, null, a, { kind: "accessor", name: "origin", static: !1, private: !1, access: { has: (e) => "origin" in e, get: (e) => e.origin, set: (e, i) => {
|
|
347
347
|
e.origin = i;
|
|
348
|
-
} }, metadata: t }, l, w), c(
|
|
348
|
+
} }, metadata: t }, l, w), c(r, null, z, { kind: "accessor", name: "trigger", static: !1, private: !1, access: { has: (e) => "trigger" in e, get: (e) => e.trigger, set: (e, i) => {
|
|
349
349
|
e.trigger = i;
|
|
350
|
-
} }, metadata: t }, I, P), c(
|
|
350
|
+
} }, metadata: t }, I, P), c(r, null, F, { kind: "accessor", name: "preserveIconSpace", static: !1, private: !1, access: { has: (e) => "preserveIconSpace" in e, get: (e) => e.preserveIconSpace, set: (e, i) => {
|
|
351
351
|
e.preserveIconSpace = i;
|
|
352
|
-
} }, metadata: t },
|
|
352
|
+
} }, metadata: t }, q, D), c(r, null, L, { kind: "accessor", name: "autoActiveFirstOption", static: !1, private: !1, access: { has: (e) => "autoActiveFirstOption" in e, get: (e) => e.autoActiveFirstOption, set: (e, i) => {
|
|
353
353
|
e.autoActiveFirstOption = i;
|
|
354
|
-
} }, metadata: t }, U, B), c(
|
|
354
|
+
} }, metadata: t }, U, B), c(r, null, N, { kind: "accessor", name: "displayWith", static: !1, private: !1, access: { has: (e) => "displayWith" in e, get: (e) => e.displayWith, set: (e, i) => {
|
|
355
355
|
e.displayWith = i;
|
|
356
|
-
} }, metadata: t }, W, V), c(
|
|
356
|
+
} }, metadata: t }, W, V), c(r, null, R, { kind: "accessor", name: "size", static: !1, private: !1, access: { has: (e) => "size" in e, get: (e) => e.size, set: (e, i) => {
|
|
357
357
|
e.size = i;
|
|
358
|
-
} }, metadata: t }, M, T), c(
|
|
358
|
+
} }, metadata: t }, M, T), c(r, null, $, { kind: "accessor", name: "autoSelectActiveOption", static: !1, private: !1, access: { has: (e) => "autoSelectActiveOption" in e, get: (e) => e.autoSelectActiveOption, set: (e, i) => {
|
|
359
359
|
e.autoSelectActiveOption = i;
|
|
360
|
-
} }, metadata: t }, j, H), c(
|
|
360
|
+
} }, metadata: t }, j, H), c(r, null, Y, { kind: "accessor", name: "autoSelectActiveOptionOnBlur", static: !1, private: !1, access: { has: (e) => "autoSelectActiveOptionOnBlur" in e, get: (e) => e.autoSelectActiveOptionOnBlur, set: (e, i) => {
|
|
361
361
|
e.autoSelectActiveOptionOnBlur = i;
|
|
362
|
-
} }, metadata: t }, Z, K), c(
|
|
362
|
+
} }, metadata: t }, Z, K), c(r, null, G, { kind: "accessor", name: "requireSelection", static: !1, private: !1, access: { has: (e) => "requireSelection" in e, get: (e) => e.requireSelection, set: (e, i) => {
|
|
363
363
|
e.requireSelection = i;
|
|
364
|
-
} }, metadata: t }, J, Q), c(
|
|
364
|
+
} }, metadata: t }, J, Q), c(r, null, X, { kind: "accessor", name: "position", static: !1, private: !1, access: { has: (e) => "position" in e, get: (e) => e.position, set: (e, i) => {
|
|
365
365
|
e.position = i;
|
|
366
|
-
} }, metadata: t }, tt, et), t && Object.defineProperty(
|
|
367
|
-
})(),
|
|
366
|
+
} }, metadata: t }, tt, et), t && Object.defineProperty(r, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: t });
|
|
367
|
+
})(), r.styles = [yt, Et], r;
|
|
368
368
|
})();
|
|
369
369
|
export {
|
|
370
370
|
Bt as SbbAutocompleteBaseElement
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
var
|
|
1
|
+
var D = (i) => {
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { __esDecorate as
|
|
7
|
-
import { css as
|
|
8
|
-
import { customElement as
|
|
9
|
-
import { isArrowKeyPressed as
|
|
10
|
-
import { SbbLanguageController as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
var B = (i, a, r) => a.has(i) || D("Cannot " + r);
|
|
5
|
+
var _ = (i, a, r) => (B(i, a, "read from private field"), r ? r.call(i) : a.get(i)), g = (i, a, r) => a.has(i) ? D("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(i) : a.set(i, r), u = (i, a, r, p) => (B(i, a, "write to private field"), p ? p.call(i, r) : a.set(i, r), r);
|
|
6
|
+
import { __esDecorate as d, __runInitializers as h } from "tslib";
|
|
7
|
+
import { css as W, LitElement as T, isServer as K, html as F } from "lit";
|
|
8
|
+
import { customElement as q, property as y } from "lit/decorators.js";
|
|
9
|
+
import { isArrowKeyPressed as M, getNextElementIndex as V } from "../../core/a11y.js";
|
|
10
|
+
import { SbbLanguageController as R, SbbPropertyWatcherController as $ } from "../../core/controllers.js";
|
|
11
|
+
import { forceType as N } from "../../core/decorators.js";
|
|
12
|
+
import { isLean as j } from "../../core/dom/lean-context.js";
|
|
13
|
+
import { i18nSelectionRequired as G, i18nChipGroupInputDescription as U } from "../../core/i18n.js";
|
|
14
|
+
import { SbbRequiredMixin as J, SbbDisabledMixin as P, SbbNegativeMixin as H, SbbFormAssociatedMixin as Q, SbbElementInternalsMixin as X } from "../../core/mixins.js";
|
|
15
|
+
import { boxSizingStyles as Y } from "../../core/styles.js";
|
|
16
|
+
import { SbbChipElement as Z } from "../chip.js";
|
|
17
|
+
const tt = W`:host{width:100%;display:flex;flex-wrap:wrap;gap:var(--sbb-chip-group-gap);align-items:center;margin-block:var(--sbb-chip-group-margin-block)}:host(:is(:is(:state(size-s),[state--size-s]),:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: 0}:host(:is(:state(size-s),[state--size-s]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: .375rem .3125rem}@media(min-width:64rem){:host(:is(:state(size-s),[state--size-s]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: .3125rem .1875rem}}:host(:is(:state(without-label),[state--without-label]):is(:state(size-s),[state--size-s]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: 0 .4375rem}@media(min-width:64rem){:host(:is(:state(without-label),[state--without-label]):is(:state(size-s),[state--size-s]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: 0 .3125rem}}:host(:is(:is(:state(size-l),[state--size-l]),:is(:state(size-m),[state--size-m]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default) 0}@media(min-width:64rem){:host(:is(:is(:state(size-l),[state--size-l]),:is(:state(size-m),[state--size-m]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default-large) 0}}:host(:is(:state(without-label),[state--without-label]):is(:state(size-m),[state--size-m]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: .1875rem .6875rem}@media(min-width:64rem){:host(:is(:state(without-label),[state--without-label]):is(:state(size-m),[state--size-m]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: .1875rem .875rem}}:host(:is(:state(without-label),[state--without-label]):not(:is(:state(empty),[state--empty]),:is(:state(size-s),[state--size-s]),:is(:state(size-m),[state--size-m]),:is(:state(size-l),[state--size-l]))){--sbb-chip-group-margin-block: var(--sbb-chip-group-margin-block-no-label-not-empty)}:host(:not(:is(:state(without-label),[state--without-label])):is(:state(size-m),[state--size-m]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default) var(--_sbb-chip-group-margin-block-start-default-large)}@media(min-width:64rem){:host(:not(:is(:state(without-label),[state--without-label])):is(:state(size-m),[state--size-m]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default-large) var(--_sbb-chip-group-margin-block-start-default-large)}}:host(:not(:is(:state(without-label),[state--without-label]),:is(:state(empty),[state--empty]),:is(:state(size-s),[state--size-s]),:is(:state(size-m),[state--size-m]),:is(:state(size-l),[state--size-l]))){--sbb-chip-group-margin-block: var(--sbb-chip-group-margin-block-with-label-not-empty)}:host(:is(:state(without-label),[state--without-label]):is(:state(size-l),[state--size-l]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default) 1rem}@media(min-width:64rem){:host(:is(:state(without-label),[state--without-label]):is(:state(size-l),[state--size-l]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default-large) 1.25rem}}:host(:not(:is(:state(without-label),[state--without-label])):is(:state(size-l),[state--size-l]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default) .46875rem}@media(min-width:64rem){:host(:not(:is(:state(without-label),[state--without-label])):is(:state(size-l),[state--size-l]):not(:is(:state(empty),[state--empty]))){--sbb-chip-group-margin-block: var(--_sbb-chip-group-margin-block-start-default-large) .46875rem}}::slotted(input){flex:1 1 var(--sbb-chip-group-input-min-width);max-height:1.5rem}::slotted(sbb-chip){max-width:100%}`;
|
|
18
|
+
let ct = (() => {
|
|
19
|
+
var b, m, c, l;
|
|
20
|
+
let i = [q("sbb-chip-group")], a, r = [], p, f = J(P(H(Q(X(T))))), v = [], z, w, k = [], E = [], C, S = [], x = [], I, O = [], A = [];
|
|
21
|
+
return l = class extends f {
|
|
21
22
|
constructor() {
|
|
22
23
|
super();
|
|
23
|
-
g(this,
|
|
24
|
-
g(this,
|
|
25
|
-
|
|
24
|
+
g(this, b);
|
|
25
|
+
g(this, m);
|
|
26
|
+
g(this, c);
|
|
27
|
+
u(this, b, (h(this, v), h(this, k, null))), u(this, m, (h(this, E), h(this, S, ["Enter"]))), u(this, c, (h(this, x), h(this, O, !1))), this._inputAttributeObserver = (h(this, A), K ? null : new MutationObserver(() => this._reactToInputChanges())), this._language = new R(this), this.addEventListener?.(Z.events.requestdelete, (t) => this._deleteChip(t.target)), this.addEventListener?.("keydown", (t) => this._onChipKeyDown(t)), this.addController(new $(this, () => this.closest("sbb-form-field"), {
|
|
26
28
|
size: (t) => this._updateSize(t.size),
|
|
27
29
|
label: (t) => this._updateLabelState(t),
|
|
28
30
|
hiddenLabel: (t) => this._updateLabelState(t)
|
|
@@ -32,30 +34,37 @@ let ot = (() => {
|
|
|
32
34
|
set value(t) {
|
|
33
35
|
t = t ?? [];
|
|
34
36
|
const e = this.value, s = [...e];
|
|
35
|
-
for (const
|
|
36
|
-
s.includes(
|
|
37
|
-
s.forEach((
|
|
37
|
+
for (const n of t)
|
|
38
|
+
s.includes(n) && s.splice(s.indexOf(n), 1);
|
|
39
|
+
s.forEach((n) => this._chipElements().find((L) => L.value === n)?.remove());
|
|
38
40
|
const o = [...t];
|
|
39
|
-
for (const
|
|
40
|
-
o.includes(
|
|
41
|
-
o.forEach((
|
|
41
|
+
for (const n of e)
|
|
42
|
+
o.includes(n) && o.splice(o.indexOf(n), 1);
|
|
43
|
+
o.forEach((n) => this._createChipElement(n));
|
|
42
44
|
}
|
|
43
45
|
get value() {
|
|
44
46
|
return this._chipElements().map((t) => t.value);
|
|
45
47
|
}
|
|
46
48
|
/** Function that maps a chip's value to its display value. */
|
|
47
49
|
get displayWith() {
|
|
48
|
-
return
|
|
50
|
+
return _(this, b);
|
|
49
51
|
}
|
|
50
52
|
set displayWith(t) {
|
|
51
|
-
|
|
53
|
+
u(this, b, t);
|
|
52
54
|
}
|
|
53
55
|
/** The array of keys that will trigger a `chipinputtokenend` event. Default `['Enter']` */
|
|
54
56
|
get separatorKeys() {
|
|
55
|
-
return
|
|
57
|
+
return _(this, m);
|
|
56
58
|
}
|
|
57
59
|
set separatorKeys(t) {
|
|
58
|
-
|
|
60
|
+
u(this, m, t);
|
|
61
|
+
}
|
|
62
|
+
/** Whether to automatically add a chip when the input loses focus if there's a value. */
|
|
63
|
+
get addOnBlur() {
|
|
64
|
+
return _(this, c);
|
|
65
|
+
}
|
|
66
|
+
set addOnBlur(t) {
|
|
67
|
+
u(this, c, t);
|
|
59
68
|
}
|
|
60
69
|
_updateLabelState(t) {
|
|
61
70
|
this.toggleState("without-label", !t.label || t.hiddenLabel);
|
|
@@ -85,7 +94,7 @@ let ot = (() => {
|
|
|
85
94
|
return super.shouldValidate(t) || t === "required" || t === "value";
|
|
86
95
|
}
|
|
87
96
|
validate() {
|
|
88
|
-
super.validate(), this.required && this.value.length === 0 ? this.setValidityFlag("valueMissing",
|
|
97
|
+
super.validate(), this.required && this.value.length === 0 ? this.setValidityFlag("valueMissing", G[this._language.current]) : this.removeValidityFlag("valueMissing");
|
|
89
98
|
}
|
|
90
99
|
/** Return the list of chip elements **/
|
|
91
100
|
_chipElements() {
|
|
@@ -99,6 +108,9 @@ let ot = (() => {
|
|
|
99
108
|
const t = this.querySelector("input");
|
|
100
109
|
t && t !== this._inputElement && (this._inputAbortController?.abort(), this._inputAttributeObserver?.disconnect(), this._inputElement = t, this._inputAbortController = new AbortController(), this._inputElement.addEventListener("keydown", (e) => this._onInputKeyDown(e), {
|
|
101
110
|
signal: this._inputAbortController.signal
|
|
111
|
+
}), this._inputElement.addEventListener("blur", () => this._onInputBlur(), {
|
|
112
|
+
signal: this._inputAbortController.signal,
|
|
113
|
+
capture: !0
|
|
102
114
|
}), this._inputElement.addEventListener("inputAutocomplete", (e) => {
|
|
103
115
|
this._createChipFromInput("autocomplete", e.detail?.option.value);
|
|
104
116
|
}, {
|
|
@@ -106,7 +118,7 @@ let ot = (() => {
|
|
|
106
118
|
}), this._inputAttributeObserver?.observe(this._inputElement, {
|
|
107
119
|
attributes: !0,
|
|
108
120
|
attributeFilter: ["readonly", "disabled"]
|
|
109
|
-
})), (!this._previousSize || !this.closest("sbb-form-field")) && this._updateSize(
|
|
121
|
+
})), (!this._previousSize || !this.closest("sbb-form-field")) && this._updateSize(j() ? "s" : "m"), this.toggleState("empty", this.value.length === 0), this._reactToInputChanges(), this._updateInputDescription(), this.updateFormValue();
|
|
110
122
|
}
|
|
111
123
|
/**
|
|
112
124
|
* Listen for keyboard events on the chip elements
|
|
@@ -114,8 +126,8 @@ let ot = (() => {
|
|
|
114
126
|
_onChipKeyDown(t) {
|
|
115
127
|
const e = t.target;
|
|
116
128
|
if (e.localName === "sbb-chip") {
|
|
117
|
-
if (
|
|
118
|
-
const s = this._enabledChipElements(), o =
|
|
129
|
+
if (M(t)) {
|
|
130
|
+
const s = this._enabledChipElements(), o = V(t, s.indexOf(e), s.length);
|
|
119
131
|
s[o].focus();
|
|
120
132
|
return;
|
|
121
133
|
}
|
|
@@ -142,6 +154,12 @@ let ot = (() => {
|
|
|
142
154
|
}
|
|
143
155
|
this.separatorKeys.includes(t.key) && (t.preventDefault(), this._createChipFromInput("input"));
|
|
144
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Handle blur event on the input
|
|
159
|
+
**/
|
|
160
|
+
_onInputBlur() {
|
|
161
|
+
this.addOnBlur && this._createChipFromInput("input");
|
|
162
|
+
}
|
|
145
163
|
/**
|
|
146
164
|
* If the input is not empty, create a chip with its value
|
|
147
165
|
*/
|
|
@@ -153,8 +171,8 @@ let ot = (() => {
|
|
|
153
171
|
origin: t,
|
|
154
172
|
value: s,
|
|
155
173
|
label: (e ? this.displayWith?.(e) : null) ?? void 0,
|
|
156
|
-
setValue: (
|
|
157
|
-
setLabel: (
|
|
174
|
+
setValue: (n) => o.value = n,
|
|
175
|
+
setLabel: (n) => o.label = n
|
|
158
176
|
};
|
|
159
177
|
this._dispatchChipInputTokenEnd(o) && (this._createChipElement(o.value, o.label), this._inputElement.value = "", this._emitInputEvents());
|
|
160
178
|
}
|
|
@@ -190,7 +208,7 @@ let ot = (() => {
|
|
|
190
208
|
this.dispatchEvent(new InputEvent("input", { bubbles: !0, composed: !0 })), this.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
191
209
|
}
|
|
192
210
|
_createChipElement(t, e) {
|
|
193
|
-
if (
|
|
211
|
+
if (K)
|
|
194
212
|
return;
|
|
195
213
|
const s = document.createElement("sbb-chip");
|
|
196
214
|
s.value = t, s.innerText = e ?? (t ? this.displayWith?.(t) : null) ?? "", this.insertBefore(s, this._inputElement ?? this.querySelector("input"));
|
|
@@ -207,26 +225,28 @@ let ot = (() => {
|
|
|
207
225
|
this._previousSize && this.internals.states.delete(`size-${this._previousSize}`), this._previousSize = t, this._previousSize && this.internals.states.add(`size-${this._previousSize}`);
|
|
208
226
|
}
|
|
209
227
|
_updateInputDescription() {
|
|
210
|
-
this._inputElement && this._inputElement.setAttribute("aria-description", `${
|
|
228
|
+
this._inputElement && this._inputElement.setAttribute("aria-description", `${U[this._language.current]} ${this.value.length}`);
|
|
211
229
|
}
|
|
212
230
|
render() {
|
|
213
|
-
return
|
|
231
|
+
return F`<slot @slotchange=${this._setupComponent}></slot>`;
|
|
214
232
|
}
|
|
215
|
-
},
|
|
216
|
-
const t = typeof Symbol == "function" && Symbol.metadata ? Object.create(
|
|
217
|
-
|
|
233
|
+
}, b = new WeakMap(), m = new WeakMap(), c = new WeakMap(), p = l, (() => {
|
|
234
|
+
const t = typeof Symbol == "function" && Symbol.metadata ? Object.create(f[Symbol.metadata] ?? null) : void 0;
|
|
235
|
+
z = [y({ type: Array })], w = [y({ attribute: !1 })], C = [y({ attribute: "separator-keys", type: Array })], I = [N(), y({ attribute: "add-on-blur", type: Boolean })], d(l, null, z, { kind: "setter", name: "value", static: !1, private: !1, access: { has: (e) => "value" in e, set: (e, s) => {
|
|
218
236
|
e.value = s;
|
|
219
|
-
} }, metadata: t }, null,
|
|
237
|
+
} }, metadata: t }, null, v), d(l, null, w, { kind: "accessor", name: "displayWith", static: !1, private: !1, access: { has: (e) => "displayWith" in e, get: (e) => e.displayWith, set: (e, s) => {
|
|
220
238
|
e.displayWith = s;
|
|
221
|
-
} }, metadata: t },
|
|
239
|
+
} }, metadata: t }, k, E), d(l, null, C, { kind: "accessor", name: "separatorKeys", static: !1, private: !1, access: { has: (e) => "separatorKeys" in e, get: (e) => e.separatorKeys, set: (e, s) => {
|
|
222
240
|
e.separatorKeys = s;
|
|
223
|
-
} }, metadata: t },
|
|
224
|
-
|
|
241
|
+
} }, metadata: t }, S, x), d(l, null, I, { kind: "accessor", name: "addOnBlur", static: !1, private: !1, access: { has: (e) => "addOnBlur" in e, get: (e) => e.addOnBlur, set: (e, s) => {
|
|
242
|
+
e.addOnBlur = s;
|
|
243
|
+
} }, metadata: t }, O, A), d(null, a = { value: p }, i, { kind: "class", name: p.name, metadata: t }, null, r), p = a.value, t && Object.defineProperty(p, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: t });
|
|
244
|
+
})(), l.role = "listbox", l.styles = [Y, tt], l.events = {
|
|
225
245
|
input: "input",
|
|
226
246
|
change: "change",
|
|
227
247
|
chipinputtokenend: "chipinputtokenend"
|
|
228
|
-
},
|
|
248
|
+
}, h(p, r), p;
|
|
229
249
|
})();
|
|
230
250
|
export {
|
|
231
|
-
|
|
251
|
+
ct as SbbChipGroupElement
|
|
232
252
|
};
|