@cds/core 5.7.3 → 5.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{css as a}from"lit";var l=a`:host{--container-padding:var(--cds-global-space-2, calc(2 / var(--cds-global-base, 20) * 1rem)) 0;--min-height:var(--cds-global-space-9, calc(24 / var(--cds-global-base, 20) * 1rem));--color:var(--cds-global-typography-color-400, var(--cds-global-color-construction-900, #21333b));--font-size:var(--cds-global-typography-secondary-font-size, calc(13 / var(--cds-global-base, 20) * 1rem));--font-weight:var(--cds-global-typography-secondary-font-weight, 400);--letter-spacing:var(--cds-global-typography-body-letter-spacing, -0.014286em);--icon-size:var(--cds-global-space-8, calc(18 / var(--cds-global-base, 20) * 1rem));--icon-color:var(--color);width:100%}.private-host{min-height:var(--min-height);color:var(--color)}:host([_type=banner]) ::slotted(cds-alert-actions),:host([_type=default]) ::slotted(cds-alert-actions){--action-size:calc(var(--min-height) - var(--cds-global-space-4, calc(6 / var(--cds-global-base, 20) * 1rem)));white-space:nowrap;display:block}:host([_type=banner]){--icon-size:var(--cds-global-space-9, calc(24 / var(--cds-global-base, 20) * 1rem))}.alert-status-icon,::slotted(cds-icon){height:var(--icon-size);width:var(--icon-size);--color:var(--icon-color)}cds-internal-close-button{--color:inherit}.alert-content-wrapper,.alert-icon-wrapper{display:flex;min-height:var(--cds-global-space-6,calc(12 / var(--cds-global-base,20) * 1rem));padding:var(--container-padding)}.alert-icon-wrapper{min-width:var(--icon-size)}.alert-content-wrapper{display:inline-flex;align-items:center;transform:translateY(var(--cds-global-space-1,calc(1 / var(--cds-global-base,20) * 1rem)));color:var(--color);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:var(--letter-spacing);line-height:var(--cds-global-typography-body-line-height,1.42857em)}::slotted(cds-alert-actions){--action-text-color:var(--color);--action-size:var(--cds-global-typography-body-line-height, 1.42857em);display:none}:host([_type=default]) cds-internal-close-button{height:var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem))}:host([_type=default]) .alert-content-wrapper{align-items:self-start}:host([_type=light][status=info]){--icon-color:var(--cds-alias-status-info, var(--cds-global-color-blue-700, #0079ad))}:host([_type=light][status=success]){--icon-color:var(--cds-alias-status-success, var(--cds-global-color-green-700, #42810e))}:host([_type=light][status=warning]){--icon-color:var(--cds-alias-status-warning-dark, var(--cds-global-color-ochre-800, #a36500))}:host([_type=light][status=danger]){--icon-color:var(--cds-alias-status-danger, var(--cds-global-color-red-700, #e02200))}:host([status=loading][_type=banner]) .alert-spinner,:host([status=loading][_type=default]) .alert-spinner{--ring-color:var(--cds-alias-object-opacity-200, rgba(0, 0, 0, 0.4))}:host([status=loading][_type=banner]) .alert-spinner{--fill-color:var(--icon-color)}:host([size=sm]:not([_type=banner])){--font-size:var(--cds-global-typography-font-size-1, calc(11 / var(--cds-global-base, 20) * 1rem));--letter-spacing:normal}:host([_type=banner]) .alert-content-wrapper{transform:none;min-height:var(--cds-global-space-10,calc(32 / var(--cds-global-base,20) * 1rem))}:host([_type=banner]){--color:var(--cds-global-typography-color-100, var(--cds-global-color-white, white))}:host([_type=banner][status=warning]),:host([_type=default][status=warning]){--color:var(--cds-global-color-black, black)}:host([_type=banner][status=warning]) cds-alert-actions,:host([_type=default][status=warning]) cds-alert-actions{--action-hover-text-color:var(--color);--action-text-color:var(--color)}:host([_type=banner]) .spinner{height:calc(var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem)) + var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem)));width:calc(var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem)) + var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem)));min-height:calc(var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem)) + var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem)));min-width:calc(var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem)) + var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem)));margin-top:var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem))}:host([_type=banner]) cds-internal-close-button{height:var(--cds-global-space-9,calc(24 / var(--cds-global-base,20) * 1rem));margin-top:var(--cds-global-space-3,calc(4 / var(--cds-global-base,20) * 1rem))}@supports (-moz-appearance:none) and (text-emphasis:none){:host(:not([_type=banner]):not([size=sm])) .alert-content{transform:translateY(calc(-1*var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem))))}}`;export{l as default};
1
+ import{css as a}from"lit";var l=a`:host{--container-padding:var(--cds-global-space-2, calc(2 / var(--cds-global-base, 20) * 1rem)) 0;--min-height:var(--cds-global-space-9, calc(24 / var(--cds-global-base, 20) * 1rem));--color:var(--cds-global-typography-color-400, var(--cds-global-color-construction-900, #21333b));--font-size:var(--cds-global-typography-secondary-font-size, calc(13 / var(--cds-global-base, 20) * 1rem));--font-weight:var(--cds-global-typography-secondary-font-weight, 400);--letter-spacing:var(--cds-global-typography-body-letter-spacing, -0.014286em);--icon-size:var(--cds-global-space-8, calc(18 / var(--cds-global-base, 20) * 1rem));--icon-color:var(--color);width:100%}.private-host{min-height:var(--min-height);color:var(--color)}:host([_type=banner]) ::slotted(cds-alert-actions),:host([_type=default]) ::slotted(cds-alert-actions){--action-size:calc(var(--min-height) - var(--cds-global-space-4, calc(6 / var(--cds-global-base, 20) * 1rem)));white-space:nowrap;display:block}:host([_type=banner]){--icon-size:var(--cds-global-space-9, calc(24 / var(--cds-global-base, 20) * 1rem))}.alert-status-icon,::slotted(cds-icon){height:var(--icon-size);width:var(--icon-size);--color:var(--icon-color)}cds-internal-close-button{--color:inherit}.alert-content-wrapper,.alert-icon-wrapper{display:flex;min-height:var(--cds-global-space-6,calc(12 / var(--cds-global-base,20) * 1rem));padding:var(--container-padding);min-width:0}.alert-icon-wrapper{min-width:var(--icon-size)}.alert-content-wrapper{display:inline-flex;align-items:center;transform:translateY(var(--cds-global-space-1,calc(1 / var(--cds-global-base,20) * 1rem)));color:var(--color);font-size:var(--font-size);font-weight:var(--font-weight);letter-spacing:var(--letter-spacing);line-height:var(--cds-global-typography-body-line-height,1.42857em)}.alert-content{min-width:0}::slotted(cds-alert-actions){--action-text-color:var(--color);--action-size:var(--cds-global-typography-body-line-height, 1.42857em);display:none}:host([_type=default]) cds-internal-close-button{height:var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem))}:host([_type=default]) .alert-content-wrapper{align-items:self-start}:host([_type=light][status=info]){--icon-color:var(--cds-alias-status-info, var(--cds-global-color-blue-700, #0079ad))}:host([_type=light][status=success]){--icon-color:var(--cds-alias-status-success, var(--cds-global-color-green-700, #42810e))}:host([_type=light][status=warning]){--icon-color:var(--cds-alias-status-warning-dark, var(--cds-global-color-ochre-800, #a36500))}:host([_type=light][status=danger]){--icon-color:var(--cds-alias-status-danger, var(--cds-global-color-red-700, #e02200))}:host([status=loading][_type=banner]) .alert-spinner,:host([status=loading][_type=default]) .alert-spinner{--ring-color:var(--cds-alias-object-opacity-200, rgba(0, 0, 0, 0.4))}:host([status=loading][_type=banner]) .alert-spinner{--fill-color:var(--icon-color)}:host([size=sm]:not([_type=banner])){--font-size:var(--cds-global-typography-font-size-1, calc(11 / var(--cds-global-base, 20) * 1rem));--letter-spacing:normal}:host([_type=banner]) .alert-content-wrapper{transform:none;min-height:var(--cds-global-space-10,calc(32 / var(--cds-global-base,20) * 1rem))}:host([_type=banner]){--color:var(--cds-global-typography-color-100, var(--cds-global-color-white, white))}:host([_type=banner][status=warning]),:host([_type=default][status=warning]){--color:var(--cds-global-color-black, black)}:host([_type=banner][status=warning]) cds-alert-actions,:host([_type=default][status=warning]) cds-alert-actions{--action-hover-text-color:var(--color);--action-text-color:var(--color)}:host([_type=banner]) .spinner{height:calc(var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem)) + var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem)));width:calc(var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem)) + var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem)));min-height:calc(var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem)) + var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem)));min-width:calc(var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem)) + var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem)));margin-top:var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem))}:host([_type=banner]) cds-internal-close-button{height:var(--cds-global-space-9,calc(24 / var(--cds-global-base,20) * 1rem));margin-top:var(--cds-global-space-3,calc(4 / var(--cds-global-base,20) * 1rem))}@supports (-moz-appearance:none) and (text-emphasis:none){:host(:not([_type=banner]):not([size=sm])) .alert-content{transform:translateY(calc(-1*var(--cds-global-space-2,calc(2 / var(--cds-global-base,20) * 1rem))))}}`;export{l as default};
2
2
  //# sourceMappingURL=alert.element.scss.js.map
@@ -42254,17 +42254,6 @@
42254
42254
  "privacy": "protected",
42255
42255
  "description": "query for all groups (including any nested groups), used ot pass state down"
42256
42256
  },
42257
- {
42258
- "kind": "method",
42259
- "name": "toggle",
42260
- "privacy": "private"
42261
- },
42262
- {
42263
- "kind": "field",
42264
- "name": "currentActiveItem",
42265
- "privacy": "private",
42266
- "readonly": true
42267
- },
42268
42257
  {
42269
42258
  "kind": "field",
42270
42259
  "name": "endTemplate",
@@ -42277,6 +42266,18 @@
42277
42266
  "privacy": "protected",
42278
42267
  "readonly": true
42279
42268
  },
42269
+ {
42270
+ "kind": "method",
42271
+ "name": "onStartItemSlotChange"
42272
+ },
42273
+ {
42274
+ "kind": "method",
42275
+ "name": "onItemSlotChange"
42276
+ },
42277
+ {
42278
+ "kind": "method",
42279
+ "name": "updateChildrenProps"
42280
+ },
42280
42281
  {
42281
42282
  "kind": "field",
42282
42283
  "name": "visibleChildren",
@@ -42288,7 +42289,14 @@
42288
42289
  },
42289
42290
  {
42290
42291
  "kind": "method",
42291
- "name": "addStartEventListener"
42292
+ "name": "toggle",
42293
+ "privacy": "private"
42294
+ },
42295
+ {
42296
+ "kind": "field",
42297
+ "name": "currentActiveItem",
42298
+ "privacy": "private",
42299
+ "readonly": true
42292
42300
  },
