/*! For license information please see sidenav-stories-sidenav-stories.6026f174.iframe.bundle.js.LICENSE.txt */
(globalThis.webpackChunk_spectrum_css_preview=globalThis.webpackChunk_spectrum_css_preview||[]).push([[5506,948],{"../components/sidenav/stories/sidenav.stories.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Default:()=>Default,Multilevel:()=>Multilevel,WithHeading:()=>WithHeading,WithIcons:()=>WithIcons,__namedExportsOrder:()=>__namedExportsOrder,default:()=>sidenav_stories});var lit=__webpack_require__("../node_modules/lit/index.js"),class_map=__webpack_require__("../node_modules/lit/directives/class-map.js"),if_defined=__webpack_require__("../node_modules/lit/directives/if-defined.js"),repeat=__webpack_require__("../node_modules/lit/directives/repeat.js"),when=__webpack_require__("../node_modules/lit-html/directives/when.js"),template=__webpack_require__("../components/icon/stories/template.js"),injectStylesIntoLinkTag=__webpack_require__("../node_modules/style-loader/dist/runtime/injectStylesIntoLinkTag.js"),injectStylesIntoLinkTag_default=__webpack_require__.n(injectStylesIntoLinkTag),insertBySelector=__webpack_require__("../node_modules/style-loader/dist/runtime/insertBySelector.js"),insertBySelector_default=__webpack_require__.n(insertBySelector),sidenav=__webpack_require__("../node_modules/file-loader/dist/cjs.js??ruleSet[1].rules[10].use[1]!../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[10].use[2]!../components/sidenav/index.css"),sidenav_default=__webpack_require__.n(sidenav),options={attributes:{"data-source":"processed"}};options.insert=insertBySelector_default().bind(null,"head");injectStylesIntoLinkTag_default()(sidenav_default(),options);const Template=({rootClass="spectrum-SideNav",customClasses=[],variant,hasIcon,iconName,items=[],...globals})=>lit.qy`
    <nav>
      <ul class=${(0,class_map.H)({[rootClass]:!0,[`${rootClass}--${variant}`]:void 0!==variant,[`${rootClass}--hasIcon`]:hasIcon,...customClasses.reduce(((a,c)=>({...a,[c]:!0})),{})})}>
        ${(0,repeat.u)(items,(item=>item.id),(item=>void 0!==item.levelTwoItems?lit.qy`
              <li class=${(0,class_map.H)({[`${rootClass}-item`]:!0,"is-selected":item.isSelected,"is-disabled":item.isDisabled})}>
              ${item.heading?lit.qy`<h2 class="${rootClass}-heading" id="${item.id}-heading">${item.heading}</h2>`:lit.qy`
                <a class="${rootClass}-itemLink">
                ${(0,when.z)(hasIcon,(()=>(0,template.B)({...globals,iconName})))}
                  <span class="${rootClass}-link-text">${item.title}</span>
                </a>
                `}
              <ul class=${(0,class_map.H)({[rootClass]:!0,[`${rootClass}--hasIcon`]:hasIcon,...customClasses.reduce(((a,c)=>({...a,[c]:!0})),{})})}
              aria-labelledby=${(0,if_defined.J)(item.heading)?`${item.id}-heading`:""}>
                  ${(0,repeat.u)(item.levelTwoItems,(item=>item.id),(item=>SideNavItem({variant,hasIcon,iconName,...globals,...item})))}
                </ul>
              </li>
            `:SideNavItem({hasIcon,iconName,...globals,...item})))}
      </ul>
  </nav>
  `,SideNavItem=({rootClass="spectrum-SideNav",variant,levelThreeItems,link,title,isSelected,isDisabled,id,hasIcon,iconName,customClasses=[],...globals})=>{const displayIcon=!(hasIcon&"multiLevel"===variant);return lit.qy`
    <li id=${id} class=${(0,class_map.H)({[`${rootClass}-item`]:!0,"is-selected":isSelected,"is-disabled":isDisabled,...customClasses.reduce(((a,c)=>({...a,[c]:!0})),{})})}>
      <a href=${link} class="${rootClass}-itemLink">
        ${displayIcon?(0,template.B)({...globals,iconName}):""}
        <span class="${rootClass}-link-text">${title}</span>
      </a>
      ${(0,when.z)(levelThreeItems,(()=>lit.qy`
        <ul class=${rootClass}>
          ${(0,repeat.u)(levelThreeItems,(item=>item.id),(item=>SideNavItem({...globals,...item})))}
        </ul>`))}
    </li>
  `},sidenav_stories={title:"Components/Side nav",description:"SideNav lets users navigate the entire content of a product or a section. These can be used for a single level or a multi-level navigation.",component:"Sidenav",argTypes:{hasIcon:{name:"Has Icon",type:{name:"boolean"},table:{type:{summary:"boolean"},category:"Component"},control:"boolean"},iconName:{name:"Icon Name",type:{name:"string"},table:{type:{summary:"string"},category:"Component"},options:["Image","Folder","Star"],control:"select",if:{arg:"hasIcon",truthy:!0}},items:{table:{disable:!0}},variant:{table:{disable:!0}}},args:{rootClass:"spectrum-SideNav",hasIcon:!1,iconName:"Folder"},parameters:{actions:{handles:[]},status:{type:"migrated"}}},Default=Template.bind({});Default.args={items:[{id:"1",title:"Section Title 1",link:"#",isSelected:!0},{id:"2",title:"Section Title 2",link:"#",isDisabled:!0},{id:"3",title:"Section Title 3",link:"#"}]};const Multilevel=Template.bind({});Multilevel.args={variant:"multiLevel",items:[{id:"1",title:"Section Title 1",link:"#"},{id:"2",title:"Section Title 2",link:"#",levelTwoItems:[{id:"2.1",title:"Section Title 1",link:"#"},{id:"2.2",title:"Section Title 2: The Long Title That Wraps to The Next Line",link:"#",levelThreeItems:[{id:"3.1",title:"Section Title 1",link:"#"},{id:"3.2",title:"Section Title 2: Another Long Title That Wraps to The Next Line",link:"#",isSelected:!0},{id:"3.3",title:"Section Title 3",link:"#"}]}]},{id:"3",title:"Section Title 3",link:"#"}]};const WithHeading=Template.bind({});WithHeading.args={items:[{id:"1",title:"Section 1",link:"#"},{id:"2",heading:"Heading 1",link:"#",levelTwoItems:[{id:"2.1",title:"Section 1",link:"#"},{id:"2.2",title:"Section 2",link:"#"}]}]};const WithIcons=Template.bind({});WithIcons.args={variant:"multiLevel",hasIcon:!0,items:[{id:"1",title:"Section 1",link:"#"},{id:"2",title:"Section 2",link:"#",levelTwoItems:[{id:"2.1",title:"Section 1",link:"#"},{id:"2.2",title:"Section 2",link:"#",levelThreeItems:[{id:"3.1",title:"Section 1",link:"#"}]}]},{id:"3",title:"Section 3",link:"#"}]};const __namedExportsOrder=["Default","Multilevel","WithHeading","WithIcons"]},"../node_modules/file-loader/dist/cjs.js??ruleSet[1].rules[10].use[1]!../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[10].use[2]!../components/sidenav/index.css":(module,__unused_webpack_exports,__webpack_require__)=>{module.exports=__webpack_require__.p+"assets/css/components/sidenav/index.css"},"../node_modules/lit-html/directives/when.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";function n(n,r,t){return n?r(n):t?.(n)}__webpack_require__.d(__webpack_exports__,{z:()=>n})},"../node_modules/lit/directives/repeat.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{u:()=>c});var lit_html=__webpack_require__("../node_modules/lit-html/lit-html.js"),directive=__webpack_require__("../node_modules/lit-html/directive.js"),directive_helpers=__webpack_require__("../node_modules/lit-html/directive-helpers.js");const u=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c=(0,directive.u$)(class extends directive.WL{constructor(e){if(super(e),e.type!==directive.OA.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return{values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){const d=(0,directive_helpers.cN)(s),{values:p,keys:a}=this.dt(t,r,c);if(!Array.isArray(d))return this.ut=a,p;const h=this.ut??=[],v=[];let m,y,x=0,j=d.length-1,k=0,w=p.length-1;for(;x<=j&&k<=w;)if(null===d[x])x++;else if(null===d[j])j--;else if(h[x]===a[k])v[k]=(0,directive_helpers.lx)(d[x],p[k]),x++,k++;else if(h[j]===a[w])v[w]=(0,directive_helpers.lx)(d[j],p[w]),j--,w--;else if(h[x]===a[w])v[w]=(0,directive_helpers.lx)(d[x],p[w]),(0,directive_helpers.Dx)(s,v[w+1],d[x]),x++,w--;else if(h[j]===a[k])v[k]=(0,directive_helpers.lx)(d[j],p[k]),(0,directive_helpers.Dx)(s,d[x],d[j]),j--,k++;else if(void 0===m&&(m=u(a,k,w),y=u(h,x,j)),m.has(h[x]))if(m.has(h[j])){const e=y.get(a[k]),t=void 0!==e?d[e]:null;if(null===t){const e=(0,directive_helpers.Dx)(s,d[x]);(0,directive_helpers.lx)(e,p[k]),v[k]=e}else v[k]=(0,directive_helpers.lx)(t,p[k]),(0,directive_helpers.Dx)(s,d[x],t),d[e]=null;k++}else(0,directive_helpers.KO)(d[j]),j--;else(0,directive_helpers.KO)(d[x]),x++;for(;k<=w;){const e=(0,directive_helpers.Dx)(s,v[w+1]);(0,directive_helpers.lx)(e,p[k]),v[k++]=e}for(;x<=j;){const e=d[x++];null!==e&&(0,directive_helpers.KO)(e)}return this.ut=a,(0,directive_helpers.mY)(s,v),lit_html.c0}})}}]);
//# sourceMappingURL=sidenav-stories-sidenav-stories.6026f174.iframe.bundle.js.map