@sbb-esta/lyne-elements-dev 5.4.1-dev.1785942709 → 5.4.1-dev.1786020383

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.
@@ -153394,6 +153394,25 @@
153394
153394
  "attribute": "size",
153395
153395
  "reflects": true
153396
153396
  },
153397
+ {
153398
+ "kind": "field",
153399
+ "name": "_checkedChangedByUser",
153400
+ "type": {
153401
+ "text": "boolean"
153402
+ },
153403
+ "privacy": "private",
153404
+ "default": "false"
153405
+ },
153406
+ {
153407
+ "kind": "method",
153408
+ "name": "_updateCheckedState",
153409
+ "privacy": "private",
153410
+ "return": {
153411
+ "type": {
153412
+ "text": "void"
153413
+ }
153414
+ }
153415
+ },
153397
153416
  {
153398
153417
  "kind": "method",
153399
153418
  "name": "_tagGroup",
@@ -153412,7 +153431,13 @@
153412
153431
  "type": {
153413
153432
  "text": "void"
153414
153433
  }
153415
- }
153434
+ },
153435
+ "parameters": [
153436
+ {
153437
+ "name": "tagGroup",
153438
+ "default": "this._tagGroup()"
153439
+ }
153440
+ ]
153416
153441
  },
153417
153442
  {
153418
153443
  "kind": "method",
@@ -153440,6 +153465,34 @@
153440
153465
  },
153441
153466
  "description": "Method triggered on button click. Inverts the checked value and emits events."
153442
153467
  },