42293
42301
  {
42294
42302
  "kind": "method",
@@ -42341,10 +42349,6 @@
42341
42349
  }
42342
42350
  }
42343
42351
  ]
42344
- },
42345
- {
42346
- "kind": "method",
42347
- "name": "updateChildrenProps"
42348
42352
  }
42349
42353
  ],
42350
42354
  "events": [
@@ -45599,7 +45603,16 @@
45599
45603
  {
45600
45604
  "kind": "method",
45601
45605
  "name": "setTrackWidth",
45602
- "privacy": "private"
45606
+ "privacy": "private",
45607
+ "parameters": [
45608
+ {
45609
+ "name": "val",
45610
+ "optional": true,
45611
+ "type": {
45612
+ "text": "number"
45613
+ }
45614
+ }
45615
+ ]
45603
45616
  },
45604
45617
  {
45605
45618
  "kind": "field",
@@ -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:[],i18nRegistry:{},elementRegistry:{},iconRegistry:{},motionRegistry:{}},environment:{production:!1},getDetails:a,logDetails:d},function(){var e;const n="5.7.3";window.CDS._version.indexOf(n)<0&&(window.CDS._version.push(n),null===(e=document.querySelector("body"))||void 0===e||e.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:[],i18nRegistry:{},elementRegistry:{},iconRegistry:{},motionRegistry:{}},environment:{production:!1},getDetails:a,logDetails:d},function(){var e;const n="5.8.2";window.CDS._version.indexOf(n)<0&&(window.CDS._version.push(n),null===(e=document.querySelector("body"))||void 0===e||e.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
@@ -103,13 +103,20 @@ export declare class CdsNavigation extends LitElement implements Animatable {
103
103
  * query for all groups (including any nested groups), used ot pass state down
104
104
  */
105
105
  protected navigationGroupRefs: NodeListOf<CdsNavigationGroup>;
106
- private toggle;
107
- private get currentActiveItem();
106
+ static get styles(): import("lit").CSSResultGroup[];
108
107
  protected get endTemplate(): "" | import("lit-html").TemplateResult<1>;
109
108
  protected get startTemplate(): string | import("lit-html").TemplateResult<1>;
110
- protected get visibleChildren(): FocusableElement[];
111
- addStartEventListener(): void;
109
+ render(): import("lit-html").TemplateResult<1>;
110
+ connectedCallback(): void;
111
+ disconnectedCallback(): void;
112
112
  firstUpdated(props: PropertyValues): void;
113
+ updated(props: PropertyValues<this>): void;
114
+ onStartItemSlotChange(): void;
115
+ onItemSlotChange(): void;
116
+ updateChildrenProps(): void;
117
+ protected get visibleChildren(): FocusableElement[];
118
+ private toggle;
119
+ private get currentActiveItem();
113
120
  private blurItemKeys;
114
121
  private focusRootStart;
115
122
  private blurRootStart;
@@ -117,10 +124,4 @@ export declare class CdsNavigation extends LitElement implements Animatable {
117
124
  private get focusableElements();
118
125
  private handleItemKeys;
119
126
  private handleRootStartKeys;
120
- connectedCallback(): void;
121
- disconnectedCallback(): void;
122
- render(): import("lit-html").TemplateResult<1>;
123
- updated(props: PropertyValues<this>): void;
124
- updateChildrenProps(): void;
125
- static get styles(): import("lit").CSSResultGroup[];
126
127
  }
@@ -1,2 +1,2 @@
1
- import{__decorate as t}from"tslib";import{LitElement as i,html as e}from"lit";import{I18nService as a,isVisible as n,setAttributes as o,onKey as s,syncPropsForAllItems as r,syncProps as d,baseStyles as v,property as c,event as l,state as h,i18n as p,querySlot as u,querySlotAll as g,animate as m,reverseAnimation as f}from"@cds/core/internal";import y from"./navigation.element.scss.js";import{removeFocus as I,setFocus as A,visibleElement as b,getNextFocusElement as E,getPreviousFocusElement as S}from"./utils/index.js";import{AnimationNavigationOpenName as x}from"../internal/motion/animations/cds-navigation-open.js";const N="cds-navigation";let R=class extends i{constructor(){super(...arguments);this.expandedRoot=!1,this.cdsMotion="on",this.groupItem=!0,this.expanded=!1,this.i18n=a.keys.navigation}toggle(){this.expandedChange.emit(!this.expanded)}get currentActiveItem(){return this.visibleChildren.find((t=>t.id===this.ariaActiveDescendant))}get endTemplate(){return this.navigationEnd?e`<div class="navigation-end" cds-layout="vertical align:horizontal-stretch"><slot name="cds-navigation-end"></slot></div>`:""}get startTemplate(){let t;return t=this.rootNavigationStart?e`<div class="navigation-start" cds-layout="vertical align:horizontal-stretch"><slot @slotchange="${()=>this.addStartEventListener()}" name="navigation-start"></slot><cds-divider class="start-divider"></cds-divider></div>`:"",t}get visibleChildren(){return Array.from(this.allNavigationElements).filter((t=>n(t)))}addStartEventListener(){this.rootNavigationStart&&this.rootNavigationStart.addEventListener("click",this.toggle.bind(this))}firstUpdated(t){var i;super.firstUpdated(t),this.allNavigationElements.forEach((t=>{o(t,["tabindex","-1"])}));const e=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector("#item-container");null==e||e.addEventListener("focus",this.initItemKeys.bind(this)),null==e||e.addEventListener("keydown",this.handleItemKeys.bind(this)),null==e||e.addEventListener("blur",this.blurItemKeys.bind(this))}blurItemKeys(){this.currentActiveItem&&I(this.currentActiveItem)}focusRootStart(){this.rootNavigationStart&&A(this.rootNavigationStart)}blurRootStart(){this.rootNavigationStart&&I(this.rootNavigationStart)}initItemKeys(){if(this.currentActiveItem){const t=this.currentActiveItem?this.currentActiveItem:this.allNavigationElements[0];A(t),this.ariaActiveDescendant=t.id}else A(this.focusableElements[0]),this.ariaActiveDescendant=this.focusableElements[0].id}get focusableElements(){return Array.from(this.allNavigationElements).filter(b)}handleItemKeys(t){s("arrow-down",t,(()=>{if(this.currentActiveItem){I(this.currentActiveItem);const i=E(this.currentActiveItem,this.focusableElements);this.ariaActiveDescendant=i.id,A(i),t.preventDefault()}})),s("arrow-up",t,(()=>{if(this.currentActiveItem){I(this.currentActiveItem);const i=S(this.currentActiveItem,this.focusableElements);this.ariaActiveDescendant=i.id,A(i),t.preventDefault()}})),s("arrow-right",t,(()=>{var t;const i=null===(t=this.currentActiveItem)||void 0===t?void 0:t.closest("cds-navigation-group");!i||i.expanded||i.expandedChange.emit(!i.expanded)})),s("arrow-left",t,(()=>{var t,i,e;const a=null===(t=this.currentActiveItem)||void 0===t?void 0:t.closest("cds-navigation-group");if("CDS-NAVIGATION-ITEM"===(null===(i=this.currentActiveItem)||void 0===i?void 0:i.tagName)&&a){const t=null==a?void 0:a.querySelector("cds-navigation-start");return I(this.currentActiveItem),this.ariaActiveDescendant=null!==(e=null==t?void 0:t.id)&&void 0!==e?e:null,void A(t)}a&&a.expanded&&a.expandedChange.emit(!a.expanded)})),s("home",t,(()=>{if(this.currentActiveItem){I(this.currentActiveItem);const t=this.focusableElements[0];this.ariaActiveDescendant=t.id,A(t)}})),s("end",t,(()=>{if(this.currentActiveItem){I(this.currentActiveItem);const t=this.focusableElements[this.focusableElements.length-1];this.ariaActiveDescendant=t.id,A(t)}})),s("enter",t,(()=>{var t,i;(null===(t=this.currentActiveItem)||void 0===t?void 0:t.focusElement)&&(null===(i=this.currentActiveItem)||void 0===i||i.focusElement.click())})),s("space",t,(()=>{var t,i;(null===(t=this.currentActiveItem)||void 0===t?void 0:t.focusElement)&&(null===(i=this.currentActiveItem)||void 0===i||i.focusElement.click())}))}handleRootStartKeys(t){s("arrow-right",t,(()=>{this.expanded||this.toggle()})),s("arrow-left",t,(()=>{this.expanded&&this.toggle()}))}connectedCallback(){var t,i,e;super.connectedCallback(),this.role="list",null===(t=this.rootNavigationStart)||void 0===t||t.addEventListener("focus",this.focusRootStart.bind(this)),null===(i=this.rootNavigationStart)||void 0===i||i.addEventListener("blur",this.blurRootStart.bind(this)),null===(e=this.rootNavigationStart)||void 0===e||e.addEventListener("keydown",this.handleRootStartKeys.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.rootNavigationStart&&this.rootNavigationStart.removeEventListener("click",this.toggle.bind(this))}render(){return e`<div class="private-host" aria-label="${this.i18n.navigationLabel}" cds-layout="vertical wrap:none">${this.startTemplate}<slot name="cds-navigation-substart"></slot><nav class="navigation-body-wrapper"><div .ariaActiveDescendant="${this.ariaActiveDescendant}" tabindex="0" id="item-container"><div class="navigation-body" cds-layout="vertical wrap:none align:horizontal-stretch"><slot></slot></div></div></nav>${this.endTemplate}</div>`}updated(t){super.updated(t),t.has("expanded")&&(this.expandedRoot=this.expanded),this.updateChildrenProps()}updateChildrenProps(){this.navigationGroupItems&&r(Array.from(this.navigationGroupItems),this,{groupItem:!0}),this.navigationItemRefs&&r(Array.from(this.navigationItemRefs),this,{expanded:!0}),this.navigationStartRefs&&r(Array.from(this.navigationStartRefs),this,{expandedRoot:!0}),this.rootNavigationStart&&d(this.rootNavigationStart,this,{expanded:this.expanded}),this.rootNavigationItems.length>0&&r(Array.from(this.rootNavigationItems),this,{expanded:this.expanded}),this.navigationGroupRefs.length>0&&r(Array.from(this.navigationGroupRefs),this,{layout:!0})}static get styles(){return[v,y]}};t([c({type:String})],R.prototype,"cdsMotion",void 0),t([l()],R.prototype,"expandedChange",void 0),t([l()],R.prototype,"cdsMotionChange",void 0),t([h({type:Boolean})],R.prototype,"groupItem",void 0),t([c({type:Boolean})],R.prototype,"expanded",void 0),t([p()],R.prototype,"i18n",void 0),t([u('[slot="cds-navigation-end"]',{assign:"cds-navigation-end"})],R.prototype,"navigationEnd",void 0),t([g("cds-navigation-group > cds-navigation-start, cds-navigation-item:not([disabled])")],R.prototype,"allNavigationElements",void 0),t([g("cds-navigation-start")],R.prototype,"navigationStartRefs",void 0),t([g(":scope > cds-divider")],R.prototype,"rootDividers",void 0),t([g(":scope > cds-navigation-group")],R.prototype,"rootNavigationGroups",void 0),t([g(":scope > cds-navigation-item")],R.prototype,"rootNavigationItems",void 0),t([u(":scope > cds-navigation-start",{assign:"navigation-start"})],R.prototype,"rootNavigationStart",void 0),t([g(":scope > cds-navigation-group > cds-navigation-item")],R.prototype,"navigationGroupItems",void 0),t([g("cds-navigation-item")],R.prototype,"navigationItemRefs",void 0),t([g("cds-navigation-group")],R.prototype,"navigationGroupRefs",void 0),R=t([m({expanded:{true:x,false:f(x)}})],R);export{R as CdsNavigation,N as CdsNavigationTagName};
1
+ import{__decorate as t}from"tslib";import{LitElement as i,html as e}from"lit";import{I18nService as n,baseStyles as a,setAttributes as o,syncPropsForAllItems as s,syncProps as r,isVisible as d,onKey as l,property as c,event as v,state as h,i18n as g,querySlot as p,querySlotAll as u,animate as m,reverseAnimation as f}from"@cds/core/internal";import I from"./navigation.element.scss.js";import{removeFocus as y,setFocus as A,visibleElement as b,getNextFocusElement as S,getPreviousFocusElement as x}from"./utils/index.js";import{AnimationNavigationOpenName as E}from"../internal/motion/animations/cds-navigation-open.js";const N="cds-navigation";let C=class extends i{constructor(){super(...arguments);this.expandedRoot=!1,this.cdsMotion="on",this.groupItem=!0,this.expanded=!1,this.i18n=n.keys.navigation}static get styles(){return[a,I]}get endTemplate(){return this.navigationEnd?e`<div class="navigation-end" cds-layout="vertical align:horizontal-stretch"><slot name="cds-navigation-end" @slotchange="${this.onItemSlotChange}"></slot></div>`:""}get startTemplate(){let t;return t=this.rootNavigationStart?e`<div class="navigation-start" cds-layout="vertical align:horizontal-stretch"><slot @slotchange="${()=>this.onStartItemSlotChange()}" name="navigation-start"></slot><cds-divider class="start-divider"></cds-divider></div>`:"",t}render(){return e`<div class="private-host" aria-label="${this.i18n.navigationLabel}" cds-layout="vertical wrap:none">${this.startTemplate}<slot name="cds-navigation-substart"></slot><nav class="navigation-body-wrapper"><div .ariaActiveDescendant="${this.ariaActiveDescendant}" tabindex="0" id="item-container"><div class="navigation-body" cds-layout="vertical wrap:none align:horizontal-stretch"><slot @slotchange="${this.onItemSlotChange}"></slot></div></div></nav>${this.endTemplate}</div>`}connectedCallback(){var t,i,e;super.connectedCallback(),this.role="list",null===(t=this.rootNavigationStart)||void 0===t||t.addEventListener("focus",this.focusRootStart.bind(this)),null===(i=this.rootNavigationStart)||void 0===i||i.addEventListener("blur",this.blurRootStart.bind(this)),null===(e=this.rootNavigationStart)||void 0===e||e.addEventListener("keydown",this.handleRootStartKeys.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.rootNavigationStart&&this.rootNavigationStart.removeEventListener("click",this.toggle.bind(this))}firstUpdated(t){var i;super.firstUpdated(t);const e=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector("#item-container");null==e||e.addEventListener("focus",this.initItemKeys.bind(this)),null==e||e.addEventListener("keydown",this.handleItemKeys.bind(this)),null==e||e.addEventListener("blur",this.blurItemKeys.bind(this))}updated(t){super.updated(t),t.has("expanded")&&(this.expandedRoot=this.expanded),this.updateChildrenProps()}onStartItemSlotChange(){this.onItemSlotChange(),this.rootNavigationStart&&this.rootNavigationStart.addEventListener("click",this.toggle.bind(this))}onItemSlotChange(){this.updateChildrenProps(),this.allNavigationElements.forEach((t=>{o(t,["tabindex","-1"])}))}updateChildrenProps(){this.navigationGroupItems&&s(Array.from(this.navigationGroupItems),this,{groupItem:!0}),this.navigationItemRefs&&s(Array.from(this.navigationItemRefs),this,{expanded:!0}),this.navigationStartRefs&&s(Array.from(this.navigationStartRefs),this,{expandedRoot:!0}),this.rootNavigationStart&&r(this.rootNavigationStart,this,{expanded:this.expanded}),this.rootNavigationItems.length>0&&s(Array.from(this.rootNavigationItems),this,{expanded:this.expanded}),this.navigationGroupRefs.length>0&&s(Array.from(this.navigationGroupRefs),this,{layout:!0})}get visibleChildren(){return Array.from(this.allNavigationElements).filter((t=>d(t)))}toggle(){this.expandedChange.emit(!this.expanded)}get currentActiveItem(){return this.visibleChildren.find((t=>t.id===this.ariaActiveDescendant))}blurItemKeys(){this.currentActiveItem&&y(this.currentActiveItem)}focusRootStart(){this.rootNavigationStart&&A(this.rootNavigationStart)}blurRootStart(){this.rootNavigationStart&&y(this.rootNavigationStart)}initItemKeys(){if(this.currentActiveItem){const t=this.currentActiveItem?this.currentActiveItem:this.allNavigationElements[0];A(t),this.ariaActiveDescendant=t.id}else A(this.focusableElements[0]),this.ariaActiveDescendant=this.focusableElements[0].id}get focusableElements(){return Array.from(this.allNavigationElements).filter(b)}handleItemKeys(t){l("arrow-down",t,(()=>{if(this.currentActiveItem){y(this.currentActiveItem);const i=S(this.currentActiveItem,this.focusableElements);this.ariaActiveDescendant=i.id,A(i),t.preventDefault()}})),l("arrow-up",t,(()=>{if(this.currentActiveItem){y(this.currentActiveItem);const i=x(this.currentActiveItem,this.focusableElements);this.ariaActiveDescendant=i.id,A(i),t.preventDefault()}})),l("arrow-right",t,(()=>{var t;const i=null===(t=this.currentActiveItem)||void 0===t?void 0:t.closest("cds-navigation-group");!i||i.expanded||i.expandedChange.emit(!i.expanded)})),l("arrow-left",t,(()=>{var t,i,e;const n=null===(t=this.currentActiveItem)||void 0===t?void 0:t.closest("cds-navigation-group");if("CDS-NAVIGATION-ITEM"===(null===(i=this.currentActiveItem)||void 0===i?void 0:i.tagName)&&n){const t=null==n?void 0:n.querySelector("cds-navigation-start");return y(this.currentActiveItem),this.ariaActiveDescendant=null!==(e=null==t?void 0:t.id)&&void 0!==e?e:null,void A(t)}n&&n.expanded&&n.expandedChange.emit(!n.expanded)})),l("home",t,(()=>{if(this.currentActiveItem){y(this.currentActiveItem);const t=this.focusableElements[0];this.ariaActiveDescendant=t.id,A(t)}})),l("end",t,(()=>{if(this.currentActiveItem){y(this.currentActiveItem);const t=this.focusableElements[this.focusableElements.length-1];this.ariaActiveDescendant=t.id,A(t)}})),l("enter",t,(()=>{var t,i;(null===(t=this.currentActiveItem)||void 0===t?void 0:t.focusElement)&&(null===(i=this.currentActiveItem)||void 0===i||i.focusElement.click())})),l("space",t,(()=>{var t,i;(null===(t=this.currentActiveItem)||void 0===t?void 0:t.focusElement)&&(null===(i=this.currentActiveItem)||void 0===i||i.focusElement.click())}))}handleRootStartKeys(t){l("arrow-right",t,(()=>{this.expanded||this.toggle()})),l("arrow-left",t,(()=>{this.expanded&&this.toggle()}))}};t([c({type:String})],C.prototype,"cdsMotion",void 0),t([v()],C.prototype,"expandedChange",void 0),t([v()],C.prototype,"cdsMotionChange",void 0),t([h({type:Boolean})],C.prototype,"groupItem",void 0),t([c({type:Boolean})],C.prototype,"expanded",void 0),t([g()],C.prototype,"i18n",void 0),t([p('[slot="cds-navigation-end"]',{assign:"cds-navigation-end"})],C.prototype,"navigationEnd",void 0),t([u("cds-navigation-group > cds-navigation-start, cds-navigation-item:not([disabled])")],C.prototype,"allNavigationElements",void 0),t([u("cds-navigation-start")],C.prototype,"navigationStartRefs",void 0),t([u(":scope > cds-divider")],C.prototype,"rootDividers",void 0),t([u(":scope > cds-navigation-group")],C.prototype,"rootNavigationGroups",void 0),t([u(":scope > cds-navigation-item")],C.prototype,"rootNavigationItems",void 0),t([p(":scope > cds-navigation-start",{assign:"navigation-start"})],C.prototype,"rootNavigationStart",void 0),t([u(":scope > cds-navigation-group > cds-navigation-item")],C.prototype,"navigationGroupItems",void 0),t([u("cds-navigation-item")],C.prototype,"navigationItemRefs",void 0),t([u("cds-navigation-group")],C.prototype,"navigationGroupRefs",void 0),C=t([m({expanded:{true:E,false:f(E)}})],C);export{C as CdsNavigation,N as CdsNavigationTagName};
2
2
  //# sourceMappingURL=navigation.element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.element.js","sources":["../../../src/navigation/navigation.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 { animate, baseStyles, event, i18n, I18nService, state, isVisible, onKey, property, querySlot, querySlotAll, reverseAnimation, setAttributes, syncProps, syncPropsForAllItems, } from '@cds/core/internal';\nimport styles from './navigation.element.scss';\nimport { getNextFocusElement, getPreviousFocusElement, removeFocus, setFocus, visibleElement, } from './utils/index.js';\nimport { AnimationNavigationOpenName } from '../internal/motion/animations/cds-navigation-open.js';\nexport const CdsNavigationTagName = 'cds-navigation';\n/**\n * ```typescript\n * import '@cds/core/navigation/register.js';\n * ```\n *\n * ```html\n * <cds-navigation>\n * <cds-navigation-item><a href=\"/home\">Home</cds-navigation-item>\n * <cds-navigation-item><a href=\"/account\">Account</cds-navigation-item>\n * </cds-navigation>\n * ```\n *\n * @beta\n * @element cds-navigation\n * @event expandedChange - notify when the user has clicked the navigation expand/collapse button\n * @cssprop --animation-duration\n * @cssprop --animation-easing\n * @cssprop --background\n * @cssprop --collapsed-width\n * @cssprop --expanded-width\n * @cssprop --font-size\n * @cssprop --font-weight\n * @cssprop --letter-spacing\n * @cssprop --line-height\n * @cssprop --nested-padding\n * @cssprop --padding\n * @slot\n * @slot - cds-navigation-substart - project content below the navigation toggle button\n * @slot - cds-navigation-end - project content below the scrollable section\n */\nlet CdsNavigation = class CdsNavigation extends LitElement {\n constructor() {\n super(...arguments);\n this.expandedRoot = false;\n this.cdsMotion = 'on';\n /**\n * This is used to sync down the information to this.navigationGroupItems\n *\n * @type { boolean }\n * @protected\n */\n this.groupItem = true;\n /**\n *\n * Vertical navigation elements can be either wide or narrow. Expanded indicates it should be wide.\n * When navigation is wide cds-navigation-start button elements and cds-navigation-item a elements display\n * text. When it is narrow they do not (consumer should provide an icon that stays visible).\n \n * @type {boolean}\n */\n this.expanded = false;\n this.i18n = I18nService.keys.navigation;\n }\n toggle() {\n this.expandedChange.emit(!this.expanded);\n }\n get currentActiveItem() {\n return this.visibleChildren.find(c => c.id === this.ariaActiveDescendant);\n }\n get endTemplate() {\n return this.navigationEnd\n ? html `\n <div class=\"navigation-end\" cds-layout=\"vertical align:horizontal-stretch\">\n <slot name=\"cds-navigation-end\"></slot>\n </div>\n `\n : '';\n }\n get startTemplate() {\n let returnHTML;\n this.rootNavigationStart\n ? (returnHTML = html `\n <div class=\"navigation-start\" cds-layout=\"vertical align:horizontal-stretch\">\n <slot @slotchange=\"${() => this.addStartEventListener()}\" name=\"navigation-start\"></slot>\n <cds-divider class=\"start-divider\"></cds-divider>\n </div>\n `)\n : (returnHTML = '');\n return returnHTML;\n }\n get visibleChildren() {\n return Array.from(this.allNavigationElements).filter(n => isVisible(n));\n }\n addStartEventListener() {\n // This is controlled by the slotchange event on the navigation-start slot\n // Make sure we reattach the click handler for toggle if consumer changes the start element (e.g *ngIf)\n if (this.rootNavigationStart) {\n this.rootNavigationStart.addEventListener('click', this.toggle.bind(this));\n }\n }\n firstUpdated(props) {\n var _a;\n super.firstUpdated(props);\n // set all visible navigation elements to tabindex = -1\n this.allNavigationElements.forEach(item => {\n setAttributes(item, ['tabindex', '-1']);\n });\n const itemWrapper = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#item-container');\n itemWrapper === null || itemWrapper === void 0 ? void 0 : itemWrapper.addEventListener('focus', this.initItemKeys.bind(this));\n itemWrapper === null || itemWrapper === void 0 ? void 0 : itemWrapper.addEventListener('keydown', this.handleItemKeys.bind(this));\n itemWrapper === null || itemWrapper === void 0 ? void 0 : itemWrapper.addEventListener('blur', this.blurItemKeys.bind(this));\n }\n blurItemKeys() {\n if (this.currentActiveItem) {\n removeFocus(this.currentActiveItem);\n }\n }\n focusRootStart() {\n if (this.rootNavigationStart) {\n setFocus(this.rootNavigationStart);\n }\n }\n blurRootStart() {\n if (this.rootNavigationStart) {\n removeFocus(this.rootNavigationStart);\n }\n }\n initItemKeys() {\n if (!this.currentActiveItem) {\n setFocus(this.focusableElements[0]);\n this.ariaActiveDescendant = this.focusableElements[0].id;\n }\n else {\n const focusElement = this.currentActiveItem ? this.currentActiveItem : this.allNavigationElements[0];\n setFocus(focusElement);\n this.ariaActiveDescendant = focusElement.id;\n }\n }\n get focusableElements() {\n return Array.from(this.allNavigationElements).filter(visibleElement);\n }\n handleItemKeys(event) {\n onKey('arrow-down', event, () => {\n if (this.currentActiveItem) {\n removeFocus(this.currentActiveItem);\n const next = getNextFocusElement(this.currentActiveItem, this.focusableElements);\n this.ariaActiveDescendant = next.id;\n setFocus(next);\n event.preventDefault();\n }\n });\n onKey('arrow-up', event, () => {\n if (this.currentActiveItem) {\n removeFocus(this.currentActiveItem);\n const previous = getPreviousFocusElement(this.currentActiveItem, this.focusableElements);\n this.ariaActiveDescendant = previous.id;\n setFocus(previous);\n event.preventDefault();\n }\n });\n onKey('arrow-right', event, () => {\n var _a;\n const groupParent = (_a = this.currentActiveItem) === null || _a === void 0 ? void 0 : _a.closest('cds-navigation-group');\n if (groupParent && !groupParent.expanded) {\n groupParent.expandedChange.emit(!groupParent.expanded);\n return;\n }\n });\n onKey('arrow-left', event, () => {\n var _a, _b, _c;\n const groupParent = (_a = this.currentActiveItem) === null || _a === void 0 ? void 0 : _a.closest('cds-navigation-group');\n if (((_b = this.currentActiveItem) === null || _b === void 0 ? void 0 : _b.tagName) === 'CDS-NAVIGATION-ITEM' && !!groupParent) {\n const groupStartElement = groupParent === null || groupParent === void 0 ? void 0 : groupParent.querySelector('cds-navigation-start');\n removeFocus(this.currentActiveItem);\n this.ariaActiveDescendant = (_c = groupStartElement === null || groupStartElement === void 0 ? void 0 : groupStartElement.id) !== null && _c !== void 0 ? _c : null;\n setFocus(groupStartElement);\n return;\n }\n if (groupParent && groupParent.expanded) {\n groupParent.expandedChange.emit(!groupParent.expanded);\n return;\n }\n });\n onKey('home', event, () => {\n if (this.currentActiveItem) {\n removeFocus(this.currentActiveItem);\n const home = this.focusableElements[0];\n this.ariaActiveDescendant = home.id;\n setFocus(home);\n }\n });\n onKey('end', event, () => {\n if (this.currentActiveItem) {\n removeFocus(this.currentActiveItem);\n const end = this.focusableElements[this.focusableElements.length - 1];\n this.ariaActiveDescendant = end.id;\n setFocus(end);\n }\n });\n onKey('enter', event, () => {\n var _a, _b;\n // focusElement is either an Anchor or a button and we want to click it here\n if ((_a = this.currentActiveItem) === null || _a === void 0 ? void 0 : _a.focusElement) {\n (_b = this.currentActiveItem) === null || _b === void 0 ? void 0 : _b.focusElement.click();\n }\n });\n onKey('space', event, () => {\n var _a, _b;\n // focusElement is either an Anchor or a button and we want to click it here\n if ((_a = this.currentActiveItem) === null || _a === void 0 ? void 0 : _a.focusElement) {\n (_b = this.currentActiveItem) === null || _b === void 0 ? void 0 : _b.focusElement.click();\n }\n });\n }\n handleRootStartKeys(event) {\n onKey('arrow-right', event, () => {\n if (!this.expanded) {\n this.toggle();\n return;\n }\n });\n onKey('arrow-left', event, () => {\n if (this.expanded) {\n this.toggle();\n return;\n }\n });\n }\n connectedCallback() {\n var _a, _b, _c;\n super.connectedCallback();\n this.role = 'list';\n (_a = this.rootNavigationStart) === null || _a === void 0 ? void 0 : _a.addEventListener('focus', this.focusRootStart.bind(this));\n (_b = this.rootNavigationStart) === null || _b === void 0 ? void 0 : _b.addEventListener('blur', this.blurRootStart.bind(this));\n (_c = this.rootNavigationStart) === null || _c === void 0 ? void 0 : _c.addEventListener('keydown', this.handleRootStartKeys.bind(this));\n }\n disconnectedCallback() {\n super.disconnectedCallback();\n if (this.rootNavigationStart) {\n this.rootNavigationStart.removeEventListener('click', this.toggle.bind(this));\n }\n }\n render() {\n return html `<div class=\"private-host\" aria-label=\"${this.i18n.navigationLabel}\" cds-layout=\"vertical wrap:none\">\n ${this.startTemplate}\n <slot name=\"cds-navigation-substart\"></slot>\n <nav class=\"navigation-body-wrapper\">\n <div .ariaActiveDescendant=${this.ariaActiveDescendant} tabindex=\"0\" id=\"item-container\">\n <div class=\"navigation-body\" cds-layout=\"vertical wrap:none align:horizontal-stretch\">\n <slot></slot>\n </div>\n </div>\n </nav>\n ${this.endTemplate}\n </div>`;\n }\n updated(props) {\n super.updated(props);\n if (props.has('expanded')) {\n this.expandedRoot = this.expanded;\n }\n this.updateChildrenProps();\n }\n updateChildrenProps() {\n if (this.navigationGroupItems) {\n syncPropsForAllItems(Array.from(this.navigationGroupItems), this, { groupItem: true });\n }\n if (this.navigationItemRefs) {\n syncPropsForAllItems(Array.from(this.navigationItemRefs), this, {\n expanded: true,\n });\n }\n if (this.navigationStartRefs) {\n syncPropsForAllItems(Array.from(this.navigationStartRefs), this, {\n expandedRoot: true,\n });\n }\n if (this.rootNavigationStart) {\n syncProps(this.rootNavigationStart, this, {\n expanded: this.expanded,\n });\n }\n if (this.rootNavigationItems.length > 0) {\n syncPropsForAllItems(Array.from(this.rootNavigationItems), this, {\n expanded: this.expanded,\n });\n }\n if (this.navigationGroupRefs.length > 0) {\n syncPropsForAllItems(Array.from(this.navigationGroupRefs), this, {\n layout: true,\n });\n }\n }\n static get styles() {\n return [baseStyles, styles];\n }\n};\n__decorate([\n property({ type: String })\n], CdsNavigation.prototype, \"cdsMotion\", void 0);\n__decorate([\n event()\n], CdsNavigation.prototype, \"expandedChange\", void 0);\n__decorate([\n event()\n], CdsNavigation.prototype, \"cdsMotionChange\", void 0);\n__decorate([\n state({ type: Boolean })\n], CdsNavigation.prototype, \"groupItem\", void 0);\n__decorate([\n property({ type: Boolean })\n], CdsNavigation.prototype, \"expanded\", void 0);\n__decorate([\n i18n()\n], CdsNavigation.prototype, \"i18n\", void 0);\n__decorate([\n querySlot('[slot=\"cds-navigation-end\"]', { assign: 'cds-navigation-end' })\n], CdsNavigation.prototype, \"navigationEnd\", void 0);\n__decorate([\n querySlotAll('cds-navigation-group > cds-navigation-start, cds-navigation-item:not([disabled])')\n], CdsNavigation.prototype, \"allNavigationElements\", void 0);\n__decorate([\n querySlotAll('cds-navigation-start')\n], CdsNavigation.prototype, \"navigationStartRefs\", void 0);\n__decorate([\n querySlotAll(':scope > cds-divider')\n], CdsNavigation.prototype, \"rootDividers\", void 0);\n__decorate([\n querySlotAll(':scope > cds-navigation-group')\n], CdsNavigation.prototype, \"rootNavigationGroups\", void 0);\n__decorate([\n querySlotAll(':scope > cds-navigation-item')\n], CdsNavigation.prototype, \"rootNavigationItems\", void 0);\n__decorate([\n querySlot(':scope > cds-navigation-start', { assign: 'navigation-start' })\n], CdsNavigation.prototype, \"rootNavigationStart\", void 0);\n__decorate([\n querySlotAll(':scope > cds-navigation-group > cds-navigation-item')\n], CdsNavigation.prototype, \"navigationGroupItems\", void 0);\n__decorate([\n querySlotAll('cds-navigation-item')\n], CdsNavigation.prototype, \"navigationItemRefs\", void 0);\n__decorate([\n querySlotAll('cds-navigation-group')\n], CdsNavigation.prototype, \"navigationGroupRefs\", void 0);\nCdsNavigation = __decorate([\n animate({\n expanded: {\n true: AnimationNavigationOpenName,\n false: reverseAnimation(AnimationNavigationOpenName),\n },\n })\n], CdsNavigation);\nexport { CdsNavigation };\n"],"names":["CdsNavigationTagName","CdsNavigation","LitElement","constructor","super","this","expandedRoot","cdsMotion","groupItem","expanded","i18n","I18nService","keys","navigation","toggle","expandedChange","emit","currentActiveItem","visibleChildren","find","c","id","ariaActiveDescendant","endTemplate","navigationEnd","html","startTemplate","returnHTML","rootNavigationStart","addStartEventListener","Array","from","allNavigationElements","filter","n","isVisible","addEventListener","bind","firstUpdated","props","_a","forEach","item","setAttributes","itemWrapper","shadowRoot","querySelector","initItemKeys","handleItemKeys","blurItemKeys","removeFocus","focusRootStart","setFocus","blurRootStart","focusElement","focusableElements","visibleElement","event","onKey","next","getNextFocusElement","preventDefault","previous","getPreviousFocusElement","groupParent","closest","_b","_c","tagName","groupStartElement","home","end","length","click","handleRootStartKeys","connectedCallback","role","disconnectedCallback","removeEventListener","render","navigationLabel","updated","has","updateChildrenProps","navigationGroupItems","syncPropsForAllItems","navigationItemRefs","navigationStartRefs","syncProps","rootNavigationItems","navigationGroupRefs","layout","styles","baseStyles","__decorate","property","type","String","prototype","state","Boolean","querySlot","assign","querySlotAll","animate","true","AnimationNavigationOpenName","false","reverseAnimation"],"mappings":"6mBAWY,MAACA,EAAuB,iBA+BjC,IAACC,EAAgB,cAA4BC,EAC5CC,cACIC,oBACAC,KAAKC,cAAe,EACpBD,KAAKE,UAAY,KAOjBF,KAAKG,WAAY,EASjBH,KAAKI,UAAW,EAChBJ,KAAKK,KAAOC,EAAYC,KAAKC,WAEjCC,SACIT,KAA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AMI,WACfnG,EAAciG,UAAW,iBAAa,GACzCJ,EAAW,CACPC,EAAS,CAAEC,KAAMI,WAClBnG,EAAciG,UAAW,gBAAY,GACxCJ,EAAW,CACPpF,KACDT,EAAciG,UAAW,YAAQ,GACpCJ,EAAW,CACPO,EAAU,8BAA+B,CAAEC,OAAQ,wBACpDrG,EAAciG,UAAW,qBAAiB,GAC7CJ,EAAW,CACPS,EAAa,qFACdtG,EAAciG,UAAW,6BAAyB,GACrDJ,EAAW,CACPS,EAAa,yBACdtG,EAAciG,UAAW,2BAAuB,GACnDJ,EAAW,CACPS,EAAa,yBACdtG,EAAciG,UAAW,oBAAgB,GAC5CJ,EAAW,CACPS,EAAa,kCACdtG,EAAciG,UAAW,4BAAwB,GACpDJ,EAAW,CACPS,EAAa,iCACdtG,EAAciG,UAAW,2BAAuB,GACnDJ,EAAW,CACPO,EAAU,gCAAiC,CAAEC,OAAQ,sBACtDrG,EAAciG,UAAW,2BAAuB,GACnDJ,EAAW,CACPS,EAAa,wDACdtG,EAAciG,UAAW,4BAAwB,GACpDJ,EAAW,CACPS,EAAa,wBACdtG,EAAciG,UAAW,0BAAsB,GAClDJ,EAAW,CACPS,EAAa,yBACdtG,EAAciG,UAAW,2BAAuB,GACnDjG,EAAgB6F,EAAW,CACvBU,EAAQ,CACJ/F,SAAU,CACNgG,KAAMC,EACNC,MAAOC,EAAiBF,OAGjCzG"}
1
+ {"version":3,"file":"navigation.element.js","sources":["../../../src/navigation/navigation.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 { animate, baseStyles, event, i18n, I18nService, state, isVisible, onKey, property, querySlot, querySlotAll, reverseAnimation, setAttributes, syncProps, syncPropsForAllItems, } from '@cds/core/internal';\nimport styles from './navigation.element.scss';\nimport { getNextFocusElement, getPreviousFocusElement, removeFocus, setFocus, visibleElement, } from './utils/index.js';\nimport { AnimationNavigationOpenName } from '../internal/motion/animations/cds-navigation-open.js';\nexport const CdsNavigationTagName = 'cds-navigation';\n/**\n * ```typescript\n * import '@cds/core/navigation/register.js';\n * ```\n *\n * ```html\n * <cds-navigation>\n * <cds-navigation-item><a href=\"/home\">Home</cds-navigation-item>\n * <cds-navigation-item><a href=\"/account\">Account</cds-navigation-item>\n * </cds-navigation>\n * ```\n *\n * @beta\n * @element cds-navigation\n * @event expandedChange - notify when the user has clicked the navigation expand/collapse button\n * @cssprop --animation-duration\n * @cssprop --animation-easing\n * @cssprop --background\n * @cssprop --collapsed-width\n * @cssprop --expanded-width\n * @cssprop --font-size\n * @cssprop --font-weight\n * @cssprop --letter-spacing\n * @cssprop --line-height\n * @cssprop --nested-padding\n * @cssprop --padding\n * @slot\n * @slot - cds-navigation-substart - project content below the navigation toggle button\n * @slot - cds-navigation-end - project content below the scrollable section\n */\nlet CdsNavigation = class CdsNavigation extends LitElement {\n constructor() {\n super(...arguments);\n this.expandedRoot = false;\n this.cdsMotion = 'on';\n /**\n * This is used to sync down the information to this.navigationGroupItems\n *\n * @type { boolean }\n * @protected\n */\n this.groupItem = true;\n /**\n *\n * Vertical navigation elements can be either wide or narrow. Expanded indicates it should be wide.\n * When navigation is wide cds-navigation-start button elements and cds-navigation-item a elements display\n * text. When it is narrow they do not (consumer should provide an icon that stays visible).\n \n * @type {boolean}\n */\n this.expanded = false;\n this.i18n = I18nService.keys.navigation;\n }\n static get styles() {\n return [baseStyles, styles];\n }\n get endTemplate() {\n return this.navigationEnd\n ? html `\n <div class=\"navigation-end\" cds-layout=\"vertical align:horizontal-stretch\">\n <slot name=\"cds-navigation-end\" @slotchange=${this.onItemSlotChange}></slot>\n </div>\n `\n : '';\n }\n get startTemplate() {\n let returnHTML;\n this.rootNavigationStart\n ? (returnHTML = html `\n <div class=\"navigation-start\" cds-layout=\"vertical align:horizontal-stretch\">\n <slot @slotchange=\"${() => this.onStartItemSlotChange()}\" name=\"navigation-start\"></slot>\n <cds-divider class=\"start-divider\"></cds-divider>\n </div>\n `)\n : (returnHTML = '');\n return returnHTML;\n }\n render() {\n return html `<div class=\"private-host\" aria-label=\"${this.i18n.navigationLabel}\" cds-layout=\"vertical wrap:none\">\n ${this.startTemplate}\n <slot name=\"cds-navigation-substart\"></slot>\n <nav class=\"navigation-body-wrapper\">\n <div .ariaActiveDescendant=${this.ariaActiveDescendant} tabindex=\"0\" id=\"item-container\">\n <div class=\"navigation-body\" cds-layout=\"vertical wrap:none align:horizontal-stretch\">\n <slot @slotchange=${this.onItemSlotChange}></slot>\n </div>\n </div>\n </nav>\n ${this.endTemplate}\n </div>`;\n }\n connectedCallback() {\n var _a, _b, _c;\n super.connectedCallback();\n this.role = 'list';\n (_a = this.rootNavigationStart) === null || _a === void 0 ? void 0 : _a.addEventListener('focus', this.focusRootStart.bind(this));\n (_b = this.rootNavigationStart) === null || _b === void 0 ? void 0 : _b.addEventListener('blur', this.blurRootStart.bind(this));\n (_c = this.rootNavigationStart) === null || _c === void 0 ? void 0 : _c.addEventListener('keydown', this.handleRootStartKeys.bind(this));\n }\n disconnectedCallback() {\n super.disconnectedCallback();\n if (this.rootNavigationStart) {\n this.rootNavigationStart.removeEventListener('click', this.toggle.bind(this));\n }\n }\n firstUpdated(props) {\n var _a;\n super.firstUpdated(props);\n const itemWrapper = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#item-container');\n itemWrapper === null || itemWrapper === void 0 ? void 0 : itemWrapper.addEventListener('focus', this.initItemKeys.bind(this));\n itemWrapper === null || itemWrapper === void 0 ? void 0 : itemWrapper.addEventListener('keydown', this.handleItemKeys.bind(this));\n itemWrapper === null || itemWrapper === void 0 ? void 0 : itemWrapper.addEventListener('blur', this.blurItemKeys.bind(this));\n }\n updated(props) {\n super.updated(props);\n if (props.has('expanded')) {\n this.expandedRoot = this.expanded;\n }\n this.updateChildrenProps();\n }\n onStartItemSlotChange() {\n this.onItemSlotChange();\n // This is controlled by the slotchange event on the navigation-start slot\n // Make sure we reattach the click handler for toggle if consumer changes the start element (e.g *ngIf)\n if (this.rootNavigationStart) {\n this.rootNavigationStart.addEventListener('click', this.toggle.bind(this));\n }\n }\n onItemSlotChange() {\n this.updateChildrenProps();\n // set all visible navigation elements to tabindex = -1\n this.allNavigationElements.forEach(item => {\n setAttributes(item, ['tabindex', '-1']);\n });\n }\n updateChildrenProps() {\n if (this.navigationGroupItems) {\n syncPropsForAllItems(Array.from(this.navigationGroupItems), this, { groupItem: true });\n }\n if (this.navigationItemRefs) {\n syncPropsForAllItems(Array.from(this.navigationItemRefs), this, {\n expanded: true,\n });\n }\n if (this.navigationStartRefs) {\n syncPropsForAllItems(Array.from(this.navigationStartRefs), this, {\n expandedRoot: true,\n });\n }\n if (this.rootNavigationStart) {\n syncProps(this.rootNavigationStart, this, {\n expanded: this.expanded,\n });\n }\n if (this.rootNavigationItems.length > 0) {\n syncPropsForAllItems(Array.from(this.rootNavigationItems), this, {\n expanded: this.expanded,\n });\n }\n if (this.navigationGroupRefs.length > 0) {\n syncPropsForAllItems(Array.from(this.navigationGroupRefs), this, {\n layout: true,\n });\n }\n }\n get visibleChildren() {\n return Array.from(this.allNavigationElements).filter(n => isVisible(n));\n }\n toggle() {\n this.expandedChange.emit(!this.expanded);\n }\n get currentActiveItem() {\n return this.visibleChildren.find(c => c.id === this.ariaActiveDescendant);\n }\n blurItemKeys() {\n if (this.currentActiveItem) {\n removeFocus(this.currentActiveItem);\n }\n }\n focusRootStart() {\n if (this.rootNavigationStart) {\n setFocus(this.rootNavigationStart);\n }\n }\n blurRootStart() {\n if (this.rootNavigationStart) {\n removeFocus(this.rootNavigationStart);\n }\n }\n initItemKeys() {\n if (!this.currentActiveItem) {\n setFocus(this.focusableElements[0]);\n this.ariaActiveDescendant = this.focusableElements[0].id;\n }\n else {\n const focusElement = this.currentActiveItem ? this.currentActiveItem : this.allNavigationElements[0];\n setFocus(focusElement);\n this.ariaActiveDescendant = focusElement.id;\n }\n }\n get focusableElements() {\n return Array.from(this.allNavigationElements).filter(visibleElement);\n }\n handleItemKeys(event) {\n onKey('arrow-down', event, () => {\n if (this.currentActiveItem) {\n removeFocus(this.currentActiveItem);\n const next = getNextFocusElement(this.currentActiveItem, this.focusableElements);\n this.ariaActiveDescendant = next.id;\n setFocus(next);\n event.preventDefault();\n }\n });\n onKey('arrow-up', event, () => {\n if (this.currentActiveItem) {\n removeFocus(this.currentActiveItem);\n const previous = getPreviousFocusElement(this.currentActiveItem, this.focusableElements);\n this.ariaActiveDescendant = previous.id;\n setFocus(previous);\n event.preventDefault();\n }\n });\n onKey('arrow-right', event, () => {\n var _a;\n const groupParent = (_a = this.currentActiveItem) === null || _a === void 0 ? void 0 : _a.closest('cds-navigation-group');\n if (groupParent && !groupParent.expanded) {\n groupParent.expandedChange.emit(!groupParent.expanded);\n return;\n }\n });\n onKey('arrow-left', event, () => {\n var _a, _b, _c;\n const groupParent = (_a = this.currentActiveItem) === null || _a === void 0 ? void 0 : _a.closest('cds-navigation-group');\n if (((_b = this.currentActiveItem) === null || _b === void 0 ? void 0 : _b.tagName) === 'CDS-NAVIGATION-ITEM' && !!groupParent) {\n const groupStartElement = groupParent === null || groupParent === void 0 ? void 0 : groupParent.querySelector('cds-navigation-start');\n removeFocus(this.currentActiveItem);\n this.ariaActiveDescendant = (_c = groupStartElement === null || groupStartElement === void 0 ? void 0 : groupStartElement.id) !== null && _c !== void 0 ? _c : null;\n setFocus(groupStartElement);\n return;\n }\n if (groupParent && groupParent.expanded) {\n groupParent.expandedChange.emit(!groupParent.expanded);\n return;\n }\n });\n onKey('home', event, () => {\n if (this.currentActiveItem) {\n removeFocus(this.currentActiveItem);\n const home = this.focusableElements[0];\n this.ariaActiveDescendant = home.id;\n setFocus(home);\n }\n });\n onKey('end', event, () => {\n if (this.currentActiveItem) {\n removeFocus(this.currentActiveItem);\n const end = this.focusableElements[this.focusableElements.length - 1];\n this.ariaActiveDescendant = end.id;\n setFocus(end);\n }\n });\n onKey('enter', event, () => {\n var _a, _b;\n // focusElement is either an Anchor or a button and we want to click it here\n if ((_a = this.currentActiveItem) === null || _a === void 0 ? void 0 : _a.focusElement) {\n (_b = this.currentActiveItem) === null || _b === void 0 ? void 0 : _b.focusElement.click();\n }\n });\n onKey('space', event, () => {\n var _a, _b;\n // focusElement is either an Anchor or a button and we want to click it here\n if ((_a = this.currentActiveItem) === null || _a === void 0 ? void 0 : _a.focusElement) {\n (_b = this.currentActiveItem) === null || _b === void 0 ? void 0 : _b.focusElement.click();\n }\n });\n }\n handleRootStartKeys(event) {\n onKey('arrow-right', event, () => {\n if (!this.expanded) {\n this.toggle();\n return;\n }\n });\n onKey('arrow-left', event, () => {\n if (this.expanded) {\n this.toggle();\n return;\n }\n });\n }\n};\n__decorate([\n property({ type: String })\n], CdsNavigation.prototype, \"cdsMotion\", void 0);\n__decorate([\n event()\n], CdsNavigation.prototype, \"expandedChange\", void 0);\n__decorate([\n event()\n], CdsNavigation.prototype, \"cdsMotionChange\", void 0);\n__decorate([\n state({ type: Boolean })\n], CdsNavigation.prototype, \"groupItem\", void 0);\n__decorate([\n property({ type: Boolean })\n], CdsNavigation.prototype, \"expanded\", void 0);\n__decorate([\n i18n()\n], CdsNavigation.prototype, \"i18n\", void 0);\n__decorate([\n querySlot('[slot=\"cds-navigation-end\"]', { assign: 'cds-navigation-end' })\n], CdsNavigation.prototype, \"navigationEnd\", void 0);\n__decorate([\n querySlotAll('cds-navigation-group > cds-navigation-start, cds-navigation-item:not([disabled])')\n], CdsNavigation.prototype, \"allNavigationElements\", void 0);\n__decorate([\n querySlotAll('cds-navigation-start')\n], CdsNavigation.prototype, \"navigationStartRefs\", void 0);\n__decorate([\n querySlotAll(':scope > cds-divider')\n], CdsNavigation.prototype, \"rootDividers\", void 0);\n__decorate([\n querySlotAll(':scope > cds-navigation-group')\n], CdsNavigation.prototype, \"rootNavigationGroups\", void 0);\n__decorate([\n querySlotAll(':scope > cds-navigation-item')\n], CdsNavigation.prototype, \"rootNavigationItems\", void 0);\n__decorate([\n querySlot(':scope > cds-navigation-start', { assign: 'navigation-start' })\n], CdsNavigation.prototype, \"rootNavigationStart\", void 0);\n__decorate([\n querySlotAll(':scope > cds-navigation-group > cds-navigation-item')\n], CdsNavigation.prototype, \"navigationGroupItems\", void 0);\n__decorate([\n querySlotAll('cds-navigation-item')\n], CdsNavigation.prototype, \"navigationItemRefs\", void 0);\n__decorate([\n querySlotAll('cds-navigation-group')\n], CdsNavigation.prototype, \"navigationGroupRefs\", void 0);\nCdsNavigation = __decorate([\n animate({\n expanded: {\n true: AnimationNavigationOpenName,\n false: reverseAnimation(AnimationNavigationOpenName),\n },\n })\n], CdsNavigation);\nexport { CdsNavigation };\n"],"names":["CdsNavigationTagName","CdsNavigation","LitElement","constructor","super","this","expandedRoot","cdsMotion","groupItem","expanded","i18n","I18nService","keys","navigation","styles","baseStyles","endTemplate","navigationEnd","html","onItemSlotChange","startTemplate","returnHTML","rootNavigationStart","onStartItemSlotChange","render","navigationLabel","ariaActiveDescendant","connectedCallback","_a","_b","_c","role","addEventListener","focusRootStart","bind","blurRootStart","handleRootStartKeys","disconnectedCallback","removeEventListener","toggle","firstUpdated","props","itemWrapper","shadowRoot","querySelector","initItemKeys","handleItemKeys","blurItemKeys","updated","has","updateChildrenProps","allNavigationElements","forEach","item","setAttributes","navigationGroupItems","syncPropsForAllItems","Array","from","navigationItemRefs","navigationStartRefs","syncProps","rootNavigationItems","length","navigationGroupRefs","layout","visibleChildren","filter","n","isVisible","expandedChange","emit","currentActiveItem","find","c","id","removeFocus","setFocus","focusElement","focusableElements","visibleElement","event","onKey","next","getNextFocusElement","preventDefault","previous","getPreviousFocusElement","groupParent","closest","tagName","groupStartElement","home","end","click","__decorate","property","type","String","prototype","state","Boolean","querySlot","assign","querySlotAll","animate","true","AnimationNavigationOpenName","false","reverseAnimation"],"mappings":"6mBAWY,MAACA,EAAuB,iBA+BjC,IAACC,EAAgB,cAA4BC,EAC5CC,cAC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rBwD,EAAW,CACPC,EAAS,CAAEC,KAAMC,UAClBjG,EAAckG,UAAW,iBAAa,GACzCJ,EAAW,CACPd,KACDhF,EAAckG,UAAW,sBAAkB,GAC9CJ,EAAW,CACPd,KACDhF,EAAckG,UAAW,uBAAmB,GAC/CJ,EAAW,CACPK,EAAM,CAAEH,KAAMI,WACfpG,EAAckG,UAAW,iBAAa,GACzCJ,EAAW,CACPC,EAAS,CAAEC,KAAMI,WAClBpG,EAAckG,UAAW,gBAAY,GACxCJ,EAAW,CACPrF,KACDT,EAAckG,UAAW,YAAQ,GACpCJ,EAAW,CACPO,EAAU,8BAA+B,CAAEC,OAAQ,wBACpDtG,EAAckG,UAAW,qBAAiB,GAC7CJ,EAAW,CACPS,EAAa,qFACdvG,EAAckG,UAAW,6BAAyB,GACrDJ,EAAW,CACPS,EAAa,yBACdvG,EAAckG,UAAW,2BAAuB,GACnDJ,EAAW,CACPS,EAAa,yBACdvG,EAAckG,UAAW,oBAAgB,GAC5CJ,EAAW,CACPS,EAAa,kCACdvG,EAAckG,UAAW,4BAAwB,GACpDJ,EAAW,CACPS,EAAa,iCACdvG,EAAckG,UAAW,2BAAuB,GACnDJ,EAAW,CACPO,EAAU,gCAAiC,CAAEC,OAAQ,sBACtDtG,EAAckG,UAAW,2BAAuB,GACnDJ,EAAW,CACPS,EAAa,wDACdvG,EAAckG,UAAW,4BAAwB,GACpDJ,EAAW,CACPS,EAAa,wBACdvG,EAAckG,UAAW,0BAAsB,GAClDJ,EAAW,CACPS,EAAa,yBACdvG,EAAckG,UAAW,2BAAuB,GACnDlG,EAAgB8F,EAAW,CACvBU,EAAQ,CACJhG,SAAU,CACNiG,KAAMC,EACNC,MAAOC,EAAiBF,OAGjC1G"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "license": "MIT",
4
4
  "author": "clarity",
5
5
  "description": "Clarity Design System - common components, themes, and utilties",
6
- "homepage": "https://clarity.design",
6
+ "homepage": "https://core.clarity.design",
7
7
  "customElements": "./custom-elements.json",
8
8
  "keywords": [
9
9
  "web component",
@@ -216,5 +216,5 @@
216
216
  "./tokens/tokens.ios.swift": "./tokens/tokens.ios.swift",
217
217
  "./tokens/tokens.android.xml": "./tokens/tokens.android.xml"
218
218
  },
219
- "version": "5.7.3"
219
+ "version": "5.8.2"
220
220
  }
@@ -1,2 +1,2 @@
1
- import{__decorate as t}from"tslib";import{html as s}from"lit";import{globalStyle as r}from"@cds/core/internal";import{CdsControl as i}from"@cds/core/forms";import e from"./range.global.scss.js";import o from"./range.element.scss.js";class n extends i{constructor(){super(...arguments);this.globalStyles=e}static get styles(){return[...super.styles,o]}get inputTemplate(){return s`<div class="input-track"></div>`}firstUpdated(t){super.firstUpdated(t),this.setTrackWidth(),this.inputControl.addEventListener("input",(()=>this.setTrackWidth()))}setTrackWidth(){const t=this.inputControl.valueAsNumber,s=this.inputControl.min?parseInt(this.inputControl.min):0,r=this.inputControl.max?parseInt(this.inputControl.max):100;this.style.setProperty("--track-width",Math.floor((t-s)/(r-s)*100)+"%")}}t([r()],n.prototype,"globalStyles",void 0);export{n as CdsRange};
1
+ import{__decorate as t}from"tslib";import{html as s}from"lit";import{getElementUpdates as r,globalStyle as i}from"@cds/core/internal";import{CdsControl as e}from"@cds/core/forms";import o from"./range.global.scss.js";import n from"./range.element.scss.js";class l extends e{constructor(){super(...arguments);this.globalStyles=o}static get styles(){return[...super.styles,n]}get inputTemplate(){return s`<div class="input-track"></div>`}firstUpdated(t){super.firstUpdated(t),this.setTrackWidth(),this.inputControl.addEventListener("input",(()=>this.setTrackWidth())),this.observers.push(r(this.inputControl,"value",(t=>{this.setTrackWidth(t)})))}setTrackWidth(t){const s=null!=t?t:this.inputControl.valueAsNumber,r=this.inputControl.min?parseInt(this.inputControl.min):0,i=this.inputControl.max?parseInt(this.inputControl.max):100;this.style.setProperty("--track-width",Math.floor((s-r)/(i-r)*100)+"%")}}t([i()],l.prototype,"globalStyles",void 0);export{l as CdsRange};
2
2
  //# sourceMappingURL=range.element.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"range.element.js","sources":["../../../src/range/range.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 } from 'lit';\nimport { globalStyle } from '@cds/core/internal';\nimport { CdsControl } from '@cds/core/forms';\nimport globalStyles from './range.global.scss';\nimport styles from './range.element.scss';\n/**\n * Range\n *\n * ```typescript\n * import '@cds/core/range/register.js';\n * ```\n *\n * ```html\n * <cds-range>\n * <label>range</label>\n * <input type=\"range\" />\n * <cds-control-message>message text</cds-control-message>\n * </cds-range>\n * ```\n *\n * @element cds-range\n * @slot - For projecting range input\n * @cssprop --background\n * @cssprop --border-radius\n * @cssprop --track-background\n * @cssprop --track-fill-background\n * @cssprop --track-height\n * @cssprop --thumb-background\n * @cssprop --thumb-width\n * @cssprop --thumb-height\n */\nexport class CdsRange extends CdsControl {\n constructor() {\n super(...arguments);\n this.globalStyles = globalStyles;\n }\n static get styles() {\n return [...super.styles, styles];\n }\n get inputTemplate() {\n return html `<div class=\"input-track\"></div>`;\n }\n firstUpdated(props) {\n super.firstUpdated(props);\n this.setTrackWidth();\n this.inputControl.addEventListener('input', () => this.setTrackWidth());\n }\n setTrackWidth() {\n const value = this.inputControl.valueAsNumber;\n const min = this.inputControl.min ? parseInt(this.inputControl.min) : 0;\n const max = this.inputControl.max ? parseInt(this.inputControl.max) : 100;\n this.style.setProperty('--track-width', `${Math.floor(((value - min) / (max - min)) * 100)}%`);\n }\n}\n__decorate([\n globalStyle()\n], CdsRange.prototype, \"globalStyles\", void 0);\n"],"names":["CdsRange","CdsControl","constructor","super","this","globalStyles","styles","inputTemplate","html","firstUpdated","props","setTrackWidth","inputControl","addEventListener","value","valueAsNumber","min","parseInt","max","style","setProperty","Math","floor","__decorate","globalStyle","prototype"],"mappings":"yOAqCO,MAAMA,UAAiBC,EAC1BC,cACIC,oBACAC,KAAKC,aAAeA,EAEbC,oBACP,MAAO,IAAIH,MAAMG,OAAQA,GAEzBC,oBACA,OAAOC,CAAK,kCAEhBC,aAAaC,GACTP,MAAMM,aAAaC,GACnBN,KAAKO,gBACLP,KAAKQ,aAAaC,iBAAiB,SAAS,IAAMT,KAAKO,kBAE3DA,gBACI,MAAMG,EAAQV,KAAKQ,aAAaG,cAC1BC,EAAMZ,KAAKQ,aAAaI,IAAMC,SAASb,KAAKQ,aAAaI,KAAO,EAChEE,EAAMd,KAAKQ,aAAaM,IAAMD,SAASb,KAAKQ,aAAaM,KAAO,IACtEd,KAAKe,MAAMC,YAAY,gBAAoBC,KAAKC,OAAQR,EAAQE,IAAQE,EAAMF,GAAQ,KAA9C,MAGhDO,EAAW,CACPC,KACDxB,EAASyB,UAAW,oBAAgB"}
1
+ {"version":3,"file":"range.element.js","sources":["../../../src/range/range.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 } from 'lit';\nimport { getElementUpdates, globalStyle } from '@cds/core/internal';\nimport { CdsControl } from '@cds/core/forms';\nimport globalStyles from './range.global.scss';\nimport styles from './range.element.scss';\n/**\n * Range\n *\n * ```typescript\n * import '@cds/core/range/register.js';\n * ```\n *\n * ```html\n * <cds-range>\n * <label>range</label>\n * <input type=\"range\" />\n * <cds-control-message>message text</cds-control-message>\n * </cds-range>\n * ```\n *\n * @element cds-range\n * @slot - For projecting range input\n * @cssprop --background\n * @cssprop --border-radius\n * @cssprop --track-background\n * @cssprop --track-fill-background\n * @cssprop --track-height\n * @cssprop --thumb-background\n * @cssprop --thumb-width\n * @cssprop --thumb-height\n */\nexport class CdsRange extends CdsControl {\n constructor() {\n super(...arguments);\n this.globalStyles = globalStyles;\n }\n static get styles() {\n return [...super.styles, styles];\n }\n get inputTemplate() {\n return html `<div class=\"input-track\"></div>`;\n }\n firstUpdated(props) {\n super.firstUpdated(props);\n this.setTrackWidth();\n this.inputControl.addEventListener('input', () => this.setTrackWidth());\n // `input` event doesnt fire when the value is changed programmatically\n // at this point, inputControl.valueAsNumber is still the old value\n // https://github.com/vmware-clarity/core/issues/157\n this.observers.push(getElementUpdates(this.inputControl, 'value', (value) => {\n this.setTrackWidth(value);\n }));\n }\n setTrackWidth(val) {\n const value = val !== null && val !== void 0 ? val : this.inputControl.valueAsNumber;\n const min = this.inputControl.min ? parseInt(this.inputControl.min) : 0;\n const max = this.inputControl.max ? parseInt(this.inputControl.max) : 100;\n this.style.setProperty('--track-width', `${Math.floor(((value - min) / (max - min)) * 100)}%`);\n }\n}\n__decorate([\n globalStyle()\n], CdsRange.prototype, \"globalStyles\", void 0);\n"],"names":["CdsRange","CdsControl","constructor","super","this","globalStyles","styles","inputTemplate","html","firstUpdated","props","setTrackWidth","inputControl","addEventListener","observers","push","getElementUpdates","value","val","valueAsNumber","min","parseInt","max","style","setProperty","Math","floor","__decorate","globalStyle","prototype"],"mappings":"gQAqCO,MAAMA,UAAiBC,EAC1BC,cACIC,oBACAC,KAAKC,aAAeA,EAEbC,oBACP,MAAO,IAAIH,MAAMG,OAAQA,GAEzBC,oBACA,OAAOC,CAAK,kCAEhBC,aAAaC,GACTP,MAAMM,aAAaC,GACnBN,KAAKO,gBACLP,KAAKQ,aAAaC,iBAAiB,SAAS,IAAMT,KAAKO,kBAIvDP,KAAKU,UAAUC,KAAKC,EAAkBZ,KAAKQ,aAAc,SAAUK,IAC/Db,KAAKO,cAAcM,OAG3BN,cAAcO,GACV,MAAMD,EAAQC,MAAAA,EAAiCA,EAAMd,KAAKQ,aAAaO,cACjEC,EAAMhB,KAAKQ,aAAaQ,IAAMC,SAASjB,KAAKQ,aAAaQ,KAAO,EAChEE,EAAMlB,KAAKQ,aAAaU,IAAMD,SAASjB,KAAKQ,aAAaU,KAAO,IACtElB,KAAKmB,MAAMC,YAAY,gBAAoBC,KAAKC,OAAQT,EAAQG,IAAQE,EAAMF,GAAQ,KAA9C,MAGhDO,EAAW,CACPC,KACD5B,EAAS6B,UAAW,oBAAgB"}
@@ -1,2 +1,2 @@
1
- import{css as a}from"lit";var o=a`:host{--background:var(--cds-alias-status-tint, var(--cds-alias-status-neutral-tint, var(--cds-global-color-construction-50, #f1f6f8)));--color:var(--cds-global-typography-color-400, var(--cds-global-color-construction-900, #21333b));--padding:var(--cds-global-space-2, calc(2 / var(--cds-global-base, 20) * 1rem));--font-size:var(--cds-global-typography-font-size-0, calc(10 / var(--cds-global-base, 20) * 1rem));--border-radius:var(--cds-alias-object-border-radius-200, calc(12 / var(--cds-global-base, 20) * 1rem));--border-color:var(--cds-alias-status-neutral, var(--cds-global-color-construction-600, #4f6169));--border-width:var(--cds-alias-object-border-width-100, calc(1 / var(--cds-global-base, 20) * 1rem));display:inline-block}.private-host{--internal-icon-color:var(--color);border-radius:var(--border-radius);background:var(--background);border-width:var(--border-width);border-style:solid;border-color:var(--border-color);color:var(--color);font-size:var(--font-size);padding:var(--padding);white-space:nowrap;text-decoration:none;min-height:calc(var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem)) + var(--cds-global-space-3,calc(4 / var(--cds-global-base,20) * 1rem)));transform:translateZ(0)}.tag-content{padding:0 var(--cds-global-space-3,calc(4 / var(--cds-global-base,20) * 1rem))}::slotted(cds-icon),cds-icon[shape=times]{--color:var(--internal-icon-color);cursor:pointer}:host(:not([readonly])):host(:active) .private-host::after,:host(:not([readonly])):host(:focus) .private-host::after,:host(:not([readonly])):host(:hover) .private-host::after,:host(:not([readonly])):host([_active]) .private-host::after{background:var(--background);border-radius:var(--border-radius);filter:brightness(95%);position:absolute;content:"";top:0;left:0;bottom:0;right:0;inset:0;z-index:-1}:host(:not([readonly])):host(:active) .private-host,:host(:not([readonly])):host([_active]) .private-host{box-shadow:0 var(--cds-global-space-1,calc(1 / var(--cds-global-base,20) * 1rem)) 0 0 var(--border-color) inset}:host(:not([readonly])):host(:active) .tag-content,:host(:not([readonly])):host([_active]) .tag-content{transform:translateY(var(--cds-global-space-1,calc(1 / var(--cds-global-base,20) * 1rem)))}:host(:not([readonly])):host(:visited){color:var(--color)}:host([status=info]){--border-color:var(--cds-alias-status-info, var(--cds-global-color-blue-700, #0079ad));--background:var(--cds-alias-status-tint, var(--cds-alias-status-info-tint, var(--cds-global-color-blue-50, #e6f7ff)))}:host([status=success]){--border-color:var(--cds-alias-status-success, var(--cds-global-color-green-700, #42810e));--background:var(--cds-alias-status-tint, var(--cds-alias-status-success-tint, var(--cds-global-color-green-50, #eefce3)))}:host([status=warning]){--border-color:var(--cds-alias-status-warning, var(--cds-global-color-ochre-500, #ffb92e));--background:var(--cds-alias-status-tint, var(--cds-alias-status-warning-tint, var(--cds-global-color-ochre-100, #fff2d6)))}:host([status=danger]){--border-color:var(--cds-alias-status-danger, var(--cds-global-color-red-700, #e02200));--background:var(--cds-alias-status-tint, var(--cds-alias-status-danger-tint, var(--cds-global-color-red-50, #fff2f0)))}:host([color]){--background:var(--cds-alias-object-opacity-0, rgba(0, 0, 0, 0))}:host([color]) :hover{--background:var(--cds-alias-status-neutral-tint, var(--cds-global-color-construction-50, #f1f6f8))}:host([color=purple]){--border-color:var(--cds-global-color-violet-600, #9b32c8)}:host([color=blue]){--border-color:var(--cds-global-color-blue-800, #00608a)}:host([color=orange]){--border-color:var(--cds-global-color-ochre-800, #a36500)}:host([color=light-blue]){--border-color:var(--cds-global-color-blue-600, #009adb)}:host([disabled]){--color:var(--cds-alias-status-disabled-tint, var(--cds-global-color-construction-200, #cbd4d8))!important;--border-color:var(--cds-alias-status-disabled-tint, var(--cds-global-color-construction-200, #cbd4d8))!important;--background:var(--cds-alias-object-opacity-0, rgba(0, 0, 0, 0))!important}:host([disabled]) ::slotted(cds-badge){--background:var(--cds-alias-status-disabled-tint, var(--cds-global-color-construction-200, #cbd4d8));--color:var(--cds-alias-status-disabled-shade, var(--cds-global-color-construction-400, #859399))!important}:host([disabled]) ::slotted(cds-icon){--color:var(--cds-alias-status-disabled-tint, var(--cds-global-color-construction-200, #cbd4d8))!important}:host([disabled]) .private-host{box-shadow:none!important}:host([disabled]) .tag-content{transform:initial!important}`;export{o as default};
1
+ import{css as a}from"lit";var o=a`:host{--background:var(--cds-alias-status-tint, var(--cds-alias-status-neutral-tint, var(--cds-global-color-construction-50, #f1f6f8)));--color:var(--cds-global-typography-color-400, var(--cds-global-color-construction-900, #21333b));--padding:var(--cds-global-space-2, calc(2 / var(--cds-global-base, 20) * 1rem));--font-size:var(--cds-global-typography-font-size-0, calc(10 / var(--cds-global-base, 20) * 1rem));--border-radius:var(--cds-alias-object-border-radius-200, calc(12 / var(--cds-global-base, 20) * 1rem));--border-color:var(--cds-alias-status-neutral, var(--cds-global-color-construction-600, #4f6169));--border-width:var(--cds-alias-object-border-width-100, calc(1 / var(--cds-global-base, 20) * 1rem));display:inline-block}.private-host{--internal-icon-color:var(--color);border-radius:var(--border-radius);background:var(--background);border-width:var(--border-width);border-style:solid;border-color:var(--border-color);color:var(--color);font-size:var(--font-size);padding:var(--padding);white-space:nowrap;text-decoration:none;min-height:calc(var(--cds-global-space-8,calc(18 / var(--cds-global-base,20) * 1rem)) + var(--cds-global-space-3,calc(4 / var(--cds-global-base,20) * 1rem)));transform:translateZ(0)}.tag-content{padding:0 var(--cds-global-space-3,calc(4 / var(--cds-global-base,20) * 1rem))}::slotted(cds-icon),cds-icon[shape=times]{--color:var(--internal-icon-color);cursor:pointer}:host(:not([readonly])):host(:active) .private-host::after,:host(:not([readonly])):host(:focus) .private-host::after,:host(:not([readonly])):host(:hover) .private-host::after,:host(:not([readonly])):host([_active]) .private-host::after{background:var(--background);border-radius:var(--border-radius);filter:brightness(95%);position:absolute;content:"";top:0;left:0;bottom:0;right:0;inset:0;z-index:-1}:host(:not([readonly])):host(:active) .private-host,:host(:not([readonly])):host([_active]) .private-host{box-shadow:0 var(--cds-global-space-1,calc(1 / var(--cds-global-base,20) * 1rem)) 0 0 var(--border-color) inset}:host(:not([readonly])):host(:active) .tag-content,:host(:not([readonly])):host([_active]) .tag-content{transform:translateY(var(--cds-global-space-1,calc(1 / var(--cds-global-base,20) * 1rem)))}:host(:not([readonly])):host(:visited){color:var(--color)}:host([status=info]){--border-color:var(--cds-alias-status-info, var(--cds-global-color-blue-700, #0079ad));--background:var(--cds-alias-status-tint, var(--cds-alias-status-info-tint, var(--cds-global-color-blue-50, #e6f7ff)))}:host([status=success]){--border-color:var(--cds-alias-status-success, var(--cds-global-color-green-700, #42810e));--background:var(--cds-alias-status-tint, var(--cds-alias-status-success-tint, var(--cds-global-color-green-50, #eefce3)))}:host([status=warning]){--border-color:var(--cds-alias-status-warning, var(--cds-global-color-ochre-500, #ffb92e));--background:var(--cds-alias-status-tint, var(--cds-alias-status-warning-tint, var(--cds-global-color-ochre-100, #fff2d6)))}:host([status=danger]){--border-color:var(--cds-alias-status-danger, var(--cds-global-color-red-700, #e02200));--background:var(--cds-alias-status-tint, var(--cds-alias-status-danger-tint, var(--cds-global-color-red-50, #fff2f0)))}:host([color]){--background:var(--cds-alias-object-opacity-0, rgba(0, 0, 0, 0))}:host([color]):host(:not([disabled])) :hover{--background:var(--cds-alias-status-neutral-tint, var(--cds-global-color-construction-50, #f1f6f8))}:host([color=purple]){--border-color:var(--cds-global-color-violet-600, #9b32c8)}:host([color=blue]){--border-color:var(--cds-global-color-blue-800, #00608a)}:host([color=orange]){--border-color:var(--cds-global-color-ochre-800, #a36500)}:host([color=light-blue]){--border-color:var(--cds-global-color-blue-600, #009adb)}:host([disabled]){--color:var(--cds-alias-status-disabled-tint, var(--cds-global-color-construction-200, #cbd4d8))!important;--border-color:var(--cds-alias-status-disabled-tint, var(--cds-global-color-construction-200, #cbd4d8))!important;--background:var(--cds-alias-object-opacity-0, rgba(0, 0, 0, 0))!important}:host([disabled]) ::slotted(cds-badge){--background:var(--cds-alias-status-disabled-tint, var(--cds-global-color-construction-200, #cbd4d8));--color:var(--cds-alias-status-disabled-shade, var(--cds-global-color-construction-400, #859399))!important}:host([disabled]) ::slotted(cds-icon){--color:var(--cds-alias-status-disabled-tint, var(--cds-global-color-construction-200, #cbd4d8))!important}:host([disabled]) .private-host{box-shadow:none!important}:host([disabled]) .tag-content{transform:initial!important}`;export{o as default};
2
2
  //# sourceMappingURL=tag.element.scss.js.map