@cds/core 6.1.6 → 6.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5088,6 +5088,15 @@
5088
5088
  "module": "forms/control/control.element.js"
5089
5089
  }
5090
5090
  },
5091
+ {
5092
+ "kind": "method",
5093
+ "name": "setupPositioningListeners",
5094
+ "privacy": "private",
5095
+ "inheritedFrom": {
5096
+ "name": "CdsControl",
5097
+ "module": "forms/control/control.element.js"
5098
+ }
5099
+ },
5091
5100
  {
5092
5101
  "kind": "method",
5093
5102
  "name": "setActionOffsetPadding",
@@ -5780,6 +5789,15 @@
5780
5789
  "module": "forms/control/control.element.js"
5781
5790
  }
5782
5791
  },
5792
+ {
5793
+ "kind": "method",
5794
+ "name": "setupPositioningListeners",
5795
+ "privacy": "private",
5796
+ "inheritedFrom": {
5797
+ "name": "CdsControl",
5798
+ "module": "forms/control/control.element.js"
5799
+ }
5800
+ },
5783
5801
  {
5784
5802
  "kind": "method",
5785
5803
  "name": "setActionOffsetPadding",
@@ -6419,6 +6437,15 @@
6419
6437
  "module": "forms/control/control.element.js"
6420
6438
  }
6421
6439
  },
6440
+ {
6441
+ "kind": "method",
6442
+ "name": "setupPositioningListeners",
6443
+ "privacy": "private",
6444
+ "inheritedFrom": {
6445
+ "name": "CdsControl",
6446
+ "module": "forms/control/control.element.js"
6447
+ }
6448
+ },
6422
6449
  {
6423
6450
  "kind": "method",
6424
6451
  "name": "setActionOffsetPadding",
@@ -7812,6 +7839,15 @@
7812
7839
  "module": "forms/control/control.element.js"
7813
7840
  }
7814
7841
  },
7842
+ {
7843
+ "kind": "method",
7844
+ "name": "setupPositioningListeners",
7845
+ "privacy": "private",
7846
+ "inheritedFrom": {
7847
+ "name": "CdsControl",
7848
+ "module": "forms/control/control.element.js"
7849
+ }
7850
+ },
7815
7851
  {
7816
7852
  "kind": "method",
7817
7853
  "name": "setActionOffsetPadding",
@@ -9119,6 +9155,15 @@
9119
9155
  "module": "forms/control/control.element.js"
9120
9156
  }
9121
9157
  },
9158
+ {
9159
+ "kind": "method",
9160
+ "name": "setupPositioningListeners",
9161
+ "privacy": "private",
9162
+ "inheritedFrom": {
9163
+ "name": "CdsControl",
9164
+ "module": "forms/control/control.element.js"
9165
+ }
9166
+ },
9122
9167
  {
9123
9168
  "kind": "method",
9124
9169
  "name": "setActionOffsetPadding",
@@ -9760,6 +9805,11 @@
9760
9805
  "name": "setupHTML5Validation",
9761
9806
  "privacy": "private"
9762
9807
  },
9808
+ {
9809
+ "kind": "method",
9810
+ "name": "setupPositioningListeners",
9811
+ "privacy": "private"
9812
+ },
9763
9813
  {
9764
9814
  "kind": "method",
9765
9815
  "name": "setActionOffsetPadding",
@@ -36100,6 +36150,15 @@
36100
36150
  "module": "forms/control/control.element.js"
36101
36151
  }
36102
36152
  },
36153
+ {
36154
+ "kind": "method",
36155
+ "name": "setupPositioningListeners",
36156
+ "privacy": "private",
36157
+ "inheritedFrom": {
36158
+ "name": "CdsControl",
36159
+ "module": "forms/control/control.element.js"
36160
+ }
36161
+ },
36103
36162
  {
36104
36163
  "kind": "method",
36105
36164
  "name": "setActionOffsetPadding",
@@ -51417,6 +51476,15 @@
51417
51476
  "module": "forms/control/control.element.js"
51418
51477
  }
51419
51478
  },
51479
+ {
51480
+ "kind": "method",
51481
+ "name": "setupPositioningListeners",
51482
+ "privacy": "private",
51483
+ "inheritedFrom": {
51484
+ "name": "CdsControl",
51485
+ "module": "forms/control/control.element.js"
51486
+ }
51487
+ },
51420
51488
  {
51421
51489
  "kind": "method",
51422
51490
  "name": "setActionOffsetPadding",
@@ -52910,6 +52978,15 @@
52910
52978
  "module": "forms/control/control.element.js"
52911
52979
  }
52912
52980
  },
52981
+ {
52982
+ "kind": "method",
52983
+ "name": "setupPositioningListeners",
52984
+ "privacy": "private",
52985
+ "inheritedFrom": {
52986
+ "name": "CdsControl",
52987
+ "module": "forms/control/control.element.js"
52988
+ }
52989
+ },
52913
52990
  {
52914
52991
  "kind": "method",
52915
52992
  "name": "setActionOffsetPadding",
@@ -53602,6 +53679,15 @@
53602
53679
  "module": "forms/control/control.element.js"
53603
53680
  }
53604
53681
  },
53682
+ {
53683
+ "kind": "method",
53684
+ "name": "setupPositioningListeners",
53685
+ "privacy": "private",
53686
+ "inheritedFrom": {
53687
+ "name": "CdsControl",
53688
+ "module": "forms/control/control.element.js"
53689
+ }
53690
+ },
53605
53691
  {
53606
53692
  "kind": "method",
53607
53693
  "name": "setActionOffsetPadding",
@@ -54279,6 +54365,15 @@
54279
54365
  "module": "forms/control/control.element.js"
54280
54366
  }
54281
54367
  },
54368
+ {
54369
+ "kind": "method",
54370
+ "name": "setupPositioningListeners",
54371
+ "privacy": "private",
54372
+ "inheritedFrom": {
54373
+ "name": "CdsControl",
54374
+ "module": "forms/control/control.element.js"
54375
+ }
54376
+ },
54282
54377
  {
54283
54378
  "kind": "method",
54284
54379
  "name": "setActionOffsetPadding",
@@ -54968,6 +55063,15 @@
54968
55063
  "module": "forms/control/control.element.js"
54969
55064
  }
54970
55065
  },
55066
+ {
55067
+ "kind": "method",
55068
+ "name": "setupPositioningListeners",
55069
+ "privacy": "private",
55070
+ "inheritedFrom": {
55071
+ "name": "CdsControl",
55072
+ "module": "forms/control/control.element.js"
55073
+ }
55074
+ },
54971
55075
  {
54972
55076
  "kind": "method",
54973
55077
  "name": "setActionOffsetPadding",
@@ -55694,6 +55798,15 @@
55694
55798
  "module": "forms/control/control.element.js"
55695
55799
  }
55696
55800
  },
55801
+ {
55802
+ "kind": "method",
55803
+ "name": "setupPositioningListeners",
55804
+ "privacy": "private",
55805
+ "inheritedFrom": {
55806
+ "name": "CdsControl",
55807
+ "module": "forms/control/control.element.js"
55808
+ }
55809
+ },
55697
55810
  {
55698
55811
  "kind": "method",
55699
55812
  "name": "setActionOffsetPadding",
@@ -56487,6 +56600,15 @@
56487
56600
  "module": "forms/control/control.element.js"
56488
56601
  }
56489
56602
  },
56603
+ {
56604
+ "kind": "method",
56605
+ "name": "setupPositioningListeners",
56606
+ "privacy": "private",
56607
+ "inheritedFrom": {
56608
+ "name": "CdsControl",
56609
+ "module": "forms/control/control.element.js"
56610
+ }
56611
+ },
56490
56612
  {
56491
56613
  "kind": "method",
56492
56614
  "name": "setActionOffsetPadding",
@@ -58302,6 +58424,15 @@
58302
58424
  "module": "forms/control/control.element.js"
58303
58425
  }
58304
58426
  },
58427
+ {
58428
+ "kind": "method",
58429
+ "name": "setupPositioningListeners",
58430
+ "privacy": "private",
58431
+ "inheritedFrom": {
58432
+ "name": "CdsControl",
58433
+ "module": "forms/control/control.element.js"
58434
+ }
58435
+ },
58305
58436
  {
58306
58437
  "kind": "method",
58307
58438
  "name": "setActionOffsetPadding",
@@ -58973,6 +59104,15 @@
58973
59104
  "module": "forms/control/control.element.js"
58974
59105
  }
58975
59106
  },
59107
+ {
59108
+ "kind": "method",
59109
+ "name": "setupPositioningListeners",
59110
+ "privacy": "private",
59111
+ "inheritedFrom": {
59112
+ "name": "CdsControl",
59113
+ "module": "forms/control/control.element.js"
59114
+ }
59115
+ },
58976
59116
  {
58977
59117
  "kind": "method",
58978
59118
  "name": "setActionOffsetPadding",
@@ -60150,6 +60290,15 @@
60150
60290
  "module": "forms/control/control.element.js"
60151
60291
  }
60152
60292
  },
