@ionic/core 8.0.0-dev.11709226349.179192de → 8.0.0-dev.11709245047.1565a499

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.
@@ -1,4 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- import{r as t,d as i,h as e,H as s,f as o}from"./p-ed7a529f.js";import{d as n}from"./p-7b30edcc.js";import{r as a,g as d}from"./p-8ab308e9.js";import{a as r,b as c,h as l}from"./p-42f189f4.js";import{a as p,b as h}from"./p-5d7e32ce.js";import{c as f}from"./p-47794def.js";import"./p-c61cc894.js";const m=class{constructor(e){t(this,e),this.ionChange=i(this,"ionChange",7),this.isScrolling=!1,this.isColumnVisible=!1,this.canExitInputMode=!0,this.centerPickerItemInView=(t,i=!0,e=!0)=>{const{isColumnVisible:s,scrollEl:o}=this;if(s&&o){const s=t.offsetTop-3*t.clientHeight+t.clientHeight/2;o.scrollTop!==s&&(this.canExitInputMode=e,o.scroll({top:s,left:0,behavior:i?"smooth":void 0}))}},this.setPickerItemActiveState=(t,i)=>{i?t.classList.add(b):t.classList.remove(b)},this.inputModeChange=t=>{if(!this.numericInput)return;const{useInputMode:i,inputModeColumn:e}=t.detail;this.setInputModeActive(!(!i||void 0!==e&&e!==this.el))},this.setInputModeActive=t=>{this.isScrolling?this.scrollEndCallback=()=>{this.isActive=t}:this.isActive=t},this.initializeScrollListener=()=>{const t=p("ios"),{el:i,scrollEl:e}=this;let s,o=this.activeItem;const d=()=>{a((()=>{if(!e)return;s&&(clearTimeout(s),s=void 0),this.isScrolling||(t&&r(),this.isScrolling=!0);const a=e.getBoundingClientRect(),d=a.x+a.width/2,p=a.y+a.height/2,h=i.getRootNode(),f=h instanceof ShadowRoot?h:n;if(void 0===f)return;const m=f.elementsFromPoint(d,p).find((t=>"ION-PICKER-COLUMN-OPTION"===t.tagName));void 0!==o&&this.setPickerItemActiveState(o,!1),void 0===m||m.disabled||(m!==o&&(t&&c(),this.canExitInputMode&&this.exitInputMode()),o=m,this.setPickerItemActiveState(m,!0),s=setTimeout((()=>{this.isScrolling=!1,t&&l();const{scrollEndCallback:i}=this;i&&(i(),this.scrollEndCallback=void 0),this.canExitInputMode=!0,this.setValue(m.value)}),250))}))};a((()=>{e&&(e.addEventListener("scroll",d),this.destroyScrollListener=()=>{e.removeEventListener("scroll",d)})}))},this.exitInputMode=()=>{const{parentEl:t}=this;null!=t&&(t.exitInputMode(),this.el.classList.remove("picker-column-active"))},this.isActive=!1,this.disabled=!1,this.value=void 0,this.color="primary",this.numericInput=!1}valueChange(){this.isColumnVisible&&this.scrollActiveItemIntoView(!0)}componentWillLoad(){const t=this.parentEl=this.el.closest("ion-picker");new IntersectionObserver((t=>{if(t[0].isIntersecting){const{activeItem:t,el:i}=this;this.isColumnVisible=!0;const e=d(i).querySelector(`.${b}`);e&&this.setPickerItemActiveState(e,!1),this.scrollActiveItemIntoView(),t&&this.setPickerItemActiveState(t,!0),this.initializeScrollListener()}else this.isColumnVisible=!1,this.destroyScrollListener&&(this.destroyScrollListener(),this.destroyScrollListener=void 0)}),{threshold:.001,root:this.parentEl}).observe(this.el),null!==t&&t.addEventListener("ionInputModeChange",(t=>this.inputModeChange(t)))}componentDidRender(){const{el:t,activeItem:i,isColumnVisible:e,value:s}=this;if(e&&!i){const i=t.querySelector("ion-picker-column-option");null!==i&&i.value!==s&&this.setValue(i.value)}}async scrollActiveItemIntoView(t=!1){const i=this.activeItem;i&&this.centerPickerItemInView(i,t,!1)}async setValue(t){!0!==this.disabled&&this.value!==t&&(this.value=t,this.ionChange.emit({value:t}))}async setFocus(){this.scrollEl&&this.scrollEl.focus()}get activeItem(){const{value:t}=this;return Array.from(this.el.querySelectorAll("ion-picker-column-option")).find((i=>!(!this.disabled&&i.disabled)&&i.value===t))}render(){const{color:t,disabled:i,isActive:o,numericInput:n}=this,a=h(this);return e(s,{key:"486d51508a8fdd0c32437cf0256a68efacb232bc",class:f(t,{[a]:!0,"picker-column-active":o,"picker-column-numeric-input":n,"picker-column-disabled":i})},e("slot",{key:"ed842f362a7dad9ae44088094a1357a36fa756b5",name:"prefix"}),e("div",{key:"05cdee8135cf4f74d553d0871ee3d1ec3645266a",class:"picker-opts",tabindex:i?void 0:0,ref:t=>{this.scrollEl=t}},e("div",{key:"4c7bab039e1c76a0e60c772685bf131c002be745",class:"picker-item-empty","aria-hidden":"true"}," "),e("div",{key:"24a63eafdc3c7143f85618291005ffb16c4adc5d",class:"picker-item-empty","aria-hidden":"true"}," "),e("div",{key:"4aa8b290bab85d7f0096077e364aa462116a6aee",class:"picker-item-empty","aria-hidden":"true"}," "),e("slot",{key:"b50261844ba7c44f93085a2bf4bcdcedd7d901f3"}),e("div",{key:"8a7074b695a9a2451c099bc5a6f15da5b5d8bf8d",class:"picker-item-empty","aria-hidden":"true"}," "),e("div",{key:"2add7a4e88ae5f1cb69dc2350248593d273bf743",class:"picker-item-empty","aria-hidden":"true"}," "),e("div",{key:"eefa1cfd28fb1427c47d1f1671811fb8e10bb47f",class:"picker-item-empty","aria-hidden":"true"}," ")),e("slot",{key:"14450be7fa297e8ea14f1174f67c69318faa63fd",name:"suffix"}))}get el(){return o(this)}static get watchers(){return{value:["valueChange"]}}},b="option-active";m.style=":host{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;max-width:100%;height:200px;font-size:22px;text-align:center}.picker-opts{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0px;padding-bottom:0px;min-width:26px;max-height:200px;outline:none;text-align:inherit;-webkit-scroll-snap-type:y mandatory;-ms-scroll-snap-type:y mandatory;scroll-snap-type:y mandatory;overflow-x:hidden;overflow-y:scroll;scrollbar-width:none}.picker-item-empty{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;height:34px;border:0px;outline:none;background:transparent;color:inherit;font-family:var(--ion-font-family, inherit);font-size:inherit;line-height:34px;text-align:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.picker-opts::-webkit-scrollbar{display:none}::slotted(ion-picker-column-option){display:block;scroll-snap-align:center}.picker-item-empty,:host(:not([disabled])) ::slotted(ion-picker-column-option.option-disabled){scroll-snap-align:none}::slotted([slot=prefix]),::slotted([slot=suffix]){max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}::slotted([slot=prefix]){-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0;padding-bottom:0;-ms-flex-pack:end;justify-content:end}::slotted([slot=suffix]){-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:0;padding-bottom:0;-ms-flex-pack:start;justify-content:start}:host(.picker-column-disabled) .picker-opts{overflow-y:hidden}:host(.picker-column-disabled) ::slotted(ion-picker-column-option){cursor:default;opacity:0.4;pointer-events:none}@media (any-hover: hover){:host(:focus) .picker-opts{outline:none;background:rgba(var(--ion-color-base-rgb), 0.2)}}";export{m as ion_picker_column}