2021-02-24 10:42:01 +01:00
function _createForOfIteratorHelper ( o , allowArrayLike ) { var it ; if ( typeof Symbol === "undefined" || o [ Symbol . iterator ] == null ) { if ( Array . isArray ( o ) || ( it = _unsupportedIterableToArray ( o ) ) || allowArrayLike && o && typeof o . length === "number" ) { if ( it ) o = it ; var i = 0 ; var F = function F ( ) { } ; return { s : F , n : function n ( ) { if ( i >= o . length ) return { done : true } ; return { done : false , value : o [ i ++ ] } ; } , e : function e ( _e ) { throw _e ; } , f : F } ; } throw new TypeError ( "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ; } var normalCompletion = true , didErr = false , err ; return { s : function s ( ) { it = o [ Symbol . iterator ] ( ) ; } , n : function n ( ) { var step = it . next ( ) ; normalCompletion = step . done ; return step ; } , e : function e ( _e2 ) { didErr = true ; err = _e2 ; } , f : function f ( ) { try { if ( ! normalCompletion && it [ "return" ] != null ) it [ "return" ] ( ) ; } finally { if ( didErr ) throw err ; } } } ; }
2021-01-15 15:31:43 +01:00
2021-02-24 10:42:01 +01:00
function _unsupportedIterableToArray ( o , minLen ) { if ( ! o ) return ; if ( typeof o === "string" ) return _arrayLikeToArray ( o , minLen ) ; var n = Object . prototype . toString . call ( o ) . slice ( 8 , - 1 ) ; if ( n === "Object" && o . constructor ) n = o . constructor . name ; if ( n === "Map" || n === "Set" ) return Array . from ( o ) ; if ( n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ . test ( n ) ) return _arrayLikeToArray ( o , minLen ) ; }
function _arrayLikeToArray ( arr , len ) { if ( len == null || len > arr . length ) len = arr . length ; for ( var i = 0 , arr2 = new Array ( len ) ; i < len ; i ++ ) { arr2 [ i ] = arr [ i ] ; } return arr2 ; }
2021-01-15 15:31:43 +01:00
function _defineProperty ( obj , key , value ) { if ( key in obj ) { Object . defineProperty ( obj , key , { value : value , enumerable : true , configurable : true , writable : true } ) ; } else { obj [ key ] = value ; } return obj ; }
2021-02-24 10:42:01 +01:00
function asyncGeneratorStep ( gen , resolve , reject , _next , _throw , key , arg ) { try { var info = gen [ key ] ( arg ) ; var value = info . value ; } catch ( error ) { reject ( error ) ; return ; } if ( info . done ) { resolve ( value ) ; } else { Promise . resolve ( value ) . then ( _next , _throw ) ; } }
function _asyncToGenerator ( fn ) { return function ( ) { var self = this , args = arguments ; return new Promise ( function ( resolve , reject ) { var gen = fn . apply ( self , args ) ; function _next ( value ) { asyncGeneratorStep ( gen , resolve , reject , _next , _throw , "next" , value ) ; } function _throw ( err ) { asyncGeneratorStep ( gen , resolve , reject , _next , _throw , "throw" , err ) ; } _next ( undefined ) ; } ) ; } ; }
2021-01-15 15:31:43 +01:00
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } }
function _createClass ( Constructor , protoProps , staticProps ) { if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) _defineProperties ( Constructor , staticProps ) ; return Constructor ; }
( window [ "webpackJsonp" ] = window [ "webpackJsonp" ] || [ ] ) . push ( [ [ 24 ] , {
/***/
"./node_modules/@ionic/core/dist/esm/ion-radio_2.entry.js" :
/*!****************************************************************!*\
!*** ./node_modules/@ionic/core/dist/esm/ion-radio_2.entry.js ***!
\****************************************************************/
/*! exports provided: ion_radio, ion_radio_group */
/***/
function node _modulesIonicCoreDistEsmIonRadio _2EntryJs ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ion_radio" , function ( ) {
return Radio ;
} ) ;
/* harmony export (binding) */
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ion_radio_group" , function ( ) {
return RadioGroup ;
} ) ;
/* harmony import */
2021-02-24 10:42:01 +01:00
var _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ (
/*! ./index-e806d1f6.js */
"./node_modules/@ionic/core/dist/esm/index-e806d1f6.js" ) ;
2021-01-15 15:31:43 +01:00
/* harmony import */
2021-02-24 10:42:01 +01:00
var _ionic _global _9d5c8ee3 _js _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ (
/*! ./ionic-global-9d5c8ee3.js */
"./node_modules/@ionic/core/dist/esm/ionic-global-9d5c8ee3.js" ) ;
2021-01-15 15:31:43 +01:00
/* harmony import */
2021-02-24 10:42:01 +01:00
var _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ (
/*! ./helpers-90f46169.js */
"./node_modules/@ionic/core/dist/esm/helpers-90f46169.js" ) ;
2021-01-15 15:31:43 +01:00
/* harmony import */
2021-02-24 10:42:01 +01:00
var _theme _ff3fc52f _js _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ (
/*! ./theme-ff3fc52f.js */
"./node_modules/@ionic/core/dist/esm/theme-ff3fc52f.js" ) ;
2021-01-15 15:31:43 +01:00
2021-02-24 10:42:01 +01:00
var radioIosCss = ":host{--inner-border-radius:50%;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;width:100%;height:100%;contain:layout size style}.radio-icon,.radio-inner{-webkit-box-sizing:border-box;box-sizing:border-box}label{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;opacity:0}[dir=rtl] label,:host-context([dir=rtl]) label{left:unset;right:unset;right:0}label::-moz-focus-inner{border:0}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}:host(:focus){outline:none}: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:0.3}:host(.ion-focused) .radio-icon::after{border-radius:var(--inner-border-radius);left:-9px;top:-8px;display:block;position:absolute;width:36px;height:36px;background:var(--ion-color-primary-tint, #4c8dff);content:\"\";opacity:0.2}:host-context([dir=rtl]):host(.ion-focused) .radio-icon::after,:host-context([dir=rtl]).ion-focused .radio-icon::after{left:unset;right:unset;right:-9px}:host(.in-item){margin-left:10px;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:10px;margin-inline-start:10px;-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}}" ;
var radioMdCss = ":host{--inner-border-radius:50%;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;width:100%;height:100%;contain:layout size style}.radio-icon,.radio-inner{-webkit-box-sizing:border-box;box-sizing:border-box}label{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;opacity:0}[dir=rtl] label,:host-context([dir=rtl]) label{left:unset;right:unset;right:0}label::-moz-focus-inner{border:0}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}:host(:focus){outline:none}:host{--color:var(--ion-color-step-400, #999999);--color-checked:var(--ion-color-primary, #3880ff);--border-width:2px;--border-style:solid;--border-radius:50%;width:20px;height:20px}:host(.ion-color) .radio-inner{background:var(--ion-color-base)}:host(.ion-color.radio-checked) .radio-icon{border-color:var(--ion-color-base)}.radio-icon{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--color)}.radio-inner{border-radius:var(--inner-border-radius);width:calc(50% + var(--border-width));height:calc(50% + var(--border-width));-webkit-transform:scale3d(0, 0, 0);transform:scale3d(0, 0, 0);-webkit-transition:-webkit-transform 280ms cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-transform 280ms cubic-bezier(0.4, 0, 0.2, 1);transition:transform 280ms cubic-bezier(0.4, 0, 0.2, 1);transition:transform 280ms cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 280ms cubic-bezier(0.4, 0, 0.2, 1);background:var(--color-checked)}:host(.radio-checked) .radio-icon{border-color:var(--color-checked)}:host(.radio-checked) .radio-inner{-webkit-transform:scale3d(1, 1, 1);transform:scale3d(1, 1, 1)}:host(.radio-disabled){opacity:0.3}:host(.ion-focused) .radio-icon::after{border-radius:var(--inner-border-radius);left:-12px;top:-12px;display:block;position:absolute;width:36px;height:36px;background:var(--ion-color-primary-tint, #4c8dff);content:\"\";opacity:0.2}:host-context([dir=rtl]):host(.ion-focused) .radio-icon::after,:host-context([dir=rtl]).ion-focused .radio-icon::after{left:unset;right:unset;right:-12px}:host(.in-item){margin-left:0;margin-right:0;margin-top:9px;margin-bottom:9px;display:block;position:static}:host(.in-item[slot=start]){margin-left:4px;margin-right:36px;margin-top:11px;margin-bottom:10px}@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:4px;margin-inline-start:4px;-webkit-margin-end:36px;margin-inline-end:36px}}" ;
2021-01-15 15:31:43 +01:00
var Radio = /*#__PURE__*/ function ( ) {
function Radio ( hostRef ) {
var _this = this ;
_classCallCheck ( this , Radio ) ;
2021-02-24 10:42:01 +01:00
Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "r" ] ) ( this , hostRef ) ;
this . ionStyle = Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "e" ] ) ( this , "ionStyle" , 7 ) ;
this . ionFocus = Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "e" ] ) ( this , "ionFocus" , 7 ) ;
this . ionBlur = Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "e" ] ) ( this , "ionBlur" , 7 ) ;
2021-01-15 15:31:43 +01:00
this . inputId = "ion-rb-" . concat ( radioButtonIds ++ ) ;
this . radioGroup = null ;
/**
* If `true`, the radio is selected.
*/
this . checked = false ;
2021-02-24 10:42:01 +01:00
/**
* The tabindex of the radio button.
* @internal
*/
this . buttonTabindex = - 1 ;
2021-01-15 15:31:43 +01:00
/**
* The name of the control, which is submitted with the form data.
*/
this . name = this . inputId ;
/**
* If `true`, the user cannot interact with the radio.
*/
this . disabled = false ;
this . updateState = function ( ) {
if ( _this . radioGroup ) {
_this . checked = _this . radioGroup . value === _this . value ;
}
} ;
this . onFocus = function ( ) {
_this . ionFocus . emit ( ) ;
} ;
this . onBlur = function ( ) {
_this . ionBlur . emit ( ) ;
} ;
}
2021-02-24 10:42:01 +01:00
/** @internal */
2021-01-15 15:31:43 +01:00
_createClass ( Radio , [ {
2021-02-24 10:42:01 +01:00
key : "setFocus" ,
value : function ( ) {
var _setFocus = _asyncToGenerator ( /*#__PURE__*/ regeneratorRuntime . mark ( function _callee ( ev ) {
return regeneratorRuntime . wrap ( function _callee$ ( _context ) {
while ( 1 ) {
switch ( _context . prev = _context . next ) {
case 0 :
ev . stopPropagation ( ) ;
ev . preventDefault ( ) ;
this . el . focus ( ) ;
case 3 :
case "end" :
return _context . stop ( ) ;
}
}
} , _callee , this ) ;
} ) ) ;
function setFocus ( _x ) {
return _setFocus . apply ( this , arguments ) ;
}
return setFocus ;
} ( )
/** @internal */
} , {
key : "setButtonTabindex" ,
value : function ( ) {
var _setButtonTabindex = _asyncToGenerator ( /*#__PURE__*/ regeneratorRuntime . mark ( function _callee2 ( value ) {
return regeneratorRuntime . wrap ( function _callee2$ ( _context2 ) {
while ( 1 ) {
switch ( _context2 . prev = _context2 . next ) {
case 0 :
this . buttonTabindex = value ;
case 1 :
case "end" :
return _context2 . stop ( ) ;
}
}
} , _callee2 , this ) ;
} ) ) ;
function setButtonTabindex ( _x2 ) {
return _setButtonTabindex . apply ( this , arguments ) ;
}
return setButtonTabindex ;
} ( )
} , {
2021-01-15 15:31:43 +01:00
key : "connectedCallback" ,
value : function connectedCallback ( ) {
if ( this . value === undefined ) {
this . value = this . inputId ;
}
var radioGroup = this . radioGroup = this . el . closest ( 'ion-radio-group' ) ;
if ( radioGroup ) {
this . updateState ( ) ;
2021-02-24 10:42:01 +01:00
Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "a" ] ) ( radioGroup , 'ionChange' , this . updateState ) ;
2021-01-15 15:31:43 +01:00
}
}
} , {
key : "disconnectedCallback" ,
value : function disconnectedCallback ( ) {
var radioGroup = this . radioGroup ;
if ( radioGroup ) {
2021-02-24 10:42:01 +01:00
Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "b" ] ) ( radioGroup , 'ionChange' , this . updateState ) ;
2021-01-15 15:31:43 +01:00
this . radioGroup = null ;
}
}
} , {
key : "componentWillLoad" ,
value : function componentWillLoad ( ) {
this . emitStyle ( ) ;
}
} , {
key : "emitStyle" ,
value : function emitStyle ( ) {
this . ionStyle . emit ( {
'radio-checked' : this . checked ,
'interactive-disabled' : this . disabled
} ) ;
}
} , {
key : "render" ,
value : function render ( ) {
2021-02-24 10:42:01 +01:00
var _Object2 ;
2021-01-15 15:31:43 +01:00
var inputId = this . inputId ,
disabled = this . disabled ,
checked = this . checked ,
color = this . color ,
2021-02-24 10:42:01 +01:00
el = this . el ,
buttonTabindex = this . buttonTabindex ;
var mode = Object ( _ionic _global _9d5c8ee3 _js _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "b" ] ) ( this ) ;
2021-01-15 15:31:43 +01:00
2021-02-24 10:42:01 +01:00
var _Object = Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "c" ] ) ( el , inputId ) ,
label = _Object . label ,
labelId = _Object . labelId ,
labelText = _Object . labelText ;
2021-01-15 15:31:43 +01:00
2021-02-24 10:42:01 +01:00
return Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "H" ] , {
2021-01-15 15:31:43 +01:00
"aria-checked" : "" . concat ( checked ) ,
2021-02-24 10:42:01 +01:00
"aria-hidden" : disabled ? 'true' : null ,
"aria-labelledby" : label ? labelId : null ,
role : "radio" ,
tabindex : buttonTabindex ,
onFocus : this . onFocus ,
onBlur : this . onBlur ,
"class" : Object ( _theme _ff3fc52f _js _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "c" ] ) ( color , ( _Object2 = { } , _defineProperty ( _Object2 , mode , true ) , _defineProperty ( _Object2 , 'in-item' , Object ( _theme _ff3fc52f _js _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "h" ] ) ( 'ion-item' , el ) ) , _defineProperty ( _Object2 , 'interactive' , true ) , _defineProperty ( _Object2 , 'radio-checked' , checked ) , _defineProperty ( _Object2 , 'radio-disabled' , disabled ) , _Object2 ) )
} , Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "div" , {
2021-01-15 15:31:43 +01:00
"class" : "radio-icon" ,
part : "container"
2021-02-24 10:42:01 +01:00
} , Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "div" , {
2021-01-15 15:31:43 +01:00
"class" : "radio-inner" ,
part : "mark"
2021-02-24 10:42:01 +01:00
} ) , Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "div" , {
"class" : "radio-ripple"
} ) ) , Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "label" , {
htmlFor : inputId
} , labelText ) , Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "input" , {
type : "radio" ,
checked : checked ,
disabled : disabled ,
tabindex : "-1" ,
id : inputId
2021-01-15 15:31:43 +01:00
} ) ) ;
}
} , {
key : "el" ,
get : function get ( ) {
2021-02-24 10:42:01 +01:00
return Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "i" ] ) ( this ) ;
2021-01-15 15:31:43 +01:00
}
} ] , [ {
key : "watchers" ,
get : function get ( ) {
return {
"color" : [ "emitStyle" ] ,
"checked" : [ "emitStyle" ] ,
"disabled" : [ "emitStyle" ]
} ;
}
} ] ) ;
return Radio ;
} ( ) ;
var radioButtonIds = 0 ;
Radio . style = {
ios : radioIosCss ,
md : radioMdCss
} ;
var RadioGroup = /*#__PURE__*/ function ( ) {
function RadioGroup ( hostRef ) {
var _this2 = this ;
_classCallCheck ( this , RadioGroup ) ;
2021-02-24 10:42:01 +01:00
Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "r" ] ) ( this , hostRef ) ;
this . ionChange = Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "e" ] ) ( this , "ionChange" , 7 ) ;
2021-01-15 15:31:43 +01:00
this . inputId = "ion-rg-" . concat ( radioGroupIds ++ ) ;
this . labelId = "" . concat ( this . inputId , "-lbl" ) ;
/**
* If `true`, the radios can be deselected.
*/
this . allowEmptySelection = false ;
/**
* The name of the control, which is submitted with the form data.
*/
this . name = this . inputId ;
2021-02-24 10:42:01 +01:00
this . setRadioTabindex = function ( value ) {
var radios = _this2 . getRadios ( ) ; // Get the first radio that is not disabled and the checked one
var first = radios . find ( function ( radio ) {
return ! radio . disabled ;
} ) ;
var checked = radios . find ( function ( radio ) {
return radio . value === value && ! radio . disabled ;
} ) ;
if ( ! first && ! checked ) {
return ;
} // If an enabled checked radio exists, set it to be the focusable radio
// otherwise we default to focus the first radio
var focusable = checked || first ;
var _iterator = _createForOfIteratorHelper ( radios ) ,
_step ;
try {
for ( _iterator . s ( ) ; ! ( _step = _iterator . n ( ) ) . done ; ) {
var radio = _step . value ;
var tabindex = radio === focusable ? 0 : - 1 ;
radio . setButtonTabindex ( tabindex ) ;
}
} catch ( err ) {
_iterator . e ( err ) ;
} finally {
_iterator . f ( ) ;
}
} ;
2021-01-15 15:31:43 +01:00
this . onClick = function ( ev ) {
2021-02-24 10:42:01 +01:00
ev . preventDefault ( ) ;
2021-01-15 15:31:43 +01:00
var selectedRadio = ev . target && ev . target . closest ( 'ion-radio' ) ;
if ( selectedRadio ) {
var currentValue = _this2 . value ;
var newValue = selectedRadio . value ;
if ( newValue !== currentValue ) {
_this2 . value = newValue ;
} else if ( _this2 . allowEmptySelection ) {
_this2 . value = undefined ;
}
}
} ;
}
_createClass ( RadioGroup , [ {
key : "valueChanged" ,
value : function valueChanged ( value ) {
2021-02-24 10:42:01 +01:00
this . setRadioTabindex ( value ) ;
2021-01-15 15:31:43 +01:00
this . ionChange . emit ( {
value : value
} ) ;
}
2021-02-24 10:42:01 +01:00
} , {
key : "componentDidLoad" ,
value : function componentDidLoad ( ) {
this . setRadioTabindex ( this . value ) ;
}
2021-01-15 15:31:43 +01:00
} , {
key : "connectedCallback" ,
value : function ( ) {
2021-02-24 10:42:01 +01:00
var _connectedCallback = _asyncToGenerator ( /*#__PURE__*/ regeneratorRuntime . mark ( function _callee3 ( ) {
var header , label ;
return regeneratorRuntime . wrap ( function _callee3$ ( _context3 ) {
2021-01-15 15:31:43 +01:00
while ( 1 ) {
2021-02-24 10:42:01 +01:00
switch ( _context3 . prev = _context3 . next ) {
2021-01-15 15:31:43 +01:00
case 0 :
// Get the list header if it exists and set the id
// this is used to set aria-labelledby
2021-02-24 10:42:01 +01:00
header = this . el . querySelector ( 'ion-list-header' ) || this . el . querySelector ( 'ion-item-divider' ) ;
2021-01-15 15:31:43 +01:00
if ( header ) {
2021-02-24 10:42:01 +01:00
label = this . label = header . querySelector ( 'ion-label' ) ;
2021-01-15 15:31:43 +01:00
if ( label ) {
this . labelId = label . id = this . name + '-lbl' ;
}
}
2021-02-24 10:42:01 +01:00
case 2 :
2021-01-15 15:31:43 +01:00
case "end" :
2021-02-24 10:42:01 +01:00
return _context3 . stop ( ) ;
2021-01-15 15:31:43 +01:00
}
}
2021-02-24 10:42:01 +01:00
} , _callee3 , this ) ;
2021-01-15 15:31:43 +01:00
} ) ) ;
function connectedCallback ( ) {
return _connectedCallback . apply ( this , arguments ) ;
}
return connectedCallback ;
} ( )
2021-02-24 10:42:01 +01:00
} , {
key : "getRadios" ,
value : function getRadios ( ) {
return Array . from ( this . el . querySelectorAll ( 'ion-radio' ) ) ;
}
} , {
key : "onKeydown" ,
value : function onKeydown ( ev ) {
var inSelectPopover = ! ! this . el . closest ( 'ion-select-popover' ) ;
if ( ev . target && ! this . el . contains ( ev . target ) ) {
return ;
} // Get all radios inside of the radio group and then
// filter out disabled radios since we need to skip those
var radios = Array . from ( this . el . querySelectorAll ( 'ion-radio' ) ) . filter ( function ( radio ) {
return ! radio . disabled ;
} ) ; // Only move the radio if the current focus is in the radio group
if ( ev . target && radios . includes ( ev . target ) ) {
var index = radios . findIndex ( function ( radio ) {
return radio === ev . target ;
} ) ;
var current = radios [ index ] ;
var next ; // If hitting arrow down or arrow right, move to the next radio
// If we're on the last radio, move to the first radio
if ( [ 'ArrowDown' , 'ArrowRight' ] . includes ( ev . code ) ) {
next = index === radios . length - 1 ? radios [ 0 ] : radios [ index + 1 ] ;
} // If hitting arrow up or arrow left, move to the previous radio
// If we're on the first radio, move to the last radio
if ( [ 'ArrowUp' , 'ArrowLeft' ] . includes ( ev . code ) ) {
next = index === 0 ? radios [ radios . length - 1 ] : radios [ index - 1 ] ;
}
if ( next && radios . includes ( next ) ) {
next . setFocus ( ev ) ;
if ( ! inSelectPopover ) {
this . value = next . value ;
}
} // Update the radio group value when a user presses the
// space bar on top of a selected radio (only applies
// to radios in a select popover)
if ( [ 'Space' ] . includes ( ev . code ) ) {
this . value = current . value ;
}
}
}
2021-01-15 15:31:43 +01:00
} , {
key : "render" ,
value : function render ( ) {
2021-02-24 10:42:01 +01:00
var label = this . label ,
labelId = this . labelId ;
var mode = Object ( _ionic _global _9d5c8ee3 _js _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "b" ] ) ( this ) ;
return Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "H" ] , {
2021-01-15 15:31:43 +01:00
role : "radiogroup" ,
2021-02-24 10:42:01 +01:00
"aria-labelledby" : label ? labelId : null ,
2021-01-15 15:31:43 +01:00
onClick : this . onClick ,
2021-02-24 10:42:01 +01:00
"class" : mode
2021-01-15 15:31:43 +01:00
} ) ;
}
} , {
key : "el" ,
get : function get ( ) {
2021-02-24 10:42:01 +01:00
return Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "i" ] ) ( this ) ;
2021-01-15 15:31:43 +01:00
}
} ] , [ {
key : "watchers" ,
get : function get ( ) {
return {
"value" : [ "valueChanged" ]
} ;
}
} ] ) ;
return RadioGroup ;
} ( ) ;
var radioGroupIds = 0 ;
/***/
}
} ] ) ;
//# sourceMappingURL=24-es5.js.map