UNPKG

@tindtechnologies/universalviewer

Version:

The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎

2 lines (1 loc) 8.1 kB
import{a as k,b as x}from"./chunk-ENN6EEDW.js";import{a as y,b as v}from"./chunk-Y2TXPXZV.js";import{c as g}from"./chunk-4DAZ7WDM.js";import{a as f,e as h,f as b,i as u,l as p,o as m}from"./chunk-VNJCZCB4.js";import"./chunk-L67DAW3A.js";var w=function(o,r,e,a){return new(e||(e=Promise))(function(n,t){function s(i){try{d(a.next(i))}catch(c){t(c)}}function l(i){try{d(a.throw(i))}catch(c){t(c)}}function d(i){i.done?n(i.value):new e(function(c){c(i.value)}).then(s,l)}d((a=a.apply(o,r||[])).next())})},S=function(o,r){var e={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},a,n,t,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(i){return function(c){return d([i,c])}}function d(i){if(a)throw new TypeError("Generator is already executing.");for(;e;)try{if(a=1,n&&(t=i[0]&2?n.return:i[0]?n.throw||((t=n.return)&&t.call(n),0):n.next)&&!(t=t.call(n,i[1])).done)return t;switch(n=0,t&&(i=[i[0]&2,t.value]),i[0]){case 0:case 1:t=i;break;case 4:return e.label++,{value:i[1],done:!1};case 5:e.label++,n=i[1],i=[0];continue;case 7:i=e.ops.pop(),e.trys.pop();continue;default:if(t=e.trys,!(t=t.length>0&&t[t.length-1])&&(i[0]===6||i[0]===2)){e=0;continue}if(i[0]===3&&(!t||i[1]>t[0]&&i[1]<t[3])){e.label=i[1];break}if(i[0]===6&&e.label<t[1]){e.label=t[1],t=i;break}if(t&&e.label<t[2]){e.label=t[2],e.ops.push(i);break}t[2]&&e.ops.pop(),e.trys.pop();continue}i=r.call(o,e)}catch(c){i=[6,c],n=0}finally{a=t=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},j=function(){function o(r){var e=this;f(this,r),this.inputId="ion-rb-"+C++,this.name=this.inputId,this.disabled=!1,this.checked=!1,this.onFocus=function(){e.ionFocus.emit()},this.onBlur=function(){e.ionBlur.emit()},this.onClick=function(){e.checked?e.ionDeselect.emit():e.checked=!0},this.ionStyle=u(this,"ionStyle",7),this.ionSelect=u(this,"ionSelect",7),this.ionDeselect=u(this,"ionDeselect",7),this.ionFocus=u(this,"ionFocus",7),this.ionBlur=u(this,"ionBlur",7)}return o.prototype.colorChanged=function(){this.emitStyle()},o.prototype.checkedChanged=function(r){r&&this.ionSelect.emit({checked:!0,value:this.value}),this.emitStyle()},o.prototype.disabledChanged=function(){this.emitStyle()},o.prototype.componentWillLoad=function(){this.value===void 0&&(this.value=this.inputId),this.emitStyle()},o.prototype.emitStyle=function(){this.ionStyle.emit({"radio-checked":this.checked,"interactive-disabled":this.disabled})},o.prototype.render=function(){var r,e=this,a=e.inputId,n=e.disabled,t=e.checked,s=e.color,l=e.el,d=m(this),i=a+"-lbl",c=g(l);return c&&(c.id=i),h(b,{onClick:this.onClick,role:"radio","aria-disabled":n?"true":null,"aria-checked":""+t,"aria-labelledby":i,class:Object.assign(Object.assign({},v(s)),(r={},r[d]=!0,r["in-item"]=y("ion-item",l),r.interactive=!0,r["radio-checked"]=t,r["radio-disabled"]=n,r))},h("div",{class:"radio-icon"},h("div",{class:"radio-inner"})),h("button",{type:"button",onFocus:this.onFocus,onBlur:this.onBlur,disabled:n}))},Object.defineProperty(o.prototype,"el",{get:function(){return p(this)},enumerable:!0,configurable:!0}),Object.defineProperty(o,"watchers",{get:function(){return{color:["colorChanged"],checked:["checkedChanged"],disabled:["disabledChanged"]}},enumerable:!0,configurable:!0}),Object.defineProperty(o,"style",{get:function(){return':host{display:inline-block;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.radio-disabled){pointer-events:none}.radio-icon{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;contain:layout size style}.radio-icon,button{width:100%;height:100%}button{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none}:host-context([dir=rtl]) button,[dir=rtl] button{left:unset;right:unset;right:0}button::-moz-focus-inner{border:0}.radio-icon,.radio-inner{-webkit-box-sizing:border-box;box-sizing:border-box}:host{--color-checked:var(--ion-color-primary,#3880ff);width:15px;height:24px}:host(.ion-color.radio-checked) .radio-inner{border-color:var(--ion-color-base)}.item-radio.item-ios ion-label{margin-left:0}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.item-radio.item-ios ion-label{margin-left:unset;-webkit-margin-start:0;margin-inline-start:0}}.radio-inner{width:33%;height:50%}:host(.radio-checked) .radio-inner{-webkit-transform:rotate(45deg);transform:rotate(45deg);border-width:2px;border-top-width:0;border-left-width:0;border-style:solid;border-color:var(--color-checked)}:host(.radio-disabled){opacity:.3}:host(.ion-focused) .radio-icon:after{border-radius:50%;left:-9px;top:-8px;display:block;position:absolute;width:36px;height:36px;background:var(--ion-color-primary-tint,#4c8dff);content:"";opacity:.2}:host-context([dir=rtl]).ion-focused .radio-icon:after,:host-context([dir=rtl]):host(.ion-focused) .radio-icon:after{left:unset;right:unset;right:-9px}:host(.in-item){margin-left:8px;margin-right:11px;margin-top:8px;margin-bottom:8px;display:block;position:static}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host(.in-item){margin-left:unset;margin-right:unset;-webkit-margin-start:8px;margin-inline-start:8px;-webkit-margin-end:11px;margin-inline-end:11px}}:host(.in-item[slot=start]){margin-left:3px;margin-right:21px;margin-top:8px;margin-bottom:8px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host(.in-item[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:3px;margin-inline-start:3px;-webkit-margin-end:21px;margin-inline-end:21px}}'},enumerable:!0,configurable:!0}),o}(),C=0,B=function(){function o(r){var e=this;f(this,r),this.inputId="ion-rg-"+I++,this.labelId=this.inputId+"-lbl",this.allowEmptySelection=!1,this.name=this.inputId,this.onSelect=function(a){var n=a.target;n&&(e.value=n.value)},this.onDeselect=function(a){var n=a.target;n&&(n.checked=!1,e.value=void 0)},this.ionChange=u(this,"ionChange",7)}return o.prototype.valueChanged=function(r){this.updateRadios(),this.ionChange.emit({value:r})},o.prototype.connectedCallback=function(){return w(this,void 0,void 0,function(){var r,e,a,n,t=this;return S(this,function(s){switch(s.label){case 0:return r=this.el,e=r.querySelector("ion-list-header")||r.querySelector("ion-item-divider"),e&&(a=e.querySelector("ion-label"),a&&(this.labelId=a.id=this.name+"-lbl")),this.value!==void 0?[3,2]:(n=x(r,"ion-radio"),n===void 0?[3,2]:[4,n.componentOnReady()]);case 1:s.sent(),this.value===void 0&&(this.value=n.value),s.label=2;case 2:return this.mutationO=k(r,"ion-radio",function(l){l!==void 0?l.componentOnReady().then(function(){t.value=l.value}):t.updateRadios()}),this.updateRadios(),[2]}})})},o.prototype.disconnectedCallback=function(){this.mutationO&&(this.mutationO.disconnect(),this.mutationO=void 0)},o.prototype.updateRadios=function(){return w(this,void 0,void 0,function(){var r,e,a,n,t,s;return S(this,function(l){switch(l.label){case 0:return[4,this.getRadios()];case 1:for(r=l.sent(),e=this.value,a=!1,n=0,t=r;n<t.length;n++)s=t[n],!a&&s.value===e?(a=!0,s.checked=!0):s.checked=!1;return a||(this.value=void 0),[2]}})})},o.prototype.getRadios=function(){return Promise.all(Array.from(this.el.querySelectorAll("ion-radio")).map(function(r){return r.componentOnReady()}))},o.prototype.render=function(){return h(b,{role:"radiogroup","aria-labelledby":this.labelId,onIonSelect:this.onSelect,onIonDeselect:this.allowEmptySelection?this.onDeselect:void 0,class:m(this)})},Object.defineProperty(o.prototype,"el",{get:function(){return p(this)},enumerable:!0,configurable:!0}),Object.defineProperty(o,"watchers",{get:function(){return{value:["valueChanged"]}},enumerable:!0,configurable:!0}),o}(),I=0;export{j as ion_radio,B as ion_radio_group};