PageSourceSearch

https://uppababy.com/_nuxt/CYDynzTH.js

js uppababy.com collected 2026-09-25 19:04:03 UTC 4,387 bytes, 1 lines download raw bytes

1import{b as V,C as j,r as d,a7 as _,a as z,c as I,av as P,j as x,k as b,t as F,m as s,ar as r,L as f,s as G,o as $,F as H,n as J,x as Q,q as g,af as U,a6 as k,a5 as W,ax as X}from"./CzV-f8tj.js";import{a as Y}from"./Bq0cXJPM.js";const Z={class:"w-full lg:w-auto mb-4 lg:mb-0"},ee={id:"sort-by-label",class:"text-xl text-uppababy font-medium mb-2 pb-2"},te={class:"relative inline-block text-left"},oe=["tabindex","disabled","aria-expanded","aria-owns","aria-activedescendant"],se=["onKeydown"],ae=["id","aria-selected","tabindex","onClick","onKeydown","onMouseover","onFocus"],ie=V({__name:"SwSortBy",props:{loading:{type:Boolean,required:!0}},setup(q){const{t:ne}=j(),p=X(),K=W(),{changeCurrentSortingOrder:R,getCurrentSortingOrder:D,getSortingOrders:v}=Y(),w=q,y=d(!1);_(()=>w.loading,e=>{!e&&y.value&&setTimeout(function(){m.value?.focus(),y.value=!1},500)});const C=d(null),o=d(!1),E=d(null),m=d(null),n=d(-1),{sessionContext:M}=z(),l=I(()=>M?.value.salesChannel?.translated?.customFields?.isRatingEnabled?v.value:(v.value||[]).filter(e=>e.key!=="lowest_reviewed"&&e.key!=="highest_reviewed")),i=I({get:()=>D.value||"",set:async e=>{await K.push({query:{...p.query,order:e}});const t={...p.query,associations:{children:{associations:{options:{associations:{media:{}}}}}}};await R(e,{...t,limit:p.query.limit?Number(p.query.limit):10}),y.value=!0}}),u=e=>{e>=0&&e<l.value.length&&(n.value=e,k(()=>{const t=l.value[e];t&&document.getElementById(`sort-option-${t.key}`)?.focus()}))};_(o,e=>{if(e){const t=l.value.findIndex(a=>a.key===i.value);u(t!==-1?t:0),k(()=>{C.value?.focus()})}else n.value=-1},{immediate:!1});const N=()=>{u(0)},T=()=>{u(l.value.length-1)},O=()=>{if(!o.value)return;let e=n.value+1;e>=l.value.length&&(e=0),u(e)},B=()=>{if(!o.value)return;let e=n.value-1;e<0&&(e=l.value.length-1),u(e)},S=async e=>{i.value=e,await k(),o.value=!1,y.value=!0},L=()=>{o.value=!1,k(()=>{m.value?.focus()})},A=e=>{if(!o.value)return;const t=document.getElementById("sort-by-listbox")?.querySelectorAll('button[role="option"]');if(!t||t.length===0)return;const a=t[0],c=t[t.length-1];e.shiftKey?document.activeElement===a?(c.focus(),e.preventDefault()):(B(),e.preventDefault()):document.activeElement===c?(a.focus(),e.preventDefault()):(O(),e.preventDefault())};return _(o,e=>{if(e){const t=l.value.findIndex(a=>a.key===i.value);u(t!==-1?t:0)}else n.value=-1},{immediate:!1}),P(E,()=>{o.value&&(o.value=!1,m.value?.focus())}),(e,t)=>(g(),x("div",Z,[b("div",ee,F(e.$t("plp.sortBy")),1),b("div",{ref_key:"dropdownElement",ref:E,class:"flex flex-wrap gap-2"},[b("div",te,[b("button",{tabindex:w.loading?-1:0,disabled:w.loading,id:"sort-by-button","aria-labelledby":"sort-by-label","aria-haspopup":"listbox","aria-expanded":s(o),role:"combobox",type:"button","aria-owns":s(o)?"sort-by-listbox":void 0,class:"group inline-flex justify-between text-uppababy rounded-md px-4 py-2 text-base font-medium border border-[#707070] bg-[#EFEFEF]","aria-controls":"sort-by-listbox",onClick:t[0]||(t[0]=a=>o.value=!s(o)),onKeydown:t[1]||(t[1]=r(f(a=>o.value=!s(o),["prevent"]),["enter","space"])),ref_key:"sortButtonRef",ref:m,"aria-activedescendant":s(o)&&s(n)!==-1?`sort-option-${s(l)[s(n)]?.key}`:void 0},[G(F(s(v)&&s(v).find(a=>a.key===s(i))?.translated?.label)+" ",1),b("div",{class:$(["icon ub-chevron-filled-down h-3 w-3 ml-2 mt-1.5 text-uppababy",{"rotate-[180deg]":s(o),"rotate-0":!s(o)}])},null,2)],40,oe),s(o)?(g(),x("div",{key:0,class:"absolute mt-2 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none z-10 min-w-60",role:"listbox","aria-labelledby":"sort-by-button",tabindex:"-1",id:"sort-by-listbox",ref_key:"listboxRef",ref:C,onKeydown:[r(f(B,["prevent"]),["up"]),r(f(O,["prevent"]),["down"]),r(f(N,["prevent"]),["home"]),r(f(T,["prevent"]),["end"]),r(L,["escape"]),r(A,["tab"])]},[(g(!0),x(H,null,J(s(l),(a,c)=>(g(),x("button",{key:a.key,id:`sort-option-${a.key}`,class:$(["block w-full text-left px-4 py-2 text-base font-400 focus:border-2 focus:border-black",a.key===s(i)?" text-white bg-uppababy":" hover:bg-gray-100  focus:bg-gray-100 text-black bg-[#EFEFEF]"]),role:"option","aria-selected":a.key===s(i)?"true":"false",tabindex:c===s(n)?0:-1,onClick:h=>S(a.key),onKeydown:r(f(h=>S(a.key),["prevent"]),["enter","space"]),onMouseover:h=>n.value=c,onFocus:h=>n.value=c},F(s(U)(a,"label")),43,ae))),128))],40,se)):Q("",!0)])],512)]))}});
1export{ie as _};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.