@faststore/ui 1.8.33 → 1.8.36

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
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),r=e(t),n=require("@reach/popover"),a=e(n),o=require("react-swipeable"),s=require("react-dom"),i=require("tabbable");const d=t.forwardRef((function({as:e,children:t,testId:n="store-link",...a},o){return r.createElement(null!=e?e:"a",Object.assign({ref:o,"data-store-link":!0,"data-testid":n},a),t)})),l=t.forwardRef((function({children:e,testId:t="store-button",...n},a){return r.createElement("button",Object.assign({ref:a,"data-store-button":!0,"data-testid":t},n),e)})),c=t.forwardRef((function({variant:e,testId:t="store-input",...n},a){return r.createElement("input",Object.assign({ref:a,"data-store-input":!0,"data-testid":t},{"data-error":"error"===e||void 0,"data-success":"success"===e||void 0},n))})),u=t.forwardRef((function({component:e,testId:t="store-icon",...n},a){return r.createElement("span",Object.assign({ref:a,"data-store-icon":!0,"data-testid":t},n),e)})),f=t.forwardRef((function({as:e="span",testId:t="store-price",value:n,formatter:a=(e=>e),variant:o="selling",...s},i){const d=a(n,o);return r.createElement(e,Object.assign({ref:i,"data-store-price":!0,"data-testid":t,"data-variant":o},s),d)})),m=t.forwardRef((function({variant:e,testId:t="store-textarea",...n},a){return r.createElement("textarea",Object.assign({ref:a,"data-store-textarea":!0,"data-testid":t},{"data-success":"success"===e||void 0,"data-error":"error"===e||void 0},n))})),p=t.forwardRef((function({testId:e="store-checkbox",...t},n){return r.createElement("input",Object.assign({ref:n,"data-store-checkbox":!0,"data-testid":e,type:"checkbox"},t))})),b=t.forwardRef((function({testId:e="store-overlay",...t},n){return r.createElement("div",Object.assign({role:"presentation","data-store-overlay":!0,"data-testid":e,ref:n},t))})),g=t.forwardRef((function({children:e,testId:t="store-select",...n},a){return r.createElement("select",Object.assign({ref:a,"data-store-select":!0,"data-testid":t},n),e)})),v=t.forwardRef((function({testId:e="store-radio",...t},n){return r.createElement("input",Object.assign({ref:n,"data-store-radio":!0,"data-testid":e,type:"radio"},t))})),h=t.forwardRef((function({testId:e="store-badge",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-store-badge":!0,"data-testid":e},n),t)})),E=({min:e,max:n,onChange:a,testId:o="store-slider",getAriaValueText:s,className:i})=>{const[d,l]=t.useState(e),[c,u]=t.useState(n),f=t.useRef(e),m=t.useRef(n),p=t.useRef(null),b=t.useCallback(t=>Math.round((t-e)/(n-e)*100),[e,n]);return t.useEffect(()=>{const e=b(d),t=b(m.current);p.current&&(p.current.style.left=e+"%",p.current.style.width=t-e+"%")},[d,b]),t.useEffect(()=>{const e=b(f.current),t=b(c);p.current&&(p.current.style.width=t-e+"%")},[c,b]),t.useEffect(()=>{null==a||a({min:d,max:c})},[d,c,a]),r.createElement("div",{"data-store-slider":!0,"data-testid":o,className:i},r.createElement("div",{ref:p,"data-slider-range":!0}),r.createElement("input",{type:"range",min:e,max:n,value:d,onChange:e=>{const t=Math.min(Number(e.target.value),c-1);l(t),f.current=t},"data-slider-thumb":"left","aria-valuemin":e,"aria-valuemax":n,"aria-valuenow":d,"aria-label":String(d),"aria-labelledby":s?s(d,"min"):void 0}),r.createElement("input",{type:"range",min:e,max:n,value:c,onChange:e=>{const t=Math.max(Number(e.target.value),d+1);u(t),m.current=t},"data-slider-thumb":"right","aria-valuemin":e,"aria-valuemax":n,"aria-valuenow":c,"aria-label":String(c),"aria-labelledby":s?s(c,"max"):void 0}))},w={description:"dl",unordered:"ul",ordered:"ol"},x=t.forwardRef((function({testId:e="store-list",variant:t="unordered",as:n,...a},o){var s;const i=null!=(s=null!=n?n:w[t])?s:"ul";return r.createElement(i,Object.assign({ref:o},{"data-testid":e,"data-store-list":t},a))})),I=t.forwardRef((function({testId:e="store-skeleton",...t},n){return r.createElement("div",Object.assign({ref:n,"data-store-skeleton":!0,"data-testid":e},t))})),R=t.forwardRef((function({testId:e="store-spinner",...t},n){return r.createElement("span",Object.assign({ref:n,"data-store-spinner":!0,"data-testid":e},t))})),y=t.forwardRef((function({testId:e="store-label",children:t,...n},a){return r.createElement("label",Object.assign({ref:a,"data-store-label":!0,"data-testid":e},n),t)})),O=t.forwardRef((function({testId:e="store-incentive",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-store-incentive":!0,"data-testid":e},n),t)})),P=t.forwardRef((function({testId:e="store-product-card",children:t,...n},a){return r.createElement("article",Object.assign({ref:a,"data-store-product-card":!0,"data-testid":e},n),t)})),k=t.forwardRef((function({testId:e="store-product-card-image",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-product-card-image":!0,"data-testid":e},n),t)})),j=t.forwardRef((function({testId:e="store-product-card-content",children:t,...n},a){return r.createElement("section",Object.assign({ref:a,"data-product-card-content":!0,"data-testid":e},n),t)})),C=t.forwardRef((function({testId:e="store-product-card-actions",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-product-card-actions":!0,"data-testid":e},n),t)})),S=t.forwardRef((function({testId:e="store-card",children:t,...n},a){return r.createElement("article",Object.assign({ref:a,"data-store-card":!0,"data-testid":e},n),t)})),D=t.forwardRef((function({testId:e="store-card-image",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-card-image":!0,"data-testid":e},n),t)})),A=t.forwardRef((function({testId:e="store-card-content",children:t,...n},a){return r.createElement("section",Object.assign({ref:a,"data-card-content":!0,"data-testid":e},n),t)})),B=t.forwardRef((function({testId:e="store-card-actions",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-card-actions":!0,"data-testid":e},n),t)})),L=(e,t)=>t?"Current page":"Go to page "+(e+1),M=t.forwardRef((function({totalQuantity:e,activeBullet:n,onClick:a,testId:o="store-bullets",ariaLabelGenerator:s=L,ariaControlsGenerator:i,...d},c){const u=t.useMemo(()=>Array(e).fill(0),[e]);return r.createElement("div",Object.assign({ref:c,"data-store-bullets":!0,"data-testid":o,role:"tablist"},d),u.map((e,t)=>{const d=n===t;return r.createElement(l,{"data-bullet-item":!0,role:"tab",tabIndex:-1,key:t,testId:o+"-item",onClick:e=>a(e,t),"aria-label":s(t,d),"aria-controls":null==i?void 0:i(t),"aria-selected":d})}))})),T=t.forwardRef((function({testId:e="store-form",children:t,...n},a){return r.createElement("form",Object.assign({ref:a,"data-store-form":!0,"data-testid":e},n),t)})),G=()=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},r.createElement("circle",{cx:"11",cy:"11",r:"8"}),r.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),_=t.forwardRef((function({onSubmit:e,icon:n,"aria-label":a="search",testId:o="store-search-input",...s},i){const d=t.useRef(null),f=t.useRef(null);return t.useImperativeHandle(i,()=>({inputRef:d.current,formRef:f.current})),r.createElement(T,{ref:f,"data-store-search-input":!0,"data-testid":o,onSubmit:t=>{var r;t.preventDefault(),""!==(null==(r=d.current)?void 0:r.value)&&e(d.current.value)},role:"search"},r.createElement(c,Object.assign({ref:d,"aria-label":a},s)),r.createElement(l,{type:"submit","aria-label":"Submit Search"},r.createElement(u,{component:null!=n?n:r.createElement(G,null)})))})),q=({size:e={width:25,height:25},viewBox:t="0 0 16 16",color:n="currentColor"})=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:t,width:e.width,height:e.height},r.createElement("path",{d:"M11 1L4 8L11 15",strokeWidth:"2",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round",stroke:n,fill:"none"})),N=({size:e={width:25,height:25},viewBox:t="0 0 16 16",color:n="currentColor"})=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:t,width:e.width,height:e.height},r.createElement("path",{d:"M5 15L12 8L5 1",strokeWidth:"2",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round",stroke:n,fill:"none"}));function $(e,t){switch(t.type){case"NEXT_PAGE":{const t=e.infinite?e.totalPages+1:e.totalPages,r=(e.currentPage+1)%t,n=r%t*e.itemsPerPage;return{...e,sliding:!0,slideDirection:"next",currentItem:n,currentPage:r}}case"PREVIOUS_PAGE":{const t=e.infinite?e.totalPages+1:e.totalPages,r=e.infinite&&0===e.currentPage?-1:((e,t)=>(t-(t-e+1)%t)%t)(e.currentPage,e.totalPages);return{...e,sliding:!0,slideDirection:"previous",currentItem:r%t*e.itemsPerPage,currentPage:r}}case"GO_TO_PAGE":return t.payload.pageIndex===e.currentPage?e:{...e,sliding:t.payload.shouldSlide,slideDirection:t.payload.pageIndex>e.currentPage?"next":"previous",currentItem:t.payload.pageIndex%e.totalPages*e.itemsPerPage,currentPage:t.payload.pageIndex};case"STOP_SLIDE":return{...e,sliding:!1};default:return e}}const F=(e,t)=>{"next"===e&&t({type:"NEXT_PAGE"}),"previous"===e&&t({type:"PREVIOUS_PAGE"}),"number"==typeof e&&t({type:"GO_TO_PAGE",payload:{pageIndex:e,shouldSlide:!0}})};function V({totalItems:e,itemsPerPage:r=1,infiniteMode:n=!1,...a}){const[s,i]=t.useReducer($,void 0,()=>((e,t,r)=>({currentItem:0,currentPage:0,sliding:!1,slideDirection:"next",totalItems:e,itemsPerPage:t,totalPages:Math.ceil(e/t),infinite:r}))(e,r,n));return{handlers:o.useSwipeable({onSwipedRight:()=>F("previous",i),onSwipedLeft:()=>F("next",i),preventDefaultTouchmoveEvent:!0,trackMouse:!0,...a}),slide:F,sliderState:s,sliderDispatch:i}}const H=t.forwardRef((function({icon:e,testId:t="store-icon-button",...n},a){return r.createElement(l,Object.assign({ref:a,"data-store-icon-button":!0,testId:t},n),r.createElement(u,{component:e}))})),Q=({beforeElementRef:e,trapFocusRef:t,afterElementRef:n,testId:a="store-modal-content",children:o,...s})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:e,"data-testid":"beforeElement",tabIndex:0,"aria-hidden":"true"}),r.createElement("div",Object.assign({"data-store-modal-content":!0,"data-testid":a,ref:t,"aria-modal":"true",role:"dialog",tabIndex:-1},s),o),r.createElement("div",{ref:n,"data-testid":"afterElement",tabIndex:0,"aria-hidden":"true"})),U=({children:e,...n})=>{const a=t.useRef(null),o=t.useRef(null),s=t.useRef(null);return(({trapFocusRef:e,beforeElementRef:r,afterElementRef:n})=>{const a=t.useRef(),o=t.useRef(document.hasFocus()?document.activeElement:null);t.useEffect(()=>{const e=o.current;return()=>{null==e||e.focus()}},[o]),t.useEffect(()=>{if(!e.current)return;a.current||(a.current=i.tabbable(e.current));const[t]=a.current;t?t.focus():e.current.focus()},[e]),t.useEffect(()=>{if(!e.current||!r.current||!n.current)return;const t=r.current,o=n.current,s=e.current,d=r=>{var n,d;document.hasFocus()&&(a.current=i.tabbable(e.current),a.current.length||s.focus(),r.target===t&&(null==(n=a.current[a.current.length-1])||n.focus()),r.target===o&&(null==(d=a.current[0])||d.focus()))};return null==t||t.addEventListener("focusin",d),null==o||o.addEventListener("focusin",d),()=>{null==t||t.removeEventListener("focusin",d),null==o||o.removeEventListener("focusin",d)}},[a,n,r,e])})({beforeElementRef:o,trapFocusRef:a,afterElementRef:s}),r.createElement(Q,Object.assign({},n,{trapFocusRef:a,beforeElementRef:o,afterElementRef:s,onClick:e=>{e.stopPropagation()}}),e)},K=t.forwardRef((function({testId:e="store-banner",children:t,variant:n="vertical",...a},o){return r.createElement("article",Object.assign({ref:o,"data-store-banner":n,"data-testid":e},a),t)})),X=t.forwardRef((function({testId:e="store-banner-image",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-banner-image":!0,"data-testid":e},n),t)})),W=t.forwardRef((function({testId:e="store-banner-content",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-banner-content":!0,"data-testid":e},n),t)})),z=t.forwardRef((function({testId:e="store-banner-link",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-banner-link":!0,"data-testid":e},n),t)})),J=t.forwardRef((function({testId:e="store-payment-methods",title:t,"aria-label":n="Payment Methods",children:a,...o},s){return r.createElement("div",Object.assign({ref:s,"data-store-payment-methods":!0,"data-testid":e},o),!!t&&r.createElement("div",null,t),r.createElement("div",{"data-payment-methods-flags":!0,"aria-label":t?void 0:n},a))})),Y=({divider:e,testId:t})=>{const n={"data-breadcrumb-divider":!0,"aria-hidden":!0,"data-testid":t+"-divider"};return r.isValidElement(e)?r.cloneElement(e,n):r.createElement("span",Object.assign({},n),null!=e?e:"/")},Z=({children:e,isLastItem:t,divider:n,testId:a})=>{const o={"data-testid":a+"-item","data-breadcrumb-item":!t||"current","aria-current":t?"page":void 0};return r.isValidElement(e)?r.createElement("li",{"data-breadcrumb-list-item":!0},r.cloneElement(e,o),t?null:r.createElement(Y,{divider:n,testId:a})):r.createElement("li",{"data-breadcrumb-list-item":!0},r.createElement("span",Object.assign({},o),e,t?null:r.createElement(Y,{divider:n,testId:a})))},ee=t.forwardRef((function({children:e,divider:t,testId:n="store-breadcrumb",...a},o){return r.createElement("nav",Object.assign({"aria-label":"Breadcrumb",role:"navigation",ref:o,"data-store-breadcrumb":!0,"data-testid":n},a),r.createElement(x,{"data-breadcrumb-list":!0,variant:"ordered"},r.Children.toArray(e).map((e,a,o)=>r.createElement(Z,{isLastItem:a===o.length-1,divider:t,key:"breadcrumb-"+a,testId:n},e))))})),te=t.forwardRef((function({children:e,loading:t,testId:n="store-loading-button",...a},o){return r.createElement(l,Object.assign({ref:o,"data-store-loading-button":!0,testId:n},a),t?r.createElement(R,null):e)})),re=t.createContext(void 0),ne=t.forwardRef((function({label:e,value:n,children:a,testId:o="store-radio-option",...s},i){const{name:d,selectedValue:l,onChange:c}=function(){const e=t.useContext(re);if(!e)throw new Error("useRadioOption hook cannot be used outside the RadioGroup context");return e}();return r.createElement("label",{"aria-label":e,"data-store-radio-option":!0},r.createElement(v,Object.assign({"data-store-radio-option-item":!0,ref:i,name:d,checked:n===l,onChange:c,value:n,testId:o},s)),a)})),ae=t.createContext(void 0),oe=t.forwardRef((function({testId:e="store-accordion",indices:n,onChange:a,children:o,...s},i){const d=r.Children.map(o,(e,r)=>{var n;return t.cloneElement(e,{index:null!=(n=e.props.index)?n:r})}),l={indices:new Set(n),onChange:a,numberOfItems:d.length};return r.createElement(ae.Provider,{value:l},r.createElement("div",Object.assign({ref:i,"data-store-accordion":!0,"data-testid":e,role:"region"},s),d))}));function se(){const e=t.useContext(ae);if(void 0===e)throw new Error("Do not use Accordion components outside the Accordion context.");return e}const ie=t.createContext(void 0),de=t.forwardRef((function({testId:e="store-accordion-item",children:t,prefixId:n="",index:a=0,...o},s){return r.createElement(ie.Provider,{value:{index:a,prefixId:n,panel:`${n&&n+"-"}panel--${a}`,button:`${n&&n+"-"}button--${a}`}},r.createElement("div",Object.assign({ref:s,"data-accordion-item":!0,"data-testid":e},o),t))}));function le(){const e=t.useContext(ie);if(void 0===e)throw new Error("Do not use AccordionItem components outside the AccordionItem context.");return e}const ce=t.forwardRef((function({testId:e="store-accordion-button",children:t,...n},a){const{indices:o,onChange:s,numberOfItems:i}=se(),{index:d,panel:c,button:u,prefixId:f}=le();return r.createElement(l,Object.assign({ref:a,id:u,"aria-expanded":o.has(d),"aria-controls":c,"data-accordion-button":!0,"data-testid":e,onKeyDown:e=>{var t,r;if(["ArrowDown","ArrowUp"].includes(e.key))switch(e.key){case"ArrowDown":e.preventDefault(),null==(t=(()=>{const e=Number(d)+1===i?0:Number(d)+1;return document.getElementById(`${f&&f+"-"}button--${e}`)})())||t.focus();break;case"ArrowUp":e.preventDefault(),null==(r=(()=>{const e=Number(d)-1<0?i-1:Number(d)-1;return document.getElementById(`${f&&f+"-"}button--${e}`)})())||r.focus()}},onClick:()=>{s(d)}},n),t)})),ue=t.forwardRef((function({testId:e="store-accordion-panel",children:t,...n},a){const{indices:o}=se(),{index:s,button:i,panel:d}=le();return r.createElement("div",Object.assign({ref:a,id:d,"aria-labelledby":i,role:"region","data-accordion-panel":!0,"data-testid":e,hidden:!o.has(s)},n),t)})),fe=t.forwardRef((function({testId:e="store-table",children:t,...n},a){return r.createElement("table",Object.assign({ref:a,"data-store-table":!0,"data-testid":e},n),t)})),me=t.forwardRef((function({testId:e="store-table-row",children:t,...n},a){return r.createElement("tr",Object.assign({ref:a,"data-table-row":!0,"data-testid":e},n),t)})),pe=t.forwardRef((function({testId:e="store-table-cell",children:t,variant:n="data",scope:a,...o},s){return r.createElement("header"===n?"th":"td",Object.assign({ref:s,"data-table-cell":n,"data-testid":e,scope:a},o),t)})),be=t.forwardRef((function({children:e,testId:t="store-table-body",...n},a){return r.createElement("tbody",Object.assign({ref:a,"data-testid":t,"data-table-body":!0},n),e)})),ge=t.forwardRef((function({children:e,testId:t="store-table-head",...n},a){return r.createElement("thead",Object.assign({ref:a,"data-testid":t,"data-table-head":!0},n),e)})),ve=t.forwardRef((function({children:e,testId:t="store-table-footer",...n},a){return r.createElement("tfoot",Object.assign({ref:a,"data-testid":t,"data-table-footer":!0},n),e)})),he=t.forwardRef((function({testId:e="store-alert",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,role:"alert","data-store-alert":!0,"data-testid":e},n),t)})),Ee=t.forwardRef((function({quantity:e,testId:t="store-quantity-selector",leftButtonProps:n,inputProps:a,rightButtonProps:o,...s},i){return r.createElement("div",Object.assign({"data-store-quantity-selector":!0,"data-testid":t,ref:i},s),r.createElement(H,Object.assign({"aria-controls":"quantity-selector-input","aria-label":"Decrement Quantity","data-quantity-selector-button":"left"},n)),r.createElement(c,Object.assign({"aria-label":"Quantity","data-quantity-selector-input":!0,id:"quantity-selector-input",value:e},a)),r.createElement(H,Object.assign({"aria-controls":"quantity-selector-input","aria-label":"Increment Quantity","data-quantity-selector-button":"right"},o)))})),we=t.createContext({isOpen:!1,dropdownButtonRef:null,selectedDropdownItemIndexRef:null,dropdownItemsRef:null,id:"store-dropdown"}),xe=()=>{const e=t.useContext(we);if(void 0===e)throw new Error("Do not use useDropdown hook outside the Dropdown context.");return e},Ie=t.forwardRef((function({children:e,testId:n="store-dropdown-button",...a},o){const{toggle:s,dropdownButtonRef:i,isOpen:d,id:l}=xe();return t.useImperativeHandle(o,()=>i.current,[i]),r.createElement("button",Object.assign({"data-store-dropdown-button":!0,onClick:s,"data-testid":n,ref:i,"aria-expanded":d,"aria-haspopup":"menu","aria-controls":l},a),e)})),Re=t.forwardRef((function({children:e,onClick:n,testId:a="store-dropdown-item",...o},s){const{dropdownItemsRef:i,selectedDropdownItemIndexRef:d,close:l}=xe(),[c,u]=t.useState(0),f=t.useRef(),m=()=>{var e;d.current=c,null==i||null==(e=i.current[d.current])||e.focus()};return t.useImperativeHandle(s,()=>f.current,[]),r.createElement("button",Object.assign({"data-store-dropdown-item":!0,"data-testid":a,ref:e=>{var t;!e||null!=i&&i.current.includes(e)||(null==i||i.current.push(e),u(null!=(t=null==i?void 0:i.current.findIndex(t=>t===e))?t:0)),f.current=e},onFocus:m,onMouseEnter:m,onClick:e=>{null==n||n(e),null==l||l()},role:"menuitem",tabIndex:-1,"data-index":c},o),e)}));exports.Accordion=oe,exports.AccordionButton=ce,exports.AccordionItem=de,exports.AccordionPanel=ue,exports.Alert=he,exports.Badge=h,exports.Banner=K,exports.BannerContent=W,exports.BannerImage=X,exports.BannerLink=z,exports.Breadcrumb=ee,exports.Bullets=M,exports.Button=l,exports.Card=S,exports.CardActions=B,exports.CardContent=A,exports.CardImage=D,exports.Carousel=function({infiniteMode:e=!0,controls:n="complete",testId:a="store-carousel",transition:o={duration:400,property:"transform"},children:s,id:i="store-carousel",...d}){var l,c;const u=r.Children.toArray(s),f=u.length,m=e?f+2:f,p=`${o.property} ${o.duration}ms ${null!=(l=o.timing)?l:""} ${null!=(c=o.delay)?c:""}`,b="complete"===n||"navigationArrows"===n,g="complete"===n||"paginationBullets"===n,v=t.useMemo(()=>((e,t)=>{const r={},n=100/t;for(let a=0;a<t;++a)r[e?a-1:a]=-n*a;return r})(e,m),[m,e]),{handlers:h,slide:E,sliderState:w,sliderDispatch:x}=V({totalItems:f,itemsPerPage:1,infiniteMode:e,...d}),{isItemVisible:I,shouldRenderItem:R}=function({currentSlide:e,itemsPerPage:r,totalItems:n}){const a=t.useRef(new Set);t.useEffect(()=>{for(let t=0;t<r;t++)a.current.add(e+t)},[e,r]);const o=t=>function({itemsPerPage:e,currentSlide:t,slideIdx:r,totalItems:n}){return t<0||t>=n||r>=t&&r<t+e}({slideIdx:t,currentSlide:e,itemsPerPage:r,totalItems:n});return{shouldRenderItem:e=>a.current.has(e)||o(e),isItemVisible:o}}({itemsPerPage:w.itemsPerPage,currentSlide:w.currentItem,totalItems:f}),y=e&&s?u.slice(0,1):[],O=(e&&s?u.slice(f-1):[]).concat(null!=s?s:[],y),P=()=>{w.sliding||!e&&0===w.currentPage||E("previous",x)},k=()=>{w.sliding||!e&&w.currentPage===f-1||E("next",x)};return r.createElement("section",{id:i,"data-store-carousel":!0,"data-testid":a,"aria-label":"carousel","aria-roledescription":"carousel"},r.createElement("div",Object.assign({"data-carousel-track-container":!0,style:{overflow:"hidden",width:"100%"}},h),r.createElement("div",{"data-carousel-track":!0,style:{display:"flex",transition:w.sliding?p:void 0,width:100*m+"%",transform:`translate3d(${v[w.currentPage]}%, 0, 0)`},onTransitionEnd:()=>{x({type:"STOP_SLIDE"}),w.currentItem>=f&&x({type:"GO_TO_PAGE",payload:{pageIndex:0,shouldSlide:!1}}),w.currentItem<0&&x({type:"GO_TO_PAGE",payload:{pageIndex:w.totalPages-1,shouldSlide:!1}})},"aria-live":"polite"},O.map((t,n)=>r.createElement("div",{role:"tabpanel","aria-roledescription":"slide",key:n,id:"carousel-item-"+n,"data-carousel-item":!0,style:{width:"100%"},"data-visible":I(n-Number(e))||void 0},R(n-Number(e))?t:null)))),b&&r.createElement("div",{"data-carousel-controls":!0},r.createElement(H,{"aria-label":"previous","data-arrow":"left","aria-controls":i,onClick:P,icon:r.createElement(q,null)}),r.createElement(H,{"aria-label":"next","data-arrow":"right","aria-controls":i,onClick:k,icon:r.createElement(N,null)})),g&&r.createElement("div",{"data-carousel-bullets":!0},r.createElement(M,{tabIndex:0,totalQuantity:f,activeBullet:w.currentPage,onClick:(e,t)=>{w.sliding||E(t,x)},ariaControlsGenerator:e=>"carousel-item-"+e,onKeyDown:e=>{switch(e.key){case"ArrowLeft":P();break;case"ArrowRight":k();break;case"Home":E(0,x);break;case"End":E(f-1,x)}},onFocus:e=>{e.currentTarget.focus()}})))},exports.Checkbox=p,exports.Dropdown=({children:e,isOpen:n=!1,onDismiss:a,id:o="store-dropdown"})=>{const[s,i]=t.useState(n),d=t.useRef([]),l=t.useRef(0),c=t.useRef(null),u=t.useCallback(()=>{var e;i(!1),null==a||a(),null==(e=c.current)||e.focus()},[a]),f=()=>{i(!0)},m=t.useCallback(()=>{i(e=>{var t;return e&&(null==a||a(),null==(t=c.current)||t.focus()),!e})},[a]);t.useEffect(()=>{i(n)},[n]),t.useEffect(()=>{var e;s&&(null==d||null==(e=d.current[0])||e.focus())},[s]),t.useEffect(()=>{let e=!0;const t=t=>{const r=null==d?void 0:d.current.some(e=>t.target===e);e?e=!1:!r&&u()};return s?document.addEventListener("click",t):document.removeEventListener("click",t),()=>{document.removeEventListener("click",t)}},[u,s]);const p=t.useMemo(()=>({isOpen:s,close:u,open:f,toggle:m,dropdownButtonRef:c,onDismiss:a,selectedDropdownItemIndexRef:l,dropdownItemsRef:d,id:o}),[u,o,s,a,m]);return r.createElement(we.Provider,{value:p},e)},exports.DropdownButton=Ie,exports.DropdownItem=Re,exports.DropdownMenu=({children:e,testId:t="store-dropdown-menu",style:n,...a})=>{const{isOpen:o,close:i,dropdownItemsRef:d,selectedDropdownItemIndexRef:l,id:c}=xe(),u=(()=>{var e,t,r,n,a,o,s,i;const{dropdownButtonRef:d}=xe(),l="undefined"!=typeof window,c=null==d||null==(e=d.current)?void 0:e.getBoundingClientRect(),u=null!=(t=null==c?void 0:c.top)?t:0,f=null!=(r=null==c?void 0:c.height)?r:0,m=null!=(n=null==c?void 0:c.left)?n:0;return{position:"absolute",top:u+f+(l?null==(a=document)||null==(o=a.documentElement)?void 0:o.scrollTop:0),left:m+(l?null==(s=document)||null==(i=s.documentElement)?void 0:i.scrollLeft:0)}})(),f=r.Children.toArray(e).length;return o?s.createPortal(r.createElement("div",{role:"presentation","data-store-dropdown-overlay":!0,onKeyDown:e=>{var t,r,n,a;e.defaultPrevented||"Enter"===e.key||(e.preventDefault(),"Escape"===e.key&&(null==i||i()),"ArrowDown"===e.key&&(l.current<f-1?l.current++:l.current=0,null==d||null==(t=d.current[l.current])||t.focus()),"ArrowUp"===e.key&&(l.current>0?l.current--:l.current=f-1,null==d||null==(r=d.current[l.current])||r.focus()),"Home"===e.key&&(l.current=0,null==d||null==(n=d.current[l.current])||n.focus()),"End"===e.key&&(l.current=f-1,null==d||null==(a=d.current[l.current])||a.focus()),e.stopPropagation())},"data-testid":t+"-overlay"},r.createElement("div",Object.assign({role:"menu","aria-orientation":"vertical","data-store-dropdown-menu":!0,"data-testid":t,style:{...u,...n},id:c},a),e)),document.body):(d.current=[],null)},exports.Form=T,exports.Icon=u,exports.IconButton=H,exports.Incentive=O,exports.Input=c,exports.Label=y,exports.Link=d,exports.List=x,exports.LoadingButton=te,exports.Modal=({isOpen:e,children:t,onDismiss:n,testId:a="store-modal",...o})=>e?s.createPortal(r.createElement(b,{"data-modal-overlay":!0,onClick:e=>{e.defaultPrevented||(e.stopPropagation(),null==n||n(e))},onKeyDown:e=>{"Escape"!==e.key||e.defaultPrevented||(e.stopPropagation(),null==n||n(e))}},r.createElement(U,Object.assign({},o,{testId:a}),t)),document.body):null,exports.Overlay=b,exports.PaymentMethods=J,exports.Popover=({targetRef:e,testId:t="store-popover",children:o,...s})=>r.createElement(a,Object.assign({"data-store-popover":!0,"data-testid":t,position:n.positionDefault,targetRef:e},s),o),exports.Price=f,exports.PriceRange=({className:e,formatter:n,max:a,min:o,onChange:s,testId:i="store-price-range",variant:d,"aria-label":l})=>{const[c,u]=t.useState(o),[m,p]=t.useState(a);return r.createElement("div",{"data-store-price-range":!0,"data-testid":i,className:e},r.createElement(E,{min:o,max:a,onChange:e=>{e.min!==c&&u(e.min),e.max!==m&&p(e.max),null==s||s(e)},"aria-label":l}),r.createElement("div",{"data-price-range-values":!0},r.createElement(f,{formatter:n,"data-price-range-value":"min",value:c,variant:d}),r.createElement(f,{formatter:n,"data-price-range-value":"max",value:m,variant:d})))},exports.ProductCard=P,exports.ProductCardActions=C,exports.ProductCardContent=j,exports.ProductCardImage=k,exports.QuantitySelector=Ee,exports.Radio=v,exports.RadioGroup=({name:e,onChange:t,children:n,selectedValue:a})=>{const o=r.useMemo(()=>({name:e,selectedValue:a,onChange:t}),[e,a,t]);return r.createElement(re.Provider,{value:o},n)},exports.RadioOption=ne,exports.SearchInput=_,exports.Select=g,exports.Skeleton=I,exports.Slider=E,exports.Spinner=R,exports.Table=fe,exports.TableBody=be,exports.TableCell=pe,exports.TableFooter=ve,exports.TableHead=ge,exports.TableRow=me,exports.TextArea=m,exports.useSlider=V;
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),r=e(t),n=require("@reach/popover"),a=e(n),o=require("react-swipeable"),s=require("react-dom"),i=require("tabbable");const d=t.forwardRef((function({as:e,children:t,testId:n="store-link",...a},o){return r.createElement(null!=e?e:"a",Object.assign({ref:o,"data-store-link":!0,"data-testid":n},a),t)})),l=t.forwardRef((function({children:e,testId:t="store-button",...n},a){return r.createElement("button",Object.assign({ref:a,"data-store-button":!0,"data-testid":t},n),e)})),c=t.forwardRef((function({variant:e,testId:t="store-input",...n},a){return r.createElement("input",Object.assign({ref:a,"data-store-input":!0,"data-testid":t},{"data-error":"error"===e||void 0,"data-success":"success"===e||void 0},n))})),u=t.forwardRef((function({component:e,testId:t="store-icon",...n},a){return r.createElement("span",Object.assign({ref:a,"data-store-icon":!0,"data-testid":t},n),e)})),f=t.forwardRef((function({as:e="span",testId:t="store-price",value:n,formatter:a=(e=>e),variant:o="selling",...s},i){const d=a(n,o);return r.createElement(e,Object.assign({ref:i,"data-store-price":!0,"data-testid":t,"data-variant":o},s),d)})),m=t.forwardRef((function({variant:e,testId:t="store-textarea",...n},a){return r.createElement("textarea",Object.assign({ref:a,"data-store-textarea":!0,"data-testid":t},{"data-success":"success"===e||void 0,"data-error":"error"===e||void 0},n))})),p=t.forwardRef((function({testId:e="store-checkbox",...t},n){return r.createElement("input",Object.assign({ref:n,"data-store-checkbox":!0,"data-testid":e,type:"checkbox"},t))})),b=t.forwardRef((function({testId:e="store-overlay",...t},n){return r.createElement("div",Object.assign({role:"presentation","data-store-overlay":!0,"data-testid":e,ref:n},t))})),g=t.forwardRef((function({children:e,testId:t="store-select",...n},a){return r.createElement("select",Object.assign({ref:a,"data-store-select":!0,"data-testid":t},n),e)})),v=t.forwardRef((function({testId:e="store-radio",...t},n){return r.createElement("input",Object.assign({ref:n,"data-store-radio":!0,"data-testid":e,type:"radio"},t))})),h=t.forwardRef((function({testId:e="store-badge",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-store-badge":!0,"data-testid":e},n),t)})),E=({min:e,max:n,onChange:a,testId:o="store-slider",getAriaValueText:s,className:i})=>{const[d,l]=t.useState(e),[c,u]=t.useState(n),f=t.useRef(e),m=t.useRef(n),p=t.useRef(null),b=t.useCallback(t=>Math.round((t-e)/(n-e)*100),[e,n]);return t.useEffect(()=>{const e=b(d),t=b(m.current);p.current&&(p.current.style.left=e+"%",p.current.style.width=t-e+"%")},[d,b]),t.useEffect(()=>{const e=b(f.current),t=b(c);p.current&&(p.current.style.width=t-e+"%")},[c,b]),t.useEffect(()=>{null==a||a({min:d,max:c})},[d,c,a]),r.createElement("div",{"data-store-slider":!0,"data-testid":o,className:i},r.createElement("div",{ref:p,"data-slider-range":!0}),r.createElement("input",{type:"range",min:e,max:n,value:d,onChange:e=>{const t=Math.min(Number(e.target.value),c-1);l(t),f.current=t},"data-slider-thumb":"left","aria-valuemin":e,"aria-valuemax":n,"aria-valuenow":d,"aria-label":String(d),"aria-labelledby":s?s(d,"min"):void 0}),r.createElement("input",{type:"range",min:e,max:n,value:c,onChange:e=>{const t=Math.max(Number(e.target.value),d+1);u(t),m.current=t},"data-slider-thumb":"right","aria-valuemin":e,"aria-valuemax":n,"aria-valuenow":c,"aria-label":String(c),"aria-labelledby":s?s(c,"max"):void 0}))},w={description:"dl",unordered:"ul",ordered:"ol"},x=t.forwardRef((function({testId:e="store-list",variant:t="unordered",as:n,...a},o){var s;const i=null!=(s=null!=n?n:w[t])?s:"ul";return r.createElement(i,Object.assign({ref:o},{"data-testid":e,"data-store-list":t},a))})),I=t.forwardRef((function({testId:e="store-skeleton",...t},n){return r.createElement("div",Object.assign({ref:n,"data-store-skeleton":!0,"data-testid":e},t))})),R=t.forwardRef((function({testId:e="store-spinner",...t},n){return r.createElement("span",Object.assign({ref:n,"data-store-spinner":!0,"data-testid":e},t))})),y=t.forwardRef((function({testId:e="store-label",children:t,...n},a){return r.createElement("label",Object.assign({ref:a,"data-store-label":!0,"data-testid":e},n),t)})),O=t.forwardRef((function({testId:e="store-incentive",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-store-incentive":!0,"data-testid":e},n),t)})),P=t.forwardRef((function({testId:e="store-product-card",children:t,...n},a){return r.createElement("article",Object.assign({ref:a,"data-store-product-card":!0,"data-testid":e},n),t)})),k=t.forwardRef((function({testId:e="store-product-card-image",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-product-card-image":!0,"data-testid":e},n),t)})),j=t.forwardRef((function({testId:e="store-product-card-content",children:t,...n},a){return r.createElement("section",Object.assign({ref:a,"data-product-card-content":!0,"data-testid":e},n),t)})),C=t.forwardRef((function({testId:e="store-product-card-actions",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-product-card-actions":!0,"data-testid":e},n),t)})),S=t.forwardRef((function({testId:e="store-card",children:t,...n},a){return r.createElement("article",Object.assign({ref:a,"data-store-card":!0,"data-testid":e},n),t)})),D=t.forwardRef((function({testId:e="store-card-image",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-card-image":!0,"data-testid":e},n),t)})),A=t.forwardRef((function({testId:e="store-card-content",children:t,...n},a){return r.createElement("section",Object.assign({ref:a,"data-card-content":!0,"data-testid":e},n),t)})),B=t.forwardRef((function({testId:e="store-card-actions",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-card-actions":!0,"data-testid":e},n),t)})),L=(e,t)=>t?"Current page":"Go to page "+(e+1),M=t.forwardRef((function({totalQuantity:e,activeBullet:n,onClick:a,testId:o="store-bullets",ariaLabelGenerator:s=L,ariaControlsGenerator:i,...d},c){const u=t.useMemo(()=>Array(e).fill(0),[e]);return r.createElement("div",Object.assign({ref:c,"data-store-bullets":!0,"data-testid":o,role:"tablist"},d),u.map((e,t)=>{const d=n===t;return r.createElement(l,{"data-bullet-item":!0,role:"tab",tabIndex:-1,key:t,testId:o+"-item",onClick:e=>a(e,t),"aria-label":s(t,d),"aria-controls":null==i?void 0:i(t),"aria-selected":d})}))})),T=t.forwardRef((function({testId:e="store-form",children:t,...n},a){return r.createElement("form",Object.assign({ref:a,"data-store-form":!0,"data-testid":e},n),t)})),G=()=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},r.createElement("circle",{cx:"11",cy:"11",r:"8"}),r.createElement("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})),_=t.forwardRef((function({onSubmit:e,icon:n,"aria-label":a="search",testId:o="store-search-input",...s},i){const d=t.useRef(null),f=t.useRef(null);return t.useImperativeHandle(i,()=>({inputRef:d.current,formRef:f.current})),r.createElement(T,{ref:f,"data-store-search-input":!0,"data-testid":o,onSubmit:t=>{var r;t.preventDefault(),""!==(null==(r=d.current)?void 0:r.value)&&e(d.current.value)},role:"search"},r.createElement(c,Object.assign({ref:d,"aria-label":a},s)),r.createElement(l,{type:"submit","aria-label":"Submit Search"},r.createElement(u,{component:null!=n?n:r.createElement(G,null)})))})),q=({size:e={width:25,height:25},viewBox:t="0 0 16 16",color:n="currentColor"})=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:t,width:e.width,height:e.height},r.createElement("path",{d:"M11 1L4 8L11 15",strokeWidth:"2",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round",stroke:n,fill:"none"})),N=({size:e={width:25,height:25},viewBox:t="0 0 16 16",color:n="currentColor"})=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:t,width:e.width,height:e.height},r.createElement("path",{d:"M5 15L12 8L5 1",strokeWidth:"2",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round",stroke:n,fill:"none"}));function $(e,t){switch(t.type){case"NEXT_PAGE":{const t=e.infinite?e.totalPages+1:e.totalPages,r=(e.currentPage+1)%t,n=r%t*e.itemsPerPage;return{...e,sliding:!0,slideDirection:"next",currentItem:n,currentPage:r}}case"PREVIOUS_PAGE":{const t=e.infinite?e.totalPages+1:e.totalPages,r=e.infinite&&0===e.currentPage?-1:((e,t)=>(t-(t-e+1)%t)%t)(e.currentPage,e.totalPages);return{...e,sliding:!0,slideDirection:"previous",currentItem:r%t*e.itemsPerPage,currentPage:r}}case"GO_TO_PAGE":return t.payload.pageIndex===e.currentPage?e:{...e,sliding:t.payload.shouldSlide,slideDirection:t.payload.pageIndex>e.currentPage?"next":"previous",currentItem:t.payload.pageIndex%e.totalPages*e.itemsPerPage,currentPage:t.payload.pageIndex};case"STOP_SLIDE":return{...e,sliding:!1};default:return e}}const F=(e,t)=>{"next"===e&&t({type:"NEXT_PAGE"}),"previous"===e&&t({type:"PREVIOUS_PAGE"}),"number"==typeof e&&t({type:"GO_TO_PAGE",payload:{pageIndex:e,shouldSlide:!0}})};function V({totalItems:e,itemsPerPage:r=1,infiniteMode:n=!1,...a}){const[s,i]=t.useReducer($,void 0,()=>((e,t,r)=>({currentItem:0,currentPage:0,sliding:!1,slideDirection:"next",totalItems:e,itemsPerPage:t,totalPages:Math.ceil(e/t),infinite:r}))(e,r,n));return{handlers:o.useSwipeable({onSwipedRight:()=>F("previous",i),onSwipedLeft:()=>F("next",i),preventDefaultTouchmoveEvent:!0,trackMouse:!0,...a}),slide:F,sliderState:s,sliderDispatch:i}}const H=t.forwardRef((function({icon:e,testId:t="store-icon-button",...n},a){return r.createElement(l,Object.assign({ref:a,"data-store-icon-button":!0,testId:t},n),r.createElement(u,{component:e}))})),Q=({beforeElementRef:e,trapFocusRef:t,afterElementRef:n,testId:a="store-modal-content",children:o,...s})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:e,"data-testid":"beforeElement",tabIndex:0,"aria-hidden":"true"}),r.createElement("div",Object.assign({"data-store-modal-content":!0,"data-testid":a,ref:t,"aria-modal":"true",role:"dialog",tabIndex:-1},s),o),r.createElement("div",{ref:n,"data-testid":"afterElement",tabIndex:0,"aria-hidden":"true"})),U=({children:e,...n})=>{const a=t.useRef(null),o=t.useRef(null),s=t.useRef(null);return(({trapFocusRef:e,beforeElementRef:r,afterElementRef:n})=>{const a=t.useRef(),o=t.useRef(document.hasFocus()?document.activeElement:null);t.useEffect(()=>{const e=o.current;return()=>{null==e||e.focus()}},[o]),t.useEffect(()=>{if(!e.current)return;a.current||(a.current=i.tabbable(e.current));const[t]=a.current;t?t.focus():e.current.focus()},[e]),t.useEffect(()=>{if(!e.current||!r.current||!n.current)return;const t=r.current,o=n.current,s=e.current,d=r=>{var n,d;document.hasFocus()&&(a.current=i.tabbable(e.current),a.current.length||s.focus(),r.target===t&&(null==(n=a.current[a.current.length-1])||n.focus()),r.target===o&&(null==(d=a.current[0])||d.focus()))};return null==t||t.addEventListener("focusin",d),null==o||o.addEventListener("focusin",d),()=>{null==t||t.removeEventListener("focusin",d),null==o||o.removeEventListener("focusin",d)}},[a,n,r,e])})({beforeElementRef:o,trapFocusRef:a,afterElementRef:s}),r.createElement(Q,Object.assign({},n,{trapFocusRef:a,beforeElementRef:o,afterElementRef:s,onClick:e=>{e.stopPropagation()}}),e)},K=t.forwardRef((function({testId:e="store-banner",children:t,variant:n="vertical",...a},o){return r.createElement("article",Object.assign({ref:o,"data-store-banner":n,"data-testid":e},a),t)})),X=t.forwardRef((function({testId:e="store-banner-image",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-banner-image":!0,"data-testid":e},n),t)})),W=t.forwardRef((function({testId:e="store-banner-content",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-banner-content":!0,"data-testid":e},n),t)})),z=t.forwardRef((function({testId:e="store-banner-link",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,"data-banner-link":!0,"data-testid":e},n),t)})),J=t.forwardRef((function({testId:e="store-payment-methods",title:t,"aria-label":n="Payment Methods",children:a,...o},s){return r.createElement("div",Object.assign({ref:s,"data-store-payment-methods":!0,"data-testid":e},o),!!t&&r.createElement("div",null,t),r.createElement("div",{"data-payment-methods-flags":!0,"aria-label":t?void 0:n},a))})),Y=({divider:e,testId:t})=>{const n={"data-breadcrumb-divider":!0,"aria-hidden":!0,"data-testid":t+"-divider"};return r.isValidElement(e)?r.cloneElement(e,n):r.createElement("span",Object.assign({},n),null!=e?e:"/")},Z=({children:e,isLastItem:t,divider:n,testId:a})=>{const o={"data-testid":a+"-item","data-breadcrumb-item":!t||"current","aria-current":t?"page":void 0};return r.isValidElement(e)?r.createElement("li",{"data-breadcrumb-list-item":!0},r.cloneElement(e,o),t?null:r.createElement(Y,{divider:n,testId:a})):r.createElement("li",{"data-breadcrumb-list-item":!0},r.createElement("span",Object.assign({},o),e,t?null:r.createElement(Y,{divider:n,testId:a})))},ee=t.forwardRef((function({children:e,divider:t,testId:n="store-breadcrumb",...a},o){return r.createElement("nav",Object.assign({"aria-label":"Breadcrumb",role:"navigation",ref:o,"data-store-breadcrumb":!0,"data-testid":n},a),r.createElement(x,{"data-breadcrumb-list":!0,variant:"ordered"},r.Children.toArray(e).map((e,a,o)=>r.createElement(Z,{isLastItem:a===o.length-1,divider:t,key:"breadcrumb-"+a,testId:n},e))))})),te=t.forwardRef((function({children:e,loading:t,testId:n="store-loading-button",...a},o){return r.createElement(l,Object.assign({ref:o,"data-store-loading-button":!0,testId:n},a),t?r.createElement(R,null):e)})),re=t.createContext(void 0),ne=t.forwardRef((function({label:e,value:n,children:a,testId:o="store-radio-option",...s},i){const{name:d,selectedValue:l,onChange:c}=function(){const e=t.useContext(re);if(!e)throw new Error("useRadioOption hook cannot be used outside the RadioGroup context");return e}();return r.createElement("label",{"aria-label":e,"data-store-radio-option":!0},r.createElement(v,Object.assign({"data-store-radio-option-item":!0,ref:i,name:d,checked:n===l,onChange:c,value:n,testId:o},s)),a)})),ae=t.createContext(void 0),oe=t.forwardRef((function({testId:e="store-accordion",indices:n,onChange:a,children:o,...s},i){const d=r.Children.map(o,(e,r)=>{var n;return t.cloneElement(e,{index:null!=(n=e.props.index)?n:r})}),l={indices:new Set(n),onChange:a,numberOfItems:d.length};return r.createElement(ae.Provider,{value:l},r.createElement("div",Object.assign({ref:i,"data-store-accordion":!0,"data-testid":e,role:"region"},s),d))}));function se(){const e=t.useContext(ae);if(void 0===e)throw new Error("Do not use Accordion components outside the Accordion context.");return e}const ie=t.createContext(void 0),de=t.forwardRef((function({testId:e="store-accordion-item",children:t,prefixId:n="",index:a=0,...o},s){return r.createElement(ie.Provider,{value:{index:a,prefixId:n,panel:`${n&&n+"-"}panel--${a}`,button:`${n&&n+"-"}button--${a}`}},r.createElement("div",Object.assign({ref:s,"data-accordion-item":!0,"data-testid":e},o),t))}));function le(){const e=t.useContext(ie);if(void 0===e)throw new Error("Do not use AccordionItem components outside the AccordionItem context.");return e}const ce=t.forwardRef((function({testId:e="store-accordion-button",children:t,...n},a){const{indices:o,onChange:s,numberOfItems:i}=se(),{index:d,panel:c,button:u,prefixId:f}=le();return r.createElement(l,Object.assign({ref:a,id:u,"aria-expanded":o.has(d),"aria-controls":c,"data-accordion-button":!0,"data-testid":e,onKeyDown:e=>{var t,r;if(["ArrowDown","ArrowUp"].includes(e.key))switch(e.key){case"ArrowDown":e.preventDefault(),null==(t=(()=>{const e=Number(d)+1===i?0:Number(d)+1;return document.getElementById(`${f&&f+"-"}button--${e}`)})())||t.focus();break;case"ArrowUp":e.preventDefault(),null==(r=(()=>{const e=Number(d)-1<0?i-1:Number(d)-1;return document.getElementById(`${f&&f+"-"}button--${e}`)})())||r.focus()}},onClick:()=>{s(d)}},n),t)})),ue=t.forwardRef((function({testId:e="store-accordion-panel",children:t,...n},a){const{indices:o}=se(),{index:s,button:i,panel:d}=le();return r.createElement("div",Object.assign({ref:a,id:d,"aria-labelledby":i,role:"region","data-accordion-panel":!0,"data-testid":e,hidden:!o.has(s)},n),t)})),fe=t.forwardRef((function({testId:e="store-table",children:t,...n},a){return r.createElement("table",Object.assign({ref:a,"data-store-table":!0,"data-testid":e},n),t)})),me=t.forwardRef((function({testId:e="store-table-row",children:t,...n},a){return r.createElement("tr",Object.assign({ref:a,"data-table-row":!0,"data-testid":e},n),t)})),pe=t.forwardRef((function({testId:e="store-table-cell",children:t,variant:n="data",scope:a,...o},s){return r.createElement("header"===n?"th":"td",Object.assign({ref:s,"data-table-cell":n,"data-testid":e,scope:a},o),t)})),be=t.forwardRef((function({children:e,testId:t="store-table-body",...n},a){return r.createElement("tbody",Object.assign({ref:a,"data-testid":t,"data-table-body":!0},n),e)})),ge=t.forwardRef((function({children:e,testId:t="store-table-head",...n},a){return r.createElement("thead",Object.assign({ref:a,"data-testid":t,"data-table-head":!0},n),e)})),ve=t.forwardRef((function({children:e,testId:t="store-table-footer",...n},a){return r.createElement("tfoot",Object.assign({ref:a,"data-testid":t,"data-table-footer":!0},n),e)})),he=t.forwardRef((function({testId:e="store-alert",children:t,...n},a){return r.createElement("div",Object.assign({ref:a,role:"alert","data-store-alert":!0,"data-testid":e},n),t)})),Ee=t.forwardRef((function({quantity:e,testId:t="store-quantity-selector",leftButtonProps:n,inputProps:a,rightButtonProps:o,...s},i){return r.createElement("div",Object.assign({"data-store-quantity-selector":!0,"data-testid":t,ref:i},s),r.createElement(H,Object.assign({"aria-controls":"quantity-selector-input","aria-label":"Decrement Quantity","data-quantity-selector-button":"left"},n)),r.createElement(c,Object.assign({"aria-label":"Quantity","data-quantity-selector-input":!0,id:"quantity-selector-input",value:e},a)),r.createElement(H,Object.assign({"aria-controls":"quantity-selector-input","aria-label":"Increment Quantity","data-quantity-selector-button":"right"},o)))})),we=t.createContext({isOpen:!1,dropdownButtonRef:null,selectedDropdownItemIndexRef:null,dropdownItemsRef:null,id:"store-dropdown"}),xe=()=>{const e=t.useContext(we);if(void 0===e)throw new Error("Do not use useDropdown hook outside the Dropdown context.");return e},Ie=t.forwardRef((function({children:e,testId:n="store-dropdown-button",...a},o){const{toggle:s,dropdownButtonRef:i,isOpen:d,id:l}=xe();return t.useImperativeHandle(o,()=>i.current,[i]),r.createElement("button",Object.assign({"data-store-dropdown-button":!0,onClick:s,"data-testid":n,ref:i,"aria-expanded":d,"aria-haspopup":"menu","aria-controls":l},a),e)})),Re=t.forwardRef((function({children:e,onClick:n,testId:a="store-dropdown-item",...o},s){const{dropdownItemsRef:i,selectedDropdownItemIndexRef:d,close:l}=xe(),[c,u]=t.useState(0),f=t.useRef(),m=()=>{var e;d.current=c,null==i||null==(e=i.current[d.current])||e.focus()};return t.useImperativeHandle(s,()=>f.current,[]),r.createElement("button",Object.assign({"data-store-dropdown-item":!0,"data-testid":a,ref:e=>{var t;!e||null!=i&&i.current.includes(e)||(null==i||i.current.push(e),u(null!=(t=null==i?void 0:i.current.findIndex(t=>t===e))?t:0)),f.current=e},onFocus:m,onMouseEnter:m,onClick:e=>{null==n||n(e),null==l||l()},role:"menuitem",tabIndex:-1,"data-index":c},o),e)}));exports.Accordion=oe,exports.AccordionButton=ce,exports.AccordionItem=de,exports.AccordionPanel=ue,exports.Alert=he,exports.Badge=h,exports.Banner=K,exports.BannerContent=W,exports.BannerImage=X,exports.BannerLink=z,exports.Breadcrumb=ee,exports.Bullets=M,exports.Button=l,exports.Card=S,exports.CardActions=B,exports.CardContent=A,exports.CardImage=D,exports.Carousel=function({infiniteMode:e=!0,controls:n="complete",testId:a="store-carousel",transition:o={duration:400,property:"transform"},children:s,id:i="store-carousel",...d}){var l,c;const u=r.Children.toArray(s),f=u.length,m=e?f+2:f,p=`${o.property} ${o.duration}ms ${null!=(l=o.timing)?l:""} ${null!=(c=o.delay)?c:""}`,b="complete"===n||"navigationArrows"===n,g="complete"===n||"paginationBullets"===n,v=t.useMemo(()=>((e,t)=>{const r={},n=100/t;for(let a=0;a<t;++a)r[e?a-1:a]=-n*a;return r})(e,m),[m,e]),{handlers:h,slide:E,sliderState:w,sliderDispatch:x}=V({totalItems:f,itemsPerPage:1,infiniteMode:e,...d}),{isItemVisible:I,shouldRenderItem:R}=function({currentSlide:e,itemsPerPage:r,totalItems:n}){const a=t.useRef(new Set);t.useEffect(()=>{for(let t=0;t<r;t++)a.current.add(e+t)},[e,r]);const o=t=>function({itemsPerPage:e,currentSlide:t,slideIdx:r,totalItems:n}){return t<0||t>=n||r>=t&&r<t+e}({slideIdx:t,currentSlide:e,itemsPerPage:r,totalItems:n});return{shouldRenderItem:e=>a.current.has(e)||o(e),isItemVisible:o}}({itemsPerPage:w.itemsPerPage,currentSlide:w.currentItem,totalItems:f}),y=e&&s?u.slice(0,1):[],O=(e&&s?u.slice(f-1):[]).concat(null!=s?s:[],y),P=()=>{w.sliding||!e&&0===w.currentPage||E("previous",x)},k=()=>{w.sliding||!e&&w.currentPage===f-1||E("next",x)};return r.createElement("section",{id:i,"data-store-carousel":!0,"data-testid":a,"aria-label":"carousel","aria-roledescription":"carousel"},r.createElement("div",Object.assign({"data-carousel-track-container":!0,style:{overflow:"hidden",width:"100%"}},h),r.createElement("div",{"data-carousel-track":!0,style:{display:"flex",transition:w.sliding?p:void 0,width:100*m+"%",transform:`translate3d(${v[w.currentPage]}%, 0, 0)`},onTransitionEnd:()=>{x({type:"STOP_SLIDE"}),w.currentItem>=f&&x({type:"GO_TO_PAGE",payload:{pageIndex:0,shouldSlide:!1}}),w.currentItem<0&&x({type:"GO_TO_PAGE",payload:{pageIndex:w.totalPages-1,shouldSlide:!1}})},"aria-live":"polite"},O.map((t,n)=>r.createElement("div",{role:"tabpanel","aria-roledescription":"slide",key:n,id:"carousel-item-"+n,"data-carousel-item":!0,style:{width:"100%"},"data-visible":I(n-Number(e))||void 0},R(n-Number(e))?t:null)))),b&&r.createElement("div",{"data-carousel-controls":!0},r.createElement(H,{"aria-label":"previous","data-arrow":"left","aria-controls":i,onClick:P,icon:r.createElement(q,null)}),r.createElement(H,{"aria-label":"next","data-arrow":"right","aria-controls":i,onClick:k,icon:r.createElement(N,null)})),g&&r.createElement("div",{"data-carousel-bullets":!0},r.createElement(M,{tabIndex:0,totalQuantity:f,activeBullet:w.currentPage,onClick:(e,t)=>{w.sliding||E(t,x)},ariaControlsGenerator:e=>"carousel-item-"+e,onKeyDown:e=>{switch(e.key){case"ArrowLeft":P();break;case"ArrowRight":k();break;case"Home":E(0,x);break;case"End":E(f-1,x)}},onFocus:e=>{e.currentTarget.focus()}})))},exports.Checkbox=p,exports.Dropdown=({children:e,isOpen:n=!1,onDismiss:a,id:o="store-dropdown"})=>{const[s,i]=t.useState(n),d=t.useRef([]),l=t.useRef(0),c=t.useRef(null),u=t.useCallback(()=>{var e;i(!1),null==a||a(),null==(e=c.current)||e.focus()},[a]),f=()=>{i(!0)},m=t.useCallback(()=>{i(e=>{var t;return e&&(null==a||a(),null==(t=c.current)||t.focus()),!e})},[a]);t.useEffect(()=>{i(n)},[n]),t.useEffect(()=>{var e;s&&(null==d||null==(e=d.current[0])||e.focus())},[s]),t.useEffect(()=>{let e=!0;const t=t=>{const r=null==d?void 0:d.current.some(e=>t.target===e);e?e=!1:!r&&u()};return s?document.addEventListener("click",t):document.removeEventListener("click",t),()=>{document.removeEventListener("click",t)}},[u,s]);const p=t.useMemo(()=>({isOpen:s,close:u,open:f,toggle:m,dropdownButtonRef:c,onDismiss:a,selectedDropdownItemIndexRef:l,dropdownItemsRef:d,id:o}),[u,o,s,a,m]);return r.createElement(we.Provider,{value:p},e)},exports.DropdownButton=Ie,exports.DropdownItem=Re,exports.DropdownMenu=({children:e,testId:t="store-dropdown-menu",style:n,...a})=>{const{isOpen:o,close:i,dropdownItemsRef:d,selectedDropdownItemIndexRef:l,id:c}=xe(),u=(()=>{var e,t,r,n,a,o,s,i;const{dropdownButtonRef:d}=xe(),l="undefined"!=typeof window,c=null==d||null==(e=d.current)?void 0:e.getBoundingClientRect(),u=null!=(t=null==c?void 0:c.top)?t:0,f=null!=(r=null==c?void 0:c.height)?r:0,m=null!=(n=null==c?void 0:c.left)?n:0;return{position:"absolute",top:u+f+(l?null==(a=document)||null==(o=a.documentElement)?void 0:o.scrollTop:0),left:m+(l?null==(s=document)||null==(i=s.documentElement)?void 0:i.scrollLeft:0)}})(),f=r.Children.toArray(e).length;return o?s.createPortal(r.createElement("div",{role:"presentation","data-store-dropdown-overlay":!0,onKeyDown:e=>{var t,r,n,a;e.defaultPrevented||"Enter"===e.key||(e.preventDefault(),"Escape"===e.key&&(null==i||i()),"ArrowDown"===e.key&&(l.current<f-1?l.current++:l.current=0,null==d||null==(t=d.current[l.current])||t.focus()),"ArrowUp"===e.key&&(l.current>0?l.current--:l.current=f-1,null==d||null==(r=d.current[l.current])||r.focus()),"Home"===e.key&&(l.current=0,null==d||null==(n=d.current[l.current])||n.focus()),"End"===e.key&&(l.current=f-1,null==d||null==(a=d.current[l.current])||a.focus()),e.stopPropagation())},"data-testid":t+"-overlay"},r.createElement("div",Object.assign({role:"menu","aria-orientation":"vertical","data-store-dropdown-menu":!0,"data-testid":t,style:{...u,...n},id:c},a),e)),document.body):(d.current=[],null)},exports.Form=T,exports.Icon=u,exports.IconButton=H,exports.Incentive=O,exports.Input=c,exports.Label=y,exports.Link=d,exports.List=x,exports.LoadingButton=te,exports.Modal=({isOpen:e,children:t,onDismiss:n,testId:a="store-modal",...o})=>e?s.createPortal(r.createElement(b,{"data-modal-overlay":!0,onClick:e=>{e.defaultPrevented||(e.stopPropagation(),null==n||n(e))},onKeyDown:e=>{"Escape"!==e.key||e.defaultPrevented||(e.stopPropagation(),null==n||n(e))}},r.createElement(U,Object.assign({},o,{testId:a}),t)),document.body):null,exports.OutOfStock=({testId:e="store-out-of-stock",children:t,...n})=>r.createElement("section",{"data-store-out-of-stock":!0,"data-testid":e},r.createElement(T,Object.assign({"data-out-of-stock-form":!0,testId:e+"-form"},n),t)),exports.OutOfStockMessage=({as:e="p",testId:t="store-out-of-stock-message",children:n})=>r.createElement(e,{"data-out-of-stock-message":!0,"data-testid":t},n),exports.OutOfStockTitle=({as:e="h2",testId:t="store-out-of-stock-title",children:n})=>r.createElement(e,{"data-out-of-stock-title":!0,"data-testid":t},n),exports.Overlay=b,exports.PaymentMethods=J,exports.Popover=({targetRef:e,testId:t="store-popover",children:o,...s})=>r.createElement(a,Object.assign({"data-store-popover":!0,"data-testid":t,position:n.positionDefault,targetRef:e},s),o),exports.Price=f,exports.PriceRange=({className:e,formatter:n,max:a,min:o,onChange:s,testId:i="store-price-range",variant:d,"aria-label":l})=>{const[c,u]=t.useState(o),[m,p]=t.useState(a);return r.createElement("div",{"data-store-price-range":!0,"data-testid":i,className:e},r.createElement(E,{min:o,max:a,onChange:e=>{e.min!==c&&u(e.min),e.max!==m&&p(e.max),null==s||s(e)},"aria-label":l}),r.createElement("div",{"data-price-range-values":!0},r.createElement(f,{formatter:n,"data-price-range-value":"min",value:c,variant:d}),r.createElement(f,{formatter:n,"data-price-range-value":"max",value:m,variant:d})))},exports.ProductCard=P,exports.ProductCardActions=C,exports.ProductCardContent=j,exports.ProductCardImage=k,exports.QuantitySelector=Ee,exports.Radio=v,exports.RadioGroup=({name:e,onChange:t,children:n,selectedValue:a})=>{const o=r.useMemo(()=>({name:e,selectedValue:a,onChange:t}),[e,a,t]);return r.createElement(re.Provider,{value:o},n)},exports.RadioOption=ne,exports.SearchInput=_,exports.Select=g,exports.Skeleton=I,exports.Slider=E,exports.Spinner=R,exports.Table=fe,exports.TableBody=be,exports.TableCell=pe,exports.TableFooter=ve,exports.TableHead=ge,exports.TableRow=me,exports.TextArea=m,exports.useSlider=V;
2
2
  //# sourceMappingURL=ui.cjs.production.min.js.map