FileMaster
Search
Toggle Dark Mode
Home
/
.
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
surecart
Edit File: p-12d7800a.entry.js
import{r as e,c,h as o,a as i}from"./p-e97fde0a.js";import{F as r}from"./p-8b323bfb.js";import{i as t}from"./p-b0d8cd6e.js";const s=":host{display:flex;flex-direction:column;align-items:stretch;justify-content:stretch;min-width:0;align-self:stretch;height:100%}[hidden]{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.choice{background:var(--sc-choice-background-color);font-family:var(--sc-input-font-family);font-size:var(--sc-input-font-size-medium);font-weight:var(--sc-input-font-weight);user-select:none;border:solid var(--sc-choice-border-width, var(--sc-input-border-width)) var(--sc-choice-border-color, var(--sc-input-border-color));border-radius:var(--sc-choice-border-radius, var(--sc-input-border-radius-large));box-shadow:var(--sc-choice-box-shadow);cursor:pointer;padding:var(--sc-choice-padding-top, 1.3em) var(--sc-choice-padding-right, 1.1em) var(--sc-choice-padding-bottom, 1.3em) var(--sc-choice-padding-left, 1.1em);position:relative;text-decoration:none;color:var(--sc-choice-text-color, var(--sc-input-color));height:100%;transition:background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;box-sizing:border-box}.choice--is-rtl{text-align:right}.choice__content{cursor:pointer;display:flex;align-items:center;gap:0.75em;height:100%}.choice--checked{border-color:var(--sc-color-primary-500);box-shadow:0 0 0 1px var(--sc-color-primary-500);z-index:1}.choice__title{display:inline-block;font-weight:var(--sc-input-label-font-weight);font-size:var(--sc-input-label-font-size-medium)}.choice--size-small{padding:0.75em 0.9em}.choice--size-large{padding:1.3em 1.1em}.choice__icon{display:inline-flex;width:var(--sc-radio-size);height:var(--sc-radio-size)}.choice__icon svg{width:100%;height:100%}.choice__control{flex:0 0 auto;position:relative;display:inline-flex;align-items:center;justify-content:center;border:solid var(--sc-input-border-width) var(--sc-input-border-color);background-color:var(--sc-input-background-color);color:transparent;transition:var(--sc-input-transition, var(--sc-transition-medium)) border-color, var(--sc-input-transition, var(--sc-transition-medium)) background-color, var(--sc-input-transition, var(--sc-transition-medium)) color, var(--sc-input-transition, var(--sc-transition-medium)) box-shadow}.choice__control.choice__radio{width:var(--sc-radio-size);height:var(--sc-radio-size);border-radius:50%}.choice__control.choice__checkbox{width:var(--sc-toggle-size);height:var(--sc-toggle-size);border-radius:4px}.choice__control input[type=radio],.choice__control input[type=checkbox]{position:absolute;opacity:0;padding:0;margin:0;pointer-events:none}.choice:not(.choice--checked):not(.choice--disabled) .choice__control:hover{border-color:var(--sc-input-border-color-hover);background-color:var(--sc-input-background-color-hover)}.choice.choice--focused:not(.choice--checked):not(.choice--disabled) .choice__control{border-color:var(--var-sc-checked-focus-border-color, var(--sc-input-background-color));background-color:var(--sc-input-background-color-focus);box-shadow:0 0 0 var(--sc-focus-ring-width) var(--sc-color-primary-500)}.choice.choice--focused:not(.choice--checked):not(.choice--disabled){outline-style:solid;outline-color:var(--sc-color-primary-500);outline-width:var(--sc-focus-ring-width);outline-offset:2px}.choice--checked .choice__control{color:var(--var-sc-checked-color, var(--sc-input-background-color));border-color:var(--sc-color-primary-500);background-color:var(--sc-color-primary-500)}.choice.choice--checked:not(.choice--disabled) .choice__control:hover{border-color:var(--var-sc-checked-hover-radio-border-color, var(--sc-input-background-color));background-color:var(--sc-color-primary-500)}.choice.choice--checked:not(.choice--disabled).choice--focused .choice__control{border-color:var(--var-sc-checked-focus-radio-border-color, var(--sc-input-background-color));background-color:var(--sc-color-primary-500);box-shadow:0 0 0 var(--sc-focus-ring-width) var(--sc-focus-ring-color-primary)}.choice--disabled{opacity:0.5;cursor:not-allowed}.choice:not(.choice--checked) svg circle{opacity:0}.choice__label{width:100%;line-height:1;user-select:none}.choice--layout-columns .choice__label{display:flex;justify-content:space-between;flex-wrap:wrap;gap:0.5em}.choice--layout-columns .choice__price{text-align:right;margin:0;display:flex;flex-direction:column;gap:var(--sc-spacing-xx-small)}.choice__description{display:inline-block;color:var(--sc-color-gray-500);font-size:var(--sc-font-size-medium)}.choice__label-text{display:flex;flex-direction:column;justify-content:center;gap:0.2em;flex:1}.choice__price{display:block}";const a=s;let n=0;const h=class{constructor(o){e(this,o);this.scBlur=c(this,"scBlur",7);this.scChange=c(this,"scChange",7);this.scFocus=c(this,"scFocus",7);this.inputId=`choice-container-${++n}`;this.labelId=`choice-container-label-${n}`;this.hasFocus=false;this.name=undefined;this.size="medium";this.value=undefined;this.type="radio";this.disabled=false;this.checked=false;this.required=false;this.invalid=false;this.showControl=true;this.role=undefined}async triggerClick(){this.input.click()}async triggerFocus(){this.input.focus()}async reportValidity(){this.invalid=!this.input.checkValidity();if(this.required){const e=this.getAllChoices();if(!e.some((e=>e.checked))){this.input.setCustomValidity(this.type==="radio"?wp.i18n.__("Please choose one.","surecart"):wp.i18n.__("Please choose at least one.","surecart"));this.invalid=!this.input.checkValidity()}else{this.input.setCustomValidity("");this.invalid=!this.input.checkValidity()}}return this.input.reportValidity()}handleCheckedChange(){this.input.setCustomValidity("");if(this.type==="radio"&&this.checked){this.getSiblingChoices().map((e=>e.checked=false))}this.input.checked=this.checked}handleBlur(){this.hasFocus=false;this.scBlur.emit()}handleFocus(){this.hasFocus=true;this.scFocus.emit()}async setCustomValidity(e){this.input.setCustomValidity(e);this.invalid=!this.input.checkValidity()}getAllChoices(){const e=this.el.closest("sc-choices")||this.el.parentElement;if(!e){return[]}return[...e.querySelectorAll("sc-choice-container, sc-choice")]}getSiblingChoices(){return this.getAllChoices().filter((e=>e!==this.el))}handleKeyDown(e){if(e.target.contentEditable==="true")return;if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key)){const c=this.getAllChoices().filter((e=>!e.disabled));const o=["ArrowUp","ArrowLeft"].includes(e.key)?-1:1;let i=c.indexOf(this.el)+o;if(i<0)i=c.length-1;if(i>c.length-1)i=0;c[i].triggerFocus();c[i].checked=true;e.preventDefault()}if(e.key===" "){e.preventDefault();this.checked=true;this.scChange.emit(this.input.checked)}}componentDidLoad(){this.formController=new r(this.el,{value:e=>e.checked?e.value:undefined}).addFormData()}disconnectedCallback(){var e;(e=this.formController)===null||e===void 0?void 0:e.removeFormData()}handleClickEvent(){if(this.type==="checkbox"){this.checked=!this.checked;this.scChange.emit(this.input.checked)}else if(!this.checked){this.checked=true;this.scChange.emit(this.input.checked)}}render(){return o("div",{key:"0bb9d801802f49277addb9ca89f764213a1cd2d5",part:"base",class:{choice:true,"choice--checked":this.checked,"choice--disabled":this.disabled,"choice--focused":this.hasFocus,"choice--is-rtl":t(),[`choice--size-${this.size}`]:true},role:"radio","aria-checked":this.checked?"true":"false","aria-disabled":this.disabled?"true":"false",onKeyDown:e=>this.handleKeyDown(e)},o("slot",{key:"a17e358f5fdfb6c206791c8e4b2c8c023b4c6ffb",name:"header"}),o("div",{key:"fc3f218d9e4896b79a8107c2d75063346821ba83",class:"choice__content",part:"content"},o("span",{key:"0d7b8bfceb11783034996a45a39fbac1427586e4",part:"control",class:{choice__control:true,choice__checkbox:this.type==="checkbox",choice__radio:this.type==="radio"},hidden:!this.showControl},o("span",{key:"f269cbbd2a65dc3ec76ee67a8299fed68a9ac7e5",part:"checked-icon",class:"choice__icon"},this.type==="checkbox"?o("svg",{viewBox:"0 0 16 16"},o("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd","stroke-linecap":"round"},o("g",{stroke:"currentColor","stroke-width":"2"},o("g",{transform:"translate(3.428571, 3.428571)"},o("path",{d:"M0,5.71428571 L3.42857143,9.14285714"}),o("path",{d:"M9.14285714,0 L3.42857143,9.14285714"}))))):o("svg",{viewBox:"0 0 16 16"},o("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},o("g",{fill:"currentColor"},o("circle",{cx:"8",cy:"8",r:"3.42857143"}))))),o("input",{key:"a4af93bf11047dc18188a6f1006ae6dac31eaf31",id:this.inputId,ref:e=>this.input=e,type:this.type,name:this.name,value:this.value,checked:this.checked,disabled:this.disabled,"aria-checked":this.checked?"true":"false","aria-disabled":this.disabled?"true":"false","aria-labelledby":this.labelId,tabindex:"0",onBlur:()=>this.handleBlur(),onFocus:()=>this.handleFocus(),onChange:()=>this.handleClickEvent(),role:this.role})),o("label",{key:"1769f4ceebf350835eaa2b608fe2032f6e147962",part:"label",id:this.labelId,class:"choice__label"},o("slot",{key:"57c617c3ac75f72f9ece0ef683557b2fdf325f17"}))))}get el(){return i(this)}static get watchers(){return{checked:["handleCheckedChange"]}}};h.style=a;export{h as sc_choice_container}; //# sourceMappingURL=p-12d7800a.entry.js.map
Save
Back