60293
+ {
60294
+ "kind": "method",
60295
+ "name": "setupPositioningListeners",
60296
+ "privacy": "private",
60297
+ "inheritedFrom": {
60298
+ "name": "CdsControl",
60299
+ "module": "forms/control/control.element.js"
60300
+ }
60301
+ },
60153
60302
  {
60154
60303
  "kind": "method",
60155
60304
  "name": "setActionOffsetPadding",
@@ -98,6 +98,7 @@ export declare class CdsControl extends LitElement {
98
98
  private setupDescribedByUpdates;
99
99
  private setupHostAttributes;
100
100
  private setupHTML5Validation;
101
+ private setupPositioningListeners;
101
102
  private setActionOffsetPadding;
102
103
  /** @private */
103
104
  get layoutStable(): boolean;
@@ -1,6 +1,6 @@
1
- import{__decorate as t}from"tslib";import{LitElement as e,html as s}from"lit";import{query as i}from"lit/decorators/query.js";import{getElementLanguageDirection as o,baseStyles as a,hasAriaLabelTypeAttr as l,syncProps as r,describeElementByElements as n,getElementUpdates as p,childrenUpdateComplete as u,pxToRem as d,calculateOptimalLayout as h,property as c,state as y,querySlot as f,querySlotAll as g,event as b,responsive as m}from"@cds/core/internal";import v from"./control.element.scss.js";import{syncHTML5Validation as x}from"../utils/validate.js";import{defaultControlWidth as L,defaultFormLayout as C,getStatusIcon as A,associateInputAndLabel as T,associateInputToDatalist as $,getCurrentMessageStatus as S,controlIsWrapped as I,formLayouts as k}from"../utils/utils.js";var w;!function(t){t.default="default",t.ariaLabel="aria-label",t.inputGroup="input-group",t.hiddenLabel="hidden-label"}(w||(w={}));let D=class extends e{constructor(){super(...arguments);this.status="neutral",this.controlWidth=L,this.validate=!1,this.responsive=!0,this._layout=C,this.focused=!1,this.disabled=!1,this.readonly=!1,this.fixedControlWidth=!1,this.supportsPrefixSuffixActions=!0,this.labelLayout=w.default,this.observers=[]}get layout(){return this._layout}set layout(t){const e=this._layout;this._layout=t?t.replace("-inline",""):C,this.requestUpdate("layout",e)}get isRTL(){return"rtl"===o(this)}static get styles(){return[a,v]}get hasAriaLabelTypeAttr(){return l(this.inputControl)}get hasStatusIcon(){return this.labelLayout!==w.inputGroup&&("error"===this.status||"success"===this.status)}render(){return s`${this.labelLayout===w.hiddenLabel||this.labelLayout===w.inputGroup?s`<span cds-layout="display:screen-reader-only"><slot name="label" @slotchange="${()=>this.associateInputAndLabel()}"></slot></span>`:""}<div cds-layout="${"vertical"===this.layout?"vertical gap:xs":"horizontal gap:lg"} align:stretch" class="private-host ${this.isRTL?"rtl":""}">${this.primaryLabelTemplate}<div class="input-message-container" cds-layout="
1
+ import{__decorate as t}from"tslib";import{LitElement as e,html as s}from"lit";import{query as i}from"lit/decorators/query.js";import{getElementLanguageDirection as o,baseStyles as a,hasAriaLabelTypeAttr as l,syncProps as r,describeElementByElements as n,getElementUpdates as p,elementVisible as u,childrenUpdateComplete as d,pxToRem as h,calculateOptimalLayout as c,property as y,state as f,querySlot as g,querySlotAll as b,event as m,responsive as v}from"@cds/core/internal";import L from"./control.element.scss.js";import{syncHTML5Validation as x}from"../utils/validate.js";import{defaultControlWidth as C,defaultFormLayout as A,getStatusIcon as T,associateInputAndLabel as $,associateInputToDatalist as S,getCurrentMessageStatus as I,controlIsWrapped as P,formLayouts as k}from"../utils/utils.js";var w;!function(t){t.default="default",t.ariaLabel="aria-label",t.inputGroup="input-group",t.hiddenLabel="hidden-label"}(w||(w={}));let D=class extends e{constructor(){super(...arguments);this.status="neutral",this.controlWidth=C,this.validate=!1,this.responsive=!0,this._layout=A,this.focused=!1,this.disabled=!1,this.readonly=!1,this.fixedControlWidth=!1,this.supportsPrefixSuffixActions=!0,this.labelLayout=w.default,this.observers=[]}get layout(){return this._layout}set layout(t){const e=this._layout;this._layout=t?t.replace("-inline",""):A,this.requestUpdate("layout",e)}get isRTL(){return"rtl"===o(this)}static get styles(){return[a,L]}get hasAriaLabelTypeAttr(){return l(this.inputControl)}get hasStatusIcon(){return this.labelLayout!==w.inputGroup&&("error"===this.status||"success"===this.status)}render(){return s`${this.labelLayout===w.hiddenLabel||this.labelLayout===w.inputGroup?s`<span cds-layout="display:screen-reader-only"><slot name="label" @slotchange="${()=>this.associateInputAndLabel()}"></slot></span>`:""}<div cds-layout="${"vertical"===this.layout?"vertical gap:xs":"horizontal gap:lg"} align:stretch" class="private-host ${this.isRTL?"rtl":""}">${this.primaryLabelTemplate}<div class="input-message-container" cds-layout="
2
2
  wrap:none
3
3
  ${"compact"===this.layout?"horizontal":"vertical"}
4
4
  ${"stretch"!==this.controlWidth||this.fixedControlWidth?"":"align:horizontal-stretch"}
5
- ${this.messages?.length?"gap:xs":""}"><div cds-layout="horizontal gap:xs wrap:none"><div cds-layout="horizontal align:top wrap:none ${"shrink"===this.controlWidth||this.fixedControlWidth?"align:shrink":"align:horizontal-stretch"}" class="${this.hasStatusIcon?"input-container with-status-icon":"input-container"}">${this.inputTemplate} ${this.prefixTemplate}<slot name="input"></slot>${this.suffixTemplate}</div>${this.hasStatusIcon?A(this.status):""}</div>${this.messagesTemplate}<slot name="datalist" @slotchange="${()=>this.associateInputToDatalist()}"></slot></div></div>`}get inputTemplate(){return s``}get prefixDefaultTemplate(){return null}get suffixDefaultTemplate(){return null}get isGenericControl(){return"cds-control"===this.tagName.toLowerCase()}get hasControlActions(){return this.controlActions.length>0||this.prefixDefaultTemplate||this.suffixDefaultTemplate}get primaryLabelTemplate(){return s`${this.labelLayout===w.default?s`<cds-internal-control-label .disabled="${this.disabled}" cds-layout="align:shrink align:top" action="primary"><slot name="label" @slotchange="${()=>this.associateInputAndLabel()}"></slot></cds-internal-control-label>`:""}`}get messagesTemplate(){return s`<div cds-layout="${"compact"===this.layout?"align:shrink":""}" class="messages"><slot name="message"></slot></div>`}get prefixTemplate(){return s`<div cds-layout="align:shrink align:vertical-center" class="prefix"><div cds-layout="horizontal gap:xxs">${this.prefixDefaultTemplate}<slot name="prefix"></slot></div></div>`}get suffixTemplate(){return s`<div cds-layout="align:shrink align:vertical-center" class="suffix"><div cds-layout="horizontal gap:xxs"><slot name="suffix"></slot>${this.suffixDefaultTemplate}</div></div>`}connectedCallback(){super.connectedCallback(),this.setAttribute("cds-control","")}firstUpdated(t){super.firstUpdated(t),this.setupHostAttributes(),this.setupHTML5Validation(),this.setActionOffsetPadding(),this.setupResponsive(),this.setupDescribedByUpdates(),this.setupLabelLayout(),this.assignSlotIfInControlGroup()}updated(t){super.updated(t),this.messages.forEach((e=>r(e,this,{disabled:t.has("disabled")}))),r(this.inputControl,this,{disabled:t.has("disabled")})}disconnectedCallback(){super.disconnectedCallback(),this.observers.forEach((t=>t?.disconnect()))}associateInputAndLabel(){T(this.inputControl,this.label)}associateInputToDatalist(){$(this.inputControl,this.datalistControl)}setupDescribedByUpdates(){this.messageSlot?.addEventListener("slotchange",(async()=>{n(this.inputControl,Array.from(this.messages)),S(Array.from(this.messages)).then((t=>this.status=t))}))}setupHostAttributes(){this.inputControl.addEventListener("focusin",(()=>this.focused=!0)),this.inputControl.addEventListener("focusout",(()=>this.focused=!1)),this.observers.push(p(this.inputControl,"disabled",(t=>this.disabled=""===t||t)),p(this.inputControl,"aria-disabled",(t=>this.disabled="true"===t)),p(this.inputControl,"readonly",(t=>this.readonly=""===t||t)))}setupHTML5Validation(){!this.inputControl?.form?.noValidate&&this.validate&&x(this,Array.from(this.messages))}async setActionOffsetPadding(){const t=this.prefixAction?.updateComplete,e=this.suffixAction?.updateComplete;if(await t||Promise.resolve(!0),await e||Promise.resolve(!0),await u(this.controlActions),!this.isGenericControl&&this.supportsPrefixSuffixActions&&this.hasControlActions){const t=d(this.prefixAction.getBoundingClientRect().width+6),e=d(this.suffixAction.getBoundingClientRect().width+6);this.inputControl.style.setProperty("padding-left",this.isRTL?e:t,"important"),this.inputControl.style.setProperty("padding-right",this.isRTL?t:e,"important")}}get layoutStable(){return this.labelLayout!==w.default||!I(this.inputControl,this.controlLabel,this.layout)}setupResponsive(){if(this.responsive&&this.labelLayout===w.default&&this.controlLabel){const t={layouts:k,initialLayout:this.layout};this.addEventListener("cdsResizeChange",(()=>{h(this,t).then((t=>{t&&this.layoutChange.emit(this.layout,{bubbles:!0})}))}))}}setupLabelLayout(){this.label?.getAttribute("cds-layout")?.includes("display:screen-reader-only")&&(this.labelLayout=w.hiddenLabel),this.hasAriaLabelTypeAttr&&(this.labelLayout=w.ariaLabel)}assignSlotIfInControlGroup(){this.parentElement?.hasAttribute("cds-control-group")&&this.setAttribute("slot","controls")}};t([c({type:String})],D.prototype,"status",void 0),t([c({type:String})],D.prototype,"controlWidth",void 0),t([c({type:Boolean})],D.prototype,"validate",void 0),t([c({type:Boolean})],D.prototype,"responsive",void 0),t([c({type:String})],D.prototype,"layout",null),t([y({type:Boolean,reflect:!0})],D.prototype,"focused",void 0),t([y({type:Boolean,reflect:!0})],D.prototype,"disabled",void 0),t([y({type:Boolean,reflect:!0})],D.prototype,"readonly",void 0),t([y()],D.prototype,"fixedControlWidth",void 0),t([y()],D.prototype,"supportsPrefixSuffixActions",void 0),t([y()],D.prototype,"isRTL",null),t([y()],D.prototype,"labelLayout",void 0),t([f("input, select, textarea, [cds-control]",{required:"error",requiredMessage:"input element is missing",assign:"input"})],D.prototype,"inputControl",void 0),t([f("label",{required:"error",requiredMessage:"To meet a11y standards either a <label> or input[aria-label] should be provided.",assign:"label",exemptOn:t=>t.hasAriaLabelTypeAttr})],D.prototype,"label",void 0),t([i("cds-internal-control-label[action=primary]")],D.prototype,"controlLabel",void 0),t([f("datalist",{assign:"datalist"})],D.prototype,"datalistControl",void 0),t([g("cds-control-message")],D.prototype,"messages",void 0),t([g("[cds-button-action]")],D.prototype,"controlActions",void 0),t([i(".prefix")],D.prototype,"prefixAction",void 0),t([i(".suffix")],D.prototype,"suffixAction",void 0),t([i(".messages")],D.prototype,"messageSlot",void 0),t([b()],D.prototype,"layoutChange",void 0),D=t([m()],D);export{D as CdsControl,w as ControlLabelLayout};
5
+ ${this.messages?.length?"gap:xs":""}"><div cds-layout="horizontal gap:xs wrap:none"><div cds-layout="horizontal align:top wrap:none ${"shrink"===this.controlWidth||this.fixedControlWidth?"align:shrink":"align:horizontal-stretch"}" class="${this.hasStatusIcon?"input-container with-status-icon":"input-container"}">${this.inputTemplate} ${this.prefixTemplate}<slot name="input"></slot>${this.suffixTemplate}</div>${this.hasStatusIcon?T(this.status):""}</div>${this.messagesTemplate}<slot name="datalist" @slotchange="${()=>this.associateInputToDatalist()}"></slot></div></div>`}get inputTemplate(){return s``}get prefixDefaultTemplate(){return null}get suffixDefaultTemplate(){return null}get isGenericControl(){return"cds-control"===this.tagName.toLowerCase()}get hasControlActions(){return this.controlActions.length>0||this.prefixDefaultTemplate||this.suffixDefaultTemplate}get primaryLabelTemplate(){return s`${this.labelLayout===w.default?s`<cds-internal-control-label .disabled="${this.disabled}" cds-layout="align:shrink align:top" action="primary"><slot name="label" @slotchange="${()=>this.associateInputAndLabel()}"></slot></cds-internal-control-label>`:""}`}get messagesTemplate(){return s`<div cds-layout="${"compact"===this.layout?"align:shrink":""}" class="messages"><slot name="message"></slot></div>`}get prefixTemplate(){return s`<div cds-layout="align:shrink align:vertical-center" class="prefix"><div cds-layout="horizontal gap:xxs">${this.prefixDefaultTemplate}<slot name="prefix"></slot></div></div>`}get suffixTemplate(){return s`<div cds-layout="align:shrink align:vertical-center" class="suffix"><div cds-layout="horizontal gap:xxs"><slot name="suffix"></slot>${this.suffixDefaultTemplate}</div></div>`}connectedCallback(){super.connectedCallback(),this.setAttribute("cds-control","")}firstUpdated(t){super.firstUpdated(t),this.setupHostAttributes(),this.setupHTML5Validation(),this.setupPositioningListeners(),this.setupResponsive(),this.setupDescribedByUpdates(),this.setupLabelLayout(),this.assignSlotIfInControlGroup()}updated(t){super.updated(t),this.messages.forEach((e=>r(e,this,{disabled:t.has("disabled")}))),r(this.inputControl,this,{disabled:t.has("disabled")})}disconnectedCallback(){super.disconnectedCallback(),this.observers.forEach((t=>t?.disconnect()))}associateInputAndLabel(){$(this.inputControl,this.label)}associateInputToDatalist(){S(this.inputControl,this.datalistControl)}setupDescribedByUpdates(){this.messageSlot?.addEventListener("slotchange",(async()=>{n(this.inputControl,Array.from(this.messages)),I(Array.from(this.messages)).then((t=>this.status=t))}))}setupHostAttributes(){this.inputControl.addEventListener("focusin",(()=>this.focused=!0)),this.inputControl.addEventListener("focusout",(()=>this.focused=!1)),this.observers.push(p(this.inputControl,"disabled",(t=>this.disabled=""===t||t)),p(this.inputControl,"aria-disabled",(t=>this.disabled="true"===t)),p(this.inputControl,"readonly",(t=>this.readonly=""===t||t)))}setupHTML5Validation(){!this.inputControl?.form?.noValidate&&this.validate&&x(this,Array.from(this.messages))}setupPositioningListeners(){this.setActionOffsetPadding(),this.observers.push(u(this.inputControl,(()=>this.setActionOffsetPadding())))}async setActionOffsetPadding(){const t=this.prefixAction?.updateComplete,e=this.suffixAction?.updateComplete;if(await t||Promise.resolve(!0),await e||Promise.resolve(!0),await d(this.controlActions),!this.isGenericControl&&this.supportsPrefixSuffixActions&&this.hasControlActions){const t=h(this.prefixAction.getBoundingClientRect().width+6),e=h(this.suffixAction.getBoundingClientRect().width+6);this.inputControl.style.setProperty("padding-left",this.isRTL?e:t,"important"),this.inputControl.style.setProperty("padding-right",this.isRTL?t:e,"important")}}get layoutStable(){return this.labelLayout!==w.default||!P(this.inputControl,this.controlLabel,this.layout)}setupResponsive(){if(this.responsive&&this.labelLayout===w.default&&this.controlLabel){const t={layouts:k,initialLayout:this.layout};this.addEventListener("cdsResizeChange",(()=>{c(this,t).then((t=>{t&&this.layoutChange.emit(this.layout,{bubbles:!0})}))}))}}setupLabelLayout(){this.label?.getAttribute("cds-layout")?.includes("display:screen-reader-only")&&(this.labelLayout=w.hiddenLabel),this.hasAriaLabelTypeAttr&&(this.labelLayout=w.ariaLabel)}assignSlotIfInControlGroup(){this.parentElement?.hasAttribute("cds-control-group")&&this.setAttribute("slot","controls")}};t([y({type:String})],D.prototype,"status",void 0),t([y({type:String})],D.prototype,"controlWidth",void 0),t([y({type:Boolean})],D.prototype,"validate",void 0),t([y({type:Boolean})],D.prototype,"responsive",void 0),t([y({type:String})],D.prototype,"layout",null),t([f({type:Boolean,reflect:!0})],D.prototype,"focused",void 0),t([f({type:Boolean,reflect:!0})],D.prototype,"disabled",void 0),t([f({type:Boolean,reflect:!0})],D.prototype,"readonly",void 0),t([f()],D.prototype,"fixedControlWidth",void 0),t([f()],D.prototype,"supportsPrefixSuffixActions",void 0),t([f()],D.prototype,"isRTL",null),t([f()],D.prototype,"labelLayout",void 0),t([g("input, select, textarea, [cds-control]",{required:"error",requiredMessage:"input element is missing",assign:"input"})],D.prototype,"inputControl",void 0),t([g("label",{required:"error",requiredMessage:"To meet a11y standards either a <label> or input[aria-label] should be provided.",assign:"label",exemptOn:t=>t.hasAriaLabelTypeAttr})],D.prototype,"label",void 0),t([i("cds-internal-control-label[action=primary]")],D.prototype,"controlLabel",void 0),t([g("datalist",{assign:"datalist"})],D.prototype,"datalistControl",void 0),t([b("cds-control-message")],D.prototype,"messages",void 0),t([b("[cds-button-action]")],D.prototype,"controlActions",void 0),t([i(".prefix")],D.prototype,"prefixAction",void 0),t([i(".suffix")],D.prototype,"suffixAction",void 0),t([i(".messages")],D.prototype,"messageSlot",void 0),t([m()],D.prototype,"layoutChange",void 0),D=t([v()],D);export{D as CdsControl,w as ControlLabelLayout};
6
6
  //# sourceMappingURL=control.element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"control.element.js","sources":["../../../../src/forms/control/control.element.ts"],"sourcesContent":["/*\n * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\nimport { __decorate } from \"tslib\";\nimport { html, LitElement } from 'lit';\nimport { query } from 'lit/decorators/query.js';\nimport { baseStyles, property, querySlot, querySlotAll, childrenUpdateComplete, getElementLanguageDirection, event, describeElementByElements, state, syncProps, pxToRem, getElementUpdates, hasAriaLabelTypeAttr, calculateOptimalLayout, responsive, } from '@cds/core/internal';\nimport styles from './control.element.scss';\nimport { syncHTML5Validation } from '../utils/validate.js';\nimport { associateInputToDatalist, getStatusIcon, associateInputAndLabel, controlIsWrapped, formLayouts, defaultFormLayout, defaultControlWidth, getCurrentMessageStatus, } from '../utils/utils.js';\nexport var ControlLabelLayout;\n(function (ControlLabelLayout) {\n ControlLabelLayout[\"default\"] = \"default\";\n ControlLabelLayout[\"ariaLabel\"] = \"aria-label\";\n ControlLabelLayout[\"inputGroup\"] = \"input-group\";\n ControlLabelLayout[\"hiddenLabel\"] = \"hidden-label\";\n})(ControlLabelLayout || (ControlLabelLayout = {}));\n/**\n * Generic Control\n *\n * ```typescript\n * import '@cds/core/forms/register.js';\n * ```\n *\n * ```html\n * <cds-control>\n * <label>control</label>\n * <input type=\"text\" />\n * </cds-control>\n * ```\n * @element cds-control\n * @slot - For projecting input and label\n * @cssprop --label-width\n */\nlet CdsControl = class CdsControl extends LitElement {\n constructor() {\n super(...arguments);\n /**\n * Set the status of form control validation\n * @type {neutral | error | success}\n */\n this.status = 'neutral';\n /**\n * Adjust the control from the default full width or the browser default width\n * @type {stretch | shrink}\n */\n this.controlWidth = defaultControlWidth;\n /**\n * Set the validate attribute to sync with HTML5 native validation\n * https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation\n */\n this.validate = false;\n /**\n * By default forms will collapse to layout that prevents overflow.\n * If disabled control layout may break or overflow in unexpected ways.\n */\n this.responsive = true;\n this._layout = defaultFormLayout;\n this.focused = false;\n this.disabled = false;\n this.readonly = false;\n this.fixedControlWidth = false;\n this.supportsPrefixSuffixActions = true;\n /** @private */\n this.labelLayout = ControlLabelLayout.default;\n this.observers = [];\n }\n /**\n * Set to adjust the default control layout. When `responsive` is true this will be the largest size to scale to.\n * @type {vertical | horizontal | compact}\n */\n get layout() {\n return this._layout;\n }\n set layout(value) {\n const oldValue = this._layout;\n this._layout = value ? value.replace('-inline', '') : defaultFormLayout; // auto convert any form-layouts from parent groups\n this.requestUpdate('layout', oldValue);\n }\n get isRTL() {\n return getElementLanguageDirection(this) === 'rtl';\n }\n static get styles() {\n return [baseStyles, styles];\n }\n get hasAriaLabelTypeAttr() {\n return hasAriaLabelTypeAttr(this.inputControl);\n }\n get hasStatusIcon() {\n return this.labelLayout !== ControlLabelLayout.inputGroup && (this.status === 'error' || this.status === 'success');\n }\n render() {\n return html `\n ${this.labelLayout === ControlLabelLayout.hiddenLabel || this.labelLayout === ControlLabelLayout.inputGroup\n ? html `<span cds-layout=\"display:screen-reader-only\"\n ><slot name=\"label\" @slotchange=${() => this.associateInputAndLabel()}></slot\n ></span>`\n : ''}\n <div\n cds-layout=\"${this.layout === 'vertical' ? 'vertical gap:xs' : 'horizontal gap:lg'} align:stretch\"\n class=\"private-host ${this.isRTL ? 'rtl' : ''}\"\n >\n ${this.primaryLabelTemplate}\n <div\n class=\"input-message-container\"\n cds-layout=\"\n wrap:none\n ${this.layout === 'compact' ? 'horizontal' : 'vertical'}\n ${this.controlWidth === 'stretch' && !this.fixedControlWidth ? 'align:horizontal-stretch' : ''}\n ${this.messages?.length ? 'gap:xs' : ''}\"\n >\n <div cds-layout=\"horizontal gap:xs wrap:none\">\n <div\n cds-layout=\"horizontal align:top wrap:none ${this.controlWidth === 'shrink' || this.fixedControlWidth\n ? 'align:shrink'\n : 'align:horizontal-stretch'}\"\n class=\"${this.hasStatusIcon ? 'input-container with-status-icon' : 'input-container'}\"\n >\n ${this.inputTemplate} ${this.prefixTemplate}\n <slot name=\"input\"></slot>\n ${this.suffixTemplate}\n </div>\n ${this.hasStatusIcon ? getStatusIcon(this.status) : ''}\n </div>\n ${this.messagesTemplate}\n <slot name=\"datalist\" @slotchange=${() => this.associateInputToDatalist()}></slot>\n </div>\n </div>\n `;\n }\n get inputTemplate() {\n return html ``;\n }\n get prefixDefaultTemplate() {\n return null;\n }\n get suffixDefaultTemplate() {\n return null;\n }\n get isGenericControl() {\n return this.tagName.toLowerCase() === 'cds-control';\n }\n get hasControlActions() {\n return this.controlActions.length > 0 || this.prefixDefaultTemplate || this.suffixDefaultTemplate;\n }\n get primaryLabelTemplate() {\n return html `\n ${this.labelLayout === ControlLabelLayout.default\n ? html ` <cds-internal-control-label\n .disabled=\"${this.disabled}\"\n cds-layout=\"align:shrink align:top\"\n action=\"primary\"\n >\n <slot name=\"label\" @slotchange=${() => this.associateInputAndLabel()}></slot>\n </cds-internal-control-label>`\n : ''}\n `;\n }\n get messagesTemplate() {\n return html `\n <div cds-layout=\"${this.layout === 'compact' ? 'align:shrink' : ''}\" class=\"messages\">\n <slot name=\"message\"></slot>\n </div>\n `;\n }\n get prefixTemplate() {\n return html `\n <div cds-layout=\"align:shrink align:vertical-center\" class=\"prefix\">\n <div cds-layout=\"horizontal gap:xxs\">\n ${this.prefixDefaultTemplate}\n <slot name=\"prefix\"></slot>\n </div>\n </div>\n `;\n }\n get suffixTemplate() {\n return html `\n <div cds-layout=\"align:shrink align:vertical-center\" class=\"suffix\">\n <div cds-layout=\"horizontal gap:xxs\">\n <slot name=\"suffix\"></slot>\n ${this.suffixDefaultTemplate}\n </div>\n </div>\n `;\n }\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('cds-control', '');\n }\n firstUpdated(props) {\n super.firstUpdated(props);\n this.setupHostAttributes();\n this.setupHTML5Validation();\n this.setActionOffsetPadding();\n this.setupResponsive();\n this.setupDescribedByUpdates();\n this.setupLabelLayout();\n this.assignSlotIfInControlGroup();\n }\n updated(props) {\n super.updated(props);\n this.messages.forEach(message => syncProps(message, this, { disabled: props.has('disabled') }));\n syncProps(this.inputControl, this, { disabled: props.has('disabled') });\n }\n disconnectedCallback() {\n super.disconnectedCallback();\n this.observers.forEach(o => o?.disconnect());\n }\n associateInputAndLabel() {\n associateInputAndLabel(this.inputControl, this.label);\n }\n associateInputToDatalist() {\n associateInputToDatalist(this.inputControl, this.datalistControl);\n }\n setupDescribedByUpdates() {\n this.messageSlot?.addEventListener('slotchange', async () => {\n describeElementByElements(this.inputControl, Array.from(this.messages));\n getCurrentMessageStatus(Array.from(this.messages)).then(s => (this.status = s));\n });\n }\n setupHostAttributes() {\n this.inputControl.addEventListener('focusin', () => (this.focused = true));\n this.inputControl.addEventListener('focusout', () => (this.focused = false));\n this.observers.push(getElementUpdates(this.inputControl, 'disabled', (value) => (this.disabled = value === '' ? true : value)), getElementUpdates(this.inputControl, 'aria-disabled', (value) => (this.disabled = value === 'true' ? true : false)), getElementUpdates(this.inputControl, 'readonly', (value) => (this.readonly = value === '' ? true : value)));\n }\n setupHTML5Validation() {\n if (!this.inputControl?.form?.noValidate && this.validate) {\n syncHTML5Validation(this, Array.from(this.messages));\n }\n }\n async setActionOffsetPadding() {\n const prefix = this.prefixAction?.updateComplete;\n const suffix = this.suffixAction?.updateComplete;\n (await prefix) ? prefix : Promise.resolve(true);\n (await suffix) ? suffix : Promise.resolve(true);\n await childrenUpdateComplete(this.controlActions);\n if (!this.isGenericControl && this.supportsPrefixSuffixActions && this.hasControlActions) {\n const start = pxToRem(this.prefixAction.getBoundingClientRect().width + 6);\n const end = pxToRem(this.suffixAction.getBoundingClientRect().width + 6);\n this.inputControl.style.setProperty('padding-left', this.isRTL ? end : start, 'important');\n this.inputControl.style.setProperty('padding-right', this.isRTL ? start : end, 'important');\n }\n }\n /** @private */\n get layoutStable() {\n return (this.labelLayout !== ControlLabelLayout.default ||\n !controlIsWrapped(this.inputControl, this.controlLabel, this.layout));\n }\n setupResponsive() {\n if (this.responsive && this.labelLayout === ControlLabelLayout.default && this.controlLabel) {\n const layoutConfig = { layouts: formLayouts, initialLayout: this.layout };\n this.addEventListener('cdsResizeChange', () => {\n calculateOptimalLayout(this, layoutConfig).then(updated => {\n if (updated) {\n this.layoutChange.emit(this.layout, { bubbles: true });\n }\n });\n });\n }\n }\n setupLabelLayout() {\n if (this.label?.getAttribute('cds-layout')?.includes('display:screen-reader-only')) {\n this.labelLayout = ControlLabelLayout.hiddenLabel;\n }\n if (this.hasAriaLabelTypeAttr) {\n this.labelLayout = ControlLabelLayout.ariaLabel;\n }\n }\n assignSlotIfInControlGroup() {\n if (this.parentElement?.hasAttribute('cds-control-group')) {\n this.setAttribute('slot', 'controls');\n }\n }\n};\n__decorate([\n property({ type: String })\n], CdsControl.prototype, \"status\", void 0);\n__decorate([\n property({ type: String })\n], CdsControl.prototype, \"controlWidth\", void 0);\n__decorate([\n property({ type: Boolean })\n], CdsControl.prototype, \"validate\", void 0);\n__decorate([\n property({ type: Boolean })\n], CdsControl.prototype, \"responsive\", void 0);\n__decorate([\n property({ type: String })\n], CdsControl.prototype, \"layout\", null);\n__decorate([\n state({ type: Boolean, reflect: true })\n], CdsControl.prototype, \"focused\", void 0);\n__decorate([\n state({ type: Boolean, reflect: true })\n], CdsControl.prototype, \"disabled\", void 0);\n__decorate([\n state({ type: Boolean, reflect: true })\n], CdsControl.prototype, \"readonly\", void 0);\n__decorate([\n state()\n], CdsControl.prototype, \"fixedControlWidth\", void 0);\n__decorate([\n state()\n], CdsControl.prototype, \"supportsPrefixSuffixActions\", void 0);\n__decorate([\n state()\n], CdsControl.prototype, \"isRTL\", null);\n__decorate([\n state()\n], CdsControl.prototype, \"labelLayout\", void 0);\n__decorate([\n querySlot('input, select, textarea, [cds-control]', {\n required: 'error',\n requiredMessage: 'input element is missing',\n assign: 'input',\n })\n], CdsControl.prototype, \"inputControl\", void 0);\n__decorate([\n querySlot('label', {\n required: 'error',\n requiredMessage: 'To meet a11y standards either a <label> or input[aria-label] should be provided.',\n assign: 'label',\n exemptOn: _this => {\n return _this.hasAriaLabelTypeAttr;\n },\n })\n], CdsControl.prototype, \"label\", void 0);\n__decorate([\n query('cds-internal-control-label[action=primary]')\n], CdsControl.prototype, \"controlLabel\", void 0);\n__decorate([\n querySlot('datalist', { assign: 'datalist' })\n], CdsControl.prototype, \"datalistControl\", void 0);\n__decorate([\n querySlotAll('cds-control-message')\n], CdsControl.prototype, \"messages\", void 0);\n__decorate([\n querySlotAll('[cds-button-action]')\n], CdsControl.prototype, \"controlActions\", void 0);\n__decorate([\n query('.prefix')\n], CdsControl.prototype, \"prefixAction\", void 0);\n__decorate([\n query('.suffix')\n], CdsControl.prototype, \"suffixAction\", void 0);\n__decorate([\n query('.messages')\n], CdsControl.prototype, \"messageSlot\", void 0);\n__decorate([\n event()\n], CdsControl.prototype, \"layoutChange\", void 0);\nCdsControl = __decorate([\n responsive()\n], CdsControl);\nexport { CdsControl };\n"],"names":["ControlLabelLayout","CdsControl","LitElement","constructor","super","this","status","controlWidth","defaultControlWidth","validate","responsive","_layout","defaultFormLayout","focused","disabled","readonly","fixedControlWidth","supportsPrefixSuffixActions","labelLayout","default","observers","layout","value","oldValue","replace","requestUpdate","isRTL","getElementLanguageDirection","styles","baseStyles","hasAriaLabelTypeAttr","inputControl","hasStatusIcon","inputGroup","render","html","hiddenLabel","associateInputAndLabel","primaryLabelTemplate","messages","length","inputTemplate","prefixTemplate","suffixTemplate","getStatusIcon","messagesTemplate","associateInputToDatalist","prefixDefaultTemplate","suffixDefaultTemplate","isGenericControl","tagName","toLowerCase","hasControlActions","controlActions","connectedCallback","setAttribute","firstUpdated","props","setupHostAttributes","setupHTML5Validation","setActionOffsetPadding","setupResponsive","setupDescribedByUpdates","setupLabelLayout","assignSlotIfInControlGroup","updated","forEach","message","syncProps","has","disconnectedCallback","o","disconnect","label","datalistControl","messageSlot","addEventListener","async","describeElementByElements","Array","from","getCurrentMessageStatus","then","s","push","getElementUpdates","form","noValidate","syncHTML5Validation","prefix","prefixAction","updateComplete","suffix","suffixAction","Promise","resolve","childrenUpdateComplete","start","pxToRem","getBoundingClientRect","width","end","style","setProperty","layoutStable","controlIsWrapped","controlLabel","layoutConfig","layouts","formLayouts","initialLayout","calculateOptimalLayout","layoutChange","emit","bubbles","getAttribute","includes","ariaLabel","parentElement","hasAttribute","__decorate","property","type","String","prototype","Boolean","state","reflect","querySlot","required","requiredMessage","assign","exemptOn","_this","query","querySlotAll","event"],"mappings":"4wBAYU,IAACA,GACX,SAAWA,GACPA,EAA4B,QAAI,UAChCA,EAA8B,UAAI,aAClCA,EAA+B,WAAI,cACnCA,EAAgC,YAAI,eAJxC,CAKGA,IAAuBA,EAAqB,KAkB5C,IAACC,EAAa,cAAyBC,EACtCC,cACIC,oBAKAC,KAAKC,OAAS,UAKdD,KAAKE,aAAeC,EAKpBH,KAAKI,UAAW,EAKhBJ,KAAKK,YAAa,EAClBL,KAAKM,QAAUC,EACfP,KAAKQ,SAAU,EACfR,KAAKS,UAAW,EAChBT,KAAKU,UAAW,EAChBV,KAAKW,mBAAoB,EACzBX,KAAKY,6BAA8B,EAEnCZ,KAAKa,YAAclB,EAAmBmB,QACtCd,KAAKe,UAAY,GAMjBC,aACA,OAAOhB,KAAKM,QAEZU,WAAOC,GACP,MAAMC,EAAWlB,KAAKM,QACtBN,KAAKM,QAAUW,EAAQA,EAAME,QAAQ,UAAW,IAAMZ,EACtDP,KAAKoB,cAAc,SAAUF,GAE7BG,YACA,MAA6C,QAAtCC,EAA4BtB,MA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CJ,EAAW,CACPc,EAAM,YACPrI,EAAW2H,UAAW,oBAAgB,GACzCJ,EAAW,CACPc,EAAM,YACPrI,EAAW2H,UAAW,oBAAgB,GACzCJ,EAAW,CACPc,EAAM,cACPrI,EAAW2H,UAAW,mBAAe,GACxCJ,EAAW,CACPgB,KACDvI,EAAW2H,UAAW,oBAAgB,GACzC3H,EAAauH,EAAW,CACpB9G,KACDT"}
1
+ {"version":3,"file":"control.element.js","sources":["../../../../src/forms/control/control.element.ts"],"sourcesContent":["/*\n * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\nimport { __decorate } from \"tslib\";\nimport { html, LitElement } from 'lit';\nimport { query } from 'lit/decorators/query.js';\nimport { baseStyles, property, querySlot, querySlotAll, childrenUpdateComplete, getElementLanguageDirection, event, describeElementByElements, state, syncProps, pxToRem, getElementUpdates, hasAriaLabelTypeAttr, calculateOptimalLayout, responsive, elementVisible, } from '@cds/core/internal';\nimport styles from './control.element.scss';\nimport { syncHTML5Validation } from '../utils/validate.js';\nimport { associateInputToDatalist, getStatusIcon, associateInputAndLabel, controlIsWrapped, formLayouts, defaultFormLayout, defaultControlWidth, getCurrentMessageStatus, } from '../utils/utils.js';\nexport var ControlLabelLayout;\n(function (ControlLabelLayout) {\n ControlLabelLayout[\"default\"] = \"default\";\n ControlLabelLayout[\"ariaLabel\"] = \"aria-label\";\n ControlLabelLayout[\"inputGroup\"] = \"input-group\";\n ControlLabelLayout[\"hiddenLabel\"] = \"hidden-label\";\n})(ControlLabelLayout || (ControlLabelLayout = {}));\n/**\n * Generic Control\n *\n * ```typescript\n * import '@cds/core/forms/register.js';\n * ```\n *\n * ```html\n * <cds-control>\n * <label>control</label>\n * <input type=\"text\" />\n * </cds-control>\n * ```\n * @element cds-control\n * @slot - For projecting input and label\n * @cssprop --label-width\n */\nlet CdsControl = class CdsControl extends LitElement {\n constructor() {\n super(...arguments);\n /**\n * Set the status of form control validation\n * @type {neutral | error | success}\n */\n this.status = 'neutral';\n /**\n * Adjust the control from the default full width or the browser default width\n * @type {stretch | shrink}\n */\n this.controlWidth = defaultControlWidth;\n /**\n * Set the validate attribute to sync with HTML5 native validation\n * https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation\n */\n this.validate = false;\n /**\n * By default forms will collapse to layout that prevents overflow.\n * If disabled control layout may break or overflow in unexpected ways.\n */\n this.responsive = true;\n this._layout = defaultFormLayout;\n this.focused = false;\n this.disabled = false;\n this.readonly = false;\n this.fixedControlWidth = false;\n this.supportsPrefixSuffixActions = true;\n /** @private */\n this.labelLayout = ControlLabelLayout.default;\n this.observers = [];\n }\n /**\n * Set to adjust the default control layout. When `responsive` is true this will be the largest size to scale to.\n * @type {vertical | horizontal | compact}\n */\n get layout() {\n return this._layout;\n }\n set layout(value) {\n const oldValue = this._layout;\n this._layout = value ? value.replace('-inline', '') : defaultFormLayout; // auto convert any form-layouts from parent groups\n this.requestUpdate('layout', oldValue);\n }\n get isRTL() {\n return getElementLanguageDirection(this) === 'rtl';\n }\n static get styles() {\n return [baseStyles, styles];\n }\n get hasAriaLabelTypeAttr() {\n return hasAriaLabelTypeAttr(this.inputControl);\n }\n get hasStatusIcon() {\n return this.labelLayout !== ControlLabelLayout.inputGroup && (this.status === 'error' || this.status === 'success');\n }\n render() {\n return html `\n ${this.labelLayout === ControlLabelLayout.hiddenLabel || this.labelLayout === ControlLabelLayout.inputGroup\n ? html `<span cds-layout=\"display:screen-reader-only\"\n ><slot name=\"label\" @slotchange=${() => this.associateInputAndLabel()}></slot\n ></span>`\n : ''}\n <div\n cds-layout=\"${this.layout === 'vertical' ? 'vertical gap:xs' : 'horizontal gap:lg'} align:stretch\"\n class=\"private-host ${this.isRTL ? 'rtl' : ''}\"\n >\n ${this.primaryLabelTemplate}\n <div\n class=\"input-message-container\"\n cds-layout=\"\n wrap:none\n ${this.layout === 'compact' ? 'horizontal' : 'vertical'}\n ${this.controlWidth === 'stretch' && !this.fixedControlWidth ? 'align:horizontal-stretch' : ''}\n ${this.messages?.length ? 'gap:xs' : ''}\"\n >\n <div cds-layout=\"horizontal gap:xs wrap:none\">\n <div\n cds-layout=\"horizontal align:top wrap:none ${this.controlWidth === 'shrink' || this.fixedControlWidth\n ? 'align:shrink'\n : 'align:horizontal-stretch'}\"\n class=\"${this.hasStatusIcon ? 'input-container with-status-icon' : 'input-container'}\"\n >\n ${this.inputTemplate} ${this.prefixTemplate}\n <slot name=\"input\"></slot>\n ${this.suffixTemplate}\n </div>\n ${this.hasStatusIcon ? getStatusIcon(this.status) : ''}\n </div>\n ${this.messagesTemplate}\n <slot name=\"datalist\" @slotchange=${() => this.associateInputToDatalist()}></slot>\n </div>\n </div>\n `;\n }\n get inputTemplate() {\n return html ``;\n }\n get prefixDefaultTemplate() {\n return null;\n }\n get suffixDefaultTemplate() {\n return null;\n }\n get isGenericControl() {\n return this.tagName.toLowerCase() === 'cds-control';\n }\n get hasControlActions() {\n return this.controlActions.length > 0 || this.prefixDefaultTemplate || this.suffixDefaultTemplate;\n }\n get primaryLabelTemplate() {\n return html `\n ${this.labelLayout === ControlLabelLayout.default\n ? html ` <cds-internal-control-label\n .disabled=\"${this.disabled}\"\n cds-layout=\"align:shrink align:top\"\n action=\"primary\"\n >\n <slot name=\"label\" @slotchange=${() => this.associateInputAndLabel()}></slot>\n </cds-internal-control-label>`\n : ''}\n `;\n }\n get messagesTemplate() {\n return html `\n <div cds-layout=\"${this.layout === 'compact' ? 'align:shrink' : ''}\" class=\"messages\">\n <slot name=\"message\"></slot>\n </div>\n `;\n }\n get prefixTemplate() {\n return html `\n <div cds-layout=\"align:shrink align:vertical-center\" class=\"prefix\">\n <div cds-layout=\"horizontal gap:xxs\">\n ${this.prefixDefaultTemplate}\n <slot name=\"prefix\"></slot>\n </div>\n </div>\n `;\n }\n get suffixTemplate() {\n return html `\n <div cds-layout=\"align:shrink align:vertical-center\" class=\"suffix\">\n <div cds-layout=\"horizontal gap:xxs\">\n <slot name=\"suffix\"></slot>\n ${this.suffixDefaultTemplate}\n </div>\n </div>\n `;\n }\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('cds-control', '');\n }\n firstUpdated(props) {\n super.firstUpdated(props);\n this.setupHostAttributes();\n this.setupHTML5Validation();\n this.setupPositioningListeners();\n this.setupResponsive();\n this.setupDescribedByUpdates();\n this.setupLabelLayout();\n this.assignSlotIfInControlGroup();\n }\n updated(props) {\n super.updated(props);\n this.messages.forEach(message => syncProps(message, this, { disabled: props.has('disabled') }));\n syncProps(this.inputControl, this, { disabled: props.has('disabled') });\n }\n disconnectedCallback() {\n super.disconnectedCallback();\n this.observers.forEach(o => o?.disconnect());\n }\n associateInputAndLabel() {\n associateInputAndLabel(this.inputControl, this.label);\n }\n associateInputToDatalist() {\n associateInputToDatalist(this.inputControl, this.datalistControl);\n }\n setupDescribedByUpdates() {\n this.messageSlot?.addEventListener('slotchange', async () => {\n describeElementByElements(this.inputControl, Array.from(this.messages));\n getCurrentMessageStatus(Array.from(this.messages)).then(s => (this.status = s));\n });\n }\n setupHostAttributes() {\n this.inputControl.addEventListener('focusin', () => (this.focused = true));\n this.inputControl.addEventListener('focusout', () => (this.focused = false));\n this.observers.push(getElementUpdates(this.inputControl, 'disabled', (value) => (this.disabled = value === '' ? true : value)), getElementUpdates(this.inputControl, 'aria-disabled', (value) => (this.disabled = value === 'true' ? true : false)), getElementUpdates(this.inputControl, 'readonly', (value) => (this.readonly = value === '' ? true : value)));\n }\n setupHTML5Validation() {\n if (!this.inputControl?.form?.noValidate && this.validate) {\n syncHTML5Validation(this, Array.from(this.messages));\n }\n }\n setupPositioningListeners() {\n this.setActionOffsetPadding();\n // https://github.com/vmware-clarity/core/issues/182\n this.observers.push(elementVisible(this.inputControl, () => this.setActionOffsetPadding()));\n }\n async setActionOffsetPadding() {\n const prefix = this.prefixAction?.updateComplete;\n const suffix = this.suffixAction?.updateComplete;\n (await prefix) ? prefix : Promise.resolve(true);\n (await suffix) ? suffix : Promise.resolve(true);\n await childrenUpdateComplete(this.controlActions);\n if (!this.isGenericControl && this.supportsPrefixSuffixActions && this.hasControlActions) {\n const start = pxToRem(this.prefixAction.getBoundingClientRect().width + 6);\n const end = pxToRem(this.suffixAction.getBoundingClientRect().width + 6);\n this.inputControl.style.setProperty('padding-left', this.isRTL ? end : start, 'important');\n this.inputControl.style.setProperty('padding-right', this.isRTL ? start : end, 'important');\n }\n }\n /** @private */\n get layoutStable() {\n return (this.labelLayout !== ControlLabelLayout.default ||\n !controlIsWrapped(this.inputControl, this.controlLabel, this.layout));\n }\n setupResponsive() {\n if (this.responsive && this.labelLayout === ControlLabelLayout.default && this.controlLabel) {\n const layoutConfig = { layouts: formLayouts, initialLayout: this.layout };\n this.addEventListener('cdsResizeChange', () => {\n calculateOptimalLayout(this, layoutConfig).then(updated => {\n if (updated) {\n this.layoutChange.emit(this.layout, { bubbles: true });\n }\n });\n });\n }\n }\n setupLabelLayout() {\n if (this.label?.getAttribute('cds-layout')?.includes('display:screen-reader-only')) {\n this.labelLayout = ControlLabelLayout.hiddenLabel;\n }\n if (this.hasAriaLabelTypeAttr) {\n this.labelLayout = ControlLabelLayout.ariaLabel;\n }\n }\n assignSlotIfInControlGroup() {\n if (this.parentElement?.hasAttribute('cds-control-group')) {\n this.setAttribute('slot', 'controls');\n }\n }\n};\n__decorate([\n property({ type: String })\n], CdsControl.prototype, \"status\", void 0);\n__decorate([\n property({ type: String })\n], CdsControl.prototype, \"controlWidth\", void 0);\n__decorate([\n property({ type: Boolean })\n], CdsControl.prototype, \"validate\", void 0);\n__decorate([\n property({ type: Boolean })\n], CdsControl.prototype, \"responsive\", void 0);\n__decorate([\n property({ type: String })\n], CdsControl.prototype, \"layout\", null);\n__decorate([\n state({ type: Boolean, reflect: true })\n], CdsControl.prototype, \"focused\", void 0);\n__decorate([\n state({ type: Boolean, reflect: true })\n], CdsControl.prototype, \"disabled\", void 0);\n__decorate([\n state({ type: Boolean, reflect: true })\n], CdsControl.prototype, \"readonly\", void 0);\n__decorate([\n state()\n], CdsControl.prototype, \"fixedControlWidth\", void 0);\n__decorate([\n state()\n], CdsControl.prototype, \"supportsPrefixSuffixActions\", void 0);\n__decorate([\n state()\n], CdsControl.prototype, \"isRTL\", null);\n__decorate([\n state()\n], CdsControl.prototype, \"labelLayout\", void 0);\n__decorate([\n querySlot('input, select, textarea, [cds-control]', {\n required: 'error',\n requiredMessage: 'input element is missing',\n assign: 'input',\n })\n], CdsControl.prototype, \"inputControl\", void 0);\n__decorate([\n querySlot('label', {\n required: 'error',\n requiredMessage: 'To meet a11y standards either a <label> or input[aria-label] should be provided.',\n assign: 'label',\n exemptOn: _this => {\n return _this.hasAriaLabelTypeAttr;\n },\n })\n], CdsControl.prototype, \"label\", void 0);\n__decorate([\n query('cds-internal-control-label[action=primary]')\n], CdsControl.prototype, \"controlLabel\", void 0);\n__decorate([\n querySlot('datalist', { assign: 'datalist' })\n], CdsControl.prototype, \"datalistControl\", void 0);\n__decorate([\n querySlotAll('cds-control-message')\n], CdsControl.prototype, \"messages\", void 0);\n__decorate([\n querySlotAll('[cds-button-action]')\n], CdsControl.prototype, \"controlActions\", void 0);\n__decorate([\n query('.prefix')\n], CdsControl.prototype, \"prefixAction\", void 0);\n__decorate([\n query('.suffix')\n], CdsControl.prototype, \"suffixAction\", void 0);\n__decorate([\n query('.messages')\n], CdsControl.prototype, \"messageSlot\", void 0);\n__decorate([\n event()\n], CdsControl.prototype, \"layoutChange\", void 0);\nCdsControl = __decorate([\n responsive()\n], CdsControl);\nexport { CdsControl };\n"],"names":["ControlLabelLayout","CdsControl","LitElement","constructor","super","this","status","controlWidth","defaultControlWidth","validate","responsive","_layout","defaultFormLayout","focused","disabled","readonly","fixedControlWidth","supportsPrefixSuffixActions","labelLayout","default","observers","layout","value","oldValue","replace","requestUpdate","isRTL","getElementLanguageDirection","styles","baseStyles","hasAriaLabelTypeAttr","inputControl","hasStatusIcon","inputGroup","render","html","hiddenLabel","associateInputAndLabel","primaryLabelTemplate","messages","length","inputTemplate","prefixTemplate","suffixTemplate","getStatusIcon","messagesTemplate","associateInputToDatalist","prefixDefaultTemplate","suffixDefaultTemplate","isGenericControl","tagName","toLowerCase","hasControlActions","controlActions","connectedCallback","setAttribute","firstUpdated","props","setupHostAttributes","setupHTML5Validation","setupPositioningListeners","setupResponsive","setupDescribedByUpdates","setupLabelLayout","assignSlotIfInControlGroup","updated","forEach","message","syncProps","has","disconnectedCallback","o","disconnect","label","datalistControl","messageSlot","addEventListener","async","describeElementByElements","Array","from","getCurrentMessageStatus","then","s","push","getElementUpdates","form","noValidate","syncHTML5Validation","setActionOffsetPadding","elementVisible","prefix","prefixAction","updateComplete","suffix","suffixAction","Promise","resolve","childrenUpdateComplete","start","pxToRem","getBoundingClientRect","width","end","style","setProperty","layoutStable","controlIsWrapped","controlLabel","layoutConfig","layouts","formLayouts","initialLayout","calculateOptimalLayout","layoutChange","emit","bubbles","getAttribute","includes","ariaLabel","parentElement","hasAttribute","__decorate","property","type","String","prototype","Boolean","state","reflect","querySlot","required","requiredMessage","assign","exemptOn","_this","query","querySlotAll","event"],"mappings":"gyBAYU,IAACA,GACX,SAAWA,GACPA,EAA4B,QAAI,UAChCA,EAA8B,UAAI,aAClCA,EAA+B,WAAI,cACnCA,EAAgC,YAAI,eAJxC,CAKGA,IAAuBA,EAAqB,KAkB5C,IAACC,EAAa,cAAyBC,EACtCC,cACIC,oBAKAC,KAAKC,OAAS,UAKdD,KAAKE,aAAeC,EAKpBH,KAAKI,UAAW,EAKhBJ,KAAKK,YAAa,EAClBL,KAAKM,QAAUC,EACfP,KAAKQ,SAAU,EACfR,KAAKS,UAAW,EAChBT,KAAKU,UAAW,EAChBV,KAAKW,mBAAoB,EACzBX,KAAKY,6BAA8B,EAEnCZ,KAAKa,YAAclB,EAAmBmB,QACtCd,KAAKe,UAAY,GAMjBC,aACA,OAAOhB,KAAKM,QAEZU,WAAOC,GACP,MAAMC,EAAWlB,KAAKM,QACtBN,KAAKM,QAAUW,EAAQ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zCJ,EAAW,CACPQ,EAAU,WAAY,CAAEG,OAAQ,cACjCpI,EAAW6H,UAAW,uBAAmB,GAC5CJ,EAAW,CACPe,EAAa,wBACdxI,EAAW6H,UAAW,gBAAY,GACrCJ,EAAW,CACPe,EAAa,wBACdxI,EAAW6H,UAAW,sBAAkB,GAC3CJ,EAAW,CACPc,EAAM,YACPvI,EAAW6H,UAAW,oBAAgB,GACzCJ,EAAW,CACPc,EAAM,YACPvI,EAAW6H,UAAW,oBAAgB,GACzCJ,EAAW,CACPc,EAAM,cACPvI,EAAW6H,UAAW,mBAAe,GACxCJ,EAAW,CACPgB,KACDzI,EAAW6H,UAAW,oBAAgB,GACzC7H,EAAayH,EAAW,CACpBhH,KACDT"}
@@ -1,13 +1,10 @@
1
1
  import { ReactiveController, ReactiveElement } from 'lit';
2
- export declare type AriaPopupTrigger = {
3
- popup: string;
4
- };
5
2
  /**
6
3
  * Provides all nessesary aria-* attributes to create a vaild aria popup trigger.
7
4
  * Used in combination of the `@ariaPopup` controller.
8
5
  */
9
- export declare function ariaPopupTrigger<T extends ReactiveElement & AriaPopupTrigger>(): ClassDecorator;
10
- export declare class AriaPopupTriggerController<T extends ReactiveElement & AriaPopupTrigger> implements ReactiveController {
6
+ export declare function ariaPopupTrigger<T extends ReactiveElement>(): ClassDecorator;
7
+ export declare class AriaPopupTriggerController<T extends ReactiveElement> implements ReactiveController {
11
8
  private host;
12
9
  constructor(host: T);
13
10
  hostConnected(): void;
@@ -1,2 +1,2 @@
1
- function t(){return t=>t.addInitializer((t=>new s(t)))}class s{constructor(t){this.host=t,this.host.addController(this)}hostConnected(){this.host.popup&&(this.host.ariaControls=this.host.popup,this.host.ariaHasPopup="true",this.host.ariaExpanded="false")}}export{s as AriaPopupTriggerController,t as ariaPopupTrigger};
1
+ function t(){return t=>t.addInitializer((t=>new s(t)))}class s{constructor(t){this.host=t,this.host.addController(this)}hostConnected(){(this.host.hasAttribute("aria-controls")||this.host.ariaControls)&&(this.host.ariaHasPopup="true",this.host.ariaExpanded="false")}}export{s as AriaPopupTriggerController,t as ariaPopupTrigger};
2
2
  //# sourceMappingURL=aria-popup-trigger.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"aria-popup-trigger.controller.js","sources":["../../../../src/internal/controllers/aria-popup-trigger.controller.ts"],"sourcesContent":["/*\n * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\n/**\n * Provides all nessesary aria-* attributes to create a vaild aria popup trigger.\n * Used in combination of the `@ariaPopup` controller.\n */\nexport function ariaPopupTrigger() {\n return (target) => target.addInitializer((instance) => new AriaPopupTriggerController(instance));\n}\nexport class AriaPopupTriggerController {\n constructor(host) {\n this.host = host;\n this.host.addController(this);\n }\n hostConnected() {\n if (this.host.popup) {\n this.host.ariaControls = this.host.popup;\n this.host.ariaHasPopup = 'true';\n this.host.ariaExpanded = 'false';\n }\n }\n}\n"],"names":["ariaPopupTrigger","target","addInitializer","instance","AriaPopupTriggerController","constructor","host","this","addController","hostConnected","popup","ariaControls","ariaHasPopup","ariaExpanded"],"mappings":"AASO,SAASA,IACZ,OAAQC,GAAWA,EAAOC,gBAAgBC,GAAa,IAAIC,EAA2BD,KAEnF,MAAMC,EACTC,YAAYC,GACRC,KAAKD,KAAOA,EACZC,KAAKD,KAAKE,cAAcD,MAE5BE,gBACQF,KAAKD,KAAKI,QACVH,KAAKD,KAAKK,aAAeJ,KAAKD,KAAKI,MACnCH,KAAKD,KAAKM,aAAe,OACzBL,KAAKD,KAAKO,aAAe"}
1
+ {"version":3,"file":"aria-popup-trigger.controller.js","sources":["../../../../src/internal/controllers/aria-popup-trigger.controller.ts"],"sourcesContent":["/*\n * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\n/**\n * Provides all nessesary aria-* attributes to create a vaild aria popup trigger.\n * Used in combination of the `@ariaPopup` controller.\n */\nexport function ariaPopupTrigger() {\n return (target) => target.addInitializer((instance) => new AriaPopupTriggerController(instance));\n}\nexport class AriaPopupTriggerController {\n constructor(host) {\n this.host = host;\n this.host.addController(this);\n }\n hostConnected() {\n if (this.host.hasAttribute('aria-controls') || this.host.ariaControls) {\n this.host.ariaHasPopup = 'true';\n this.host.ariaExpanded = 'false';\n }\n }\n}\n"],"names":["ariaPopupTrigger","target","addInitializer","instance","AriaPopupTriggerController","constructor","host","this","addController","hostConnected","hasAttribute","ariaControls","ariaHasPopup","ariaExpanded"],"mappings":"AASO,SAASA,IACZ,OAAQC,GAAWA,EAAOC,gBAAgBC,GAAa,IAAIC,EAA2BD,KAEnF,MAAMC,EACTC,YAAYC,GACRC,KAAKD,KAAOA,EACZC,KAAKD,KAAKE,cAAcD,MAE5BE,iBACQF,KAAKD,KAAKI,aAAa,kBAAoBH,KAAKD,KAAKK,gBACrDJ,KAAKD,KAAKM,aAAe,OACzBL,KAAKD,KAAKO,aAAe"}
@@ -1,2 +1,2 @@
1
- import{listenForAttributeChange as t}from"../utils/events.js";import{TriggerController as e}from"./trigger.controller.js";function r(){return t=>t.addInitializer((t=>new i(t)))}class i{constructor(t){this.host=t,this.host.addController(this),this.trigger=new e(this.host,{focus:!1})}async hostConnected(){await this.host.updateComplete,this.observer=t(this.host,"hidden",(()=>this.updateTrigger(!this.host.hidden)))}async hostUpdate(){await this.host.updateComplete,this.updateTrigger(!this.host.hidden)}hostDisconnected(){this.updateTrigger(!1),this.observer?.disconnect()}updateTrigger(t){this.trigger.current?.hasAttribute("popup")&&(this.trigger.current.ariaExpanded=""+t),this.trigger.prev?.hasAttribute("popup")&&this.trigger.prev!==this.trigger.current&&(this.trigger.prev.ariaExpanded="false")}}export{i as AriaPopupController,r as ariaPopup};
1
+ import{listenForAttributeChange as t}from"../utils/events.js";import{TriggerController as r}from"./trigger.controller.js";function e(){return t=>t.addInitializer((t=>new i(t)))}class i{constructor(t){this.host=t,this.host.addController(this),this.trigger=new r(this.host,{focus:!1})}async hostConnected(){await this.host.updateComplete,this.observer=t(this.host,"hidden",(()=>this.updateTrigger(!this.host.hidden)))}async hostUpdate(){await this.host.updateComplete,this.updateTrigger(!this.host.hidden)}hostDisconnected(){this.updateTrigger(!1),this.observer?.disconnect()}updateTrigger(t){this.trigger.current?.hasAttribute("aria-controls")&&(this.trigger.current.ariaExpanded=""+t),this.trigger.prev?.hasAttribute("aria-controls")&&this.trigger.prev!==this.trigger.current&&(this.trigger.prev.ariaExpanded="false")}}export{i as AriaPopupController,e as ariaPopup};
2
2
  //# sourceMappingURL=aria-popup.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"aria-popup.controller.js","sources":["../../../../src/internal/controllers/aria-popup.controller.ts"],"sourcesContent":["/*\n * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\nimport { listenForAttributeChange } from '../utils/events.js';\nimport { TriggerController } from './trigger.controller.js';\n/**\n * Provides all nessesary aria-* attributes to create a vaild aria popup.\n * Used in combination of the `@ariaPopupTrigger` controller.\n */\nexport function ariaPopup() {\n return (target) => target.addInitializer((instance) => new AriaPopupController(instance));\n}\nexport class AriaPopupController {\n constructor(host) {\n this.host = host;\n this.host.addController(this);\n this.trigger = new TriggerController(this.host, { focus: false });\n }\n async hostConnected() {\n await this.host.updateComplete;\n this.observer = listenForAttributeChange(this.host, 'hidden', () => this.updateTrigger(!this.host.hidden));\n }\n async hostUpdate() {\n await this.host.updateComplete;\n this.updateTrigger(!this.host.hidden);\n }\n hostDisconnected() {\n this.updateTrigger(false);\n this.observer?.disconnect();\n }\n updateTrigger(expanded) {\n if (this.trigger.current?.hasAttribute('popup')) {\n this.trigger.current.ariaExpanded = `${expanded}`;\n }\n if (this.trigger.prev?.hasAttribute('popup') && this.trigger.prev !== this.trigger.current) {\n this.trigger.prev.ariaExpanded = 'false';\n }\n }\n}\n"],"names":["ariaPopup","target","addInitializer","instance","AriaPopupController","constructor","host","this","addController","trigger","TriggerController","focus","async","updateComplete","observer","listenForAttributeChange","updateTrigger","hidden","hostDisconnected","disconnect","expanded","current","hasAttribute","ariaExpanded","prev"],"mappings":"0HAWO,SAASA,IACZ,OAAQC,GAAWA,EAAOC,gBAAgBC,GAAa,IAAIC,EAAoBD,KAE5E,MAAMC,EACTC,YAAYC,GACRC,KAAKD,KAAOA,EACZC,KAAKD,KAAKE,cAAcD,MACxBA,KAAKE,QAAU,IAAIC,EAAkBH,KAAKD,KAAM,CAAEK,OAAO,IAE7DC,4BACUL,KAAKD,KAAKO,eAChBN,KAAKO,SAAWC,EAAyBR,KAAKD,KAAM,UAAU,IAAMC,KAAKS,eAAeT,KAAKD,KAAKW,UAEtGL,yBACUL,KAAKD,KAAKO,eAChBN,KAAKS,eAAeT,KAAKD,KAAKW,QAElCC,mBACIX,KAAKS,eAAc,GACnBT,KAAKO,UAAUK,aAEnBH,cAAcI,GACNb,KAAKE,QAAQY,SAASC,aAAa,WACnCf,KAAKE,QAAQY,QAAQE,aAAe,GAAGH,GAEvCb,KAAKE,QAAQe,MAAMF,aAAa,UAAYf,KAAKE,QAAQe,OAASjB,KAAKE,QAAQY,UAC/Ed,KAAKE,QAAQe,KAAKD,aAAe"}
1
+ {"version":3,"file":"aria-popup.controller.js","sources":["../../../../src/internal/controllers/aria-popup.controller.ts"],"sourcesContent":["/*\n * Copyright (c) 2016-2022 VMware, Inc. All Rights Reserved.\n * This software is released under MIT license.\n * The full license information can be found in LICENSE in the root directory of this project.\n */\nimport { listenForAttributeChange } from '../utils/events.js';\nimport { TriggerController } from './trigger.controller.js';\n/**\n * Provides all nessesary aria-* attributes to create a vaild aria popup.\n * Used in combination of the `@ariaPopupTrigger` controller.\n */\nexport function ariaPopup() {\n return (target) => target.addInitializer((instance) => new AriaPopupController(instance));\n}\nexport class AriaPopupController {\n constructor(host) {\n this.host = host;\n this.host.addController(this);\n this.trigger = new TriggerController(this.host, { focus: false });\n }\n async hostConnected() {\n await this.host.updateComplete;\n this.observer = listenForAttributeChange(this.host, 'hidden', () => this.updateTrigger(!this.host.hidden));\n }\n async hostUpdate() {\n await this.host.updateComplete;\n this.updateTrigger(!this.host.hidden);\n }\n hostDisconnected() {\n this.updateTrigger(false);\n this.observer?.disconnect();\n }\n updateTrigger(expanded) {\n if (this.trigger.current?.hasAttribute('aria-controls')) {\n this.trigger.current.ariaExpanded = `${expanded}`;\n }\n if (this.trigger.prev?.hasAttribute('aria-controls') && this.trigger.prev !== this.trigger.current) {\n this.trigger.prev.ariaExpanded = 'false';\n }\n }\n}\n"],"names":["ariaPopup","target","addInitializer","instance","AriaPopupController","constructor","host","this","addController","trigger","TriggerController","focus","async","updateComplete","observer","listenForAttributeChange","updateTrigger","hidden","hostDisconnected","disconnect","expanded","current","hasAttribute","ariaExpanded","prev"],"mappings":"0HAWO,SAASA,IACZ,OAAQC,GAAWA,EAAOC,gBAAgBC,GAAa,IAAIC,EAAoBD,KAE5E,MAAMC,EACTC,YAAYC,GACRC,KAAKD,KAAOA,EACZC,KAAKD,KAAKE,cAAcD,MACxBA,KAAKE,QAAU,IAAIC,EAAkBH,KAAKD,KAAM,CAAEK,OAAO,IAE7DC,4BACUL,KAAKD,KAAKO,eAChBN,KAAKO,SAAWC,EAAyBR,KAAKD,KAAM,UAAU,IAAMC,KAAKS,eAAeT,KAAKD,KAAKW,UAEtGL,yBACUL,KAAKD,KAAKO,eAChBN,KAAKS,eAAeT,KAAKD,KAAKW,QAElCC,mBACIX,KAAKS,eAAc,GACnBT,KAAKO,UAAUK,aAEnBH,cAAcI,GACNb,KAAKE,QAAQY,SAASC,aAAa,mBACnCf,KAAKE,QAAQY,QAAQE,aAAe,GAAGH,GAEvCb,KAAKE,QAAQe,MAAMF,aAAa,kBAAoBf,KAAKE,QAAQe,OAASjB,KAAKE,QAAQY,UACvFd,KAAKE,QAAQe,KAAKD,aAAe"}
@@ -1,2 +1,2 @@
1
- import{isBrowser as e}from"./environment.js";import{getAngularVersion as n,getAngularJSVersion as o,getReactVersion as t,getVueVersion as i}from"./framework.js";import{browserFeatures as s}from"./supports.js";import{LogService as r}from"../services/log.service.js";function w(){e()&&(window.CDS=window.CDS||{_version:[],_react:{version:void 0},_supports:s.supports,_isStateProxied:!1,_state:{focusTrapItems:[],layerElements:[],i18nRegistry:{},elementRegistry:{},iconRegistry:{},motionRegistry:{}},environment:{production:!1},getDetails:a,logDetails:d},function(){const e="6.1.6";window.CDS._version.indexOf(e)<0&&(window.CDS._version.push(e),document.querySelector("body")?.setAttribute("cds-version",window.CDS._version.join(" "))),window.CDS._version.length>1&&r.warn("Running more than one version of Clarity can cause unexpected issues. Please ensure only one version is loaded.")}(),window.CDS._isStateProxied||(window.CDS._isStateProxied=!0,window.CDS._state=new Proxy(window.CDS._state,{set:(e,n,o)=>{const t={key:n,prev:window.CDS._state[n],current:o};return e[n]=o,document.dispatchEvent(new CustomEvent("CDS_STATE_UPDATE",{detail:t})),!0}})))}function a(){return{versions:window.CDS._version,environment:window.CDS.environment,userAgent:navigator.userAgent,supports:window.CDS._supports,angularVersion:n(!1),angularJSVersion:o(!1),reactVersion:t(!1),vueVersion:i(!1),state:{...window.CDS._state,iconRegistry:Object.keys(window.CDS._state.iconRegistry),motionRegistry:Object.keys(window.CDS._state.motionRegistry),focusTrapRegistry:Object.keys(window.CDS._state.focusTrapItems.map((e=>e.focusTrapId)))}}}function d(){r.log(JSON.stringify(a(),null,2))}export{w as setupCDSGlobal};
1
+ import{isBrowser as e}from"./environment.js";import{getAngularVersion as n,getAngularJSVersion as o,getReactVersion as t,getVueVersion as i}from"./framework.js";import{browserFeatures as s}from"./supports.js";import{LogService as r}from"../services/log.service.js";function w(){e()&&(window.CDS=window.CDS||{_version:[],_react:{version:void 0},_supports:s.supports,_isStateProxied:!1,_state:{focusTrapItems:[],layerElements:[],i18nRegistry:{},elementRegistry:{},iconRegistry:{},motionRegistry:{}},environment:{production:!1},getDetails:a,logDetails:d},function(){const e="6.2.1";window.CDS._version.indexOf(e)<0&&(window.CDS._version.push(e),document.querySelector("body")?.setAttribute("cds-version",window.CDS._version.join(" "))),window.CDS._version.length>1&&r.warn("Running more than one version of Clarity can cause unexpected issues. Please ensure only one version is loaded.")}(),window.CDS._isStateProxied||(window.CDS._isStateProxied=!0,window.CDS._state=new Proxy(window.CDS._state,{set:(e,n,o)=>{const t={key:n,prev:window.CDS._state[n],current:o};return e[n]=o,document.dispatchEvent(new CustomEvent("CDS_STATE_UPDATE",{detail:t})),!0}})))}function a(){return{versions:window.CDS._version,environment:window.CDS.environment,userAgent:navigator.userAgent,supports:window.CDS._supports,angularVersion:n(!1),angularJSVersion:o(!1),reactVersion:t(!1),vueVersion:i(!1),state:{...window.CDS._state,iconRegistry:Object.keys(window.CDS._state.iconRegistry),motionRegistry:Object.keys(window.CDS._state.motionRegistry),focusTrapRegistry:Object.keys(window.CDS._state.focusTrapItems.map((e=>e.focusTrapId)))}}}function d(){r.log(JSON.stringify(a(),null,2))}export{w as setupCDSGlobal};
2
2
  //# sourceMappingURL=global.js.map
package/package.json CHANGED
@@ -256,5 +256,5 @@
256
256
  "./tokens/tokens.ios.swift": "./tokens/tokens.ios.swift",
257
257
  "./tokens/tokens.android.xml": "./tokens/tokens.android.xml"
258
258
  },
259
- "version": "6.1.6"
259
+ "version": "6.2.1"
260
260
  }