@faststore/ui 1.5.17 → 1.5.18
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.
- package/CHANGELOG.md +11 -0
- package/dist/ui.cjs.development.js +16 -8
- package/dist/ui.cjs.development.js.map +1 -1
- package/dist/ui.cjs.production.min.js +1 -1
- package/dist/ui.cjs.production.min.js.map +1 -1
- package/dist/ui.esm.js +17 -9
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/molecules/Breadcrumb/Breadcrumb.test.tsx +34 -0
- package/src/molecules/Breadcrumb/Breadcrumb.tsx +27 -13
- package/src/molecules/Breadcrumb/stories/Breadcrumb.mdx +2 -0
|
@@ -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),a=require("@reach/popover"),n=e(a),o=require("react-swipeable"),i=require("react-dom"),s=require("tabbable");const d=t.forwardRef((function({as:e,children:t,testId:a="store-link",...n},o){return r.createElement(null!=e?e:"a",Object.assign({ref:o,"data-store-link":!0,"data-testid":a},n),t)})),l=t.forwardRef((function({children:e,testId:t="store-button",...a},n){return r.createElement("button",Object.assign({ref:n,"data-store-button":!0,"data-testid":t},a),e)})),c=t.forwardRef((function({variant:e,testId:t="store-input",...a},n){return r.createElement("input",Object.assign({ref:n,"data-store-input":!0,"data-testid":t},{"data-error":"error"===e||void 0,"data-success":"success"===e||void 0},a))})),u=t.forwardRef((function({component:e,testId:t="store-icon",...a},n){return r.createElement("span",Object.assign({ref:n,"data-store-icon":!0,"data-testid":t},a),e)})),f=t.forwardRef((function({as:e="span",testId:t="store-price",value:a,formatter:n=(e=>e),variant:o="selling",...i},s){const d=n(a,o);return r.createElement(e,Object.assign({ref:s,"data-store-price":!0,"data-testid":t,"data-variant":o},i),d)})),m=t.forwardRef((function({variant:e,testId:t="store-textarea",...a},n){return r.createElement("textarea",Object.assign({ref:n,"data-store-textarea":!0,"data-testid":t},{"data-success":"success"===e||void 0,"data-error":"error"===e||void 0},a))})),p=t.forwardRef((function({testId:e="store-checkbox",...t},a){return r.createElement("input",Object.assign({ref:a,"data-store-checkbox":!0,"data-testid":e,type:"checkbox"},t))})),b=t.forwardRef((function({testId:e="store-overlay",...t},a){return r.createElement("div",Object.assign({role:"presentation","data-store-overlay":!0,"data-testid":e,ref:a},t))})),g=t.forwardRef((function({children:e,testId:t="store-select",...a},n){return r.createElement("select",Object.assign({ref:n,"data-store-select":!0,"data-testid":t},a),e)})),h=t.forwardRef((function({testId:e="store-radio",...t},a){return r.createElement("input",Object.assign({ref:a,"data-store-radio":!0,"data-testid":e,type:"radio"},t))})),E=t.forwardRef((function({testId:e="store-badge",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-store-badge":!0,"data-testid":e},a),t)})),v=({min:e,max:a,onChange:n,testId:o="store-slider",getAriaValueText:i,className:s})=>{const[d,l]=t.useState(e),[c,u]=t.useState(a),f=t.useRef(e),m=t.useRef(a),p=t.useRef(null),b=t.useCallback(t=>Math.round((t-e)/(a-e)*100),[e,a]);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==n||n({min:d,max:c})},[d,c,n]),r.createElement("div",{"data-store-slider":!0,"data-testid":o,className:s},r.createElement("div",{ref:p,"data-slider-range":!0}),r.createElement("input",{type:"range",min:e,max:a,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":a,"aria-valuenow":d,"aria-label":String(d),"aria-labelledby":i?i(d,"min"):void 0}),r.createElement("input",{type:"range",min:e,max:a,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":a,"aria-valuenow":c,"aria-label":String(c),"aria-labelledby":i?i(c,"max"):void 0}))},x={description:"dl",unordered:"ul",ordered:"ol"},I=t.forwardRef((function({testId:e="store-list",variant:t="unordered",as:a,...n},o){var i;const s=null!=(i=null!=a?a:x[t])?i:"ul";return r.createElement(s,Object.assign({ref:o},{"data-testid":e,"data-store-list":t},n))})),w=t.forwardRef((function({testId:e="store-skeleton",...t},a){return r.createElement("div",Object.assign({ref:a,"data-store-skeleton":!0,"data-testid":e},t))})),R=t.forwardRef((function({testId:e="store-spinner",...t},a){return r.createElement("span",Object.assign({ref:a,"data-store-spinner":!0,"data-testid":e},t))})),y=t.forwardRef((function({testId:e="store-label",children:t,...a},n){return r.createElement("label",Object.assign({ref:n,"data-store-label":!0,"data-testid":e},a),t)})),P=t.forwardRef((function({testId:e="store-incentive",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-store-incentive":!0,"data-testid":e},a),t)})),O=(e,t)=>t?"Current page":"Go to page "+(e+1),j=t.forwardRef((function({totalQuantity:e,activeBullet:a,onClick:n,testId:o="store-bullets",ariaLabelGenerator:i=O,ariaControlsGenerator:s,...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=a===t;return r.createElement(l,{"data-bullet-item":!0,role:"tab",tabIndex:-1,key:t,testId:o+"-item",onClick:e=>n(e,t),"aria-label":i(t,d),"aria-controls":null==s?void 0:s(t),"aria-selected":d})}))})),k=t.forwardRef((function({testId:e="store-form",children:t,...a},n){return r.createElement("form",Object.assign({ref:n,"data-store-form":!0,"data-testid":e},a),t)})),C=()=>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"})),S=t.forwardRef((function({onSubmit:e,icon:a,"aria-label":n="search",testId:o="store-search-input",...i},s){const d=t.useRef(null),f=t.useRef(null);return t.useImperativeHandle(s,()=>({inputRef:d.current,formRef:f.current})),r.createElement(k,{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":n},i)),r.createElement(l,{type:"submit","aria-label":"Submit Search"},r.createElement(u,{component:null!=a?a:r.createElement(C,null)})))})),A=({size:e={width:25,height:25},viewBox:t="0 0 16 16",color:a="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:a,fill:"none"})),L=({size:e={width:25,height:25},viewBox:t="0 0 16 16",color:a="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:a,fill:"none"}));function B(e,t){switch(t.type){case"NEXT_PAGE":{const t=e.infinite?e.totalPages+1:e.totalPages,r=(e.currentPage+1)%t,a=r%t*e.itemsPerPage;return{...e,sliding:!0,slideDirection:"next",currentItem:a,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 D=(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 M({totalItems:e,itemsPerPage:r=1,infiniteMode:a=!1,...n}){const[i,s]=t.useReducer(B,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,a));return{handlers:o.useSwipeable({onSwipedRight:()=>D("previous",s),onSwipedLeft:()=>D("next",s),preventDefaultTouchmoveEvent:!0,trackMouse:!0,...n}),slide:D,sliderState:i,sliderDispatch:s}}const T=t.forwardRef((function({icon:e,testId:t="store-icon-button",...a},n){return r.createElement(l,Object.assign({ref:n,"data-store-icon-button":!0,testId:t},a),r.createElement(u,{component:e}))})),G=({beforeElementRef:e,trapFocusRef:t,afterElementRef:a,testId:n="store-modal-content",children:o,...i})=>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},i,{"data-testid":n,ref:t,"aria-modal":"true",role:"dialog",tabIndex:-1}),o),r.createElement("div",{ref:a,"data-testid":"afterElement",tabIndex:0,"aria-hidden":"true"})),_=({children:e,...a})=>{const n=t.useRef(null),o=t.useRef(null),i=t.useRef(null);return(({trapFocusRef:e,beforeElementRef:r,afterElementRef:a})=>{const n=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;n.current||(n.current=s.tabbable(e.current));const[t]=n.current;t?t.focus():e.current.focus()},[e]),t.useEffect(()=>{if(!e.current||!r.current||!a.current)return;const t=r.current,o=a.current,i=e.current,d=r=>{var a,d;document.hasFocus()&&(n.current=s.tabbable(e.current),n.current.length||i.focus(),r.target===t&&(null==(a=n.current[n.current.length-1])||a.focus()),r.target===o&&(null==(d=n.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)}},[n,a,r,e])})({beforeElementRef:o,trapFocusRef:n,afterElementRef:i}),r.createElement(G,Object.assign({},a,{trapFocusRef:n,beforeElementRef:o,afterElementRef:i,onClick:e=>{e.stopPropagation()}}),e)},q=t.forwardRef((function({testId:e="store-banner-image",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-banner-image":!0,"data-testid":e},a),t)})),N=t.forwardRef((function({testId:e="store-banner-content",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-banner-content":!0,"data-testid":e},a),t)})),$=t.forwardRef((function({testId:e="store-banner-link",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-banner-link":!0,"data-testid":e},a),t)})),F=t.forwardRef((function({testId:e="store-payment-methods",title:t,"aria-label":a="Payment Methods",children:n,...o},i){return r.createElement("div",Object.assign({ref:i,"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:a},n))})),V=({divider:e,testId:t})=>{const a={"data-breadcrumb-divider":!0,"aria-hidden":!0,"data-testid":t+"-divider"};return r.isValidElement(e)?r.cloneElement(e,a):r.createElement("span",Object.assign({},a),null!=e?e:"/")},Q=({children:e,isLastItem:t,testId:a})=>{const n={"data-testid":a+"-item","data-breadcrumb-item":!t||"current","aria-current":t?"page":void 0};return r.isValidElement(e)?r.createElement("li",null,r.cloneElement(e,n)):r.createElement("li",null,r.createElement("span",Object.assign({},n),e))},U=t.forwardRef((function({children:e,divider:a,testId:n="store-breadcrumb",...o},i){const s=r.Children.count(e);return r.createElement("nav",Object.assign({"aria-label":"Breadcrumb",role:"navigation",ref:i,"data-store-breadcrumb":!0,"data-testid":n},o),r.createElement(I,{"data-breadcrumb-list":!0,variant:"ordered"},r.Children.map(e,(e,o)=>{const i=o===s-1;return r.createElement(t.Fragment,{key:"breadcrumb-"+o},r.createElement(Q,{isLastItem:i,testId:n},e),i?null:r.createElement(V,{divider:a,testId:n}))})))})),X=t.forwardRef((function({children:e,loading:t,testId:a="store-loading-button",...n},o){return r.createElement(l,Object.assign({ref:o,"data-store-loading-button":!0,testId:a},n),t?r.createElement(R,null):e)})),H=t.createContext(void 0),K=t.forwardRef((function({label:e,value:a,children:n,testId:o="store-radio-option",...i},s){const{name:d,selectedValue:l,onChange:c}=function(){const e=t.useContext(H);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(h,Object.assign({"data-store-radio-option-item":!0,ref:s,name:d,checked:a===l,onChange:c,value:a,testId:o},i)),n)})),W=t.createContext(void 0),z=t.forwardRef((function({testId:e="store-accordion",indices:a,onChange:n,children:o,...i},s){const d=r.Children.map(o,(e,r)=>{var a;return t.cloneElement(e,{index:null!=(a=e.props.index)?a:r})}),l={indices:new Set(a),onChange:n,numberOfItems:d.length};return r.createElement(W.Provider,{value:l},r.createElement("div",Object.assign({ref:s,"data-store-accordion":!0,"data-testid":e,role:"region"},i),d))}));function J(){const e=t.useContext(W);if(void 0===e)throw new Error("Do not use Accordion components outside the Accordion context.");return e}const Y=t.createContext(void 0),Z=t.forwardRef((function({testId:e="store-accordion-item",children:t,prefixId:a="",index:n=0,...o},i){return r.createElement(Y.Provider,{value:{index:n,prefixId:a,panel:`${a&&a+"-"}panel--${n}`,button:`${a&&a+"-"}button--${n}`}},r.createElement("div",Object.assign({ref:i,"data-accordion-item":!0,"data-testid":e},o),t))}));function ee(){const e=t.useContext(Y);if(void 0===e)throw new Error("Do not use AccordionItem components outside the AccordionItem context.");return e}const te=t.forwardRef((function({testId:e="store-accordion-button",children:t,...a},n){const{indices:o,onChange:i,numberOfItems:s}=J(),{index:d,panel:c,button:u,prefixId:f}=ee();return r.createElement(l,Object.assign({ref:n,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===s?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?s-1:Number(d)-1;return document.getElementById(`${f&&f+"-"}button--${e}`)})())||r.focus()}},onClick:()=>{i(d)}},a),t)})),re=t.forwardRef((function({testId:e="store-accordion-panel",children:t,...a},n){const{indices:o}=J(),{index:i,button:s,panel:d}=ee();return r.createElement("div",Object.assign({ref:n,id:d,"aria-labelledby":s,role:"region","data-accordion-panel":!0,"data-testid":e,hidden:!o.has(i)},a),t)})),ae=t.forwardRef((function({testId:e="store-table",children:t,...a},n){return r.createElement("table",Object.assign({ref:n,"data-store-table":!0,"data-testid":e},a),t)})),ne=t.forwardRef((function({testId:e="store-table-row",children:t,...a},n){return r.createElement("tr",Object.assign({ref:n,"data-table-row":!0,"data-testid":e},a),t)})),oe=t.forwardRef((function({testId:e="store-table-cell",children:t,variant:a="data",scope:n,...o},i){return r.createElement("header"===a?"th":"td",Object.assign({ref:i,"data-table-cell":a,"data-testid":e,scope:n},o),t)})),ie=t.forwardRef((function({children:e,testId:t="store-table-body",...a},n){return r.createElement("tbody",Object.assign({ref:n,"data-testid":t,"data-table-body":!0},a),e)})),se=t.forwardRef((function({children:e,testId:t="store-table-head",...a},n){return r.createElement("thead",Object.assign({ref:n,"data-testid":t,"data-table-head":!0},a),e)})),de=t.forwardRef((function({children:e,testId:t="store-table-footer",...a},n){return r.createElement("tfoot",Object.assign({ref:n,"data-testid":t,"data-table-footer":!0},a),e)})),le=t.forwardRef((function({testId:e="store-alert",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,role:"alert","data-store-alert":!0,"data-testid":e},a),t)})),ce=t.forwardRef((function({quantity:e,testId:t="store-quantity-selector",leftButtonProps:a,inputProps:n,rightButtonProps:o,...i},s){return r.createElement("div",Object.assign({"data-store-quantity-selector":!0,"data-testid":t,ref:s},i),r.createElement(T,Object.assign({"aria-controls":"quantity-selector-input","aria-label":"Decrement Quantity","data-quantity-selector-button":"left"},a)),r.createElement(c,Object.assign({"aria-label":"Quantity","data-quantity-selector-input":!0,id:"quantity-selector-input",value:e},n)),r.createElement(T,Object.assign({"aria-controls":"quantity-selector-input","aria-label":"Increment Quantity","data-quantity-selector-button":"right"},o)))})),ue=t.forwardRef((function({testId:e="store-card",children:t,...a},n){return r.createElement("article",Object.assign({ref:n,"data-store-card":!0,"data-testid":e},a),t)})),fe=t.forwardRef((function({testId:e="store-card-image",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-card-image":!0,"data-testid":e},a),t)})),me=t.forwardRef((function({testId:e="store-card-content",children:t,...a},n){return r.createElement("section",Object.assign({ref:n,"data-card-content":!0,"data-testid":e},a),t)})),pe=t.forwardRef((function({testId:e="store-card-actions",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-card-actions":!0,"data-testid":e},a),t)}));exports.Accordion=z,exports.AccordionButton=te,exports.AccordionItem=Z,exports.AccordionPanel=re,exports.Alert=le,exports.Badge=E,exports.Banner=({testId:e="store-banner",children:t,variant:a="vertical"})=>r.createElement("article",{"data-store-banner":a,"data-testid":e},t),exports.BannerContent=N,exports.BannerImage=q,exports.BannerLink=$,exports.Breadcrumb=U,exports.Bullets=j,exports.Button=l,exports.Card=ue,exports.CardActions=pe,exports.CardContent=me,exports.CardImage=fe,exports.Carousel=function({infiniteMode:e=!0,controls:a="complete",testId:n="store-carousel",transition:o={duration:400,property:"transform"},children:i,id:s="store-carousel",...d}){var l,c;const u=r.Children.toArray(i),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"===a||"navigationArrows"===a,g="complete"===a||"paginationBullets"===a,h=t.useMemo(()=>((e,t)=>{const r={},a=100/t;for(let n=0;n<t;++n)r[e?n-1:n]=-a*n;return r})(e,m),[m,e]),{handlers:E,slide:v,sliderState:x,sliderDispatch:I}=M({totalItems:f,itemsPerPage:1,infiniteMode:e,...d}),{isItemVisible:w,shouldRenderItem:R}=function({currentSlide:e,itemsPerPage:r,totalItems:a}){const n=t.useRef(new Set);t.useEffect(()=>{for(let t=0;t<r;t++)n.current.add(e+t)},[e,r]);const o=t=>function({itemsPerPage:e,currentSlide:t,slideIdx:r,totalItems:a}){return t<0||t>=a||r>=t&&r<t+e}({slideIdx:t,currentSlide:e,itemsPerPage:r,totalItems:a});return{shouldRenderItem:e=>n.current.has(e)||o(e),isItemVisible:o}}({itemsPerPage:x.itemsPerPage,currentSlide:x.currentItem,totalItems:f}),y=e&&i?u.slice(0,1):[],P=(e&&i?u.slice(f-1):[]).concat(null!=i?i:[],y),O=()=>{x.sliding||!e&&0===x.currentPage||v("previous",I)},k=()=>{x.sliding||!e&&x.currentPage===f-1||v("next",I)};return r.createElement("section",{id:s,"data-store-carousel":!0,"data-testid":n,"aria-label":"carousel","aria-roledescription":"carousel"},r.createElement("div",Object.assign({"data-carousel-track-container":!0,style:{overflow:"hidden",width:"100%"}},E),r.createElement("div",{"data-carousel-track":!0,style:{display:"flex",transition:x.sliding?p:void 0,width:100*m+"%",transform:`translate3d(${h[x.currentPage]}%, 0, 0)`},onTransitionEnd:()=>{I({type:"STOP_SLIDE"}),x.currentItem>=f&&I({type:"GO_TO_PAGE",payload:{pageIndex:0,shouldSlide:!1}}),x.currentItem<0&&I({type:"GO_TO_PAGE",payload:{pageIndex:x.totalPages-1,shouldSlide:!1}})},"aria-live":"polite"},P.map((t,a)=>r.createElement("div",{role:"tabpanel","aria-roledescription":"slide",key:a,id:"carousel-item-"+a,"data-carousel-item":!0,style:{width:"100%"},"data-visible":w(a-Number(e))||void 0},R(a-Number(e))?t:null)))),b&&r.createElement("div",{"data-carousel-controls":!0},r.createElement(T,{"aria-label":"previous","data-arrow":"left","aria-controls":s,onClick:O,icon:r.createElement(A,null)}),r.createElement(T,{"aria-label":"next","data-arrow":"right","aria-controls":s,onClick:k,icon:r.createElement(L,null)})),g&&r.createElement("div",{"data-carousel-bullets":!0},r.createElement(j,{tabIndex:0,totalQuantity:f,activeBullet:x.currentPage,onClick:(e,t)=>{x.sliding||v(t,I)},ariaControlsGenerator:e=>"carousel-item-"+e,onKeyDown:e=>{switch(e.key){case"ArrowLeft":O();break;case"ArrowRight":k();break;case"Home":v(0,I);break;case"End":v(f-1,I)}},onFocus:e=>{e.currentTarget.focus()}})))},exports.Checkbox=p,exports.Form=k,exports.Icon=u,exports.IconButton=T,exports.Incentive=P,exports.Input=c,exports.Label=y,exports.Link=d,exports.List=I,exports.LoadingButton=X,exports.Modal=({isOpen:e,children:t,onDismiss:a,testId:n="store-modal",...o})=>e?i.createPortal(r.createElement(b,{"data-modal-overlay":!0,onClick:e=>{e.defaultPrevented||(e.stopPropagation(),null==a||a(e))},onKeyDown:e=>{"Escape"!==e.key||e.defaultPrevented||(e.stopPropagation(),null==a||a(e))}},r.createElement(_,Object.assign({},o,{testId:n}),t)),document.body):null,exports.Overlay=b,exports.PaymentMethods=F,exports.Popover=({targetRef:e,testId:t="store-popover",children:o,...i})=>r.createElement(n,Object.assign({"data-store-popover":!0,"data-testid":t,position:a.positionDefault,targetRef:e},i),o),exports.Price=f,exports.PriceRange=({className:e,formatter:a,max:n,min:o,onChange:i,testId:s="store-price-range",variant:d,"aria-label":l})=>{const[c,u]=t.useState(o),[m,p]=t.useState(n);return r.createElement("div",{"data-store-price-range":!0,"data-testid":s,className:e},r.createElement(v,{min:o,max:n,onChange:e=>{e.min!==c&&u(e.min),e.max!==m&&p(e.max),null==i||i(e)},"aria-label":l}),r.createElement("div",{"data-price-range-values":!0},r.createElement(f,{formatter:a,"data-price-range-value":"min",value:c,variant:d}),r.createElement(f,{formatter:a,"data-price-range-value":"max",value:m,variant:d})))},exports.QuantitySelector=ce,exports.Radio=h,exports.RadioGroup=({name:e,onChange:t,children:a,selectedValue:n})=>{const o=r.useMemo(()=>({name:e,selectedValue:n,onChange:t}),[e,n,t]);return r.createElement(H.Provider,{value:o},a)},exports.RadioOption=K,exports.SearchInput=S,exports.Select=g,exports.Skeleton=w,exports.Slider=v,exports.Spinner=R,exports.Table=ae,exports.TableBody=ie,exports.TableCell=oe,exports.TableFooter=de,exports.TableHead=se,exports.TableRow=ne,exports.TextArea=m,exports.useSlider=M;
|
|
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),a=require("@reach/popover"),n=e(a),o=require("react-swipeable"),i=require("react-dom"),s=require("tabbable");const d=t.forwardRef((function({as:e,children:t,testId:a="store-link",...n},o){return r.createElement(null!=e?e:"a",Object.assign({ref:o,"data-store-link":!0,"data-testid":a},n),t)})),l=t.forwardRef((function({children:e,testId:t="store-button",...a},n){return r.createElement("button",Object.assign({ref:n,"data-store-button":!0,"data-testid":t},a),e)})),c=t.forwardRef((function({variant:e,testId:t="store-input",...a},n){return r.createElement("input",Object.assign({ref:n,"data-store-input":!0,"data-testid":t},{"data-error":"error"===e||void 0,"data-success":"success"===e||void 0},a))})),u=t.forwardRef((function({component:e,testId:t="store-icon",...a},n){return r.createElement("span",Object.assign({ref:n,"data-store-icon":!0,"data-testid":t},a),e)})),f=t.forwardRef((function({as:e="span",testId:t="store-price",value:a,formatter:n=(e=>e),variant:o="selling",...i},s){const d=n(a,o);return r.createElement(e,Object.assign({ref:s,"data-store-price":!0,"data-testid":t,"data-variant":o},i),d)})),m=t.forwardRef((function({variant:e,testId:t="store-textarea",...a},n){return r.createElement("textarea",Object.assign({ref:n,"data-store-textarea":!0,"data-testid":t},{"data-success":"success"===e||void 0,"data-error":"error"===e||void 0},a))})),p=t.forwardRef((function({testId:e="store-checkbox",...t},a){return r.createElement("input",Object.assign({ref:a,"data-store-checkbox":!0,"data-testid":e,type:"checkbox"},t))})),b=t.forwardRef((function({testId:e="store-overlay",...t},a){return r.createElement("div",Object.assign({role:"presentation","data-store-overlay":!0,"data-testid":e,ref:a},t))})),g=t.forwardRef((function({children:e,testId:t="store-select",...a},n){return r.createElement("select",Object.assign({ref:n,"data-store-select":!0,"data-testid":t},a),e)})),h=t.forwardRef((function({testId:e="store-radio",...t},a){return r.createElement("input",Object.assign({ref:a,"data-store-radio":!0,"data-testid":e,type:"radio"},t))})),v=t.forwardRef((function({testId:e="store-badge",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-store-badge":!0,"data-testid":e},a),t)})),E=({min:e,max:a,onChange:n,testId:o="store-slider",getAriaValueText:i,className:s})=>{const[d,l]=t.useState(e),[c,u]=t.useState(a),f=t.useRef(e),m=t.useRef(a),p=t.useRef(null),b=t.useCallback(t=>Math.round((t-e)/(a-e)*100),[e,a]);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==n||n({min:d,max:c})},[d,c,n]),r.createElement("div",{"data-store-slider":!0,"data-testid":o,className:s},r.createElement("div",{ref:p,"data-slider-range":!0}),r.createElement("input",{type:"range",min:e,max:a,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":a,"aria-valuenow":d,"aria-label":String(d),"aria-labelledby":i?i(d,"min"):void 0}),r.createElement("input",{type:"range",min:e,max:a,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":a,"aria-valuenow":c,"aria-label":String(c),"aria-labelledby":i?i(c,"max"):void 0}))},x={description:"dl",unordered:"ul",ordered:"ol"},I=t.forwardRef((function({testId:e="store-list",variant:t="unordered",as:a,...n},o){var i;const s=null!=(i=null!=a?a:x[t])?i:"ul";return r.createElement(s,Object.assign({ref:o},{"data-testid":e,"data-store-list":t},n))})),w=t.forwardRef((function({testId:e="store-skeleton",...t},a){return r.createElement("div",Object.assign({ref:a,"data-store-skeleton":!0,"data-testid":e},t))})),R=t.forwardRef((function({testId:e="store-spinner",...t},a){return r.createElement("span",Object.assign({ref:a,"data-store-spinner":!0,"data-testid":e},t))})),y=t.forwardRef((function({testId:e="store-label",children:t,...a},n){return r.createElement("label",Object.assign({ref:n,"data-store-label":!0,"data-testid":e},a),t)})),P=t.forwardRef((function({testId:e="store-incentive",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-store-incentive":!0,"data-testid":e},a),t)})),O=(e,t)=>t?"Current page":"Go to page "+(e+1),j=t.forwardRef((function({totalQuantity:e,activeBullet:a,onClick:n,testId:o="store-bullets",ariaLabelGenerator:i=O,ariaControlsGenerator:s,...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=a===t;return r.createElement(l,{"data-bullet-item":!0,role:"tab",tabIndex:-1,key:t,testId:o+"-item",onClick:e=>n(e,t),"aria-label":i(t,d),"aria-controls":null==s?void 0:s(t),"aria-selected":d})}))})),k=t.forwardRef((function({testId:e="store-form",children:t,...a},n){return r.createElement("form",Object.assign({ref:n,"data-store-form":!0,"data-testid":e},a),t)})),C=()=>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"})),S=t.forwardRef((function({onSubmit:e,icon:a,"aria-label":n="search",testId:o="store-search-input",...i},s){const d=t.useRef(null),f=t.useRef(null);return t.useImperativeHandle(s,()=>({inputRef:d.current,formRef:f.current})),r.createElement(k,{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":n},i)),r.createElement(l,{type:"submit","aria-label":"Submit Search"},r.createElement(u,{component:null!=a?a:r.createElement(C,null)})))})),A=({size:e={width:25,height:25},viewBox:t="0 0 16 16",color:a="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:a,fill:"none"})),L=({size:e={width:25,height:25},viewBox:t="0 0 16 16",color:a="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:a,fill:"none"}));function B(e,t){switch(t.type){case"NEXT_PAGE":{const t=e.infinite?e.totalPages+1:e.totalPages,r=(e.currentPage+1)%t,a=r%t*e.itemsPerPage;return{...e,sliding:!0,slideDirection:"next",currentItem:a,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 D=(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 M({totalItems:e,itemsPerPage:r=1,infiniteMode:a=!1,...n}){const[i,s]=t.useReducer(B,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,a));return{handlers:o.useSwipeable({onSwipedRight:()=>D("previous",s),onSwipedLeft:()=>D("next",s),preventDefaultTouchmoveEvent:!0,trackMouse:!0,...n}),slide:D,sliderState:i,sliderDispatch:s}}const T=t.forwardRef((function({icon:e,testId:t="store-icon-button",...a},n){return r.createElement(l,Object.assign({ref:n,"data-store-icon-button":!0,testId:t},a),r.createElement(u,{component:e}))})),G=({beforeElementRef:e,trapFocusRef:t,afterElementRef:a,testId:n="store-modal-content",children:o,...i})=>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},i,{"data-testid":n,ref:t,"aria-modal":"true",role:"dialog",tabIndex:-1}),o),r.createElement("div",{ref:a,"data-testid":"afterElement",tabIndex:0,"aria-hidden":"true"})),_=({children:e,...a})=>{const n=t.useRef(null),o=t.useRef(null),i=t.useRef(null);return(({trapFocusRef:e,beforeElementRef:r,afterElementRef:a})=>{const n=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;n.current||(n.current=s.tabbable(e.current));const[t]=n.current;t?t.focus():e.current.focus()},[e]),t.useEffect(()=>{if(!e.current||!r.current||!a.current)return;const t=r.current,o=a.current,i=e.current,d=r=>{var a,d;document.hasFocus()&&(n.current=s.tabbable(e.current),n.current.length||i.focus(),r.target===t&&(null==(a=n.current[n.current.length-1])||a.focus()),r.target===o&&(null==(d=n.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)}},[n,a,r,e])})({beforeElementRef:o,trapFocusRef:n,afterElementRef:i}),r.createElement(G,Object.assign({},a,{trapFocusRef:n,beforeElementRef:o,afterElementRef:i,onClick:e=>{e.stopPropagation()}}),e)},q=t.forwardRef((function({testId:e="store-banner-image",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-banner-image":!0,"data-testid":e},a),t)})),N=t.forwardRef((function({testId:e="store-banner-content",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-banner-content":!0,"data-testid":e},a),t)})),$=t.forwardRef((function({testId:e="store-banner-link",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-banner-link":!0,"data-testid":e},a),t)})),F=t.forwardRef((function({testId:e="store-payment-methods",title:t,"aria-label":a="Payment Methods",children:n,...o},i){return r.createElement("div",Object.assign({ref:i,"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:a},n))})),V=({divider:e,testId:t})=>{const a={"data-breadcrumb-divider":!0,"aria-hidden":!0,"data-testid":t+"-divider"};return r.isValidElement(e)?r.cloneElement(e,a):r.createElement("span",Object.assign({},a),null!=e?e:"/")},Q=({children:e,isLastItem:t,divider:a,testId:n})=>{const o={"data-testid":n+"-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(V,{divider:a,testId:n})):r.createElement("li",{"data-breadcrumb-list-item":!0},r.createElement("span",Object.assign({},o),e,t?null:r.createElement(V,{divider:a,testId:n})))},U=t.forwardRef((function({children:e,divider:t,testId:a="store-breadcrumb",...n},o){const i=r.Children.count(e);return r.createElement("nav",Object.assign({"aria-label":"Breadcrumb",role:"navigation",ref:o,"data-store-breadcrumb":!0,"data-testid":a},n),r.createElement(I,{"data-breadcrumb-list":!0,variant:"ordered"},r.Children.map(e,(e,n)=>r.createElement(Q,{isLastItem:n===i-1,divider:t,key:"breadcrumb-"+n,testId:a},e))))})),X=t.forwardRef((function({children:e,loading:t,testId:a="store-loading-button",...n},o){return r.createElement(l,Object.assign({ref:o,"data-store-loading-button":!0,testId:a},n),t?r.createElement(R,null):e)})),H=t.createContext(void 0),K=t.forwardRef((function({label:e,value:a,children:n,testId:o="store-radio-option",...i},s){const{name:d,selectedValue:l,onChange:c}=function(){const e=t.useContext(H);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(h,Object.assign({"data-store-radio-option-item":!0,ref:s,name:d,checked:a===l,onChange:c,value:a,testId:o},i)),n)})),W=t.createContext(void 0),z=t.forwardRef((function({testId:e="store-accordion",indices:a,onChange:n,children:o,...i},s){const d=r.Children.map(o,(e,r)=>{var a;return t.cloneElement(e,{index:null!=(a=e.props.index)?a:r})}),l={indices:new Set(a),onChange:n,numberOfItems:d.length};return r.createElement(W.Provider,{value:l},r.createElement("div",Object.assign({ref:s,"data-store-accordion":!0,"data-testid":e,role:"region"},i),d))}));function J(){const e=t.useContext(W);if(void 0===e)throw new Error("Do not use Accordion components outside the Accordion context.");return e}const Y=t.createContext(void 0),Z=t.forwardRef((function({testId:e="store-accordion-item",children:t,prefixId:a="",index:n=0,...o},i){return r.createElement(Y.Provider,{value:{index:n,prefixId:a,panel:`${a&&a+"-"}panel--${n}`,button:`${a&&a+"-"}button--${n}`}},r.createElement("div",Object.assign({ref:i,"data-accordion-item":!0,"data-testid":e},o),t))}));function ee(){const e=t.useContext(Y);if(void 0===e)throw new Error("Do not use AccordionItem components outside the AccordionItem context.");return e}const te=t.forwardRef((function({testId:e="store-accordion-button",children:t,...a},n){const{indices:o,onChange:i,numberOfItems:s}=J(),{index:d,panel:c,button:u,prefixId:f}=ee();return r.createElement(l,Object.assign({ref:n,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===s?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?s-1:Number(d)-1;return document.getElementById(`${f&&f+"-"}button--${e}`)})())||r.focus()}},onClick:()=>{i(d)}},a),t)})),re=t.forwardRef((function({testId:e="store-accordion-panel",children:t,...a},n){const{indices:o}=J(),{index:i,button:s,panel:d}=ee();return r.createElement("div",Object.assign({ref:n,id:d,"aria-labelledby":s,role:"region","data-accordion-panel":!0,"data-testid":e,hidden:!o.has(i)},a),t)})),ae=t.forwardRef((function({testId:e="store-table",children:t,...a},n){return r.createElement("table",Object.assign({ref:n,"data-store-table":!0,"data-testid":e},a),t)})),ne=t.forwardRef((function({testId:e="store-table-row",children:t,...a},n){return r.createElement("tr",Object.assign({ref:n,"data-table-row":!0,"data-testid":e},a),t)})),oe=t.forwardRef((function({testId:e="store-table-cell",children:t,variant:a="data",scope:n,...o},i){return r.createElement("header"===a?"th":"td",Object.assign({ref:i,"data-table-cell":a,"data-testid":e,scope:n},o),t)})),ie=t.forwardRef((function({children:e,testId:t="store-table-body",...a},n){return r.createElement("tbody",Object.assign({ref:n,"data-testid":t,"data-table-body":!0},a),e)})),se=t.forwardRef((function({children:e,testId:t="store-table-head",...a},n){return r.createElement("thead",Object.assign({ref:n,"data-testid":t,"data-table-head":!0},a),e)})),de=t.forwardRef((function({children:e,testId:t="store-table-footer",...a},n){return r.createElement("tfoot",Object.assign({ref:n,"data-testid":t,"data-table-footer":!0},a),e)})),le=t.forwardRef((function({testId:e="store-alert",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,role:"alert","data-store-alert":!0,"data-testid":e},a),t)})),ce=t.forwardRef((function({quantity:e,testId:t="store-quantity-selector",leftButtonProps:a,inputProps:n,rightButtonProps:o,...i},s){return r.createElement("div",Object.assign({"data-store-quantity-selector":!0,"data-testid":t,ref:s},i),r.createElement(T,Object.assign({"aria-controls":"quantity-selector-input","aria-label":"Decrement Quantity","data-quantity-selector-button":"left"},a)),r.createElement(c,Object.assign({"aria-label":"Quantity","data-quantity-selector-input":!0,id:"quantity-selector-input",value:e},n)),r.createElement(T,Object.assign({"aria-controls":"quantity-selector-input","aria-label":"Increment Quantity","data-quantity-selector-button":"right"},o)))})),ue=t.forwardRef((function({testId:e="store-card",children:t,...a},n){return r.createElement("article",Object.assign({ref:n,"data-store-card":!0,"data-testid":e},a),t)})),fe=t.forwardRef((function({testId:e="store-card-image",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-card-image":!0,"data-testid":e},a),t)})),me=t.forwardRef((function({testId:e="store-card-content",children:t,...a},n){return r.createElement("section",Object.assign({ref:n,"data-card-content":!0,"data-testid":e},a),t)})),pe=t.forwardRef((function({testId:e="store-card-actions",children:t,...a},n){return r.createElement("div",Object.assign({ref:n,"data-card-actions":!0,"data-testid":e},a),t)}));exports.Accordion=z,exports.AccordionButton=te,exports.AccordionItem=Z,exports.AccordionPanel=re,exports.Alert=le,exports.Badge=v,exports.Banner=({testId:e="store-banner",children:t,variant:a="vertical"})=>r.createElement("article",{"data-store-banner":a,"data-testid":e},t),exports.BannerContent=N,exports.BannerImage=q,exports.BannerLink=$,exports.Breadcrumb=U,exports.Bullets=j,exports.Button=l,exports.Card=ue,exports.CardActions=pe,exports.CardContent=me,exports.CardImage=fe,exports.Carousel=function({infiniteMode:e=!0,controls:a="complete",testId:n="store-carousel",transition:o={duration:400,property:"transform"},children:i,id:s="store-carousel",...d}){var l,c;const u=r.Children.toArray(i),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"===a||"navigationArrows"===a,g="complete"===a||"paginationBullets"===a,h=t.useMemo(()=>((e,t)=>{const r={},a=100/t;for(let n=0;n<t;++n)r[e?n-1:n]=-a*n;return r})(e,m),[m,e]),{handlers:v,slide:E,sliderState:x,sliderDispatch:I}=M({totalItems:f,itemsPerPage:1,infiniteMode:e,...d}),{isItemVisible:w,shouldRenderItem:R}=function({currentSlide:e,itemsPerPage:r,totalItems:a}){const n=t.useRef(new Set);t.useEffect(()=>{for(let t=0;t<r;t++)n.current.add(e+t)},[e,r]);const o=t=>function({itemsPerPage:e,currentSlide:t,slideIdx:r,totalItems:a}){return t<0||t>=a||r>=t&&r<t+e}({slideIdx:t,currentSlide:e,itemsPerPage:r,totalItems:a});return{shouldRenderItem:e=>n.current.has(e)||o(e),isItemVisible:o}}({itemsPerPage:x.itemsPerPage,currentSlide:x.currentItem,totalItems:f}),y=e&&i?u.slice(0,1):[],P=(e&&i?u.slice(f-1):[]).concat(null!=i?i:[],y),O=()=>{x.sliding||!e&&0===x.currentPage||E("previous",I)},k=()=>{x.sliding||!e&&x.currentPage===f-1||E("next",I)};return r.createElement("section",{id:s,"data-store-carousel":!0,"data-testid":n,"aria-label":"carousel","aria-roledescription":"carousel"},r.createElement("div",Object.assign({"data-carousel-track-container":!0,style:{overflow:"hidden",width:"100%"}},v),r.createElement("div",{"data-carousel-track":!0,style:{display:"flex",transition:x.sliding?p:void 0,width:100*m+"%",transform:`translate3d(${h[x.currentPage]}%, 0, 0)`},onTransitionEnd:()=>{I({type:"STOP_SLIDE"}),x.currentItem>=f&&I({type:"GO_TO_PAGE",payload:{pageIndex:0,shouldSlide:!1}}),x.currentItem<0&&I({type:"GO_TO_PAGE",payload:{pageIndex:x.totalPages-1,shouldSlide:!1}})},"aria-live":"polite"},P.map((t,a)=>r.createElement("div",{role:"tabpanel","aria-roledescription":"slide",key:a,id:"carousel-item-"+a,"data-carousel-item":!0,style:{width:"100%"},"data-visible":w(a-Number(e))||void 0},R(a-Number(e))?t:null)))),b&&r.createElement("div",{"data-carousel-controls":!0},r.createElement(T,{"aria-label":"previous","data-arrow":"left","aria-controls":s,onClick:O,icon:r.createElement(A,null)}),r.createElement(T,{"aria-label":"next","data-arrow":"right","aria-controls":s,onClick:k,icon:r.createElement(L,null)})),g&&r.createElement("div",{"data-carousel-bullets":!0},r.createElement(j,{tabIndex:0,totalQuantity:f,activeBullet:x.currentPage,onClick:(e,t)=>{x.sliding||E(t,I)},ariaControlsGenerator:e=>"carousel-item-"+e,onKeyDown:e=>{switch(e.key){case"ArrowLeft":O();break;case"ArrowRight":k();break;case"Home":E(0,I);break;case"End":E(f-1,I)}},onFocus:e=>{e.currentTarget.focus()}})))},exports.Checkbox=p,exports.Form=k,exports.Icon=u,exports.IconButton=T,exports.Incentive=P,exports.Input=c,exports.Label=y,exports.Link=d,exports.List=I,exports.LoadingButton=X,exports.Modal=({isOpen:e,children:t,onDismiss:a,testId:n="store-modal",...o})=>e?i.createPortal(r.createElement(b,{"data-modal-overlay":!0,onClick:e=>{e.defaultPrevented||(e.stopPropagation(),null==a||a(e))},onKeyDown:e=>{"Escape"!==e.key||e.defaultPrevented||(e.stopPropagation(),null==a||a(e))}},r.createElement(_,Object.assign({},o,{testId:n}),t)),document.body):null,exports.Overlay=b,exports.PaymentMethods=F,exports.Popover=({targetRef:e,testId:t="store-popover",children:o,...i})=>r.createElement(n,Object.assign({"data-store-popover":!0,"data-testid":t,position:a.positionDefault,targetRef:e},i),o),exports.Price=f,exports.PriceRange=({className:e,formatter:a,max:n,min:o,onChange:i,testId:s="store-price-range",variant:d,"aria-label":l})=>{const[c,u]=t.useState(o),[m,p]=t.useState(n);return r.createElement("div",{"data-store-price-range":!0,"data-testid":s,className:e},r.createElement(E,{min:o,max:n,onChange:e=>{e.min!==c&&u(e.min),e.max!==m&&p(e.max),null==i||i(e)},"aria-label":l}),r.createElement("div",{"data-price-range-values":!0},r.createElement(f,{formatter:a,"data-price-range-value":"min",value:c,variant:d}),r.createElement(f,{formatter:a,"data-price-range-value":"max",value:m,variant:d})))},exports.QuantitySelector=ce,exports.Radio=h,exports.RadioGroup=({name:e,onChange:t,children:a,selectedValue:n})=>{const o=r.useMemo(()=>({name:e,selectedValue:n,onChange:t}),[e,n,t]);return r.createElement(H.Provider,{value:o},a)},exports.RadioOption=K,exports.SearchInput=S,exports.Select=g,exports.Skeleton=w,exports.Slider=E,exports.Spinner=R,exports.Table=ae,exports.TableBody=ie,exports.TableCell=oe,exports.TableFooter=de,exports.TableHead=se,exports.TableRow=ne,exports.TextArea=m,exports.useSlider=M;
|
|
2
2
|
//# sourceMappingURL=ui.cjs.production.min.js.map
|