1 line
22 KiB
Plaintext
1 line
22 KiB
Plaintext
{"version":3,"sources":["webpack:///node_modules/@ionic/core/dist/esm/ion-radio_2.entry.js"],"names":["radioIosCss","radioMdCss","Radio","hostRef","ionStyle","ionFocus","ionBlur","inputId","radioButtonIds","radioGroup","checked","buttonTabindex","name","disabled","updateState","value","onFocus","emit","onBlur","buttonEl","focus","undefined","el","closest","addEventListener","removeEventListener","emitStyle","color","mode","labelId","label","id","role","part","ref","btnEl","type","tabindex","style","ios","md","RadioGroup","ionChange","radioGroupIds","allowEmptySelection","setRadioTabindex","radios","getRadios","first","find","radio","focusable","setButtonTabindex","onClick","ev","selectedRadio","target","currentValue","newValue","header","querySelector","Array","from","querySelectorAll","contains","filter","includes","index","findIndex","next","key","length","setFocus"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;;AAKA,UAAMA,WAAW,GAAG,ukFAApB;AAEA,UAAMC,UAAU,GAAG,y5FAAnB;;AAEA,UAAMC,KAAK;AACP,uBAAYC,OAAZ,EAAqB;AAAA;;AAAA;;AACjB,uEAAiB,IAAjB,EAAuBA,OAAvB;AACA,eAAKC,QAAL,GAAgB,6DAAY,IAAZ,EAAkB,UAAlB,EAA8B,CAA9B,CAAhB;AACA,eAAKC,QAAL,GAAgB,6DAAY,IAAZ,EAAkB,UAAlB,EAA8B,CAA9B,CAAhB;AACA,eAAKC,OAAL,GAAe,6DAAY,IAAZ,EAAkB,SAAlB,EAA6B,CAA7B,CAAf;AACA,eAAKC,OAAL,oBAAyBC,cAAc,EAAvC;AACA,eAAKC,UAAL,GAAkB,IAAlB;AACA;;;;AAGA,eAAKC,OAAL,GAAe,KAAf;AACA;;;;;AAIA,eAAKC,cAAL,GAAsB,CAAC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AAKA,OAArE;AAA8E,uBAAO,oEAAW,IAAX;AAArF,aAAR,CAAR;AACH;AAnGW;AAAA;AAAA,8BAoGH;AAAE,mBAAO,6DAAW,IAAX,CAAP;AAA0B;AApGzB;AAAA;AAAA,8BAqGU;AAAE,mBAAO;AAC3B,uBAAS,CAAC,cAAD;AADkB,aAAP;AAEpB;AAvGQ;;AAAA;AAAA,SAAhB;;AAyGA,UAAIV,aAAa,GAAG,CAApB","file":"24-es5.js","sourcesContent":["import { r as registerInstance, e as createEvent, h, H as Host, i as getElement } from './index-92848855.js';\nimport { b as getIonMode } from './ionic-global-23e7365a.js';\nimport { f as findItemLabel } from './helpers-5c745fbd.js';\nimport { c as createColorClasses, h as hostContext } from './theme-5641d27f.js';\n\nconst 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}button{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}[dir=rtl] button,:host-context([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: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}}\";\n\nconst 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}button{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}[dir=rtl] button,:host-context([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: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}}\";\n\nconst Radio = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.ionStyle = createEvent(this, \"ionStyle\", 7);\n this.ionFocus = createEvent(this, \"ionFocus\", 7);\n this.ionBlur = createEvent(this, \"ionBlur\", 7);\n this.inputId = `ion-rb-${radioButtonIds++}`;\n this.radioGroup = null;\n /**\n * If `true`, the radio is selected.\n */\n this.checked = false;\n /**\n * The tabindex of the radio button.\n * @internal\n */\n this.buttonTabindex = -1;\n /**\n * The name of the control, which is submitted with the form data.\n */\n this.name = this.inputId;\n /**\n * If `true`, the user cannot interact with the radio.\n */\n this.disabled = false;\n this.updateState = () => {\n if (this.radioGroup) {\n this.checked = this.radioGroup.value === this.value;\n }\n };\n this.onFocus = () => {\n this.ionFocus.emit();\n };\n this.onBlur = () => {\n this.ionBlur.emit();\n };\n }\n /** @internal */\n async setFocus() {\n if (this.buttonEl) {\n this.buttonEl.focus();\n }\n }\n /** @internal */\n async setButtonTabindex(value) {\n this.buttonTabindex = value;\n }\n connectedCallback() {\n if (this.value === undefined) {\n this.value = this.inputId;\n }\n const radioGroup = this.radioGroup = this.el.closest('ion-radio-group');\n if (radioGroup) {\n this.updateState();\n radioGroup.addEventListener('ionChange', this.updateState);\n }\n }\n disconnectedCallback() {\n const radioGroup = this.radioGroup;\n if (radioGroup) {\n radioGroup.removeEventListener('ionChange', this.updateState);\n this.radioGroup = null;\n }\n }\n componentWillLoad() {\n this.emitStyle();\n }\n emitStyle() {\n this.ionStyle.emit({\n 'radio-checked': this.checked,\n 'interactive-disabled': this.disabled,\n });\n }\n render() {\n const { inputId, disabled, checked, color, el, buttonTabindex } = this;\n const mode = getIonMode(this);\n const labelId = inputId + '-lbl';\n const label = findItemLabel(el);\n if (label) {\n label.id = labelId;\n }\n return (h(Host, { role: \"radio\", \"aria-disabled\": disabled ? 'true' : null, \"aria-checked\": `${checked}`, \"aria-labelledby\": labelId, class: createColorClasses(color, {\n [mode]: true,\n 'in-item': hostContext('ion-item', el),\n 'interactive': true,\n 'radio-checked': checked,\n 'radio-disabled': disabled,\n }) }, h(\"div\", { class: \"radio-icon\", part: \"container\" }, h(\"div\", { class: \"radio-inner\", part: \"mark\" })), h(\"button\", { ref: btnEl => this.buttonEl = btnEl, type: \"button\", onFocus: this.onFocus, onBlur: this.onBlur, disabled: disabled, tabindex: buttonTabindex })));\n }\n get el() { return getElement(this); }\n static get watchers() { return {\n \"color\": [\"emitStyle\"],\n \"checked\": [\"emitStyle\"],\n \"disabled\": [\"emitStyle\"]\n }; }\n};\nlet radioButtonIds = 0;\nRadio.style = {\n ios: radioIosCss,\n md: radioMdCss\n};\n\nconst RadioGroup = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.ionChange = createEvent(this, \"ionChange\", 7);\n this.inputId = `ion-rg-${radioGroupIds++}`;\n this.labelId = `${this.inputId}-lbl`;\n /**\n * If `true`, the radios can be deselected.\n */\n this.allowEmptySelection = false;\n /**\n * The name of the control, which is submitted with the form data.\n */\n this.name = this.inputId;\n this.setRadioTabindex = (value) => {\n const radios = this.getRadios();\n // Get the first radio that is not disabled and the checked one\n const first = radios.find(radio => !radio.disabled);\n const checked = radios.find(radio => (radio.value === value && !radio.disabled));\n if (!first && !checked) {\n return;\n }\n // If an enabled checked radio exists, set it to be the focusable radio\n // otherwise we default to focus the first radio\n const focusable = checked || first;\n for (const radio of radios) {\n const tabindex = radio === focusable ? 0 : -1;\n radio.setButtonTabindex(tabindex);\n }\n };\n this.onClick = (ev) => {\n const selectedRadio = ev.target && ev.target.closest('ion-radio');\n if (selectedRadio) {\n const currentValue = this.value;\n const newValue = selectedRadio.value;\n if (newValue !== currentValue) {\n this.value = newValue;\n }\n else if (this.allowEmptySelection) {\n this.value = undefined;\n }\n }\n };\n }\n valueChanged(value) {\n this.setRadioTabindex(value);\n this.ionChange.emit({ value });\n }\n componentDidLoad() {\n this.setRadioTabindex(this.value);\n }\n async connectedCallback() {\n // Get the list header if it exists and set the id\n // this is used to set aria-labelledby\n const el = this.el;\n const header = el.querySelector('ion-list-header') || el.querySelector('ion-item-divider');\n if (header) {\n const label = header.querySelector('ion-label');\n if (label) {\n this.labelId = label.id = this.name + '-lbl';\n }\n }\n }\n getRadios() {\n return Array.from(this.el.querySelectorAll('ion-radio'));\n }\n onKeydown(ev) {\n if (ev.target && !this.el.contains(ev.target)) {\n return;\n }\n // Get all radios inside of the radio group and then\n // filter out disabled radios since we need to skip those\n const radios = Array.from(this.el.querySelectorAll('ion-radio')).filter(radio => !radio.disabled);\n // Only move the radio if the current focus is in the radio group\n if (ev.target && radios.includes(ev.target)) {\n const index = radios.findIndex(radio => radio === ev.target);\n let next;\n // If hitting arrow down or arrow right, move to the next radio\n // If we're on the last radio, move to the first radio\n if (['ArrowDown', 'ArrowRight'].includes(ev.key)) {\n next = (index === radios.length - 1)\n ? radios[0]\n : radios[index + 1];\n }\n // If hitting arrow up or arrow left, move to the previous radio\n // If we're on the first radio, move to the last radio\n if (['ArrowUp', 'ArrowLeft'].includes(ev.key)) {\n next = (index === 0)\n ? radios[radios.length - 1]\n : radios[index - 1];\n }\n if (next && radios.includes(next)) {\n next.setFocus();\n this.value = next.value;\n }\n }\n }\n render() {\n return (h(Host, { role: \"radiogroup\", \"aria-labelledby\": this.labelId, onClick: this.onClick, class: getIonMode(this) }));\n }\n get el() { return getElement(this); }\n static get watchers() { return {\n \"value\": [\"valueChanged\"]\n }; }\n};\nlet radioGroupIds = 0;\n\nexport { Radio as ion_radio, RadioGroup as ion_radio_group };\n"]} |