@paperless/core 0.1.0-alpha.354 → 0.1.0-alpha.356

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.
Files changed (155) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/{paperless/p-50789b59.entry.js → build/p-0cf80e70.entry.js} +2 -2
  3. package/dist/build/{p-50789b59.entry.js.map → p-0cf80e70.entry.js.map} +0 -0
  4. package/dist/build/{p-657eb257.entry.js → p-0d7941f2.entry.js} +2 -2
  5. package/dist/build/{p-657eb257.entry.js.map → p-0d7941f2.entry.js.map} +1 -1
  6. package/dist/build/{p-2bc6b026.entry.js → p-16825918.entry.js} +2 -2
  7. package/dist/build/{p-2bc6b026.entry.js.map → p-16825918.entry.js.map} +0 -0
  8. package/dist/build/{p-c2ce8fea.entry.js → p-589ad402.entry.js} +2 -2
  9. package/dist/build/{p-c2ce8fea.entry.js.map → p-589ad402.entry.js.map} +0 -0
  10. package/dist/build/{p-4fc82528.entry.js → p-5a2a08c5.entry.js} +2 -2
  11. package/dist/build/{p-4fc82528.entry.js.map → p-5a2a08c5.entry.js.map} +0 -0
  12. package/dist/build/{p-f80f397d.entry.js → p-69e0e5f9.entry.js} +2 -2
  13. package/dist/build/{p-f80f397d.entry.js.map → p-69e0e5f9.entry.js.map} +0 -0
  14. package/dist/build/{p-3d68b72f.entry.js → p-790ca7e1.entry.js} +2 -2
  15. package/dist/build/{p-3d68b72f.entry.js.map → p-790ca7e1.entry.js.map} +0 -0
  16. package/dist/{paperless/p-7171690b.entry.js → build/p-81dc831e.entry.js} +2 -2
  17. package/dist/build/{p-7171690b.entry.js.map → p-81dc831e.entry.js.map} +0 -0
  18. package/dist/build/{p-bdaeb7c7.entry.js → p-a83d71a4.entry.js} +2 -2
  19. package/dist/build/{p-bdaeb7c7.entry.js.map → p-a83d71a4.entry.js.map} +0 -0
  20. package/dist/{paperless/p-846dd0bb.entry.js → build/p-b295883e.entry.js} +2 -2
  21. package/dist/build/{p-846dd0bb.entry.js.map → p-b295883e.entry.js.map} +0 -0
  22. package/dist/{paperless/p-bea2ecf8.entry.js → build/p-c74a98f3.entry.js} +2 -2
  23. package/dist/build/p-c74a98f3.entry.js.map +1 -0
  24. package/dist/build/p-efd20880.entry.js +2 -0
  25. package/dist/build/p-efd20880.entry.js.map +1 -0
  26. package/dist/build/paperless.esm.js +1 -1
  27. package/dist/build/paperless.esm.js.map +1 -1
  28. package/dist/cjs/loader.cjs.js +1 -1
  29. package/dist/cjs/p-button_3.cjs.entry.js +3 -3
  30. package/dist/cjs/p-divider.cjs.entry.js +1 -1
  31. package/dist/cjs/p-dropdown-menu-container.cjs.entry.js +1 -1
  32. package/dist/cjs/p-dropdown_2.cjs.entry.js +2 -2
  33. package/dist/cjs/p-dropdown_2.cjs.entry.js.map +1 -1
  34. package/dist/cjs/p-helper_3.cjs.entry.js +2 -2
  35. package/dist/cjs/p-illustration_6.cjs.entry.js +5 -5
  36. package/dist/cjs/p-label_3.cjs.entry.js +3 -3
  37. package/dist/cjs/p-page-size-select_3.cjs.entry.js +2 -2
  38. package/dist/cjs/p-select.cjs.entry.js +23 -8
  39. package/dist/cjs/p-select.cjs.entry.js.map +1 -1
  40. package/dist/cjs/p-stepper.cjs.entry.js +0 -8
  41. package/dist/cjs/p-stepper.cjs.entry.js.map +1 -1
  42. package/dist/cjs/p-table.cjs.entry.js +1 -1
  43. package/dist/cjs/p-tooltip.cjs.entry.js +1 -1
  44. package/dist/cjs/paperless.cjs.js +1 -1
  45. package/dist/collection/components/atoms/button/button.component.css +1 -1
  46. package/dist/collection/components/atoms/divider/divider.component.css +1 -1
  47. package/dist/collection/components/atoms/dropdown-menu-container/dropdown-menu-container.component.css +1 -1
  48. package/dist/collection/components/atoms/dropdown-menu-item/dropdown-menu-item.component.css +1 -1
  49. package/dist/collection/components/atoms/helper/helper.component.css +1 -1
  50. package/dist/collection/components/atoms/icon/icon.component.css +1 -1
  51. package/dist/collection/components/atoms/label/label.component.css +1 -1
  52. package/dist/collection/components/atoms/loader/loader.component.css +1 -1
  53. package/dist/collection/components/atoms/pagination-item/pagination-item.component.css +1 -1
  54. package/dist/collection/components/atoms/segment-container/segment-container.component.css +1 -1
  55. package/dist/collection/components/atoms/segment-item/segment-item.component.css +1 -1
  56. package/dist/collection/components/atoms/table-container/table-container.component.css +1 -1
  57. package/dist/collection/components/atoms/tooltip/tooltip.component.css +1 -1
  58. package/dist/collection/components/molecules/attachment/attachment.component.css +1 -1
  59. package/dist/collection/components/molecules/calendar/calendar.component.css +1 -1
  60. package/dist/collection/components/molecules/datepicker/datepicker.component.css +1 -1
  61. package/dist/collection/components/molecules/dropdown/dropdown.component.css +1 -1
  62. package/dist/collection/components/molecules/input-group/input-group.component.css +1 -1
  63. package/dist/collection/components/molecules/pagination/pagination.component.css +1 -1
  64. package/dist/collection/components/molecules/profile/profile.component.css +1 -1
  65. package/dist/collection/components/molecules/select/select.component.js +40 -8
  66. package/dist/collection/components/molecules/select/select.component.js.map +1 -1
  67. package/dist/collection/components/molecules/stepper/stepper.component.js +0 -8
  68. package/dist/collection/components/molecules/stepper/stepper.component.js.map +1 -1
  69. package/dist/collection/components/molecules/table-cell/table-cell.component.css +1 -1
  70. package/dist/collection/components/molecules/table-footer/table-footer.component.css +1 -1
  71. package/dist/collection/components/molecules/table-header/table-header.component.css +1 -1
  72. package/dist/collection/components/molecules/table-row/table-row.component.css +1 -1
  73. package/dist/collection/components/organisms/table/table.component.css +1 -1
  74. package/dist/components/button.component.js +1 -1
  75. package/dist/components/divider.component.js +1 -1
  76. package/dist/components/dropdown-menu-container.component.js +1 -1
  77. package/dist/components/dropdown-menu-item.component.js +1 -1
  78. package/dist/components/dropdown-menu-item.component.js.map +1 -1
  79. package/dist/components/dropdown.component.js +1 -1
  80. package/dist/components/helper.component.js +1 -1
  81. package/dist/components/icon.component.js +1 -1
  82. package/dist/components/input-group.component.js +1 -1
  83. package/dist/components/label.component.js +1 -1
  84. package/dist/components/loader.component.js +1 -1
  85. package/dist/components/p-select.js +24 -8
  86. package/dist/components/p-select.js.map +1 -1
  87. package/dist/components/p-stepper.js +0 -8
  88. package/dist/components/p-stepper.js.map +1 -1
  89. package/dist/components/p-table.js +1 -1
  90. package/dist/components/pagination-item.component.js +1 -1
  91. package/dist/components/pagination.component.js +1 -1
  92. package/dist/components/segment-container.component.js +1 -1
  93. package/dist/components/segment-item.component.js +1 -1
  94. package/dist/components/table-cell.component.js +1 -1
  95. package/dist/components/table-container.component.js +1 -1
  96. package/dist/components/table-footer.component.js +1 -1
  97. package/dist/components/table-header.component.js +1 -1
  98. package/dist/components/table-row.component.js +1 -1
  99. package/dist/components/tooltip.component.js +1 -1
  100. package/dist/esm/loader.js +1 -1
  101. package/dist/esm/p-button_3.entry.js +3 -3
  102. package/dist/esm/p-divider.entry.js +1 -1
  103. package/dist/esm/p-dropdown-menu-container.entry.js +1 -1
  104. package/dist/esm/p-dropdown_2.entry.js +2 -2
  105. package/dist/esm/p-dropdown_2.entry.js.map +1 -1
  106. package/dist/esm/p-helper_3.entry.js +2 -2
  107. package/dist/esm/p-illustration_6.entry.js +5 -5
  108. package/dist/esm/p-label_3.entry.js +3 -3
  109. package/dist/esm/p-page-size-select_3.entry.js +2 -2
  110. package/dist/esm/p-select.entry.js +23 -8
  111. package/dist/esm/p-select.entry.js.map +1 -1
  112. package/dist/esm/p-stepper.entry.js +0 -8
  113. package/dist/esm/p-stepper.entry.js.map +1 -1
  114. package/dist/esm/p-table.entry.js +1 -1
  115. package/dist/esm/p-tooltip.entry.js +1 -1
  116. package/dist/esm/paperless.js +1 -1
  117. package/dist/index.html +1 -1
  118. package/dist/{build/p-50789b59.entry.js → paperless/p-0cf80e70.entry.js} +2 -2
  119. package/dist/paperless/{p-50789b59.entry.js.map → p-0cf80e70.entry.js.map} +0 -0
  120. package/dist/paperless/{p-657eb257.entry.js → p-0d7941f2.entry.js} +2 -2
  121. package/dist/paperless/{p-657eb257.entry.js.map → p-0d7941f2.entry.js.map} +1 -1
  122. package/dist/paperless/{p-2bc6b026.entry.js → p-16825918.entry.js} +2 -2
  123. package/dist/paperless/{p-2bc6b026.entry.js.map → p-16825918.entry.js.map} +0 -0
  124. package/dist/paperless/{p-c2ce8fea.entry.js → p-589ad402.entry.js} +2 -2
  125. package/dist/paperless/{p-c2ce8fea.entry.js.map → p-589ad402.entry.js.map} +0 -0
  126. package/dist/paperless/{p-4fc82528.entry.js → p-5a2a08c5.entry.js} +2 -2
  127. package/dist/paperless/{p-4fc82528.entry.js.map → p-5a2a08c5.entry.js.map} +0 -0
  128. package/dist/paperless/{p-f80f397d.entry.js → p-69e0e5f9.entry.js} +2 -2
  129. package/dist/paperless/{p-f80f397d.entry.js.map → p-69e0e5f9.entry.js.map} +0 -0
  130. package/dist/paperless/{p-3d68b72f.entry.js → p-790ca7e1.entry.js} +2 -2
  131. package/dist/paperless/{p-3d68b72f.entry.js.map → p-790ca7e1.entry.js.map} +0 -0
  132. package/dist/{build/p-7171690b.entry.js → paperless/p-81dc831e.entry.js} +2 -2
  133. package/dist/paperless/{p-7171690b.entry.js.map → p-81dc831e.entry.js.map} +0 -0
  134. package/dist/paperless/{p-bdaeb7c7.entry.js → p-a83d71a4.entry.js} +2 -2
  135. package/dist/paperless/{p-bdaeb7c7.entry.js.map → p-a83d71a4.entry.js.map} +0 -0
  136. package/dist/{build/p-846dd0bb.entry.js → paperless/p-b295883e.entry.js} +2 -2
  137. package/dist/paperless/{p-846dd0bb.entry.js.map → p-b295883e.entry.js.map} +0 -0
  138. package/dist/{build/p-bea2ecf8.entry.js → paperless/p-c74a98f3.entry.js} +2 -2
  139. package/dist/paperless/p-c74a98f3.entry.js.map +1 -0
  140. package/dist/paperless/p-efd20880.entry.js +2 -0
  141. package/dist/paperless/p-efd20880.entry.js.map +1 -0
  142. package/dist/paperless/paperless.esm.js +1 -1
  143. package/dist/paperless/paperless.esm.js.map +1 -1
  144. package/dist/sw.js +1 -1
  145. package/dist/sw.js.map +1 -1
  146. package/dist/types/components/molecules/select/select.component.d.ts +5 -0
  147. package/dist/types/components.d.ts +8 -0
  148. package/hydrate/index.js +48 -40
  149. package/package.json +1 -1
  150. package/dist/build/p-376d98e9.entry.js +0 -2
  151. package/dist/build/p-376d98e9.entry.js.map +0 -1
  152. package/dist/build/p-bea2ecf8.entry.js.map +0 -1
  153. package/dist/paperless/p-376d98e9.entry.js +0 -2
  154. package/dist/paperless/p-376d98e9.entry.js.map +0 -1
  155. package/dist/paperless/p-bea2ecf8.entry.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paperless/core",