153468
+ {
153469
+ "kind": "method",
153470
+ "name": "_setCheckedFromUser",
153471
+ "privacy": "private",
153472
+ "return": {
153473
+ "type": {
153474
+ "text": "void"
153475
+ }
153476
+ },
153477
+ "parameters": [
153478
+ {
153479
+ "name": "checked",
153480
+ "type": {
153481
+ "text": "boolean"
153482
+ }
153483
+ }
153484
+ ]
153485
+ },
153486
+ {
153487
+ "kind": "method",
153488
+ "name": "_dispatchChangeEvents",
153489
+ "privacy": "private",
153490
+ "return": {
153491
+ "type": {
153492
+ "text": "void"
153493
+ }
153494
+ }
153495
+ },
153443
153496
  {
153444
153497
  "kind": "method",
153445
153498
  "name": "updateFormValue",
@@ -1,4 +1,4 @@
1
- import { type CSSResultGroup, type PropertyValues, type TemplateResult } from 'lit';
1
+ import { type CSSResultGroup, type PropertyDeclaration, type PropertyValues, type TemplateResult } from 'lit';
2
2
  import { type FormRestoreReason, type FormRestoreState, SbbButtonLikeBaseElement } from '../../core.ts';
3
3
  declare const SbbTagElement_base: import("../../core.ts").AbstractConstructor<import("../../icon.pure.ts").SbbIconNameMixinType> & import("../../core.ts").AbstractConstructor<import("../../core.ts").SbbDisabledMixinType & import("../../core.ts").SbbDisabledInteractiveMixinType> & typeof SbbButtonLikeBaseElement;
4
4
  /**
@@ -28,13 +28,19 @@ export declare class SbbTagElement<T = string> extends SbbTagElement_base {
28
28
  * The value is inherited from the closest `<sbb-tag-group>`.
29
29
  */
30
30
  accessor size: 's' | 'm' | null;
31
+ private _checkedChangedByUser;
31
32
  constructor();
33
+ private _updateCheckedState;
32
34
  private _tagGroup;
33
35
  private _updateAriaRole;
34
36
  protected isDisabledExternally(): boolean;
35
37
  /** Method triggered on button click. Inverts the checked value and emits events. */
36
38
  private _handleClick;
39
+ private _setCheckedFromUser;
40
+ private _dispatchChangeEvents;
41
+ requestUpdate(name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration): void;
37
42
  protected willUpdate(changedProperties: PropertyValues<this>): void;
43
+ protected updated(changedProperties: PropertyValues<this>): void;
38
44
  /**
39
45
  * @internal
40
46
  */
@@ -153,7 +153,10 @@ let SbbTagGroupElement = (() => {
153
153
  }
154
154
  /** The child instances of sbb-tag as an array. */
155
155
  get tags() {
156
- return Array.from(this.querySelectorAll?.("sbb-tag") ?? []);
156
+ return Array.from(this.querySelectorAll?.("sbb-tag") ?? [], (t) => {
157
+ customElements.upgrade(t);
158
+ return t;
159
+ });
157
160
  }
158
161
  constructor() {
159
162
  super();
@@ -341,7 +344,7 @@ let SbbTagElement = (() => {
341
344
  change: "change"
342
345
  };
343
346
  }
344
- #value_accessor_storage = __runInitializers(this, _value_initializers, null);
347
+ #value_accessor_storage;
345
348
  /** Value of the form element. */
346
349
  get value() {
347
350
  return this.#value_accessor_storage;
@@ -349,7 +352,7 @@ let SbbTagElement = (() => {
349
352
  set value(value) {
350
353
  this.#value_accessor_storage = value;
351
354
  }
352
- #amount_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _amount_initializers, ""));
355
+ #amount_accessor_storage;
353
356
  /** Amount displayed inside the tag. */
354
357
  get amount() {
355
358
  return this.#amount_accessor_storage;
@@ -357,7 +360,7 @@ let SbbTagElement = (() => {
357
360
  set amount(value) {
358
361
  this.#amount_accessor_storage = value;
359
362
  }
360
- #checked_accessor_storage = (__runInitializers(this, _amount_extraInitializers), __runInitializers(this, _checked_initializers, false));
363
+ #checked_accessor_storage;
361
364
  /** Whether the tag is checked. */
362
365
  get checked() {
363
366
  return this.#checked_accessor_storage;
@@ -365,7 +368,7 @@ let SbbTagElement = (() => {
365
368
  set checked(value) {
366
369
  this.#checked_accessor_storage = value;
367
370
  }
368
- #size_accessor_storage = (__runInitializers(this, _checked_extraInitializers), __runInitializers(this, _size_initializers, null));
371
+ #size_accessor_storage;
369
372
  /**
370
373
  * Tag size, either s (lean theme default) or m (standard theme default).
371
374
  * The value is inherited from the closest `<sbb-tag-group>`.
@@ -378,20 +381,29 @@ let SbbTagElement = (() => {
378
381
  }
379
382
  constructor() {
380
383
  super();
381
- __runInitializers(this, _size_extraInitializers);
384
+ this.#value_accessor_storage = __runInitializers(this, _value_initializers, null);
385
+ this.#amount_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _amount_initializers, ""));
386
+ this.#checked_accessor_storage = (__runInitializers(this, _amount_extraInitializers), __runInitializers(this, _checked_initializers, false));
387
+ this.#size_accessor_storage = (__runInitializers(this, _checked_extraInitializers), __runInitializers(this, _size_initializers, null));
388
+ this._checkedChangedByUser = (__runInitializers(this, _size_extraInitializers), false);
382
389
  this.addEventListener?.("click", () => this._handleClick());
383
390
  this.addController(new SbbPropertyWatcherController(this, () => this._tagGroup(), {
384
- multiple: () => this._updateAriaRole(),
391
+ multiple: (g) => this._updateAriaRole(g),
385
392
  size: (g) => {
386
393
  this.size = g.size;
387
394
  }
388
395
  }));
396
+ this._updateCheckedState();
397
+ }
398
+ _updateCheckedState() {
399
+ this.toggleState("checked", this.checked);
400
+ this.updateFormValue();
401
+ this._updateAriaRole();
389
402
  }
390
403
  _tagGroup() {
391
404
  return this.closest?.("sbb-tag-group") ?? null;
392
405
  }
393
- _updateAriaRole() {
394
- const tagGroup = this._tagGroup();
406
+ _updateAriaRole(tagGroup = this._tagGroup()) {
395
407
  if (tagGroup && !tagGroup.multiple) {
396
408
  this.internals.role = "radio";
397
409
  this.internals.ariaChecked = `${this.checked}`;
@@ -410,11 +422,18 @@ let SbbTagElement = (() => {
410
422
  if (this.disabled) return;
411
423
  const tagGroup = this._tagGroup();
412
424
  if (tagGroup && !tagGroup.multiple && this.checked) return;
413
- this.checked = !this.checked;
425
+ this._setCheckedFromUser(!this.checked);
414
426
  this.dispatchEvent(new InputEvent("input", {
415
427
  bubbles: true,
416
428
  composed: true
417
429
  }));
430
+ }
431
+ _setCheckedFromUser(checked) {
432
+ if (this.checked === checked) return;
433
+ this._checkedChangedByUser = true;
434
+ this.checked = checked;
435
+ }
436
+ _dispatchChangeEvents() {
418
437
  /**
419
438
  * The change event is fired when the user modifies the element's value.
420
439
  * Unlike the input event, the change event is not necessarily fired
@@ -427,20 +446,32 @@ let SbbTagElement = (() => {
427
446
  */
428
447
  this.dispatchEvent(new Event("didChange", { bubbles: true }));
429
448
  }
449
+ requestUpdate(name, oldValue, options) {
450
+ super.requestUpdate(name, oldValue, options);
451
+ if (name === "checked") this._updateCheckedState();
452
+ }
430
453
  willUpdate(changedProperties) {
431
454
  super.willUpdate(changedProperties);
432
- const tagGroup = this._tagGroup();
455
+ const checkedChangedByUser = this._checkedChangedByUser;
433
456
  if (changedProperties.has("checked")) {
434
- this._updateAriaRole();
435
- this.toggleState("checked", this.checked);
436
- this.updateFormValue();
457
+ const tagGroup = this._tagGroup();
458
+ if (tagGroup && !tagGroup.multiple) {
459
+ if (this.checked) tagGroup.tags.forEach((t) => {
460
+ t.tabIndex = t === this ? 0 : -1;
461
+ if (t !== this) if (checkedChangedByUser) t._setCheckedFromUser(false);
462
+ else t.checked = false;
463
+ });
464
+ else if (!tagGroup.tags.some((t) => t.checked)) tagGroup["updateExclusiveTabIndex"]();
465
+ }
437
466
  }
438
- if (tagGroup && !tagGroup.multiple && changedProperties.has("checked")) {
439
- if (this.checked) tagGroup.tags.forEach((t) => {
440
- t.tabIndex = t === this ? 0 : -1;
441
- t.checked = t === this;
442
- });
443
- else if (!tagGroup.tags.some((t) => t.checked)) tagGroup["updateExclusiveTabIndex"]();
467
+ }
468
+ updated(changedProperties) {
469
+ super.updated(changedProperties);
470
+ if (changedProperties.has("checked")) {
471
+ if (this._checkedChangedByUser) {
472
+ this._dispatchChangeEvents();
473
+ this._checkedChangedByUser = false;
474
+ }
444
475
  }
445
476
  }
446
477
  /**
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@sbb-esta/lyne-elements-dev",
3
- "version": "5.4.1-dev.1785942709",
3
+ "version": "5.4.1-dev.1786020383",
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/d65a85ba4f58c73a129db1a37121d16d7e54742e"
9
+ "https://github.com/sbb-design-systems/lyne-components/commit/bdafaf122c39ead8f200553230932a934f3faaad"
10
10
  ],
11
11
  "type": "module",
12
12
  "exports": {
package/tag.pure.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import{__esDecorate as e,__runInitializers as t}from"tslib";import{html as n,isServer as r,unsafeCSS as i}from"lit";import{property as a}from"lit/decorators.js";import{SbbButtonLikeBaseElement as o,SbbDisabledMixin as s,SbbDisabledTabIndexActionMixin as c,SbbElement as l,SbbNamedSlotListMixin as u,SbbPropertyWatcherController as d,forceType as f,getNextElementIndex as p,isArrowKeyPressed as m,omitEmptyConverter as h}from"./core.js";import{SbbIconNameMixin as g}from"./icon.pure.js";var _=`:host{display:block}.sbb-tag-group__list{gap:var(--sbb-spacing-fixed-3x);flex-wrap:wrap;display:flex}.sbb-tag-group__list>:is(li,span){max-width:100%;display:flex}
2
- `;let v=(()=>{let o=s(u(l)),c=[],d,h=[],g=[],v,y=[],b=[],x,S=[],C=[],w;return class extends o{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;d=[f(),a({attribute:`accessibility-label`})],v=[f(),a({type:Boolean})],x=[a({reflect:!0})],w=[a()],e(this,null,d,{kind:`accessor`,name:`accessibilityLabel`,static:!1,private:!1,access:{has:e=>`accessibilityLabel`in e,get:e=>e.accessibilityLabel,set:(e,t)=>{e.accessibilityLabel=t}},metadata:t},h,g),e(this,null,v,{kind:`accessor`,name:`multiple`,static:!1,private:!1,access:{has:e=>`multiple`in e,get:e=>e.multiple,set:(e,t)=>{e.multiple=t}},metadata:t},y,b),e(this,null,x,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:t},S,C),e(this,null,w,{kind:`setter`,name:`value`,static:!1,private:!1,access:{has:e=>`value`in e,set:(e,t)=>{e.value=t}},metadata:t},null,c),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.elementName=`sbb-tag-group`}static{this.styles=[i(_)]}#e;get accessibilityLabel(){return this.#e}set accessibilityLabel(e){this.#e=e}#t;get multiple(){return this.#t}set multiple(e){this.#t=e}#n;get size(){return this.#n}set size(e){this.#n=e}set value(e){if(r||!this.hasUpdated){this._value=e;return}this._applyValueToTags(e)}get value(){return r||!this.hasUpdated?this._value:this.multiple?this.tags.filter(e=>e.checked).map(e=>e.value):this.tags.find(e=>e.checked)?.value??null}get tags(){return Array.from(this.querySelectorAll?.(`sbb-tag`)??[])}constructor(){super(),this.listChildLocalNames=(t(this,c),[`sbb-tag`,`div`]),this.#e=t(this,h,``),this.#t=(t(this,g),t(this,y,!1)),this.#n=(t(this,b),t(this,S,null)),this._value=(t(this,C),null),this.addEventListener?.(`keydown`,e=>this._handleArrowKeyDown(e))}willUpdate(e){super.willUpdate(e),e.has(`value`)&&!this.hasUpdated&&this._value&&this._applyValueToTags(this.value),e.has(`disabled`)&&this.tags.forEach(e=>e.requestUpdate?.(`disabled`)),(e.has(`listChildren`)||e.has(`multiple`))&&(this.multiple?e.has(`multiple`)&&this._enabledTags().forEach(e=>e.tabIndex=0):(this.tags.filter(e=>e.checked).slice(1).forEach(e=>e.checked=!1),this.updateExclusiveTabIndex())),(e.has(`accessibilityLabel`)||e.has(`multiple`))&&(this.multiple?(this.internals.role=this.accessibilityLabel?null:`group`,this.internals.ariaLabel=null):(this.internals.role=`radiogroup`,this.internals.ariaLabel=this.accessibilityLabel))}_enabledTags(){return this.tags.filter(e=>!e.disabled)}updateExclusiveTabIndex(){let e=this._enabledTags(),t=e.find(e=>e.checked)??e[0];e.forEach(e=>e.tabIndex=e===t?0:-1)}_handleArrowKeyDown(e){if(this.multiple||!m(e))return;e.preventDefault();let t=this._enabledTags(),n=t.indexOf(e.target);if(n===-1)return;let r=t[p(e,n,t.length)];t.forEach(e=>e.tabIndex=e===r?0:-1),r.focus()}_applyValueToTags(e){let t=this.tags;if(e===null)t.forEach(e=>e.checked=!1);else if(this.multiple){if(!Array.isArray(e)&&t.every(t=>t.value!==e))try{e=JSON.parse(e)}catch{}let n=Array.isArray(e)?e:[e];t.forEach(e=>e.checked=n.includes(e.value))}else Array.isArray(e)||t.forEach(t=>t.checked=t.value===e)}render(){return n`
2
+ `;let v=(()=>{let o=s(u(l)),c=[],d,h=[],g=[],v,y=[],b=[],x,S=[],C=[],w;return class extends o{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;d=[f(),a({attribute:`accessibility-label`})],v=[f(),a({type:Boolean})],x=[a({reflect:!0})],w=[a()],e(this,null,d,{kind:`accessor`,name:`accessibilityLabel`,static:!1,private:!1,access:{has:e=>`accessibilityLabel`in e,get:e=>e.accessibilityLabel,set:(e,t)=>{e.accessibilityLabel=t}},metadata:t},h,g),e(this,null,v,{kind:`accessor`,name:`multiple`,static:!1,private:!1,access:{has:e=>`multiple`in e,get:e=>e.multiple,set:(e,t)=>{e.multiple=t}},metadata:t},y,b),e(this,null,x,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:t},S,C),e(this,null,w,{kind:`setter`,name:`value`,static:!1,private:!1,access:{has:e=>`value`in e,set:(e,t)=>{e.value=t}},metadata:t},null,c),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.elementName=`sbb-tag-group`}static{this.styles=[i(_)]}#e;get accessibilityLabel(){return this.#e}set accessibilityLabel(e){this.#e=e}#t;get multiple(){return this.#t}set multiple(e){this.#t=e}#n;get size(){return this.#n}set size(e){this.#n=e}set value(e){if(r||!this.hasUpdated){this._value=e;return}this._applyValueToTags(e)}get value(){return r||!this.hasUpdated?this._value:this.multiple?this.tags.filter(e=>e.checked).map(e=>e.value):this.tags.find(e=>e.checked)?.value??null}get tags(){return Array.from(this.querySelectorAll?.(`sbb-tag`)??[],e=>(customElements.upgrade(e),e))}constructor(){super(),this.listChildLocalNames=(t(this,c),[`sbb-tag`,`div`]),this.#e=t(this,h,``),this.#t=(t(this,g),t(this,y,!1)),this.#n=(t(this,b),t(this,S,null)),this._value=(t(this,C),null),this.addEventListener?.(`keydown`,e=>this._handleArrowKeyDown(e))}willUpdate(e){super.willUpdate(e),e.has(`value`)&&!this.hasUpdated&&this._value&&this._applyValueToTags(this.value),e.has(`disabled`)&&this.tags.forEach(e=>e.requestUpdate?.(`disabled`)),(e.has(`listChildren`)||e.has(`multiple`))&&(this.multiple?e.has(`multiple`)&&this._enabledTags().forEach(e=>e.tabIndex=0):(this.tags.filter(e=>e.checked).slice(1).forEach(e=>e.checked=!1),this.updateExclusiveTabIndex())),(e.has(`accessibilityLabel`)||e.has(`multiple`))&&(this.multiple?(this.internals.role=this.accessibilityLabel?null:`group`,this.internals.ariaLabel=null):(this.internals.role=`radiogroup`,this.internals.ariaLabel=this.accessibilityLabel))}_enabledTags(){return this.tags.filter(e=>!e.disabled)}updateExclusiveTabIndex(){let e=this._enabledTags(),t=e.find(e=>e.checked)??e[0];e.forEach(e=>e.tabIndex=e===t?0:-1)}_handleArrowKeyDown(e){if(this.multiple||!m(e))return;e.preventDefault();let t=this._enabledTags(),n=t.indexOf(e.target);if(n===-1)return;let r=t[p(e,n,t.length)];t.forEach(e=>e.tabIndex=e===r?0:-1),r.focus()}_applyValueToTags(e){let t=this.tags;if(e===null)t.forEach(e=>e.checked=!1);else if(this.multiple){if(!Array.isArray(e)&&t.every(t=>t.value!==e))try{e=JSON.parse(e)}catch{}let n=Array.isArray(e)?e:[e];t.forEach(e=>e.checked=n.includes(e.value))}else Array.isArray(e)||t.forEach(t=>t.checked=t.value===e)}render(){return n`
3
3
  ${this.renderList({class:`sbb-tag-group__list`,ariaLabel:this.multiple?this.accessibilityLabel:void 0})}
4
4
  `}}})();var y=`:host{--sbb-tag-animation-duration:var(--sbb-disable-animation-duration,var(--sbb-animation-duration-2x));max-width:100%;display:inline-block;outline:none!important}:host([size=s]){--sbb-tag-height:var(--sbb-tag-height-s);--sbb-tag-padding-inline:var(--sbb-tag-padding-inline-s)}:host([size=m]){--sbb-tag-height:var(--sbb-tag-height-m);--sbb-tag-padding-inline:var(--sbb-tag-padding-inline-m)}:host(:is(:state(checked),[state--checked])){--sbb-tag-border-color:var(--sbb-border-color-3);--sbb-tag-border-width:var(--sbb-border-width-2x)}@media (forced-colors:active){:host(:is(:state(checked),[state--checked])){--sbb-tag-border-width:var(--sbb-border-width-4x);--sbb-tag-border-color:Highlight!important}}:host(:is(:disabled,[disabled-interactive])){--sbb-tag-text-color:light-dark(var(--sbb-color-granite),var(--sbb-color-aluminium));--sbb-tag-amount-color:var(--sbb-tag-text-color);--sbb-tag-background-color:var(--sbb-background-color-3);--sbb-tag-border-color:light-dark(var(--sbb-color-cement),var(--sbb-color-smoke));--sbb-tag-border-style:dashed;--sbb-tag-cursor:unset;--sbb-tag-pointer-events:none}@media (forced-colors:active){:host(:is(:disabled,[disabled-interactive])){--sbb-tag-text-color:GrayText;--sbb-tag-amount-color:GrayText;--sbb-tag-border-color:GrayText}}:host(:is(:state(checked),[state--checked]):is(:disabled,[disabled-interactive])){--sbb-tag-border-color:light-dark(var(--sbb-color-metal),var(--sbb-color-cement));--sbb-tag-border-style:dashed}@media (any-hover:hover){:host(:hover:not(:disabled,[disabled-interactive],:active,:is(:state(active),[state--active]))){--sbb-tag-background-color:var(--sbb-background-color-3);--sbb-tag-inset:calc(var(--sbb-border-width-2x) * -1);--sbb-tag-content-shift:translateY(calc(var(--sbb-border-width-1x) * -1))}}@media (any-hover:hover) and (forced-colors:active){:host(:hover:not(:disabled,[disabled-interactive],:active,:is(:state(active),[state--active]))){--sbb-tag-border-color:Highlight}}:host(:is(:active,:is(:state(active),[state--active])):not(:disabled,[disabled-interactive])){--sbb-tag-background-color:var(--sbb-background-color-3);--sbb-tag-border-color:light-dark(var(--sbb-color-iron),var(--sbb-color-storm));--sbb-tag-border-width:var(--sbb-border-width-2x);--sbb-tag-text-color:var(--sbb-color-4)}@media (forced-colors:active){:host(:is(:active,:is(:state(active),[state--active])):not(:disabled,[disabled-interactive])){--sbb-tag-border-color:Highlight;--sbb-tag-text-color:ButtonText}}.sbb-tag{height:var(--sbb-tag-height);max-width:100%;font-size:var(--sbb-text-font-size-xs);letter-spacing:var(--sbb-typo-letter-spacing-text);line-height:var(--sbb-typo-line-height-text);align-items:center;gap:var(--sbb-tag-gap);padding-inline:var(--sbb-tag-padding-inline);cursor:var(--sbb-tag-cursor,var(--sbb-cursor-pointer));border-radius:var(--sbb-tag-border-radius);color:var(--sbb-tag-text-color);transition:color var(--sbb-tag-animation-duration) var(--sbb-tag-animation-easing);-webkit-tap-highlight-color:transparent;user-select:none;pointer-events:var(--sbb-tag-pointer-events,unset);display:flex;position:relative}.sbb-tag:before{content:"";inset:var(--sbb-tag-inset,0);background-color:var(--sbb-tag-background-color);border:var(--sbb-tag-border-width) var(--sbb-tag-border-style) var(--sbb-tag-border-color);border-radius:var(--sbb-tag-border-radius);transition-duration:var(--sbb-tag-animation-duration);transition-timing-function:var(--sbb-tag-animation-easing);transition-property:inset,background-color,border-color,box-shadow;position:absolute}:host(:focus-visible) .sbb-tag:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style,solid) var(--sbb-focus-outline-width)}.sbb-tag__icon{height:calc(var(--sbb-typo-line-height-text) * 1em);flex-shrink:0;align-items:center;display:flex}:host(:not(:is(:state(slotted-icon),[state--slotted-icon]),:is(:state(has-icon-name),[state--has-icon-name]))) .sbb-tag__icon{display:none}.sbb-tag__text{white-space:nowrap;text-overflow:ellipsis;font-weight:700;overflow:hidden}.sbb-tag__amount{color:var(--sbb-tag-amount-color)}:host(:not(:is(:state(slotted-amount),[state--slotted-amount]),[amount])) .sbb-tag__amount{display:none}.sbb-tag--shift{transition:transform var(--sbb-tag-animation-duration) var(--sbb-tag-animation-easing);transform:var(--sbb-tag-content-shift,0);will-change:transform}
5
- `;let b=(()=>{let r=g(c(o)),s,l=[],u=[],p,m=[],_=[],v,b=[],x=[],S,C=[],w=[];return class extends r{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;s=[a()],p=[f(),a({reflect:!0,converter:h})],v=[f(),a({reflect:!1,type:Boolean})],S=[a({reflect:!0})],e(this,null,s,{kind:`accessor`,name:`value`,static:!1,private:!1,access:{has:e=>`value`in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:t},l,u),e(this,null,p,{kind:`accessor`,name:`amount`,static:!1,private:!1,access:{has:e=>`amount`in e,get:e=>e.amount,set:(e,t)=>{e.amount=t}},metadata:t},m,_),e(this,null,v,{kind:`accessor`,name:`checked`,static:!1,private:!1,access:{has:e=>`checked`in e,get:e=>e.checked,set:(e,t)=>{e.checked=t}},metadata:t},b,x),e(this,null,S,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:t},C,w),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.elementName=`sbb-tag`}static{this.styles=[i(y)]}static{this.events={input:`input`,didChange:`didChange`,change:`change`}}#e=t(this,l,null);get value(){return this.#e}set value(e){this.#e=e}#t=(t(this,u),t(this,m,``));get amount(){return this.#t}set amount(e){this.#t=e}#n=(t(this,_),t(this,b,!1));get checked(){return this.#n}set checked(e){this.#n=e}#r=(t(this,x),t(this,C,null));get size(){return this.#r}set size(e){this.#r=e}constructor(){super(),t(this,w),this.addEventListener?.(`click`,()=>this._handleClick()),this.addController(new d(this,()=>this._tagGroup(),{multiple:()=>this._updateAriaRole(),size:e=>{this.size=e.size}}))}_tagGroup(){return this.closest?.(`sbb-tag-group`)??null}_updateAriaRole(){let e=this._tagGroup();e&&!e.multiple?(this.internals.role=`radio`,this.internals.ariaChecked=`${this.checked}`,this.internals.ariaPressed=null):(this.internals.role=`button`,this.internals.ariaChecked=null,this.internals.ariaPressed=`${this.checked}`)}isDisabledExternally(){return this._tagGroup()?.disabled??!1}_handleClick(){if(this.disabled)return;let e=this._tagGroup();e&&!e.multiple&&this.checked||(this.checked=!this.checked,this.dispatchEvent(new InputEvent(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0})),this.dispatchEvent(new Event(`didChange`,{bubbles:!0})))}willUpdate(e){super.willUpdate(e);let t=this._tagGroup();e.has(`checked`)&&(this._updateAriaRole(),this.toggleState(`checked`,this.checked),this.updateFormValue()),t&&!t.multiple&&e.has(`checked`)&&(this.checked?t.tags.forEach(e=>{e.tabIndex=e===this?0:-1,e.checked=e===this}):t.tags.some(e=>e.checked)||t.updateExclusiveTabIndex())}formResetCallback(){this.checked=this.hasAttribute(`checked`)}formStateRestoreCallback(e,t){e&&(this.checked=e===`true`)}updateFormValue(){this.checked?super.updateFormValue():this.internals.setFormValue(null)}formState(){return`${this.checked}`}renderTemplate(){return n`
5
+ `;let b=(()=>{let r=g(c(o)),s,l=[],u=[],p,m=[],_=[],v,b=[],x=[],S,C=[],w=[];return class extends r{static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;s=[a()],p=[f(),a({reflect:!0,converter:h})],v=[f(),a({reflect:!1,type:Boolean})],S=[a({reflect:!0})],e(this,null,s,{kind:`accessor`,name:`value`,static:!1,private:!1,access:{has:e=>`value`in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:t},l,u),e(this,null,p,{kind:`accessor`,name:`amount`,static:!1,private:!1,access:{has:e=>`amount`in e,get:e=>e.amount,set:(e,t)=>{e.amount=t}},metadata:t},m,_),e(this,null,v,{kind:`accessor`,name:`checked`,static:!1,private:!1,access:{has:e=>`checked`in e,get:e=>e.checked,set:(e,t)=>{e.checked=t}},metadata:t},b,x),e(this,null,S,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:t},C,w),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.elementName=`sbb-tag`}static{this.styles=[i(y)]}static{this.events={input:`input`,didChange:`didChange`,change:`change`}}#e;get value(){return this.#e}set value(e){this.#e=e}#t;get amount(){return this.#t}set amount(e){this.#t=e}#n;get checked(){return this.#n}set checked(e){this.#n=e}#r;get size(){return this.#r}set size(e){this.#r=e}constructor(){super(),this.#e=t(this,l,null),this.#t=(t(this,u),t(this,m,``)),this.#n=(t(this,_),t(this,b,!1)),this.#r=(t(this,x),t(this,C,null)),this._checkedChangedByUser=(t(this,w),!1),this.addEventListener?.(`click`,()=>this._handleClick()),this.addController(new d(this,()=>this._tagGroup(),{multiple:e=>this._updateAriaRole(e),size:e=>{this.size=e.size}})),this._updateCheckedState()}_updateCheckedState(){this.toggleState(`checked`,this.checked),this.updateFormValue(),this._updateAriaRole()}_tagGroup(){return this.closest?.(`sbb-tag-group`)??null}_updateAriaRole(e=this._tagGroup()){e&&!e.multiple?(this.internals.role=`radio`,this.internals.ariaChecked=`${this.checked}`,this.internals.ariaPressed=null):(this.internals.role=`button`,this.internals.ariaChecked=null,this.internals.ariaPressed=`${this.checked}`)}isDisabledExternally(){return this._tagGroup()?.disabled??!1}_handleClick(){if(this.disabled)return;let e=this._tagGroup();e&&!e.multiple&&this.checked||(this._setCheckedFromUser(!this.checked),this.dispatchEvent(new InputEvent(`input`,{bubbles:!0,composed:!0})))}_setCheckedFromUser(e){this.checked!==e&&(this._checkedChangedByUser=!0,this.checked=e)}_dispatchChangeEvents(){this.dispatchEvent(new Event(`change`,{bubbles:!0})),this.dispatchEvent(new Event(`didChange`,{bubbles:!0}))}requestUpdate(e,t,n){super.requestUpdate(e,t,n),e===`checked`&&this._updateCheckedState()}willUpdate(e){super.willUpdate(e);let t=this._checkedChangedByUser;if(e.has(`checked`)){let e=this._tagGroup();e&&!e.multiple&&(this.checked?e.tags.forEach(e=>{e.tabIndex=e===this?0:-1,e!==this&&(t?e._setCheckedFromUser(!1):e.checked=!1)}):e.tags.some(e=>e.checked)||e.updateExclusiveTabIndex())}}updated(e){super.updated(e),e.has(`checked`)&&(this._checkedChangedByUser&&=(this._dispatchChangeEvents(),!1))}formResetCallback(){this.checked=this.hasAttribute(`checked`)}formStateRestoreCallback(e,t){e&&(this.checked=e===`true`)}updateFormValue(){this.checked?super.updateFormValue():this.internals.setFormValue(null)}formState(){return`${this.checked}`}renderTemplate(){return n`
6
6
  <span class="sbb-tag__icon sbb-tag--shift"> ${this.renderIconSlot()} </span>
7
7
  <span class="sbb-tag__text sbb-tag--shift">
8
8
  <slot></slot>