3
- "version": "0.1.0-alpha.354",
3
+ "version": "0.1.0-alpha.356",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1,2 +0,0 @@
1
- import{r as t,h as e,H as i,g as s}from"./p-69d43b9d.js";const o=".static{position:static!important}.flex{display:flex!important}.h-auto{height:auto!important}.w-full{width:100%!important}.flex-col{flex-direction:column!important}.flex-wrap{flex-wrap:wrap!important}*{box-sizing:border-box}:host{display:flex}:host([direction=horizontal]){align-items:flex-end;height:auto}:host([direction=vertical]){align-items:flex-start;flex-direction:column;flex-wrap:wrap;min-height:100%;width:100%}:host([direction=vertical][content-position=start]){align-items:flex-end}";const n=class{constructor(e){t(this,e);this.activeStep=1;this.direction="horizontal";this.contentPosition="end"}componentDidRender(){this._generateSteps()}render(){return e(i,{class:"p-stepper"},e("slot",null))}_generateSteps(){let t=this.activeStep-1||0;const e=this._el.querySelectorAll("p-stepper-item");console.log("active step",t,this.activeStep);if(!this.activeStep||t<0){const i=Array.from(e);const s=i.findIndex((t=>t.tagName.toLowerCase()==="p-stepper-item"&&t.active&&!t.finished));if(s>=0){console.log("Edit activeStep active");t=s}const o=i.findIndex((t=>t.tagName.toLowerCase()==="p-stepper-item"&&t.finished));if(t<0&&o>=0){console.log("Edit activeStep finished");t=o+1}}for(let i=0;i<(e===null||e===void 0?void 0:e.length);i++){const s=e.item(i);console.log({i,activeStep:t,thisActiveStep:this.activeStep});s.active=i===t;s.finished=i<t;s.direction=this.direction;s.align=i===0?"start":i===(e===null||e===void 0?void 0:e.length)-1?"end":"center";s.contentPosition=this.contentPosition;if(i<e.length-1){const e=s.nextElementSibling;if(e&&e.tagName.toLowerCase()==="p-stepper-item"){const o=(s.clientHeight-16)/2;const n=document.createElement("p-stepper-line");n.direction=this.direction;n.active=i<=t;if(o>0&&this.direction==="vertical"){n.style.marginTop=`-${o/16}rem`;n.style.marginBottom=`-${o/16}rem`;n.style.minHeight=`calc(1rem + ${o*2/16}rem)`}this._el.insertBefore(n,e);continue}}if(i>0){const t=s.previousElementSibling;if(t.tagName.toLowerCase()==="p-stepper-line"){t.direction=this.direction;t.active=s.active||s.finished}}}}get _el(){return s(this)}};n.style=o;export{n as p_stepper};
2
- //# sourceMappingURL=p-376d98e9.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["stepperComponentCss","Stepper","componentDidRender","this","_generateSteps","render","h","Host","class","activeStep","items","_el","querySelectorAll","console","log","arrayItems","Array","from","activeItemIndex","findIndex","i","tagName","toLowerCase","active","finished","finishedItemIndex","length","item","thisActiveStep","direction","align","contentPosition","nextItem","nextElementSibling","heightDiff","clientHeight","stepperLine","document","createElement","style","marginTop","marginBottom","minHeight","insertBefore","previousItem","previousElementSibling"],"sources":["./src/components/molecules/stepper/stepper.component.scss?tag=p-stepper&encapsulation=shadow","./src/components/molecules/stepper/stepper.component.tsx"],"sourcesContent":[":host {\n @apply flex;\n}\n\n:host([direction='horizontal']) {\n @apply h-auto items-end;\n}\n\n:host([direction='vertical']) {\n @apply flex-col flex-wrap items-start;\n @apply w-full min-h-full;\n}\n\n:host([direction='vertical'][content-position='start']) {\n @apply items-end;\n}\n","import { Component, Element, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'p-stepper',\n styleUrl: 'stepper.component.scss',\n shadow: true,\n})\nexport class Stepper {\n /**\n * The currently active step\n */\n @Prop() activeStep: number = 1;\n\n /**\n * The direction of the stepper\n */\n @Prop({ reflect: true }) direction: 'horizontal' | 'vertical' =\n 'horizontal';\n\n /**\n * The position of the content in case of vertical direction\n */\n @Prop({ reflect: true }) contentPosition: 'start' | 'end' = 'end';\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n // private _steps: Array<HTMLPStepperItemElement>;\n\n componentDidRender() {\n this._generateSteps();\n }\n\n render() {\n return (\n <Host class=\"p-stepper\">\n <slot />\n </Host>\n );\n }\n\n private _generateSteps() {\n let activeStep = this.activeStep - 1 || 0;\n const items = this._el.querySelectorAll('p-stepper-item');\n\n console.log('active step', activeStep, this.activeStep);\n if (!this.activeStep || activeStep < 0) {\n const arrayItems = Array.from(items);\n const activeItemIndex = arrayItems.findIndex(\n (i: any) =>\n i.tagName.toLowerCase() === 'p-stepper-item' &&\n i.active &&\n !i.finished\n );\n\n if (activeItemIndex >= 0) {\n console.log('Edit activeStep active');\n activeStep = activeItemIndex;\n }\n\n const finishedItemIndex = arrayItems.findIndex(\n (i: any) =>\n i.tagName.toLowerCase() === 'p-stepper-item' && i.finished\n );\n if (activeStep < 0 && finishedItemIndex >= 0) {\n console.log('Edit activeStep finished');\n activeStep = finishedItemIndex + 1;\n }\n }\n\n for (let i = 0; i < items?.length; i++) {\n const item = items.item(i) as any;\n\n console.log({\n i,\n activeStep,\n thisActiveStep: this.activeStep,\n });\n\n item.active = i === activeStep;\n item.finished = i < activeStep;\n item.direction = this.direction;\n item.align =\n i === 0 ? 'start' : i === items?.length - 1 ? 'end' : 'center';\n item.contentPosition = this.contentPosition;\n\n if (i < items.length - 1) {\n const nextItem = item.nextElementSibling;\n if (\n nextItem &&\n nextItem.tagName.toLowerCase() === 'p-stepper-item'\n ) {\n const heightDiff = (item.clientHeight - 16) / 2;\n\n const stepperLine =\n document.createElement('p-stepper-line');\n\n stepperLine.direction = this.direction;\n stepperLine.active = i <= activeStep;\n\n if (heightDiff > 0 && this.direction === 'vertical') {\n stepperLine.style.marginTop = `-${heightDiff / 16}rem`;\n stepperLine.style.marginBottom = `-${\n heightDiff / 16\n }rem`;\n stepperLine.style.minHeight = `calc(1rem + ${\n (heightDiff * 2) / 16\n }rem)`;\n }\n\n this._el.insertBefore(stepperLine, nextItem);\n\n continue;\n }\n }\n\n if (i > 0) {\n const previousItem = item.previousElementSibling;\n if (previousItem.tagName.toLowerCase() === 'p-stepper-line') {\n previousItem.direction = this.direction;\n previousItem.active = item.active || item.finished;\n }\n }\n }\n }\n}\n"],"mappings":"yDAAA,MAAMA,EAAsB,if,MCOfC,EAAO,M,yCAIa,E,eAMzB,a,qBAKwD,K,CAS5DC,qBACIC,KAAKC,gB,CAGTC,SACI,OACIC,EAACC,EAAI,CAACC,MAAM,aACRF,EAAA,a,CAKJF,iBACJ,IAAIK,EAAaN,KAAKM,WAAa,GAAK,EACxC,MAAMC,EAAQP,KAAKQ,IAAIC,iBAAiB,kBAExCC,QAAQC,IAAI,cAAeL,EAAYN,KAAKM,YAC5C,IAAKN,KAAKM,YAAcA,EAAa,EAAG,CACpC,MAAMM,EAAaC,MAAMC,KAAKP,GAC9B,MAAMQ,EAAkBH,EAAWI,WAC9BC,GACGA,EAAEC,QAAQC,gBAAkB,kBAC5BF,EAAEG,SACDH,EAAEI,WAGX,GAAIN,GAAmB,EAAG,CACtBL,QAAQC,IAAI,0BACZL,EAAaS,C,CAGjB,MAAMO,EAAoBV,EAAWI,WAChCC,GACGA,EAAEC,QAAQC,gBAAkB,kBAAoBF,EAAEI,WAE1D,GAAIf,EAAa,GAAKgB,GAAqB,EAAG,CAC1CZ,QAAQC,IAAI,4BACZL,EAAagB,EAAoB,C,EAIzC,IAAK,IAAIL,EAAI,EAAGA,GAAIV,IAAK,MAALA,SAAK,SAALA,EAAOgB,QAAQN,IAAK,CACpC,MAAMO,EAAOjB,EAAMiB,KAAKP,GAExBP,QAAQC,IAAI,CACRM,EACAX,aACAmB,eAAgBzB,KAAKM,aAGzBkB,EAAKJ,OAASH,IAAMX,EACpBkB,EAAKH,SAAWJ,EAAIX,EACpBkB,EAAKE,UAAY1B,KAAK0B,UACtBF,EAAKG,MACDV,IAAM,EAAI,QAAUA,KAAMV,IAAK,MAALA,SAAK,SAALA,EAAOgB,QAAS,EAAI,MAAQ,SAC1DC,EAAKI,gBAAkB5B,KAAK4B,gBAE5B,GAAIX,EAAIV,EAAMgB,OAAS,EAAG,CACtB,MAAMM,EAAWL,EAAKM,mBACtB,GACID,GACAA,EAASX,QAAQC,gBAAkB,iBACrC,CACE,MAAMY,GAAcP,EAAKQ,aAAe,IAAM,EAE9C,MAAMC,EACFC,SAASC,cAAc,kBAE3BF,EAAYP,UAAY1B,KAAK0B,UAC7BO,EAAYb,OAASH,GAAKX,EAE1B,GAAIyB,EAAa,GAAK/B,KAAK0B,YAAc,WAAY,CACjDO,EAAYG,MAAMC,UAAY,IAAIN,EAAa,QAC/CE,EAAYG,MAAME,aAAe,IAC7BP,EAAa,QAEjBE,EAAYG,MAAMG,UAAY,eACzBR,EAAa,EAAK,Q,CAI3B/B,KAAKQ,IAAIgC,aAAaP,EAAaJ,GAEnC,Q,EAIR,GAAIZ,EAAI,EAAG,CACP,MAAMwB,EAAejB,EAAKkB,uBAC1B,GAAID,EAAavB,QAAQC,gBAAkB,iBAAkB,CACzDsB,EAAaf,UAAY1B,KAAK0B,UAC9Be,EAAarB,OAASI,EAAKJ,QAAUI,EAAKH,Q"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["selectComponentCss","Select","this","_isAutoCompleting","_items","items","loading","JSON","parse","displayKey","valueKey","map","str","value","text","_a","query","length","asyncFilter","filter","item","queryKey","_checkvalue","slice","maxDisplayedItems","_displayValue","_selectedItem","_placeholder","autocompletePlaceholder","placeholder","componentDidLoad","_valueChange","autoSelectFirst","render","h","Host","class","disableTriggerClick","calculateWidth","insideClick","show","_showDropdown","slot","icon","size","prefix","label","helper","error","disabled","focused","type","onFocus","_onFocus","onMouseDown","ev","_onMouseDown","onClick","_onClick","onInput","_onChange","ref","_inputRef","showChevron","variant","_getLoadingItems","_getItems","documentClickHandler","target","childOf","_el","_preselectItem","itemChanges","_showDropdownChanges","dropdownShown","emit","undefined","parsedValue","stringify","find","i","_selectValue","valueChange","_onBlur","enableAutocomplete","blur","preventDefault","force","queryChange","key","_b","toString","toLowerCase","indexOf","_c","active","enableHover"],"sources":["./src/components/molecules/select/select.component.scss?tag=p-select","./src/components/molecules/select/select.component.tsx"],"sourcesContent":[":host {\n @apply flex flex-col;\n\n input.read-only {\n @apply text-ellipsis;\n }\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { childOf } from '../../../utils';\nimport { IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-select',\n styleUrl: 'select.component.scss',\n shadow: false,\n})\nexport class Select {\n /**\n * The items to show in the dropdown\n */\n @Prop() items: string | any[];\n\n /**\n * Icon of the select box\n */\n @Prop() icon: IconVariant;\n\n /**\n * The current query\n */\n @Prop() query: string;\n\n /**\n * The placeholder of the input\n */\n @Prop() placeholder: string;\n\n /**\n * The placeholder of the input when auto completing\n */\n @Prop() autocompletePlaceholder: string;\n\n /**\n * The current value\n */\n @Prop() value: any;\n\n /**\n * The key of the object to display\n */\n @Prop() displayKey: string = 'text';\n\n /**\n * The key of the object to return\n */\n @Prop() valueKey: string = 'value';\n\n /**\n * The key of the object to display\n */\n @Prop() queryKey?: string;\n\n /**\n * Wether to automatically select the first item\n */\n @Prop() autoSelectFirst: boolean = true;\n\n /**\n * Wether to show the chevron or not\n */\n @Prop() showChevron: boolean = true;\n\n /**\n * The maximum amount of items to display\n */\n @Prop() maxDisplayedItems: number = 10;\n\n /**\n * Wether to enable autocomplete\n */\n @Prop() enableAutocomplete: boolean = true;\n\n /**\n * Wether the input uses async filtering\n */\n @Prop() asyncFilter: boolean = false;\n\n /**\n * Wether to show loading items\n */\n @Prop() loading: boolean = false;\n\n /**\n * Event when the query of the autocomplete changes\n */\n @Event() queryChange: EventEmitter<string>;\n\n /**\n * Event when the value changes\n */\n @Event() valueChange: EventEmitter<any>;\n\n /**\n * Event when the dropdown shows\n */\n @Event() dropdownShown: EventEmitter<any>;\n\n /**\n * The size of the input group used by the select\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group used by the select\n */\n @Prop() prefix: string;\n\n /**\n * The label of the input group used by the select\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop() helper: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled used by the select\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _showDropdown: any = false;\n @State() private _selectedItem: any = null;\n\n private _isAutoCompleting: boolean = false;\n\n private _inputRef: HTMLInputElement;\n\n get _items() {\n if (!this.items || this.loading) {\n return [];\n }\n\n let items =\n typeof this.items === 'string'\n ? JSON.parse(this.items)\n : this.items;\n\n if (typeof items?.[0] === 'string') {\n this.displayKey = 'text';\n this.valueKey = 'value';\n\n items = items.map((str) => ({\n value: str,\n text: str,\n }));\n }\n\n if (this._isAutoCompleting && this.query?.length && !this.asyncFilter) {\n items = items.filter((item) => {\n if (this.queryKey) {\n return this._checkvalue(this.queryKey, item);\n }\n\n return (\n this._checkvalue(this.valueKey, item) ||\n this._checkvalue(this.displayKey, item)\n );\n });\n }\n\n return items?.slice(0, this.maxDisplayedItems);\n }\n\n get _displayValue() {\n if (this._isAutoCompleting) {\n return this.query;\n }\n\n return this._selectedItem?.[this.displayKey];\n }\n\n get _placeholder() {\n return this._isAutoCompleting && this.autocompletePlaceholder?.length\n ? this.autocompletePlaceholder\n : this.placeholder;\n }\n\n componentDidLoad() {\n if (this.value) {\n this._valueChange(this.value);\n return;\n }\n\n if (this.autoSelectFirst) {\n this._selectedItem = this._items?.[0];\n }\n }\n\n render() {\n return (\n <Host class=\"p-select\">\n <p-dropdown\n disableTriggerClick={true}\n calculateWidth={true}\n insideClick={true}\n show={\n this._showDropdown &&\n (!!this._items.length || this.loading)\n }\n >\n <p-input-group\n slot=\"trigger\"\n icon={this.icon}\n size={this.size}\n prefix={this.prefix}\n label={this.label}\n helper={this.helper}\n error={this.error}\n disabled={this.disabled}\n focused={this._showDropdown}\n >\n <input\n slot=\"input\"\n type=\"text\"\n placeholder={this._placeholder}\n value={this._displayValue}\n class={`p-input cursor-pointer ${\n !this._isAutoCompleting && 'read-only'\n }`}\n onFocus={() => this._onFocus()}\n onMouseDown={(ev) => this._onMouseDown(ev)}\n onClick={() => this._onClick()}\n onInput={(ev) => this._onChange(ev)}\n ref={(ref) => (this._inputRef = ref)}\n />\n\n {this.showChevron && (\n <p-icon variant=\"chevron\" slot=\"suffix\" />\n )}\n </p-input-group>\n <div slot=\"items\">\n {this.loading\n ? this._getLoadingItems()\n : this._getItems()}\n </div>\n </p-dropdown>\n </Host>\n );\n }\n\n @Listen('click', { target: 'document', capture: true })\n protected documentClickHandler({ target }) {\n if (!this._showDropdown || childOf(target, this._el)) {\n return;\n }\n\n this._showDropdown = false;\n this._isAutoCompleting = false;\n }\n\n @Watch('value')\n private _valueChange(value: any) {\n this._preselectItem(value);\n }\n\n @Watch('items')\n public itemChanges() {\n this._preselectItem();\n }\n\n @Watch('_showDropdown')\n public _showDropdownChanges() {\n this.dropdownShown.emit({\n value: this._showDropdown,\n query: this.query,\n });\n }\n\n private _preselectItem(value?: any) {\n value = value === undefined ? null : value;\n const parsedValue = !!this.value\n ? JSON.stringify(this.value)\n : JSON.stringify(value);\n\n if (\n this._selectedItem &&\n JSON.stringify(this._selectedItem[this.valueKey]) === parsedValue\n ) {\n return;\n }\n\n const item = this._items.find(\n (i) => JSON.stringify(i?.[this.valueKey]) === parsedValue\n );\n\n this._selectedItem = item;\n }\n\n private _selectValue(item) {\n this._selectedItem = item;\n const value = this.valueKey ? item[this.valueKey] : item;\n\n this.value = value;\n this.valueChange.emit(this.value);\n\n this._onBlur(true);\n }\n\n private _onFocus() {\n if (!this.enableAutocomplete) {\n this._inputRef.blur();\n if (!this._showDropdown) {\n this._showDropdown = true;\n }\n return;\n }\n\n this._isAutoCompleting = true;\n\n this._showDropdown = true;\n }\n\n private _onMouseDown(ev) {\n if (this.enableAutocomplete) {\n return;\n }\n\n ev.preventDefault();\n }\n\n private _onClick() {\n if (this.enableAutocomplete) {\n return;\n }\n\n this._showDropdown = !this._showDropdown;\n }\n\n private _onBlur(force = false) {\n if (!this.enableAutocomplete && !force) {\n return;\n }\n\n this._isAutoCompleting = false;\n this._showDropdown = false;\n }\n\n private _onChange(ev) {\n if (!this._isAutoCompleting) {\n return;\n }\n\n this.query = ev.target.value;\n this.queryChange.emit(this.query);\n }\n\n private _checkvalue(key, item) {\n return (\n item?.[key]\n ?.toString()\n ?.toLowerCase()\n .indexOf(this.query?.toLowerCase()) >= 0\n );\n }\n\n private _getItems() {\n return this._items.map((item) => (\n <p-dropdown-menu-item\n onClick={() => this._selectValue(item)}\n active={\n item[this.valueKey] === this._selectedItem?.[this.valueKey]\n }\n >\n {item[this.displayKey]}\n </p-dropdown-menu-item>\n ));\n }\n\n private _getLoadingItems() {\n return [0, 0, 0].map(() => (\n <p-dropdown-menu-item enableHover={false}>\n <p-loader variant=\"ghost\" class=\"h-6 w-full rounded\" />\n </p-dropdown-menu-item>\n ));\n }\n}\n"],"mappings":"oGAAA,MAAMA,EAAqB,2yL,MCoBdC,EAAM,M,wJAiIPC,KAAAC,kBAA6B,M,qKA/FR,O,cAKF,Q,6CAUQ,K,iBAKJ,K,uBAKK,G,wBAKE,K,iBAKP,M,aAKJ,M,UAoBQ,S,oGAyBU,M,mBAOP,M,mBACA,I,CAMlCC,a,MACA,IAAKF,KAAKG,OAASH,KAAKI,QAAS,CAC7B,MAAO,E,CAGX,IAAID,SACOH,KAAKG,QAAU,SAChBE,KAAKC,MAAMN,KAAKG,OAChBH,KAAKG,MAEf,UAAWA,IAA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YAGrDU,EAAKlB,KAAKO,YACQ,G,CAIvBwD,mBACJ,MAAO,CAAC,EAAG,EAAG,GAAGtD,KAAI,IACjBuB,EAAA,wBAAsB8D,YAAa,OAC/B9D,EAAA,YAAU8B,QAAQ,QAAQ5B,MAAM,yB"}
@@ -1,2 +0,0 @@
1
- import{r as t,h as e,H as i,g as s}from"./p-69d43b9d.js";const o=".static{position:static!important}.flex{display:flex!important}.h-auto{height:auto!important}.w-full{width:100%!important}.flex-col{flex-direction:column!important}.flex-wrap{flex-wrap:wrap!important}*{box-sizing:border-box}:host{display:flex}:host([direction=horizontal]){align-items:flex-end;height:auto}:host([direction=vertical]){align-items:flex-start;flex-direction:column;flex-wrap:wrap;min-height:100%;width:100%}:host([direction=vertical][content-position=start]){align-items:flex-end}";const n=class{constructor(e){t(this,e);this.activeStep=1;this.direction="horizontal";this.contentPosition="end"}componentDidRender(){this._generateSteps()}render(){return e(i,{class:"p-stepper"},e("slot",null))}_generateSteps(){let t=this.activeStep-1||0;const e=this._el.querySelectorAll("p-stepper-item");console.log("active step",t,this.activeStep);if(!this.activeStep||t<0){const i=Array.from(e);const s=i.findIndex((t=>t.tagName.toLowerCase()==="p-stepper-item"&&t.active&&!t.finished));if(s>=0){console.log("Edit activeStep active");t=s}const o=i.findIndex((t=>t.tagName.toLowerCase()==="p-stepper-item"&&t.finished));if(t<0&&o>=0){console.log("Edit activeStep finished");t=o+1}}for(let i=0;i<(e===null||e===void 0?void 0:e.length);i++){const s=e.item(i);console.log({i,activeStep:t,thisActiveStep:this.activeStep});s.active=i===t;s.finished=i<t;s.direction=this.direction;s.align=i===0?"start":i===(e===null||e===void 0?void 0:e.length)-1?"end":"center";s.contentPosition=this.contentPosition;if(i<e.length-1){const e=s.nextElementSibling;if(e&&e.tagName.toLowerCase()==="p-stepper-item"){const o=(s.clientHeight-16)/2;const n=document.createElement("p-stepper-line");n.direction=this.direction;n.active=i<=t;if(o>0&&this.direction==="vertical"){n.style.marginTop=`-${o/16}rem`;n.style.marginBottom=`-${o/16}rem`;n.style.minHeight=`calc(1rem + ${o*2/16}rem)`}this._el.insertBefore(n,e);continue}}if(i>0){const t=s.previousElementSibling;if(t.tagName.toLowerCase()==="p-stepper-line"){t.direction=this.direction;t.active=s.active||s.finished}}}}get _el(){return s(this)}};n.style=o;export{n as p_stepper};
2
- //# sourceMappingURL=p-376d98e9.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["stepperComponentCss","Stepper","componentDidRender","this","_generateSteps","render","h","Host","class","activeStep","items","_el","querySelectorAll","console","log","arrayItems","Array","from","activeItemIndex","findIndex","i","tagName","toLowerCase","active","finished","finishedItemIndex","length","item","thisActiveStep","direction","align","contentPosition","nextItem","nextElementSibling","heightDiff","clientHeight","stepperLine","document","createElement","style","marginTop","marginBottom","minHeight","insertBefore","previousItem","previousElementSibling"],"sources":["./src/components/molecules/stepper/stepper.component.scss?tag=p-stepper&encapsulation=shadow","./src/components/molecules/stepper/stepper.component.tsx"],"sourcesContent":[":host {\n @apply flex;\n}\n\n:host([direction='horizontal']) {\n @apply h-auto items-end;\n}\n\n:host([direction='vertical']) {\n @apply flex-col flex-wrap items-start;\n @apply w-full min-h-full;\n}\n\n:host([direction='vertical'][content-position='start']) {\n @apply items-end;\n}\n","import { Component, Element, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'p-stepper',\n styleUrl: 'stepper.component.scss',\n shadow: true,\n})\nexport class Stepper {\n /**\n * The currently active step\n */\n @Prop() activeStep: number = 1;\n\n /**\n * The direction of the stepper\n */\n @Prop({ reflect: true }) direction: 'horizontal' | 'vertical' =\n 'horizontal';\n\n /**\n * The position of the content in case of vertical direction\n */\n @Prop({ reflect: true }) contentPosition: 'start' | 'end' = 'end';\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n // private _steps: Array<HTMLPStepperItemElement>;\n\n componentDidRender() {\n this._generateSteps();\n }\n\n render() {\n return (\n <Host class=\"p-stepper\">\n <slot />\n </Host>\n );\n }\n\n private _generateSteps() {\n let activeStep = this.activeStep - 1 || 0;\n const items = this._el.querySelectorAll('p-stepper-item');\n\n console.log('active step', activeStep, this.activeStep);\n if (!this.activeStep || activeStep < 0) {\n const arrayItems = Array.from(items);\n const activeItemIndex = arrayItems.findIndex(\n (i: any) =>\n i.tagName.toLowerCase() === 'p-stepper-item' &&\n i.active &&\n !i.finished\n );\n\n if (activeItemIndex >= 0) {\n console.log('Edit activeStep active');\n activeStep = activeItemIndex;\n }\n\n const finishedItemIndex = arrayItems.findIndex(\n (i: any) =>\n i.tagName.toLowerCase() === 'p-stepper-item' && i.finished\n );\n if (activeStep < 0 && finishedItemIndex >= 0) {\n console.log('Edit activeStep finished');\n activeStep = finishedItemIndex + 1;\n }\n }\n\n for (let i = 0; i < items?.length; i++) {\n const item = items.item(i) as any;\n\n console.log({\n i,\n activeStep,\n thisActiveStep: this.activeStep,\n });\n\n item.active = i === activeStep;\n item.finished = i < activeStep;\n item.direction = this.direction;\n item.align =\n i === 0 ? 'start' : i === items?.length - 1 ? 'end' : 'center';\n item.contentPosition = this.contentPosition;\n\n if (i < items.length - 1) {\n const nextItem = item.nextElementSibling;\n if (\n nextItem &&\n nextItem.tagName.toLowerCase() === 'p-stepper-item'\n ) {\n const heightDiff = (item.clientHeight - 16) / 2;\n\n const stepperLine =\n document.createElement('p-stepper-line');\n\n stepperLine.direction = this.direction;\n stepperLine.active = i <= activeStep;\n\n if (heightDiff > 0 && this.direction === 'vertical') {\n stepperLine.style.marginTop = `-${heightDiff / 16}rem`;\n stepperLine.style.marginBottom = `-${\n heightDiff / 16\n }rem`;\n stepperLine.style.minHeight = `calc(1rem + ${\n (heightDiff * 2) / 16\n }rem)`;\n }\n\n this._el.insertBefore(stepperLine, nextItem);\n\n continue;\n }\n }\n\n if (i > 0) {\n const previousItem = item.previousElementSibling;\n if (previousItem.tagName.toLowerCase() === 'p-stepper-line') {\n previousItem.direction = this.direction;\n previousItem.active = item.active || item.finished;\n }\n }\n }\n }\n}\n"],"m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ACE,MAAMY,GAAcP,EAAKQ,aAAe,IAAM,EAE9C,MAAMC,EACFC,SAASC,cAAc,kBAE3BF,EAAYP,UAAY1B,KAAK0B,UAC7BO,EAAYb,OAASH,GAAKX,EAE1B,GAAIyB,EAAa,GAAK/B,KAAK0B,YAAc,WAAY,CACjDO,EAAYG,MAAMC,UAAY,IAAIN,EAAa,QAC/CE,EAAYG,MAAME,aAAe,IAC7BP,EAAa,QAEjBE,EAAYG,MAAMG,UAAY,eACzBR,EAAa,EAAK,Q,CAI3B/B,KAAKQ,IAAIgC,aAAaP,EAAaJ,GAEnC,Q,EAIR,GAAIZ,EAAI,EAAG,CACP,MAAMwB,EAAejB,EAAKkB,uBAC1B,GAAID,EAAavB,QAAQC,gBAAkB,iBAAkB,CACzDsB,EAAaf,UAAY1B,KAAK0B,UAC9Be,EAAarB,OAASI,EAAKJ,QAAUI,EAAKH,Q"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["selectComponentCss","Select","this","_isAutoCompleting","_items","items","loading","JSON","parse","displayKey","valueKey","map","str","value","text","_a","query","length","asyncFilter","filter","item","queryKey","_checkvalue","slice","maxDisplayedItems","_displayValue","_selectedItem","_placeholder","autocompletePlaceholder","placeholder","componentDidLoad","_valueChange","autoSelectFirst","render","h","Host","class","disableTriggerClick","calculateWidth","insideClick","show","_showDropdown","slot","icon","size","prefix","label","helper","error","disabled","focused","type","onFocus","_onFocus","onMouseDown","ev","_onMouseDown","onClick","_onClick","onInput","_onChange","ref","_inputRef","showChevron","variant","_getLoadingItems","_getItems","documentClickHandler","target","childOf","_el","_preselectItem","itemChanges","_showDropdownChanges","dropdownShown","emit","undefined","parsedValue","stringify","find","i","_selectValue","valueChange","_onBlur","enableAutocomplete","blur","preventDefault","force","queryChange","key","_b","toString","toLowerCase","indexOf","_c","active","enableHover"],"sources":["./src/components/molecules/select/select.component.scss?tag=p-select","./src/components/molecules/select/select.component.tsx"],"sourcesContent":[":host {\n @apply flex flex-col;\n\n input.read-only {\n @apply text-ellipsis;\n }\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { childOf } from '../../../utils';\nimport { IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-select',\n styleUrl: 'select.component.scss',\n shadow: false,\n})\nexport class Select {\n /**\n * The items to show in the dropdown\n */\n @Prop() items: string | any[];\n\n /**\n * Icon of the select box\n */\n @Prop() icon: IconVariant;\n\n /**\n * The current query\n */\n @Prop() query: string;\n\n /**\n * The placeholder of the input\n */\n @Prop() placeholder: string;\n\n /**\n * The placeholder of the input when auto completing\n */\n @Prop() autocompletePlaceholder: string;\n\n /**\n * The current value\n */\n @Prop() value: any;\n\n /**\n * The key of the object to display\n */\n @Prop() displayKey: string = 'text';\n\n /**\n * The key of the object to return\n */\n @Prop() valueKey: string = 'value';\n\n /**\n * The key of the object to display\n */\n @Prop() queryKey?: string;\n\n /**\n * Wether to automatically select the first item\n */\n @Prop() autoSelectFirst: boolean = true;\n\n /**\n * Wether to show the chevron or not\n */\n @Prop() showChevron: boolean = true;\n\n /**\n * The maximum amount of items to display\n */\n @Prop() maxDisplayedItems: number = 10;\n\n /**\n * Wether to enable autocomplete\n */\n @Prop() enableAutocomplete: boolean = true;\n\n /**\n * Wether the input uses async filtering\n */\n @Prop() asyncFilter: boolean = false;\n\n /**\n * Wether to show loading items\n */\n @Prop() loading: boolean = false;\n\n /**\n * Event when the query of the autocomplete changes\n */\n @Event() queryChange: EventEmitter<string>;\n\n /**\n * Event when the value changes\n */\n @Event() valueChange: EventEmitter<any>;\n\n /**\n * Event when the dropdown shows\n */\n @Event() dropdownShown: EventEmitter<any>;\n\n /**\n * The size of the input group used by the select\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group used by the select\n */\n @Prop() prefix: string;\n\n /**\n * The label of the input group used by the select\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop() helper: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled used by the select\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _showDropdown: any = false;\n @State() private _selectedItem: any = null;\n\n private _isAutoCompleting: boolean = false;\n\n private _inputRef: HTMLInputElement;\n\n get _items() {\n if (!this.items || this.loading) {\n return [];\n }\n\n let items =\n typeof this.items === 'string'\n ? JSON.parse(this.items)\n : this.items;\n\n if (typeof items?.[0] === 'string') {\n this.displayKey = 'text';\n this.valueKey = 'value';\n\n items = items.map((str) => ({\n value: str,\n text: str,\n }));\n }\n\n if (this._isAutoCompleting && this.query?.length && !this.asyncFilter) {\n items = items.filter((item) => {\n if (this.queryKey) {\n return this._checkvalue(this.queryKey, item);\n }\n\n return (\n this._checkvalue(this.valueKey, item) ||\n this._checkvalue(this.displayKey, item)\n );\n });\n }\n\n return items?.slice(0, this.maxDisplayedItems);\n }\n\n get _displayValue() {\n if (this._isAutoCompleting) {\n return this.query;\n }\n\n return this._selectedItem?.[this.displayKey];\n }\n\n get _placeholder() {\n return this._isAutoCompleting && this.autocompletePlaceholder?.length\n ? this.autocompletePlaceholder\n : this.placeholder;\n }\n\n componentDidLoad() {\n if (this.value) {\n this._valueChange(this.value);\n return;\n }\n\n if (this.autoSelectFirst) {\n this._selectedItem = this._items?.[0];\n }\n }\n\n render() {\n return (\n <Host class=\"p-select\">\n <p-dropdown\n disableTriggerClick={true}\n calculateWidth={true}\n insideClick={true}\n show={\n this._showDropdown &&\n (!!this._items.length || this.loading)\n }\n >\n <p-input-group\n slot=\"trigger\"\n icon={this.icon}\n size={this.size}\n prefix={this.prefix}\n label={this.label}\n helper={this.helper}\n error={this.error}\n disabled={this.disabled}\n focused={this._showDropdown}\n >\n <input\n slot=\"input\"\n type=\"text\"\n placeholder={this._placeholder}\n value={this._displayValue}\n class={`p-input cursor-pointer ${\n !this._isAutoCompleting && 'read-only'\n }`}\n onFocus={() => this._onFocus()}\n onMouseDown={(ev) => this._onMouseDown(ev)}\n onClick={() => this._onClick()}\n onInput={(ev) => this._onChange(ev)}\n ref={(ref) => (this._inputRef = ref)}\n />\n\n {this.showChevron && (\n <p-icon variant=\"chevron\" slot=\"suffix\" />\n )}\n </p-input-group>\n <div slot=\"items\">\n {this.loading\n ? this._getLoadingItems()\n : this._getItems()}\n </div>\n </p-dropdown>\n </Host>\n );\n }\n\n @Listen('click', { target: 'document', capture: true })\n protected documentClickHandler({ target }) {\n if (!this._showDropdown || childOf(target, this._el)) {\n return;\n }\n\n this._showDropdown = false;\n this._isAutoCompleting = false;\n }\n\n @Watch('value')\n private _valueChange(value: any) {\n this._preselectItem(value);\n }\n\n @Watch('items')\n public itemChanges() {\n this._preselectItem();\n }\n\n @Watch('_showDropdown')\n public _showDropdownChanges() {\n this.dropdownShown.emit({\n value: this._showDropdown,\n query: this.query,\n });\n }\n\n private _preselectItem(value?: any) {\n value = value === undefined ? null : value;\n const parsedValue = !!this.value\n ? JSON.stringify(this.value)\n : JSON.stringify(value);\n\n if (\n this._selectedItem &&\n JSON.stringify(this._selectedItem[this.valueKey]) === parsedValue\n ) {\n return;\n }\n\n const item = this._items.find(\n (i) => JSON.stringify(i?.[this.valueKey]) === parsedValue\n );\n\n this._selectedItem = item;\n }\n\n private _selectValue(item) {\n this._selectedItem = item;\n const value = this.valueKey ? item[this.valueKey] : item;\n\n this.value = value;\n this.valueChange.emit(this.value);\n\n this._onBlur(true);\n }\n\n private _onFocus() {\n if (!this.enableAutocomplete) {\n this._inputRef.blur();\n if (!this._showDropdown) {\n this._showDropdown = true;\n }\n return;\n }\n\n this._isAutoCompleting = true;\n\n this._showDropdown = true;\n }\n\n private _onMouseDown(ev) {\n if (this.enableAutocomplete) {\n return;\n }\n\n ev.preventDefault();\n }\n\n private _onClick() {\n if (this.enableAutocomplete) {\n return;\n }\n\n this._showDropdown = !this._showDropdown;\n }\n\n private _onBlur(force = false) {\n if (!this.enableAutocomplete && !force) {\n return;\n }\n\n this._isAutoCompleting = false;\n this._showDropdown = false;\n }\n\n private _onChange(ev) {\n if (!this._isAutoCompleting) {\n return;\n }\n\n this.query = ev.target.value;\n this.queryChange.emit(this.query);\n }\n\n private _checkvalue(key, item) {\n return (\n item?.[key]\n ?.toString()\n ?.toLowerCase()\n .indexOf(this.query?.toLowerCase()) >= 0\n );\n }\n\n private _getItems() {\n return this._items.map((item) => (\n <p-dropdown-menu-item\n onClick={() => this._selectValue(item)}\n active={\n item[this.valueKey] === this._selectedItem?.[this.valueKey]\n }\n >\n {item[this.displayKey]}\n </p-dropdown-menu-item>\n ));\n }\n\n private _getLoadingItems() {\n return [0, 0, 0].map(() => (\n <p-dropdown-menu-item enableHover={false}>\n <p-loader variant=\"ghost\" class=\"h-6 w-full rounded\" />\n </p-dropdown-menu-item>\n ));\n }\n}\n"],"mappings":"oGAAA,MAAMA,EAAqB,2yL,MCoBdC,EAAM,M,wJAiIPC,KAAAC,kBAA6B,M,qKA/FR,O,cAKF,Q,6CAUQ,K,iBAKJ,K,uBAKK,G,wBAKE,K,iBAKP,M,aAKJ,M,UAoBQ,S,oGAyBU,M,mBAOP,M,mBACA,I,CAMlCC,a,MACA,IAAKF,KAAKG,OAASH,KAAKI,QAAS,CAC7B,MAAO,E,CAGX,IAAID,SACOH,KAAKG,QAAU,SAChBE,KAAKC,MAAMN,KAAKG,OAChBH,KAAKG,MAEf,UAAWA,IAAK,MAALA,SAAK,SAALA,EAAQ,MAAO,SAAU,CAChCH,KAAKO,WAAa,OAClBP,KAAKQ,SAAW,QAEhBL,EAAQA,EAAMM,KAAKC,IAAG,CAClBC,MAAOD,EACPE,KAAMF,K,CAId,GAAIV,KAAKC,qBAAqBY,EAAAb,KAAKc,SAAK,MAAAD,SAAA,SAAAA,EAAEE,UAAWf,KAAKgB,YAAa,CACnEb,EAAQA,EAAMc,QAAQC,IAClB,GAAIlB,KAAKmB,SAAU,CACf,OAAOnB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