@baloise/ds-core 19.5.0 → 19.6.0

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 (237) hide show
  1. package/components/bal-accordion.js +1 -1
  2. package/components/bal-carousel-item.js +1 -1
  3. package/components/bal-data-value.js +4 -2
  4. package/components/bal-date-calendar2.js +1 -1
  5. package/components/bal-date.js +1 -1
  6. package/components/bal-dropdown.js +1 -1
  7. package/components/bal-field-hint.js +25 -2
  8. package/components/bal-field-message.js +7 -2
  9. package/components/bal-field.js +1 -1
  10. package/components/bal-file-upload.js +3 -3
  11. package/components/bal-form.js +1 -1
  12. package/components/bal-icon2.js +1 -1
  13. package/components/bal-modal.js +1 -1
  14. package/components/bal-nav-meta-bar2.js +1 -1
  15. package/components/bal-nav.js +2 -2
  16. package/components/bal-navbar-brand.js +1 -1
  17. package/components/bal-number-input.js +30 -13
  18. package/components/bal-option-list.js +1 -1
  19. package/components/bal-pagination.js +1 -1
  20. package/components/bal-popup2.js +8 -2
  21. package/components/bal-segment.js +2 -1
  22. package/components/bal-select2.js +1 -1
  23. package/components/bal-tabs2.js +2 -2
  24. package/components/bal-toast.controller.js +127 -0
  25. package/components/focus.decorator.js +1 -1
  26. package/components/form-input.js +1 -1
  27. package/components/helpers.js +1 -1
  28. package/components/index.js +6 -127
  29. package/components/mutation.decorator.js +1 -1
  30. package/components/tokens.esm.js +1 -1
  31. package/components/visibility.decorator.js +1 -1
  32. package/dist/baloise-design-system/baloise-design-system.esm.js +1 -1
  33. package/dist/baloise-design-system/index.esm.js +1 -1
  34. package/dist/baloise-design-system/{p-b3c4bb46d3.entry.js → p-0a4ac49e02.entry.js} +1 -1
  35. package/dist/baloise-design-system/p-0cf4c25729.system.entry.js +1 -0
  36. package/dist/baloise-design-system/{p-53d4b7058b.entry.js → p-0ea9ab068b.entry.js} +1 -1
  37. package/dist/baloise-design-system/p-0f6bb8caa3.system.entry.js +1 -0
  38. package/dist/baloise-design-system/{p-05171f8822.system.entry.js → p-10c062442e.system.entry.js} +1 -1
  39. package/dist/baloise-design-system/p-18454aabec.entry.js +1 -0
  40. package/dist/baloise-design-system/{p-64ef8c714d.entry.js → p-1857577c70.entry.js} +1 -1
  41. package/dist/baloise-design-system/p-1e9c5546fc.system.entry.js +1 -0
  42. package/dist/baloise-design-system/p-255dd40d49.entry.js +1 -0
  43. package/dist/baloise-design-system/{p-1e16b6160b.entry.js → p-327c84b06b.entry.js} +1 -1
  44. package/dist/baloise-design-system/{p-32f4c6a2a2.entry.js → p-3641978d62.entry.js} +1 -1
  45. package/dist/baloise-design-system/{p-3595a9493d.entry.js → p-5465e8ac55.entry.js} +1 -1
  46. package/dist/baloise-design-system/{p-b8b00da091.entry.js → p-5567a745f4.entry.js} +1 -1
  47. package/dist/baloise-design-system/{p-8b02d1f691.system.entry.js → p-59390868c1.system.entry.js} +1 -1
  48. package/dist/baloise-design-system/p-60c78f3752.entry.js +1 -0
  49. package/dist/baloise-design-system/p-6242e41d53.system.entry.js +1 -0
  50. package/dist/baloise-design-system/{p-e45196d720.system.entry.js → p-7405a37a9a.system.entry.js} +1 -1
  51. package/dist/baloise-design-system/{p-2f840ebc0e.system.entry.js → p-804bbad7f2.system.entry.js} +1 -1
  52. package/dist/baloise-design-system/p-8a0dbc8717.system.entry.js +1 -0
  53. package/dist/baloise-design-system/p-8ae0044332.entry.js +1 -0
  54. package/dist/baloise-design-system/{p-8f16b577ed.system.entry.js → p-8bc0af1a02.system.entry.js} +1 -1
  55. package/dist/baloise-design-system/p-8c9f806358.system.entry.js +1 -0
  56. package/dist/baloise-design-system/{p-063fe43bad.entry.js → p-93a741aa6b.entry.js} +1 -1
  57. package/dist/baloise-design-system/p-94610ff5fd.system.entry.js +1 -0
  58. package/dist/baloise-design-system/{p-7eebcf67e2.entry.js → p-9a16bde9ad.entry.js} +1 -1
  59. package/dist/baloise-design-system/p-9d4ddca8b1.entry.js +1 -0
  60. package/dist/baloise-design-system/{p-450ed0e3a8.system.entry.js → p-9fe93f520f.system.entry.js} +1 -1
  61. package/dist/baloise-design-system/{p-D-wn3VCz.system.js → p-B6AwgiDg.system.js} +1 -1
  62. package/dist/baloise-design-system/{p-D7joM2A_.js → p-BXW6ULlI.js} +1 -1
  63. package/dist/baloise-design-system/p-BZQXDr-g.js +1 -0
  64. package/dist/baloise-design-system/p-Bas5fYcv.system.js +1 -1
  65. package/dist/baloise-design-system/p-BtpJmRB8.js +1 -1
  66. package/dist/baloise-design-system/{p-C2O6xJy8.js → p-Bwanpq90.js} +1 -1
  67. package/dist/baloise-design-system/p-CLs4UZCO.js +1 -0
  68. package/dist/baloise-design-system/p-CMlYDQJS.system.js +1 -0
  69. package/dist/baloise-design-system/{p-nmPiAskM.js → p-CTBN6DaX.js} +1 -1
  70. package/dist/baloise-design-system/p-ChlfBLwb.system.js +1 -0
  71. package/dist/baloise-design-system/p-CpKZoBAF.js +1 -0
  72. package/dist/baloise-design-system/{p-DACM2A18.system.js → p-DGPZrO0x.system.js} +1 -1
  73. package/dist/baloise-design-system/p-DJQ7cTKs.system.js +1 -0
  74. package/dist/baloise-design-system/p-Dd2hz_QL.system.js +1 -1
  75. package/dist/baloise-design-system/{p-BQFHQM2n.system.js → p-K4LP7N6U.system.js} +1 -1
  76. package/dist/baloise-design-system/p-ZO510gkN.system.js +1 -0
  77. package/dist/baloise-design-system/p-a9b6129706.entry.js +1 -0
  78. package/dist/baloise-design-system/p-b2af8a3657.system.entry.js +1 -0
  79. package/dist/baloise-design-system/{p-11e1bb87d5.system.entry.js → p-b2cd8c8099.system.entry.js} +1 -1
  80. package/dist/baloise-design-system/p-c63fbd713d.entry.js +1 -0
  81. package/dist/baloise-design-system/{p-589719130f.system.entry.js → p-cd61656b64.system.entry.js} +1 -1
  82. package/dist/baloise-design-system/{p-fa57c17fd2.system.entry.js → p-cf2493f296.system.entry.js} +1 -1
  83. package/dist/baloise-design-system/{p-bcbfc5cf1a.entry.js → p-d1eb2cfb34.entry.js} +1 -1
  84. package/dist/baloise-design-system/{p-154031cfcd.entry.js → p-dba1172156.entry.js} +1 -1
  85. package/dist/baloise-design-system/{p-b20a5928a7.system.entry.js → p-df817b1f49.system.entry.js} +1 -1
  86. package/dist/baloise-design-system/p-e071742801.entry.js +1 -0
  87. package/dist/baloise-design-system/p-e105c174ba.entry.js +1 -0
  88. package/dist/baloise-design-system/p-e9bcbaa911.system.entry.js +1 -0
  89. package/dist/baloise-design-system/p-f0299bfaa0.system.entry.js +1 -0
  90. package/dist/cjs/bal-carousel_2.cjs.entry.js +4 -4
  91. package/dist/cjs/bal-data_4.cjs.entry.js +4 -2
  92. package/dist/cjs/bal-date-calendar_2.cjs.entry.js +5 -4
  93. package/dist/cjs/bal-date.cjs.entry.js +3 -2
  94. package/dist/cjs/bal-date.i18n-DJlY99as.js +66 -0
  95. package/dist/cjs/bal-field_5.cjs.entry.js +28 -3
  96. package/dist/cjs/bal-file-upload.cjs.entry.js +3 -3
  97. package/dist/cjs/bal-hint_5.cjs.entry.js +3 -3
  98. package/dist/cjs/bal-icon.cjs.entry.js +1 -1
  99. package/dist/cjs/bal-list_8.cjs.entry.js +4 -4
  100. package/dist/cjs/bal-logo.cjs.entry.js +3 -3
  101. package/dist/cjs/bal-nav_8.cjs.entry.js +6 -6
  102. package/dist/cjs/bal-navbar_5.cjs.entry.js +3 -3
  103. package/dist/cjs/bal-number-input.cjs.entry.js +28 -12
  104. package/dist/cjs/bal-pagination.cjs.entry.js +4 -4
  105. package/dist/cjs/bal-popup.cjs.entry.js +8 -2
  106. package/dist/cjs/bal-progress-bar.cjs.entry.js +5 -5
  107. package/dist/cjs/bal-segment_2.cjs.entry.js +7 -6
  108. package/dist/cjs/bal-shape.cjs.entry.js +1 -1
  109. package/dist/cjs/bal-steps.cjs.entry.js +3 -3
  110. package/dist/cjs/bal-tab-item_2.cjs.entry.js +5 -5
  111. package/dist/cjs/baloise-design-system.cjs.js +1 -1
  112. package/dist/cjs/{breakpoints.decorator-BSEpzMB7.js → breakpoints.decorator-Cz7bHPb8.js} +1 -1
  113. package/dist/cjs/{breakpoints.subject-DsbiTElZ.js → breakpoints.subject-BvbPa-gl.js} +1 -1
  114. package/dist/cjs/{date-DffviXAX.js → date-z_vUhJKX.js} +0 -64
  115. package/dist/cjs/index-wO-C-tKN.js +1 -1
  116. package/dist/cjs/index.cjs.js +7 -6
  117. package/dist/cjs/loader.cjs.js +1 -1
  118. package/dist/cjs/{tokens.esm-DDxoq3-N.js → tokens.esm-G_2YKM-0.js} +1 -1
  119. package/dist/cjs/{window-resize.decorator-lVS3Mcus.js → window-resize.decorator-KhRfwqd-.js} +1 -1
  120. package/dist/cjs/{window-resize.subject-BT9wsOzd.js → window-resize.subject-avwpF9vX.js} +1 -1
  121. package/dist/collection/components/bal-data/bal-data-value/bal-data-value.js +4 -2
  122. package/dist/collection/components/bal-field/bal-field-hint/bal-field-hint.js +43 -1
  123. package/dist/collection/components/bal-field/bal-field-message/bal-field-message.js +26 -2
  124. package/dist/collection/components/bal-file-upload/components/file-list.js +1 -2
  125. package/dist/collection/components/bal-icon/bal-icon.js +1 -1
  126. package/dist/collection/components/bal-input/bal-input.js +1 -1
  127. package/dist/collection/components/bal-nav/bal-nav-meta-bar/bal-nav-meta-bar.css +1 -1
  128. package/dist/collection/components/bal-nav/bal-nav.css +1 -1
  129. package/dist/collection/components/bal-number-input/bal-number-input.js +40 -11
  130. package/dist/collection/components/bal-number-input/bal-number-input.utils.js +11 -4
  131. package/dist/collection/components/bal-pagination/bal-pagination.js +1 -1
  132. package/dist/collection/components/bal-popup/bal-popup.css +1 -1
  133. package/dist/collection/components/bal-popup/bal-popup.js +1 -1
  134. package/dist/collection/components/bal-popup/variants/fullscreen-variant.renderer.js +6 -0
  135. package/dist/collection/components/bal-segment/bal-segment.js +2 -1
  136. package/dist/collection/components/bal-tabs/bal-tabs.css +1 -1
  137. package/dist/collection/utils/constants/version.constant.js +1 -1
  138. package/dist/esm/bal-carousel_2.entry.js +4 -4
  139. package/dist/esm/bal-data_4.entry.js +4 -2
  140. package/dist/esm/bal-date-calendar_2.entry.js +2 -1
  141. package/dist/esm/bal-date.entry.js +2 -1
  142. package/dist/esm/bal-date.i18n-CLs4UZCO.js +64 -0
  143. package/dist/esm/bal-field_5.entry.js +28 -3
  144. package/dist/esm/bal-file-upload.entry.js +3 -3
  145. package/dist/esm/bal-hint_5.entry.js +3 -3
  146. package/dist/esm/bal-icon.entry.js +1 -1
  147. package/dist/esm/bal-list_8.entry.js +4 -4
  148. package/dist/esm/bal-logo.entry.js +3 -3
  149. package/dist/esm/bal-nav_8.entry.js +6 -6
  150. package/dist/esm/bal-navbar_5.entry.js +3 -3
  151. package/dist/esm/bal-number-input.entry.js +28 -12
  152. package/dist/esm/bal-pagination.entry.js +4 -4
  153. package/dist/esm/bal-popup.entry.js +8 -2
  154. package/dist/esm/bal-progress-bar.entry.js +5 -5
  155. package/dist/esm/bal-segment_2.entry.js +7 -6
  156. package/dist/esm/bal-shape.entry.js +1 -1
  157. package/dist/esm/bal-steps.entry.js +3 -3
  158. package/dist/esm/bal-tab-item_2.entry.js +5 -5
  159. package/dist/esm/baloise-design-system.js +1 -1
  160. package/dist/esm/{breakpoints.decorator-DcuiF9pJ.js → breakpoints.decorator-B5g2J7uh.js} +1 -1
  161. package/dist/esm/{breakpoints.subject-DtMFg17t.js → breakpoints.subject-BUhfnNwa.js} +1 -1
  162. package/dist/esm/{date-DPdjnaiY.js → date-B_izjCbq.js} +1 -64
  163. package/dist/esm/index-BtpJmRB8.js +1 -1
  164. package/dist/esm/index.js +6 -5
  165. package/dist/esm/loader.js +1 -1
  166. package/dist/esm/{tokens.esm-ChltR09F.js → tokens.esm-Dal-cGiQ.js} +1 -1
  167. package/dist/esm/{window-resize.decorator-WtdUPOFx.js → window-resize.decorator-DpazCyu9.js} +1 -1
  168. package/dist/esm/{window-resize.subject-B5jZTc22.js → window-resize.subject-nsxIxT5E.js} +1 -1
  169. package/dist/esm-es5/bal-carousel_2.entry.js +1 -1
  170. package/dist/esm-es5/bal-data_4.entry.js +1 -1
  171. package/dist/esm-es5/bal-date-calendar_2.entry.js +1 -1
  172. package/dist/esm-es5/bal-date.entry.js +1 -1
  173. package/dist/esm-es5/bal-date.i18n-CLs4UZCO.js +1 -0
  174. package/dist/esm-es5/bal-field_5.entry.js +1 -1
  175. package/dist/esm-es5/bal-file-upload.entry.js +1 -1
  176. package/dist/esm-es5/bal-hint_5.entry.js +1 -1
  177. package/dist/esm-es5/bal-icon.entry.js +1 -1
  178. package/dist/esm-es5/bal-list_8.entry.js +1 -1
  179. package/dist/esm-es5/bal-logo.entry.js +1 -1
  180. package/dist/esm-es5/bal-nav_8.entry.js +1 -1
  181. package/dist/esm-es5/bal-navbar_5.entry.js +1 -1
  182. package/dist/esm-es5/bal-number-input.entry.js +1 -1
  183. package/dist/esm-es5/bal-pagination.entry.js +1 -1
  184. package/dist/esm-es5/bal-popup.entry.js +1 -1
  185. package/dist/esm-es5/bal-progress-bar.entry.js +1 -1
  186. package/dist/esm-es5/bal-segment_2.entry.js +1 -1
  187. package/dist/esm-es5/bal-shape.entry.js +1 -1
  188. package/dist/esm-es5/bal-steps.entry.js +1 -1
  189. package/dist/esm-es5/bal-tab-item_2.entry.js +1 -1
  190. package/dist/esm-es5/baloise-design-system.js +1 -1
  191. package/dist/esm-es5/{breakpoints.decorator-DcuiF9pJ.js → breakpoints.decorator-B5g2J7uh.js} +1 -1
  192. package/dist/esm-es5/{breakpoints.subject-DtMFg17t.js → breakpoints.subject-BUhfnNwa.js} +1 -1
  193. package/dist/esm-es5/date-B_izjCbq.js +1 -0
  194. package/dist/esm-es5/index-BtpJmRB8.js +1 -1
  195. package/dist/esm-es5/index.js +1 -1
  196. package/dist/esm-es5/loader.js +1 -1
  197. package/dist/esm-es5/{window-resize.decorator-WtdUPOFx.js → window-resize.decorator-DpazCyu9.js} +1 -1
  198. package/dist/esm-es5/{window-resize.subject-B5jZTc22.js → window-resize.subject-nsxIxT5E.js} +1 -1
  199. package/dist/html.html-data.json +12 -9
  200. package/dist/types/components/bal-field/bal-field-hint/bal-field-hint.d.ts +7 -0
  201. package/dist/types/components/bal-field/bal-field-message/bal-field-message.d.ts +4 -0
  202. package/dist/types/components/bal-input/bal-input.interfaces.d.ts +1 -1
  203. package/dist/types/components/bal-number-input/bal-number-input.d.ts +5 -1
  204. package/dist/types/components/bal-number-input/bal-number-input.utils.d.ts +2 -1
  205. package/dist/types/components/bal-popup/bal-popup.d.ts +1 -0
  206. package/dist/types/components/bal-popup/variants/fullscreen-variant.renderer.d.ts +1 -1
  207. package/dist/types/components/bal-popup/variants/variant.interfaces.d.ts +1 -0
  208. package/dist/types/components.d.ts +30 -0
  209. package/package.json +6 -6
  210. package/dist/baloise-design-system/p-0afcf25d8f.entry.js +0 -1
  211. package/dist/baloise-design-system/p-0f612d8105.system.entry.js +0 -1
  212. package/dist/baloise-design-system/p-2f3ad8c189.entry.js +0 -1
  213. package/dist/baloise-design-system/p-4807818445.entry.js +0 -1
  214. package/dist/baloise-design-system/p-4bfdc5247d.entry.js +0 -1
  215. package/dist/baloise-design-system/p-4d426915e6.entry.js +0 -1
  216. package/dist/baloise-design-system/p-7cb62ca6a6.system.entry.js +0 -1
  217. package/dist/baloise-design-system/p-83ac26dc7f.entry.js +0 -1
  218. package/dist/baloise-design-system/p-86306babc7.system.entry.js +0 -1
  219. package/dist/baloise-design-system/p-88f0b18133.system.entry.js +0 -1
  220. package/dist/baloise-design-system/p-8f77305828.system.entry.js +0 -1
  221. package/dist/baloise-design-system/p-B7YifDeX.js +0 -1
  222. package/dist/baloise-design-system/p-BvXsXhJM.system.js +0 -1
  223. package/dist/baloise-design-system/p-Ch2Qwzxg.system.js +0 -1
  224. package/dist/baloise-design-system/p-Ds9xIIWo.js +0 -1
  225. package/dist/baloise-design-system/p-af26087fec.entry.js +0 -1
  226. package/dist/baloise-design-system/p-b2e5bd0a60.entry.js +0 -1
  227. package/dist/baloise-design-system/p-c72cb42e12.system.entry.js +0 -1
  228. package/dist/baloise-design-system/p-d4733ba7cd.system.entry.js +0 -1
  229. package/dist/baloise-design-system/p-d8462e585c.system.entry.js +0 -1
  230. package/dist/baloise-design-system/p-df3a2e3c86.entry.js +0 -1
  231. package/dist/baloise-design-system/p-dsS1PhhG.system.js +0 -1
  232. package/dist/baloise-design-system/p-e2c4571fb2.system.entry.js +0 -1
  233. package/dist/baloise-design-system/p-e6f77338c1.system.entry.js +0 -1
  234. package/dist/esm-es5/date-DPdjnaiY.js +0 -1
  235. /package/dist/baloise-design-system/{p-ChltR09F.js → p-Dal-cGiQ.js} +0 -0
  236. /package/dist/baloise-design-system/{p-CwtPviPa.system.js → p-meHsyXfE.system.js} +0 -0
  237. /package/dist/esm-es5/{tokens.esm-ChltR09F.js → tokens.esm-Dal-cGiQ.js} +0 -0
@@ -1 +1 @@
1
- import{__awaiter,__extends,__generator,__spreadArray}from"tslib";import{M as h,L as Logger,H as registerInstance,P as createEvent,f as defaultConfig,x as waitAfterFramePaint,N as Host,O as getElement,X as hasParent}from"./index-BtpJmRB8.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-dfXERft2.js";import{p as padStart}from"./index-BU7FUSdu.js";import{i as isNil}from"./index-zWZxKBfo.js";import{B as BalDate,i as i18nBalDate,d as dateSeparator}from"./date-DPdjnaiY.js";import{L as ListenToConfig}from"./config.decorator-CIdA1I1h.js";import{B as BEM}from"./bem-ByiN-QjD.js";import{L as ListenToSwipe}from"./swipe.decorator-BpU5Ogqx.js";import{i as inheritAttributes}from"./attributes-C4sZQbkT.js";import{l as hasValueChanged,c as inputSetFocus,d as inputSetBlur}from"./form-input-C2vJzMPS.js";import{N as NUMBER_KEYS}from"./keys.constant-xVPGsAdF.js";import{I as INVALID_VALUE}from"./mask-util-DuObDTix.js";import{d as defaultBalAriaForm}from"./form-FCLKfv6B.js";import{a as ariaBooleanToString}from"./aria-DBsOHTWj.js";import"./_commonjsHelpers-BFTU3MAI.js";import"./swipe.subject-B1IPMW8E.js";import"./device-D0RSC50t.js";import"./listener-DI7AdrHk.js";function getDaysInMonth(t,e){if(e<1||t<0){return undefined}return new Date(t,e,0).getDate()}function isoDateOfDay(t,e,a){return"".concat(a,"-").concat(padStart("".concat(e),2,"0"),"-").concat(padStart("".concat(t),2,"0"))}function isoDateOfToday(){var t=new Date;return"".concat(t.getFullYear(),"-").concat(padStart("".concat(t.getMonth()+1),2,"0"),"-").concat(padStart("".concat(t.getDate()),2,"0"))}function generateCalendarGrid(t,e,a,i,n){var r=[];var s=getDaysInMonth(t,e);var l=getFirstDayOfMonth(t,e);if(s!==undefined&&l){var o=isoDateOfToday();var u=BalDate.fromISO(a);var d=BalDate.fromISO(i);var c=function(t){if(isNil(n)){return false}return!n(t)};for(var h=1;h<=s;h++){var f=isoDateOfDay(h,e,t);r.push({day:h,month:e,year:t,isoDate:f,fullDate:BalDate.fromISO(f).toFormat(),today:o===f,disabled:u.isAfter(f)||d.isBefore(f)||c(f)})}}return r}function getFirstWeekdayOfMonth(t,e){if(e<1||t<0){return 1}var a=new Date(t,e-1,1);var i=a.getDay();return i===0?7:i}function validateLanguage(t){if(["en","de","fr","it","nl","es","pl","pt","sv","fi"].includes(t)){return t}return"de"}function generateYears(t,e,a){var i=[];var n=new Date;var r=n.getFullYear();for(var s=e;s<=a;s++){i.push({value:s,label:"".concat(s),disabled:false,today:r===s,selected:t===s})}return i}function generateMonths(t,e,a,i,n){var r=validateLanguage(t);var s=BalDate.infoMonths({format:"long",locale:r});var l=BalDate.fromISO(a);var o=new Date;var u=o.getFullYear();var d=o.getMonth()+1;var c=0;if(i&&e!==undefined){var h=BalDate.fromISO(i);if(h.isValid){if(e>h.year){c=0}else{c=h.month||c}}}var f=12;if(n&&e!==undefined){var b=BalDate.fromISO(n);if(b.isValid){if(e<b.year){f=12}else{f=b.month||f}}}return s.map((function(t,a){var i=a+1;return{label:t,value:i,today:i===d&&e===u,selected:i===l.month&&e===l.year,disabled:i<c||i>f}}))}function generateWeekDays(t){var e=validateLanguage(t);var a=BalDate.infoWeekdays({format:"short",locale:e});var i=BalDate.infoWeekdays({format:"long",locale:e});return a.map((function(t,e){return{ariaLabel:i[e],textContent:t}}))}function getFirstDayOfMonth(t,e){if(e<1||e>12||t<0){return undefined}return new Date(t,e-1,1)}var CalendarList=function(t){var e=t.name,a=t.isVisible,i=t.girdHeight,n=t.list,r=t.onSelect,s=t.ref;var l=BEM.block("date-calendar");var o=l.element("body");var u=o.element("list");return h("ul",{class:Object.assign(Object.assign(Object.assign({},u.class()),u.modifier(e).class()),u.modifier("visible").class(a)),"aria-hidden":a?"false":"true",style:{height:"".concat(i-2-8-8,"px")},ref:function(t){return s?s(t):undefined}},n.map((function(t){return h("li",{key:t.value,id:"".concat(e,"-").concat(t.value)},h("button",{class:Object.assign(Object.assign(Object.assign(Object.assign({},u.element("item").class()),u.element("item").modifier("today").class(t.today)),u.element("item").modifier("selected").class(t.selected)),u.element("item").modifier("disabled").class(t.disabled)),disabled:t.disabled,tabIndex:-1,onClick:function(){if(!t.disabled){r(t)}}},t.label))})))};var CalendarGrid=function(t){var e=t.isVisible,a=t.ref,i=t.grid,n=t.weekdays,r=t.selectedDate,s=t.firstDayOfWeek,l=t.onSelectDay;var o=BEM.block("date-calendar");var u=o.element("body");var d=u.element("grid");return h("div",{role:"grid",class:Object.assign(Object.assign({},d.class()),d.modifier("visible").class(e)),"aria-hidden":e?"false":"true",ref:function(t){return a(t)}},h("div",{role:"row",class:Object.assign({},d.element("head").class())},n.map((function(t){return h("span",{key:t.textContent,role:"columnheader","aria-label":t.ariaLabel,title:t.ariaLabel},t.textContent)}))),h("div",{role:"row",class:Object.assign({},d.element("body").class()),style:{"--bal-date-first-week-day":"".concat(s)}},i.map((function(t){return h("bal-date-calendar-cell",Object.assign({key:t.isoDate},t,{selected:t.isoDate===r,onBalSelectDay:function(t){var e=t.detail;return l(e)}}))}))))};var CalendarNav=function(t){var e=t.language,a=t.onClickSelectMonthAndYear,i=t.monthFullNames,n=t.month,r=t.year,s=t.isCalendarVisible,l=t.isListVisible,o=t.onClickPreviousMonth,u=t.onClickNextMonth;var d=BEM.block("date-calendar");var c=d.element("nav");var f=i18nBalDate[e].nextMonth;var b=i18nBalDate[e].previousMonth;var _=i18nBalDate[e].selectMonth;return h("div",{class:Object.assign({},c.class())},h("div",{class:Object.assign({},c.modifier("start").class())},h("button",{title:_,"aria-label":_,tabIndex:-1,"data-test":"change-year-month",onClick:a},h("span",null,i[n-1]," ",r),h("bal-icon",{name:"caret-up",color:"primary",size:"small",turn:s}))),h("div",{class:Object.assign({},c.modifier("end").class()),style:{display:l?"none":"flex"}},h("button",{title:b,"aria-label":b,onClick:o,tabIndex:-1,"data-test":"previous-month"},h("bal-icon",{name:"caret-left",color:"primary",size:"small"})),h("button",{title:f,"aria-label":f,onClick:u,tabIndex:-1,"data-test":"next-month"},h("bal-icon",{name:"caret-right",color:"primary",size:"small"}))))};var balDateCalendarCss=':host{--bal-date-first-week-day:0;--bal-date-calendar-background:var(--bal-color-red-3)}:host{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:inline-block;background:var(--bal-color-white);border-radius:var(--bal-radius-normal)}.bal-date-calendar__nav{display:-ms-flexbox;display:flex;width:calc(100% - 1rem);-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;padding:.5rem;gap:.5rem}.bal-date-calendar__nav--start>button{display:-ms-flexbox;display:flex;gap:.5rem}.bal-date-calendar__nav--end{display:-ms-flexbox;display:flex;gap:.5rem}.bal-date-calendar__nav button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-radius:var(--bal-radius-normal);font-family:var(--bal-font-family-text);font-weight:var(--bal-font-weight-regular);color:var(--bal-color-text-primary);border:none;background:rgba(0,0,0,0);text-align:center;font-size:var(--bal-text-size-normal);line-height:var(--bal-line-height-normal);-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;outline:none;min-height:2rem;min-width:2rem;padding:.25rem;border-radius:var(--bal-button-radius);font-family:var(--bal-font-family-title);font-weight:var(--bal-font-weight-bold)}@media (hover: hover)and (pointer: fine){.bal-date-calendar__nav button:not(.bal-date-calendar__nav button--selected):not(.bal-date-calendar__nav button--disabled):hover{background:var(--bal-color-light-blue-1)}}.bal-date-calendar__nav button:not(.bal-date-calendar__nav button--selected):not(.bal-date-calendar__nav button--disabled):active{background:var(--bal-color-light-blue-2)}.bal-date-calendar__nav button--today:not(.bal-date-calendar__nav button--selected):not(.bal-date-calendar__nav button--disabled){color:var(--bal-color-light-blue-3);font-weight:var(--bal-font-weight-bold)}@media (hover: hover)and (pointer: fine){.bal-date-calendar__nav button--today:not(.bal-date-calendar__nav button--selected):not(.bal-date-calendar__nav button--disabled):hover{color:var(--bal-color-text-primary)}}.bal-date-calendar__nav button--today:not(.bal-date-calendar__nav button--selected):not(.bal-date-calendar__nav button--disabled):active{color:var(--bal-color-text-primary)}.bal-date-calendar__nav button--selected{background:var(--bal-color-primary);color:var(--bal-color-text-white);font-weight:var(--bal-font-weight-bold)}.bal-date-calendar__nav button--disabled{cursor:default;background:rgba(0,0,0,0);color:var(--bal-color-text-grey-light)}.bal-date-calendar__body{display:block}.bal-date-calendar__body__grid{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;padding:.5rem;height:0;padding-top:0;padding-bottom:0;visibility:hidden}.bal-date-calendar__body__grid--visible{height:auto;padding-top:.5rem;padding-bottom:.5rem;visibility:visible}.bal-date-calendar__body__grid__head{position:relative;display:grid;grid-template-columns:repeat(7, 1fr);-webkit-column-gap:.5rem;-moz-column-gap:.5rem;column-gap:.5rem;row-gap:.5rem;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.bal-date-calendar__body__grid__head::after{position:absolute;content:"";height:2px;width:calc(100% + 1rem);bottom:0;left:-0.5rem;right:-0.5rem;background:var(--bal-color-border)}.bal-date-calendar__body__grid__head span{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:2rem;width:2rem;font-family:var(--bal-font-family-title);font-weight:var(--bal-font-weight-bold);font-size:var(--bal-text-size-normal);line-height:var(--bal-line-height-normal);-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;text-wrap:nowrap}.bal-date-calendar__body__grid__body{display:grid;grid-template-columns:repeat(7, 1fr);-webkit-column-gap:.5rem;-moz-column-gap:.5rem;column-gap:.5rem;row-gap:.5rem;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;padding-top:.5rem}.bal-date-calendar__body__grid__body>.bal-date-calendar-cell{width:2rem;height:2rem;text-align:center;font-size:var(--bal-text-size-normal);line-height:var(--bal-line-height-normal);-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto}.bal-date-calendar__body__grid__body>.bal-date-calendar-cell:first-child{grid-column:var(--bal-date-first-week-day)}.bal-date-calendar__body__list{display:none;list-style:none;margin:0;padding:0;-webkit-column-gap:.5rem;-moz-column-gap:.5rem;column-gap:.5rem;row-gap:.5rem;width:calc(100% - 1rem);overflow-y:auto;max-height:18rem;position:relative;padding:.5rem;border-top:2px solid var(--bal-color-border)}.bal-date-calendar__body__list .bal-date-calendar__body__list__item{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-radius:var(--bal-radius-normal);font-family:var(--bal-font-family-text);font-weight:var(--bal-font-weight-regular);color:var(--bal-color-text-primary);border:none;background:rgba(0,0,0,0);text-align:center;font-size:var(--bal-text-size-normal);line-height:var(--bal-line-height-normal);-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;outline:none;width:100%}@media (hover: hover)and (pointer: fine){.bal-date-calendar__body__list .bal-date-calendar__body__list__item:not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected):not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled):hover{background:var(--bal-color-light-blue-1)}}.bal-date-calendar__body__list .bal-date-calendar__body__list__item:not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected):not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled):active{background:var(--bal-color-light-blue-2)}.bal-date-calendar__body__list .bal-date-calendar__body__list__item--today:not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected):not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled){color:var(--bal-color-light-blue-3);font-weight:var(--bal-font-weight-bold)}@media (hover: hover)and (pointer: fine){.bal-date-calendar__body__list .bal-date-calendar__body__list__item--today:not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected):not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled):hover{color:var(--bal-color-text-primary)}}.bal-date-calendar__body__list .bal-date-calendar__body__list__item--today:not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected):not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled):active{color:var(--bal-color-text-primary)}.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected{background:var(--bal-color-primary);color:var(--bal-color-text-white);font-weight:var(--bal-font-weight-bold)}.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled{cursor:default;background:rgba(0,0,0,0);color:var(--bal-color-text-grey-light)}.bal-date-calendar__body__list--visible{display:grid}.bal-date-calendar__body__list--year{grid-template-columns:repeat(4, 1fr)}.bal-date-calendar__body__list--month{grid-template-columns:repeat(2, 1fr)}.bal-date-calendar-cell{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-radius:var(--bal-radius-normal);font-family:var(--bal-font-family-text);font-weight:var(--bal-font-weight-regular);color:var(--bal-color-text-primary);border:none;background:rgba(0,0,0,0);text-align:center;font-size:var(--bal-text-size-normal);line-height:var(--bal-line-height-normal);-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;outline:none;width:2rem;height:2rem}@media (hover: hover)and (pointer: fine){.bal-date-calendar-cell:not(.bal-date-calendar-cell--selected):not(.bal-date-calendar-cell--disabled):hover{background:var(--bal-color-light-blue-1)}}.bal-date-calendar-cell:not(.bal-date-calendar-cell--selected):not(.bal-date-calendar-cell--disabled):active{background:var(--bal-color-light-blue-2)}.bal-date-calendar-cell--today:not(.bal-date-calendar-cell--selected):not(.bal-date-calendar-cell--disabled){color:var(--bal-color-light-blue-3);font-weight:var(--bal-font-weight-bold)}@media (hover: hover)and (pointer: fine){.bal-date-calendar-cell--today:not(.bal-date-calendar-cell--selected):not(.bal-date-calendar-cell--disabled):hover{color:var(--bal-color-text-primary)}}.bal-date-calendar-cell--today:not(.bal-date-calendar-cell--selected):not(.bal-date-calendar-cell--disabled):active{color:var(--bal-color-text-primary)}.bal-date-calendar-cell--selected{background:var(--bal-color-primary);color:var(--bal-color-text-white);font-weight:var(--bal-font-weight-bold)}.bal-date-calendar-cell--disabled{cursor:default;background:rgba(0,0,0,0);color:var(--bal-color-text-grey-light)}';var DateCalendar=function(){function t(t){var e=this;registerInstance(this,t);this.balChange=createEvent(this,"balChange");this.oldMin="";this.oldMax="";this.selectedDate="";this.monthFullNames=[];this.weekdays=[];this.months=[];this.years=[];this.calendarGrid=[];this.firstDayOfWeek=0;this.month=0;this.year=0;this.language=defaultConfig.language;this.isCalendarVisible=true;this.isYearListVisible=false;this.isMonthListVisible=false;this.allowedDates=undefined;this.onSelectDay=function(t){e.valueChanged(t,e.selectedDate);e.balChange.emit(e.selectedDate)};this.onClickNextMonth=function(){var t=e.year;var a=e.month+1;if(a>12){a=1;t=t+1}e.generateGridByMonthAndYear(a,t)};this.onClickPreviousMonth=function(){var t=e.year;var a=e.month-1;if(a<1){a=12;t=t-1}e.generateGridByMonthAndYear(a,t)};this.onClickSelectMonthAndYear=function(){return __awaiter(e,void 0,void 0,(function(){var t,e;return __generator(this,(function(a){switch(a.label){case 0:this.updateSelections();if(!(this.isCalendarVisible===true))return[3,2];this.isCalendarVisible=false;this.isYearListVisible=true;this.isMonthListVisible=false;return[4,waitAfterFramePaint()];case 1:a.sent();if(this.yearListEl){t=this.yearListEl.querySelector("#year-".concat(this.year));if(t){e=26+8+4;this.yearListEl.scrollTop=t.offsetTop-e*2}else{this.yearListEl.scrollTop=0}}return[3,3];case 2:this.isCalendarVisible=true;this.isYearListVisible=false;this.isMonthListVisible=false;a.label=3;case 3:return[2]}}))}))};this.onClickYear=function(t){e.isYearListVisible=false;e.isMonthListVisible=true;e.generateGridByMonthAndYear(e.month,t);e.months=generateMonths(e.language,t,e.selectedDate,e.min,e.max)};this.onClickMonth=function(t){e.isYearListVisible=false;e.isMonthListVisible=false;e.isCalendarVisible=true;e.generateGridByMonthAndYear(t,e.year)}}t.prototype.createLogger=function(t){this.log=t};t.prototype.valueChanged=function(t,e){if(t!==e){var a=BalDate.fromISO(t);if(!a.isValid){this.generateGridByDefaultDate();this.selectedDate=""}else{this.generateGridByDate(a);this.selectedDate=a.toISODate()}this.updateSelections()}};t.prototype.rangePropChanged=function(){this.updateSelections();this.generateGrid()};t.prototype.yearRangePropChanged=function(){this.updateSelections()};t.prototype.connectedCallback=function(){this.generateGridByDefaultDate();this.valueChanged(this.value,undefined)};t.prototype.configChanged=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.language=t.language;this.monthFullNames=BalDate.infoMonths({format:"long",locale:this.language});this.weekdays=generateWeekDays(this.language);this.updateSelections();return[2]}))}))};t.prototype.swipeListener=function(t){var e=t.left,a=t.right;if(e){this.onClickNextMonth()}else if(a){this.onClickPreviousMonth()}};Object.defineProperty(t.prototype,"minYear",{get:function(){if(this.minYearProp===undefined){var t=new Date;var e=t.getFullYear();var a=e-100;if(this.min){var i=BalDate.fromISO(this.min);return i.year||a}else{return a}}return this.minYearProp},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"maxYear",{get:function(){if(this.maxYearProp===undefined){var t=new Date;var e=t.getFullYear();var a=e+50;if(this.max){var i=BalDate.fromISO(this.max);return i.year||a}else{return a}}return this.maxYearProp},enumerable:false,configurable:true});t.prototype.updateSelections=function(){this.years=generateYears(this.year,this.minYear,this.maxYear);this.months=generateMonths(this.language,this.year,this.selectedDate,this.min,this.max)};t.prototype.generateGrid=function(){var t=BalDate.fromISO(this.value);if(t.isValid){this.generateGridByDate(t)}else{this.generateGridByDefaultDate()}};t.prototype.generateGridByDate=function(t){if(t.year!==undefined&&t.month!==undefined){this.generateGridByMonthAndYear(t.month,t.year)}};t.prototype.generateGridByDefaultDate=function(){var t=BalDate.fromISO(this.defaultDate);if(t.isValid){this.generateGridByDate(t)}else{var e=new Date;this.month=e.getMonth()+1;this.year=e.getFullYear();this.calendarGrid=generateCalendarGrid(this.year,this.month,this.min,this.max,this.allowedDates);this.firstDayOfWeek=getFirstWeekdayOfMonth(this.year,this.month)}};t.prototype.generateGridByMonthAndYear=function(t,e){if(this.month!==t||this.year!==e||this.oldMin!==this.min||this.oldMax!==this.max){this.calendarGrid=generateCalendarGrid(e,t,this.min,this.max,this.allowedDates);this.firstDayOfWeek=getFirstWeekdayOfMonth(e,t)}this.month=t;this.year=e;this.oldMin=this.min;this.oldMax=this.max};t.prototype.render=function(){var t=this;var e;var a=((e=this.gridEl)===null||e===void 0?void 0:e.clientHeight)||0;var i=BEM.block("date-calendar");var n=i.element("body");var r=i.element("foot");return h(Host,{key:"5d6a297ec24ae26e80aa64800168e0f7c184e803",class:Object.assign({},i.class())},h(CalendarNav,{key:"d59886c88f34bfb9fc17cc121d6c7262c2a15485",language:this.language,monthFullNames:this.monthFullNames,month:this.month,year:this.year,isCalendarVisible:this.isCalendarVisible,isListVisible:this.isMonthListVisible||this.isYearListVisible,onClickSelectMonthAndYear:this.onClickSelectMonthAndYear,onClickPreviousMonth:this.onClickPreviousMonth,onClickNextMonth:this.onClickNextMonth}),h("div",{key:"53fe06a5f24418668d3a77a03ee6da3e48c5c019",class:Object.assign({},n.class())},h(CalendarGrid,{key:"f898ac758f1dfcaa1dbd7eb7b56c3cb339971528",isVisible:this.isCalendarVisible,grid:this.calendarGrid,weekdays:this.weekdays,firstDayOfWeek:this.firstDayOfWeek,selectedDate:this.selectedDate,ref:function(e){return t.gridEl=e},onSelectDay:function(e){return t.onSelectDay(e)}}),h(CalendarList,{key:"011bf1c4f7ba1332b7b336ffffdf7ba4dd1f0062",name:"year",isVisible:this.isYearListVisible,girdHeight:a,list:this.years,ref:function(e){return t.yearListEl=e},onSelect:function(e){return t.onClickYear(e.value)}}),h(CalendarList,{key:"0b3c1d01fea6752b5f954083b18883e0da5a1e96",name:"month",isVisible:this.isMonthListVisible,girdHeight:a,list:this.months,onSelect:function(e){return t.onClickMonth(e.value)}})),h("div",{key:"a4bd07270d850442b4604a75beaed04baa33c64f",class:Object.assign({},r.class())},h("slot",{key:"50d760695d612864422574e13ef9cfdf352dbbcc"})))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{value:["valueChanged"],min:["rangePropChanged"],max:["rangePropChanged"],minYearProp:["yearRangePropChanged"],maxYearProp:["yearRangePropChanged"]}},enumerable:false,configurable:true});return t}();__decorate([Logger("bal-date-calendar"),__metadata("design:type",Function),__metadata("design:paramtypes",[Function]),__metadata("design:returntype",void 0)],DateCalendar.prototype,"createLogger",null);__decorate([ListenToConfig(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],DateCalendar.prototype,"configChanged",null);__decorate([ListenToSwipe({mobileOnly:true}),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",void 0)],DateCalendar.prototype,"swipeListener",null);DateCalendar.style=balDateCalendarCss;var MaskPosition=function(){function t(t){this._options=t;this._position=0;this._positionEnd=0;this._isRangeSelection=false;if(t.component&&t.component.nativeInput){this._position=t.component.nativeInput.selectionStart||0;this._positionEnd=t.component.nativeInput.selectionEnd||0;this._isRangeSelection=this._position!==this._positionEnd}}Object.defineProperty(t.prototype,"isRangeSelection",{get:function(){return this._isRangeSelection},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"value",{get:function(){if(this._options.isBackspace&&this._position>0){return this._position-1}return this._position},set:function(t){var e=t<0?0:t>this._options.mask.maxLength?this._options.mask.maxLength:t;this._position=e},enumerable:false,configurable:true});t.prototype.toStart=function(){this.value=0};t.prototype.toEnd=function(){var t=this.getTarget();if(t){this.value=t.value.length}};t.prototype.next=function(t){if(t===void 0){t=1}var e=this._position+t;if(e<=this._options.mask.maxLength){this._position=e}return this._position};t.prototype.previous=function(t){if(t===void 0){t=1}var e=this._position-t;if(e>=0){this._position=e}else{this._position=0}return this._position};t.prototype.submit=function(){var t=this.getTarget();if(t&&t.selectionStart!==this._position&&t.selectionEnd!==this._position){t.selectionStart=this._position;t.selectionEnd=this._position}};t.prototype.getTarget=function(){if(this._options.component&&this._options.component.nativeInput){return this._options.component.nativeInput}return undefined};return t}();var MaskContext=function(){function t(t){this._options=t;this._value="";if(this._options.component&&this._options.component.nativeInput){this._value=this._options.component.nativeInput.value}this.position=new MaskPosition(this._options);this.component=this._options.component}Object.defineProperty(t.prototype,"target",{get:function(){if(this._options.component&&this._options.component.nativeInput){return this._options.component.nativeInput}return undefined},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){this._value=t},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"focused",{get:function(){return this._options.component.focused},enumerable:false,configurable:true});t.prototype.isValueEmpty=function(){return this.value===""||this.value===undefined||this.value===null};t.prototype.preventDefault=function(){if(this._options.event.preventDefault){this._options.event.preventDefault()}};t.prototype.stopPropagation=function(){this.preventDefault();if(this._options.event.stopPropagation){this._options.event.stopPropagation()}};t.prototype.submit=function(){return __awaiter(this,arguments,void 0,(function(t,e){if(t===void 0){t="input"}return __generator(this,(function(a){if(this.target){this.target.value=this.value;if(t!=="blur"&&t!=="tab"){this.position.submit()}if(this._options.component){if(t==="input"||t==="tab"){this._options.component.balInput.emit(this.value)}if((t==="change"||t==="blur")&&e!==undefined){if(hasValueChanged(this._options.component.value,e)){this._options.component.value=e;this._options.component.balChange.emit(e)}}}}return[2]}))}))};return t}();var MaskClipboardContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}Object.defineProperty(e.prototype,"clipboardData",{get:function(){var t;return(t=this._options.event.clipboardData)===null||t===void 0?void 0:t.getData("text")},enumerable:false,configurable:true});return e}(MaskContext);var MaskFocusContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(MaskContext);var MaskKeyboardContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}Object.defineProperty(e.prototype,"key",{get:function(){return this._options.event.key},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isCtrlOrCommandKey",{get:function(){return this._options.event.metaKey||this._options.event.ctrlKey},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isBackspaceKey",{get:function(){return this._options.event.key==="Backspace"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isTabKey",{get:function(){return this._options.event.key==="Tab"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isWhiteSpaceKey",{get:function(){return this._options.event.key===" "},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isDeleteKey",{get:function(){return this._options.event.key==="Delete"||this._options.event.key==="Del"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isNumberKey",{get:function(){return e.NUMBER_KEYS.includes(this._options.event.key)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isNavigationKey",{get:function(){return e.NAVIGATION_KEYS.includes(this._options.event.key)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isSelectAllCommand",{get:function(){return(this._options.event.ctrlKey||this._options.event.metaKey)&&this.key==="a"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isCopyCommand",{get:function(){return(this._options.event.ctrlKey||this._options.event.metaKey)&&this.key==="c"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isPasteCommand",{get:function(){return(this._options.event.ctrlKey||this._options.event.metaKey)&&this.key==="v"},enumerable:false,configurable:true});e.prototype.getCharAt=function(t){if(t===void 0){t=this.position.value}return this.value.charAt(t)};e.prototype.getCharAtBackspacePosition=function(){return this.getCharAt(this.position.value-1)};e.prototype.setChar=function(t,e){if(t===void 0){t=this._options.event.key}if(e===void 0){e=this.position.value}this.value=this.value.substring(0,e)+t+this.value.substring(e+1)};return e}(MaskContext);MaskKeyboardContext.NUMBER_KEYS=["0","1","2","3","4","5","6","7","8","9"];MaskKeyboardContext.NAVIGATION_KEYS=["Home","End","ArrowLeft","Left","ArrowRight","Right","Tab","Enter","Esc","Escape"];var MaskLocaleContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}Object.defineProperty(e.prototype,"locale",{get:function(){return this._options.event.locale},enumerable:false,configurable:true});return e}(MaskContext);var MaskMouseContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(MaskContext);var MaskValueChangedContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}Object.defineProperty(e.prototype,"newValue",{get:function(){return this._options.event.newValue},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"oldValue",{get:function(){return this._options.event.oldValue},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"didValueChange",{get:function(){return this.newValue!==this.oldValue},enumerable:false,configurable:true});return e}(MaskContext);var MaskBlock=function(){function t(t){this._isSeparator=false;this._allowedKeys=[];this._locale="de-CH";this._from=t.from||0;this._to=t.to||0;this._isSeparator=t.isSeparator===undefined?false:t.isSeparator;this._mask=t.mask||"_";this._allowedKeys=t.allowedKeys?t.allowedKeys:this.allowedKeys;this._format=t.format}t.prototype.format=function(t){if(this._format){return this._format(t.replace(this.mask,""),this._locale,this.mask)}return t};Object.defineProperty(t.prototype,"isSeparator",{get:function(){return this._isSeparator},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"to",{get:function(){return this._to},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"from",{get:function(){return this._from},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"mask",{get:function(){if(typeof this._mask==="function"){return this._mask(this._locale)}return this._mask},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"allowedKeys",{get:function(){return this._allowedKeys},enumerable:false,configurable:true});t.prototype.onI18nChange=function(t){this._locale=t};t.prototype.getValueOfTheBlock=function(t){return t.slice(this._from,this._to)};t.prototype.isTouched=function(t){var e=this;var a=this.getValueOfTheBlock(t);return!a.split("").every((function(t){return t===e.mask}))};t.prototype.verifyAllowedKeyHits=function(t){if(this.isSeparator&&t===this.mask){return true}else if(this.allowedKeys.indexOf(t)>=0){return true}else{return false}};return t}();var MaskBlockList=function(){function t(t){if(t===void 0){t=[]}this._list=t}Object.defineProperty(t.prototype,"lastPosition",{get:function(){return this._list[this._list.length-1].to},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"list",{get:function(){return this._list},set:function(t){this._list=t},enumerable:false,configurable:true});t.prototype.clone=function(){return new t(__spreadArray([],this._list,true))};t.prototype.findByIndex=function(t,e){if(e===void 0){e=this.list}return e.find((function(e){return e.from<=t&&t<e.to}))};t.prototype.getPlaceholderMask=function(){var t=[];this.list.forEach((function(e){var a=e.to-e.from;for(var i=0;i<a;i++){t.push(e.mask)}}));return t.join("")};t.prototype.getRawValueWithoutMaskByContext=function(t){return this.getRawValueWithoutMask(t.value)};t.prototype.getRawValueWithoutMask=function(t){if(t){var e=[];var a=t.split("");for(var i=0;i<a.length;i++){var n=a[i];var r=this.findByIndex(i);if(r&&!r.isSeparator){e.push(n.replace(r.mask,""))}else{e.push(n)}}e=e.filter((function(t){return t}));var s=this.list.filter((function(t){return t.isSeparator})).length;if(s===e.length){return""}return e.join("")}return""};t.prototype.formatBlocks=function(t,e){var a="".concat(t);for(var i=0;i<this.list.length;i++){var n=this.list[i];if(e!==i&&!n.isSeparator&&n.isTouched(a)){var r=n.getValueOfTheBlock(a);var s=n.format(r);a=a.substring(0,n.from)+s+a.substring(n.to)}}return a};t.prototype.getBlockIndexFromPosition=function(t){var e=this.list.reduce((function(t,e){return t+e.to-e.from}),0);if(t===e){return this.list.length-1}var a=this.list.findIndex((function(e){return e.from<=t&&t<e.to}));return a<0?undefined:Math.min(e,a)};t.prototype.verifyCallOfNextSeparator=function(t,e){if(this.list.length-1>e){var a=this.list[e+1];if(a.isSeparator&&a.mask===t){return true}}return false};return t}();var AbstractMask=function(){function t(t){if(t===void 0){t=[]}this.inputMode="text";this.locale="de-CH";this.blocks=new MaskBlockList(t)}t.prototype.onLocaleChange=function(t,e,a){if(t.target){var i=t.value;var n=i.split("");for(var r=0;r<n.length;r++){var s=n[r];var l=this.blocks.findByIndex(r);var o=a.findByIndex(r);if(l&&o){if(l.isSeparator){n[r]=l.mask}else if(s===o.mask){n[r]=l.mask}}}t.value=n.join("")}};t.prototype.onFocus=function(t){};t.prototype.onBlur=function(t){};t.prototype.onChange=function(t){t.submit("change",this.onParseValue(t.value))};t.prototype.onNavigationDown=function(t,e,a){};t.prototype.onSelectAll=function(t,e,a){};t.prototype.onPaste=function(t,e,a){var i=t.clipboardData||"";t.value=i;t.position.toEnd()};t.prototype.onBlockChange=function(t,e,a){t.setChar();t.position.next();var i=this.blocks.list[a+1];if(t.position.value===e.to&&i&&i.isSeparator){t.position.next()}};t.prototype.onBackspaceDown=function(t,e,a){t.position.previous();if(!e.isSeparator){t.setChar(e.mask);var i=this.blocks.list[a-1];if(t.position.value===e.from&&i&&i.isSeparator){t.position.previous()}}};t.prototype.onDeleteDown=function(t,e,a){t.setChar(e.mask);t.position.next();var i=this.blocks.list[a+1];if(t.position.value===e.to&&i&&i.isSeparator){t.position.next()}};t.prototype.onValueChanged=function(t){var e=this.onFormatValue(t.newValue);var a=t.focused&&e===""?this.blocks.getPlaceholderMask():e;t.value=a;t.position.toEnd()};t.prototype.onParseValue=function(t,e){if(e===void 0){e={allowInvalidValue:false}}if(t){return t.trim()}return t||""};t.prototype.onFormatValue=function(t){if(t){return t.trim()}return t||""};t.prototype.toParsedValue=function(t){return this.onParseValue(t)};t.prototype.toFormattedValue=function(t){return this.onFormatValue(t)};t.prototype.fireI18nChange=function(t){var e=this.blocks.clone();var a="".concat(t.locale);this.locale=t.locale;this.blocks.list.forEach((function(e){return e.onI18nChange(t.locale)}));this.onLocaleChange(t,a,e)};t.prototype.fireValueChanged=function(t){if(t.didValueChange){this.onValueChanged(t)}};t.prototype.firePaste=function(t){var e=this.blocks.getBlockIndexFromPosition(t.position.value);if(e!==undefined){var a=this.blocks.list[e];this.onPaste(t,a,e);this.onChange(t)}};t.prototype.fireClick=function(t){var e=this.blocks.getPlaceholderMask();if(e===t.value){t.position.toStart()}};t.prototype.fireFocus=function(t){if(t.target&&t.isValueEmpty()){this.resetInputValueWithMask(t)}this.onFocus(t)};t.prototype.fireBlur=function(t){if(t.target){if(this.isValueEmptyMask(t)){this.emptyInputValue(t)}else{this.onBlur(t);t.submit("blur",this.onParseValue(t.value,{allowInvalidValue:t.component.allowInvalidValue}))}}};t.prototype.fireKeyDown=function(t){var e=t.isBackspaceKey?Math.max(0,t.position.value-1):t.position.value;var a=this.blocks.getBlockIndexFromPosition(e);if(e>=this.blocks.lastPosition&&!t.isNavigationKey&&!t.isSelectAllCommand){t.preventDefault();t.stopPropagation();return}if(a!==undefined&&!t.position.isRangeSelection){var i=this.blocks.list[a];if(t.isNavigationKey){this.onNavigationDown(t,i,a)}else if(t.isSelectAllCommand){this.onSelectAll(t,i,a)}else if(t.isCopyCommand);else if(t.isPasteCommand);else if(t.isBackspaceKey){t.preventDefault();this.onBackspaceDown(t,i,a)}else if(t.isDeleteKey){t.preventDefault();this.onDeleteDown(t,i,a)}else if(t.isWhiteSpaceKey){t.preventDefault();var n=t.value[t.position.value];if(n==="."){t.stopPropagation();var r=t.value;t.value=r.substring(0,t.position.value)+"_"+r.substring(t.position.value+1)}}else if(i.verifyAllowedKeyHits(t.key)){t.preventDefault();this.onBlockChange(t,i,a)}else if(this.blocks.verifyCallOfNextSeparator(t.key,a)){t.preventDefault();var s=this.blocks.list[a];if(t.position.value>s.from){var l=this.blocks.list[a+1];var r=t.value;var o=i.getValueOfTheBlock(r);var u=i.format(o);t.value=r.substring(0,i.from)+u+r.substring(i.to);t.position.value=l.to}}var d=this.blocks.getBlockIndexFromPosition(t.position.value);if(d&&!t.isBackspaceKey){var c=this.blocks.formatBlocks(t.value,d);var h=t.position.value;t.value=c;t.position.value=h}}else{if(!t.isTabKey){t.preventDefault()}if(t.isBackspaceKey||t.isDeleteKey){this.resetInputValueWithMask(t)}else if(this.blocks.list[0].verifyAllowedKeyHits(t.key)){this.onBlockChange(t,this.blocks.list[0],0)}}};t.prototype.resetInputValueWithMask=function(t){t.value=this.blocks.getPlaceholderMask();t.position.toStart()};t.prototype.isValueEmptyMask=function(t){var e=this.blocks.getPlaceholderMask();return e===t.value};t.prototype.emptyInputValue=function(t){t.value="";t.submit("blur",t.value)};return t}();var DateMask=function(t){__extends(e,t);function e(){var e=t.call(this,[new MaskBlock({from:0,to:2,allowedKeys:__spreadArray([],NUMBER_KEYS,true),format:function(t,e,a){if(Number.isNaN(parseInt(t,10))){return"".concat(a).concat(a)}return t.padStart(2,"0")},mask:function(t){return e.dayMask[t.split("-")[0]]||e.dayMask["de"]}}),new MaskBlock({from:2,to:3,mask:function(t){return dateSeparator(t)},isSeparator:true}),new MaskBlock({from:3,to:5,allowedKeys:__spreadArray([],NUMBER_KEYS,true),format:function(t,e,a){if(Number.isNaN(parseInt(t,10))){return"".concat(a).concat(a)}return t.padStart(2,"0")},mask:function(t){return e.monthMask[t.split("-")[0]]||e.monthMask["de"]}}),new MaskBlock({from:5,to:6,mask:function(t){return dateSeparator(t)},isSeparator:true}),new MaskBlock({from:6,to:10,allowedKeys:__spreadArray([],NUMBER_KEYS,true),mask:function(t){return e.yearMask[t.split("-")[0]]||e.yearMask["de"]}})])||this;e.maxLength=10;e.minLength=10;e.inputMode="decimal";e.dayMask={de:"T",en:"D",fr:"J",it:"G",nl:"D",es:"D",pl:"D",pt:"D",sv:"D",fi:"M"};e.monthMask={de:"M",en:"M",fr:"M",it:"M",nl:"M",es:"M",pl:"M",pt:"M",sv:"M",fi:"K"};e.yearMask={de:"J",en:"Y",fr:"A",it:"A",nl:"J",es:"A",pl:"R",pt:"A",sv:"Å",fi:"V"};return e}e.prototype.onParseValue=function(t,e){if(e===void 0){e={allowInvalidValue:false}}if(t){var a=BalDate.fromAnyFormat(this.blocks.getRawValueWithoutMask(t));if(a.isValid){return a.toISODate()}else if(e&&e.allowInvalidValue){return INVALID_VALUE}}return""};e.prototype.onFormatValue=function(t){if(t){var e=BalDate.fromISO(t);if(e.isValid){return e.toFormat()}}return""};e.prototype.onPaste=function(t,e,a){var i=t.clipboardData||"";var n=BalDate.fromAnyFormat(i);if(n.isValid){t.value=n.toFormat();t.position.toEnd()}};e.prototype.onBlur=function(t){var e=this.blocks.getRawValueWithoutMaskByContext(t);var a=BalDate.fromAnyFormat(e);if(a.isValid){var i=a.toFormat();if(i!==t.value){t.value=i}}else if(t.component.allowInvalidValue){if(e!==t.value){t.value=e}}};return e}(AbstractMask);var MaskComponentAdapter=function(){function t(t){this.mask=t}Object.defineProperty(t.prototype,"attributes",{get:function(){return{inputMode:this.mask.inputMode,maxLength:this.mask.maxLength,minLength:this.mask.minLength,type:"text",autoCapitalize:"off",autoCorrect:"off",spellcheck:false}},enumerable:false,configurable:true});t.prototype.bindComponent=function(t){this.component=t};t.prototype.bindComponentDidLoad=function(){if(this.component&&this.component.nativeInput){this.component.nativeInput.value=this.component.value||""}this.bindValueChanged(this.component.value,undefined)};t.prototype.bindConfigChanged=function(t){var e=this,a=e.component,i=e.mask;var n=new MaskLocaleContext({component:a,mask:i,event:{locale:"".concat(t.language,"-").concat(t.region)}});this.mask.fireI18nChange(n);n.submit()};t.prototype.bindValueChanged=function(t,e){var a=this,i=a.component,n=a.mask;var r=new MaskValueChangedContext({component:i,mask:n,event:{newValue:t,oldValue:e}});this.mask.fireValueChanged(r);r.submit("blur")};t.prototype.bindKeyDown=function(t){if(this.isComponentAccessible){var e=this,a=e.component,i=e.mask;var n=new MaskKeyboardContext({event:t,component:a,mask:i});this.mask.fireKeyDown(n);var r=t.key==="Tab";n.submit(r?"tab":"input");a.balKeyPress.emit(t)}};t.prototype.bindFocus=function(t){if(this.isComponentAccessible){var e=this,a=e.component,i=e.mask;a.focused=true;var n=new MaskFocusContext({event:t,component:a,mask:i});this.mask.fireFocus(n);n.submit();a.balFocus.emit(t)}};t.prototype.bindBlur=function(t){if(this.isComponentAccessible){var e=this,a=e.component,i=e.mask;a.focused=false;var n=new MaskFocusContext({event:t,component:a,mask:i});this.mask.fireBlur(n);n.submit("blur");a.balBlur.emit(t)}};t.prototype.bindPaste=function(t){if(this.isComponentAccessible){var e=this,a=e.component,i=e.mask;var n=new MaskClipboardContext({event:t,component:a,mask:i});this.mask.firePaste(n);n.submit()}};t.prototype.bindFormReset=function(t){var e=this;var a=t.target;if(a&&(a===this.component.el||a.contains(this.component.el))){this.component.value=this.component.initialValue;this.component.inputValue=this.component.initialValue;clearTimeout(this.resetHandlerTimer);this.resetHandlerTimer=setTimeout((function(){if(e.component.nativeInput){e.component.nativeInput.value=e.mask.toFormattedValue(e.component.value||"")}}))}};t.prototype.bindClick=function(t){if(this.isComponentAccessible){var e=this,a=e.component,i=e.mask;var n=new MaskMouseContext({event:t,component:a,mask:i});this.mask.fireClick(n);n.submit()}};t.prototype.bindHostClick=function(t){if(!this.isComponentAccessible){t.preventDefault();t.stopPropagation()}};t.prototype.bindGlobalClick=function(t){if(!this.isComponentAccessible){if(t.target&&t.target===this.component.el){t.preventDefault();t.stopPropagation()}}};Object.defineProperty(t.prototype,"isComponentAccessible",{get:function(){return!this.component.disabled&&!this.component.readonly},enumerable:false,configurable:true});return t}();var balInputDateCss=".bal-input-date{display:block;width:100%;-ms-flex:1;flex:1}.bal-input-date input:not(:-moz-placeholder-shown){letter-spacing:.4px}.bal-input-date input:not(:-ms-input-placeholder){letter-spacing:.4px}.bal-input-date input:not(:placeholder-shown){letter-spacing:.4px}.bal-input-date__native{position:absolute !important;left:0;top:0;margin:0;padding:0;opacity:0;outline:0;border:none;width:1px;height:1px;clip:rect(1px, 1px, 1px, 1px);overflow:hidden}";var InputDate=function(){function t(t){registerInstance(this,t);this.balKeyPress=createEvent(this,"balKeyPress");this.balChange=createEvent(this,"balChange");this.balInput=createEvent(this,"balInput");this.balBlur=createEvent(this,"balBlur");this.balFocus=createEvent(this,"balFocus");this.inputId="bal-i-date-".concat(inputDateIds++);this.inheritedAttributes={};this.maskAdapter=new MaskComponentAdapter(new DateMask);this.focused=false;this.isGrouped=false;this.ariaForm=defaultBalAriaForm;this.name=this.inputId;this.invalid=false;this.required=false;this.disabled=false;this.readonly=false;this.clickable=false;this.autocomplete="off";this.hasIconRight=false;this.value=undefined;this.inputValue=this.value;this.initialValue=this.value||"";this.autoInvalidOff=false;this.allowInvalidValue=false}t.prototype.createLogger=function(t){this.log=t};t.prototype.valueChanged=function(t,e){this.maskAdapter.bindValueChanged(t,e)};t.prototype.connectedCallback=function(){this.maskAdapter.bindComponent(this);this.isGrouped=hasParent("bal-input-group",this.el)};t.prototype.componentDidLoad=function(){this.maskAdapter.bindComponentDidLoad()};t.prototype.componentWillRender=function(){this.inheritedAttributes=inheritAttributes(this.el,["aria-label","tabindex","title"])};t.prototype.configChanged=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.maskAdapter.bindConfigChanged(t);return[2]}))}))};t.prototype.resetHandler=function(t){this.maskAdapter.bindFormReset(t)};t.prototype.listenOnClick=function(t){this.maskAdapter.bindGlobalClick(t)};t.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){inputSetFocus(this);return[2]}))}))};t.prototype.setBlur=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){inputSetBlur(this);return[2]}))}))};t.prototype.getInputElement=function(){return Promise.resolve(this.nativeInput)};t.prototype.setAriaForm=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.ariaForm=Object.assign({},t);return[2]}))}))};t.prototype.render=function(){var t=this;var e=BEM.block("input-date");var a=e.element("native");return h(Host,{key:"f40927d913ec705fdc87137c6b47aadd7549f187",onClick:function(e){return t.maskAdapter.bindHostClick(e)},class:Object.assign({},e.class())},h("input",Object.assign({key:"175e4b3d9ff2df12c4b663bd4927dee2fddd14ab",class:{input:true,"is-disabled":this.disabled||this.readonly,"is-danger":this.invalid,"is-clickable":this.clickable&&!(this.disabled||this.readonly),"bal-focusable":!this.disabled,"has-icon-right":this.hasIconRight},"data-testid":"bal-date-input",ref:function(e){return t.nativeInput=e},id:this.ariaForm.controlId||this.inputId,"aria-labelledby":this.ariaForm.labelId,"aria-describedby":this.ariaForm.messageId,"aria-invalid":this.invalid===true?"true":"false","aria-disabled":ariaBooleanToString(this.disabled),required:this.required,disabled:this.disabled,readonly:this.readonly,autoComplete:this.autocomplete},this.maskAdapter.attributes,this.inheritedAttributes,{placeholder:this.placeholder,value:this.inputValue,onKeyDown:function(e){return t.maskAdapter.bindKeyDown(e)},onClick:function(e){return t.maskAdapter.bindClick(e)},onFocus:function(e){return t.maskAdapter.bindFocus(e)},onBlur:function(e){return t.maskAdapter.bindBlur(e)},onPaste:function(e){return t.maskAdapter.bindPaste(e)}})),h("input",{key:"c1dfb6ccecd24a345e3de3dfb33e436dfbf98615",type:"date",class:Object.assign({},a.class()),name:this.name,min:this.min,max:this.max,value:this.value,tabindex:-1,"aria-hidden":"true"}))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{value:["valueChanged"]}},enumerable:false,configurable:true});return t}();__decorate([Logger("bal-input-date"),__metadata("design:type",Function),__metadata("design:paramtypes",[Function]),__metadata("design:returntype",void 0)],InputDate.prototype,"createLogger",null);__decorate([ListenToConfig(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],InputDate.prototype,"configChanged",null);var inputDateIds=0;InputDate.style=balInputDateCss;export{DateCalendar as bal_date_calendar,InputDate as bal_input_date};
1
+ import{__awaiter,__extends,__generator,__spreadArray}from"tslib";import{M as h,L as Logger,H as registerInstance,P as createEvent,f as defaultConfig,x as waitAfterFramePaint,N as Host,O as getElement,X as hasParent}from"./index-BtpJmRB8.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-dfXERft2.js";import{p as padStart}from"./index-BU7FUSdu.js";import{i as isNil}from"./index-zWZxKBfo.js";import{B as BalDate,d as dateSeparator}from"./date-B_izjCbq.js";import{L as ListenToConfig}from"./config.decorator-CIdA1I1h.js";import{B as BEM}from"./bem-ByiN-QjD.js";import{L as ListenToSwipe}from"./swipe.decorator-BpU5Ogqx.js";import{i as i18nBalDate}from"./bal-date.i18n-CLs4UZCO.js";import{i as inheritAttributes}from"./attributes-C4sZQbkT.js";import{l as hasValueChanged,c as inputSetFocus,d as inputSetBlur}from"./form-input-C2vJzMPS.js";import{N as NUMBER_KEYS}from"./keys.constant-xVPGsAdF.js";import{I as INVALID_VALUE}from"./mask-util-DuObDTix.js";import{d as defaultBalAriaForm}from"./form-FCLKfv6B.js";import{a as ariaBooleanToString}from"./aria-DBsOHTWj.js";import"./_commonjsHelpers-BFTU3MAI.js";import"./swipe.subject-B1IPMW8E.js";import"./device-D0RSC50t.js";import"./listener-DI7AdrHk.js";function getDaysInMonth(t,e){if(e<1||t<0){return undefined}return new Date(t,e,0).getDate()}function isoDateOfDay(t,e,a){return"".concat(a,"-").concat(padStart("".concat(e),2,"0"),"-").concat(padStart("".concat(t),2,"0"))}function isoDateOfToday(){var t=new Date;return"".concat(t.getFullYear(),"-").concat(padStart("".concat(t.getMonth()+1),2,"0"),"-").concat(padStart("".concat(t.getDate()),2,"0"))}function generateCalendarGrid(t,e,a,i,n){var r=[];var s=getDaysInMonth(t,e);var l=getFirstDayOfMonth(t,e);if(s!==undefined&&l){var o=isoDateOfToday();var u=BalDate.fromISO(a);var d=BalDate.fromISO(i);var c=function(t){if(isNil(n)){return false}return!n(t)};for(var h=1;h<=s;h++){var f=isoDateOfDay(h,e,t);r.push({day:h,month:e,year:t,isoDate:f,fullDate:BalDate.fromISO(f).toFormat(),today:o===f,disabled:u.isAfter(f)||d.isBefore(f)||c(f)})}}return r}function getFirstWeekdayOfMonth(t,e){if(e<1||t<0){return 1}var a=new Date(t,e-1,1);var i=a.getDay();return i===0?7:i}function validateLanguage(t){if(["en","de","fr","it","nl","es","pl","pt","sv","fi"].includes(t)){return t}return"de"}function generateYears(t,e,a){var i=[];var n=new Date;var r=n.getFullYear();for(var s=e;s<=a;s++){i.push({value:s,label:"".concat(s),disabled:false,today:r===s,selected:t===s})}return i}function generateMonths(t,e,a,i,n){var r=validateLanguage(t);var s=BalDate.infoMonths({format:"long",locale:r});var l=BalDate.fromISO(a);var o=new Date;var u=o.getFullYear();var d=o.getMonth()+1;var c=0;if(i&&e!==undefined){var h=BalDate.fromISO(i);if(h.isValid){if(e>h.year){c=0}else{c=h.month||c}}}var f=12;if(n&&e!==undefined){var b=BalDate.fromISO(n);if(b.isValid){if(e<b.year){f=12}else{f=b.month||f}}}return s.map((function(t,a){var i=a+1;return{label:t,value:i,today:i===d&&e===u,selected:i===l.month&&e===l.year,disabled:i<c||i>f}}))}function generateWeekDays(t){var e=validateLanguage(t);var a=BalDate.infoWeekdays({format:"short",locale:e});var i=BalDate.infoWeekdays({format:"long",locale:e});return a.map((function(t,e){return{ariaLabel:i[e],textContent:t}}))}function getFirstDayOfMonth(t,e){if(e<1||e>12||t<0){return undefined}return new Date(t,e-1,1)}var CalendarList=function(t){var e=t.name,a=t.isVisible,i=t.girdHeight,n=t.list,r=t.onSelect,s=t.ref;var l=BEM.block("date-calendar");var o=l.element("body");var u=o.element("list");return h("ul",{class:Object.assign(Object.assign(Object.assign({},u.class()),u.modifier(e).class()),u.modifier("visible").class(a)),"aria-hidden":a?"false":"true",style:{height:"".concat(i-2-8-8,"px")},ref:function(t){return s?s(t):undefined}},n.map((function(t){return h("li",{key:t.value,id:"".concat(e,"-").concat(t.value)},h("button",{class:Object.assign(Object.assign(Object.assign(Object.assign({},u.element("item").class()),u.element("item").modifier("today").class(t.today)),u.element("item").modifier("selected").class(t.selected)),u.element("item").modifier("disabled").class(t.disabled)),disabled:t.disabled,tabIndex:-1,onClick:function(){if(!t.disabled){r(t)}}},t.label))})))};var CalendarGrid=function(t){var e=t.isVisible,a=t.ref,i=t.grid,n=t.weekdays,r=t.selectedDate,s=t.firstDayOfWeek,l=t.onSelectDay;var o=BEM.block("date-calendar");var u=o.element("body");var d=u.element("grid");return h("div",{role:"grid",class:Object.assign(Object.assign({},d.class()),d.modifier("visible").class(e)),"aria-hidden":e?"false":"true",ref:function(t){return a(t)}},h("div",{role:"row",class:Object.assign({},d.element("head").class())},n.map((function(t){return h("span",{key:t.textContent,role:"columnheader","aria-label":t.ariaLabel,title:t.ariaLabel},t.textContent)}))),h("div",{role:"row",class:Object.assign({},d.element("body").class()),style:{"--bal-date-first-week-day":"".concat(s)}},i.map((function(t){return h("bal-date-calendar-cell",Object.assign({key:t.isoDate},t,{selected:t.isoDate===r,onBalSelectDay:function(t){var e=t.detail;return l(e)}}))}))))};var CalendarNav=function(t){var e=t.language,a=t.onClickSelectMonthAndYear,i=t.monthFullNames,n=t.month,r=t.year,s=t.isCalendarVisible,l=t.isListVisible,o=t.onClickPreviousMonth,u=t.onClickNextMonth;var d=BEM.block("date-calendar");var c=d.element("nav");var f=i18nBalDate[e].nextMonth;var b=i18nBalDate[e].previousMonth;var _=i18nBalDate[e].selectMonth;return h("div",{class:Object.assign({},c.class())},h("div",{class:Object.assign({},c.modifier("start").class())},h("button",{title:_,"aria-label":_,tabIndex:-1,"data-test":"change-year-month",onClick:a},h("span",null,i[n-1]," ",r),h("bal-icon",{name:"caret-up",color:"primary",size:"small",turn:s}))),h("div",{class:Object.assign({},c.modifier("end").class()),style:{display:l?"none":"flex"}},h("button",{title:b,"aria-label":b,onClick:o,tabIndex:-1,"data-test":"previous-month"},h("bal-icon",{name:"caret-left",color:"primary",size:"small"})),h("button",{title:f,"aria-label":f,onClick:u,tabIndex:-1,"data-test":"next-month"},h("bal-icon",{name:"caret-right",color:"primary",size:"small"}))))};var balDateCalendarCss=':host{--bal-date-first-week-day:0;--bal-date-calendar-background:var(--bal-color-red-3)}:host{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:inline-block;background:var(--bal-color-white);border-radius:var(--bal-radius-normal)}.bal-date-calendar__nav{display:-ms-flexbox;display:flex;width:calc(100% - 1rem);-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;padding:.5rem;gap:.5rem}.bal-date-calendar__nav--start>button{display:-ms-flexbox;display:flex;gap:.5rem}.bal-date-calendar__nav--end{display:-ms-flexbox;display:flex;gap:.5rem}.bal-date-calendar__nav button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-radius:var(--bal-radius-normal);font-family:var(--bal-font-family-text);font-weight:var(--bal-font-weight-regular);color:var(--bal-color-text-primary);border:none;background:rgba(0,0,0,0);text-align:center;font-size:var(--bal-text-size-normal);line-height:var(--bal-line-height-normal);-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;outline:none;min-height:2rem;min-width:2rem;padding:.25rem;border-radius:var(--bal-button-radius);font-family:var(--bal-font-family-title);font-weight:var(--bal-font-weight-bold)}@media (hover: hover)and (pointer: fine){.bal-date-calendar__nav button:not(.bal-date-calendar__nav button--selected):not(.bal-date-calendar__nav button--disabled):hover{background:var(--bal-color-light-blue-1)}}.bal-date-calendar__nav button:not(.bal-date-calendar__nav button--selected):not(.bal-date-calendar__nav button--disabled):active{background:var(--bal-color-light-blue-2)}.bal-date-calendar__nav button--today:not(.bal-date-calendar__nav button--selected):not(.bal-date-calendar__nav button--disabled){color:var(--bal-color-light-blue-3);font-weight:var(--bal-font-weight-bold)}@media (hover: hover)and (pointer: fine){.bal-date-calendar__nav button--today:not(.bal-date-calendar__nav button--selected):not(.bal-date-calendar__nav button--disabled):hover{color:var(--bal-color-text-primary)}}.bal-date-calendar__nav button--today:not(.bal-date-calendar__nav button--selected):not(.bal-date-calendar__nav button--disabled):active{color:var(--bal-color-text-primary)}.bal-date-calendar__nav button--selected{background:var(--bal-color-primary);color:var(--bal-color-text-white);font-weight:var(--bal-font-weight-bold)}.bal-date-calendar__nav button--disabled{cursor:default;background:rgba(0,0,0,0);color:var(--bal-color-text-grey-light)}.bal-date-calendar__body{display:block}.bal-date-calendar__body__grid{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;padding:.5rem;height:0;padding-top:0;padding-bottom:0;visibility:hidden}.bal-date-calendar__body__grid--visible{height:auto;padding-top:.5rem;padding-bottom:.5rem;visibility:visible}.bal-date-calendar__body__grid__head{position:relative;display:grid;grid-template-columns:repeat(7, 1fr);-webkit-column-gap:.5rem;-moz-column-gap:.5rem;column-gap:.5rem;row-gap:.5rem;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.bal-date-calendar__body__grid__head::after{position:absolute;content:"";height:2px;width:calc(100% + 1rem);bottom:0;left:-0.5rem;right:-0.5rem;background:var(--bal-color-border)}.bal-date-calendar__body__grid__head span{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:2rem;width:2rem;font-family:var(--bal-font-family-title);font-weight:var(--bal-font-weight-bold);font-size:var(--bal-text-size-normal);line-height:var(--bal-line-height-normal);-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;text-wrap:nowrap}.bal-date-calendar__body__grid__body{display:grid;grid-template-columns:repeat(7, 1fr);-webkit-column-gap:.5rem;-moz-column-gap:.5rem;column-gap:.5rem;row-gap:.5rem;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;padding-top:.5rem}.bal-date-calendar__body__grid__body>.bal-date-calendar-cell{width:2rem;height:2rem;text-align:center;font-size:var(--bal-text-size-normal);line-height:var(--bal-line-height-normal);-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto}.bal-date-calendar__body__grid__body>.bal-date-calendar-cell:first-child{grid-column:var(--bal-date-first-week-day)}.bal-date-calendar__body__list{display:none;list-style:none;margin:0;padding:0;-webkit-column-gap:.5rem;-moz-column-gap:.5rem;column-gap:.5rem;row-gap:.5rem;width:calc(100% - 1rem);overflow-y:auto;max-height:18rem;position:relative;padding:.5rem;border-top:2px solid var(--bal-color-border)}.bal-date-calendar__body__list .bal-date-calendar__body__list__item{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-radius:var(--bal-radius-normal);font-family:var(--bal-font-family-text);font-weight:var(--bal-font-weight-regular);color:var(--bal-color-text-primary);border:none;background:rgba(0,0,0,0);text-align:center;font-size:var(--bal-text-size-normal);line-height:var(--bal-line-height-normal);-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;outline:none;width:100%}@media (hover: hover)and (pointer: fine){.bal-date-calendar__body__list .bal-date-calendar__body__list__item:not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected):not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled):hover{background:var(--bal-color-light-blue-1)}}.bal-date-calendar__body__list .bal-date-calendar__body__list__item:not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected):not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled):active{background:var(--bal-color-light-blue-2)}.bal-date-calendar__body__list .bal-date-calendar__body__list__item--today:not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected):not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled){color:var(--bal-color-light-blue-3);font-weight:var(--bal-font-weight-bold)}@media (hover: hover)and (pointer: fine){.bal-date-calendar__body__list .bal-date-calendar__body__list__item--today:not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected):not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled):hover{color:var(--bal-color-text-primary)}}.bal-date-calendar__body__list .bal-date-calendar__body__list__item--today:not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected):not(.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled):active{color:var(--bal-color-text-primary)}.bal-date-calendar__body__list .bal-date-calendar__body__list__item--selected{background:var(--bal-color-primary);color:var(--bal-color-text-white);font-weight:var(--bal-font-weight-bold)}.bal-date-calendar__body__list .bal-date-calendar__body__list__item--disabled{cursor:default;background:rgba(0,0,0,0);color:var(--bal-color-text-grey-light)}.bal-date-calendar__body__list--visible{display:grid}.bal-date-calendar__body__list--year{grid-template-columns:repeat(4, 1fr)}.bal-date-calendar__body__list--month{grid-template-columns:repeat(2, 1fr)}.bal-date-calendar-cell{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-radius:var(--bal-radius-normal);font-family:var(--bal-font-family-text);font-weight:var(--bal-font-weight-regular);color:var(--bal-color-text-primary);border:none;background:rgba(0,0,0,0);text-align:center;font-size:var(--bal-text-size-normal);line-height:var(--bal-line-height-normal);-webkit-hyphens:auto;-ms-hyphens:auto;hyphens:auto;outline:none;width:2rem;height:2rem}@media (hover: hover)and (pointer: fine){.bal-date-calendar-cell:not(.bal-date-calendar-cell--selected):not(.bal-date-calendar-cell--disabled):hover{background:var(--bal-color-light-blue-1)}}.bal-date-calendar-cell:not(.bal-date-calendar-cell--selected):not(.bal-date-calendar-cell--disabled):active{background:var(--bal-color-light-blue-2)}.bal-date-calendar-cell--today:not(.bal-date-calendar-cell--selected):not(.bal-date-calendar-cell--disabled){color:var(--bal-color-light-blue-3);font-weight:var(--bal-font-weight-bold)}@media (hover: hover)and (pointer: fine){.bal-date-calendar-cell--today:not(.bal-date-calendar-cell--selected):not(.bal-date-calendar-cell--disabled):hover{color:var(--bal-color-text-primary)}}.bal-date-calendar-cell--today:not(.bal-date-calendar-cell--selected):not(.bal-date-calendar-cell--disabled):active{color:var(--bal-color-text-primary)}.bal-date-calendar-cell--selected{background:var(--bal-color-primary);color:var(--bal-color-text-white);font-weight:var(--bal-font-weight-bold)}.bal-date-calendar-cell--disabled{cursor:default;background:rgba(0,0,0,0);color:var(--bal-color-text-grey-light)}';var DateCalendar=function(){function t(t){var e=this;registerInstance(this,t);this.balChange=createEvent(this,"balChange");this.oldMin="";this.oldMax="";this.selectedDate="";this.monthFullNames=[];this.weekdays=[];this.months=[];this.years=[];this.calendarGrid=[];this.firstDayOfWeek=0;this.month=0;this.year=0;this.language=defaultConfig.language;this.isCalendarVisible=true;this.isYearListVisible=false;this.isMonthListVisible=false;this.allowedDates=undefined;this.onSelectDay=function(t){e.valueChanged(t,e.selectedDate);e.balChange.emit(e.selectedDate)};this.onClickNextMonth=function(){var t=e.year;var a=e.month+1;if(a>12){a=1;t=t+1}e.generateGridByMonthAndYear(a,t)};this.onClickPreviousMonth=function(){var t=e.year;var a=e.month-1;if(a<1){a=12;t=t-1}e.generateGridByMonthAndYear(a,t)};this.onClickSelectMonthAndYear=function(){return __awaiter(e,void 0,void 0,(function(){var t,e;return __generator(this,(function(a){switch(a.label){case 0:this.updateSelections();if(!(this.isCalendarVisible===true))return[3,2];this.isCalendarVisible=false;this.isYearListVisible=true;this.isMonthListVisible=false;return[4,waitAfterFramePaint()];case 1:a.sent();if(this.yearListEl){t=this.yearListEl.querySelector("#year-".concat(this.year));if(t){e=26+8+4;this.yearListEl.scrollTop=t.offsetTop-e*2}else{this.yearListEl.scrollTop=0}}return[3,3];case 2:this.isCalendarVisible=true;this.isYearListVisible=false;this.isMonthListVisible=false;a.label=3;case 3:return[2]}}))}))};this.onClickYear=function(t){e.isYearListVisible=false;e.isMonthListVisible=true;e.generateGridByMonthAndYear(e.month,t);e.months=generateMonths(e.language,t,e.selectedDate,e.min,e.max)};this.onClickMonth=function(t){e.isYearListVisible=false;e.isMonthListVisible=false;e.isCalendarVisible=true;e.generateGridByMonthAndYear(t,e.year)}}t.prototype.createLogger=function(t){this.log=t};t.prototype.valueChanged=function(t,e){if(t!==e){var a=BalDate.fromISO(t);if(!a.isValid){this.generateGridByDefaultDate();this.selectedDate=""}else{this.generateGridByDate(a);this.selectedDate=a.toISODate()}this.updateSelections()}};t.prototype.rangePropChanged=function(){this.updateSelections();this.generateGrid()};t.prototype.yearRangePropChanged=function(){this.updateSelections()};t.prototype.connectedCallback=function(){this.generateGridByDefaultDate();this.valueChanged(this.value,undefined)};t.prototype.configChanged=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.language=t.language;this.monthFullNames=BalDate.infoMonths({format:"long",locale:this.language});this.weekdays=generateWeekDays(this.language);this.updateSelections();return[2]}))}))};t.prototype.swipeListener=function(t){var e=t.left,a=t.right;if(e){this.onClickNextMonth()}else if(a){this.onClickPreviousMonth()}};Object.defineProperty(t.prototype,"minYear",{get:function(){if(this.minYearProp===undefined){var t=new Date;var e=t.getFullYear();var a=e-100;if(this.min){var i=BalDate.fromISO(this.min);return i.year||a}else{return a}}return this.minYearProp},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"maxYear",{get:function(){if(this.maxYearProp===undefined){var t=new Date;var e=t.getFullYear();var a=e+50;if(this.max){var i=BalDate.fromISO(this.max);return i.year||a}else{return a}}return this.maxYearProp},enumerable:false,configurable:true});t.prototype.updateSelections=function(){this.years=generateYears(this.year,this.minYear,this.maxYear);this.months=generateMonths(this.language,this.year,this.selectedDate,this.min,this.max)};t.prototype.generateGrid=function(){var t=BalDate.fromISO(this.value);if(t.isValid){this.generateGridByDate(t)}else{this.generateGridByDefaultDate()}};t.prototype.generateGridByDate=function(t){if(t.year!==undefined&&t.month!==undefined){this.generateGridByMonthAndYear(t.month,t.year)}};t.prototype.generateGridByDefaultDate=function(){var t=BalDate.fromISO(this.defaultDate);if(t.isValid){this.generateGridByDate(t)}else{var e=new Date;this.month=e.getMonth()+1;this.year=e.getFullYear();this.calendarGrid=generateCalendarGrid(this.year,this.month,this.min,this.max,this.allowedDates);this.firstDayOfWeek=getFirstWeekdayOfMonth(this.year,this.month)}};t.prototype.generateGridByMonthAndYear=function(t,e){if(this.month!==t||this.year!==e||this.oldMin!==this.min||this.oldMax!==this.max){this.calendarGrid=generateCalendarGrid(e,t,this.min,this.max,this.allowedDates);this.firstDayOfWeek=getFirstWeekdayOfMonth(e,t)}this.month=t;this.year=e;this.oldMin=this.min;this.oldMax=this.max};t.prototype.render=function(){var t=this;var e;var a=((e=this.gridEl)===null||e===void 0?void 0:e.clientHeight)||0;var i=BEM.block("date-calendar");var n=i.element("body");var r=i.element("foot");return h(Host,{key:"5d6a297ec24ae26e80aa64800168e0f7c184e803",class:Object.assign({},i.class())},h(CalendarNav,{key:"d59886c88f34bfb9fc17cc121d6c7262c2a15485",language:this.language,monthFullNames:this.monthFullNames,month:this.month,year:this.year,isCalendarVisible:this.isCalendarVisible,isListVisible:this.isMonthListVisible||this.isYearListVisible,onClickSelectMonthAndYear:this.onClickSelectMonthAndYear,onClickPreviousMonth:this.onClickPreviousMonth,onClickNextMonth:this.onClickNextMonth}),h("div",{key:"53fe06a5f24418668d3a77a03ee6da3e48c5c019",class:Object.assign({},n.class())},h(CalendarGrid,{key:"f898ac758f1dfcaa1dbd7eb7b56c3cb339971528",isVisible:this.isCalendarVisible,grid:this.calendarGrid,weekdays:this.weekdays,firstDayOfWeek:this.firstDayOfWeek,selectedDate:this.selectedDate,ref:function(e){return t.gridEl=e},onSelectDay:function(e){return t.onSelectDay(e)}}),h(CalendarList,{key:"011bf1c4f7ba1332b7b336ffffdf7ba4dd1f0062",name:"year",isVisible:this.isYearListVisible,girdHeight:a,list:this.years,ref:function(e){return t.yearListEl=e},onSelect:function(e){return t.onClickYear(e.value)}}),h(CalendarList,{key:"0b3c1d01fea6752b5f954083b18883e0da5a1e96",name:"month",isVisible:this.isMonthListVisible,girdHeight:a,list:this.months,onSelect:function(e){return t.onClickMonth(e.value)}})),h("div",{key:"a4bd07270d850442b4604a75beaed04baa33c64f",class:Object.assign({},r.class())},h("slot",{key:"50d760695d612864422574e13ef9cfdf352dbbcc"})))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{value:["valueChanged"],min:["rangePropChanged"],max:["rangePropChanged"],minYearProp:["yearRangePropChanged"],maxYearProp:["yearRangePropChanged"]}},enumerable:false,configurable:true});return t}();__decorate([Logger("bal-date-calendar"),__metadata("design:type",Function),__metadata("design:paramtypes",[Function]),__metadata("design:returntype",void 0)],DateCalendar.prototype,"createLogger",null);__decorate([ListenToConfig(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],DateCalendar.prototype,"configChanged",null);__decorate([ListenToSwipe({mobileOnly:true}),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",void 0)],DateCalendar.prototype,"swipeListener",null);DateCalendar.style=balDateCalendarCss;var MaskPosition=function(){function t(t){this._options=t;this._position=0;this._positionEnd=0;this._isRangeSelection=false;if(t.component&&t.component.nativeInput){this._position=t.component.nativeInput.selectionStart||0;this._positionEnd=t.component.nativeInput.selectionEnd||0;this._isRangeSelection=this._position!==this._positionEnd}}Object.defineProperty(t.prototype,"isRangeSelection",{get:function(){return this._isRangeSelection},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"value",{get:function(){if(this._options.isBackspace&&this._position>0){return this._position-1}return this._position},set:function(t){var e=t<0?0:t>this._options.mask.maxLength?this._options.mask.maxLength:t;this._position=e},enumerable:false,configurable:true});t.prototype.toStart=function(){this.value=0};t.prototype.toEnd=function(){var t=this.getTarget();if(t){this.value=t.value.length}};t.prototype.next=function(t){if(t===void 0){t=1}var e=this._position+t;if(e<=this._options.mask.maxLength){this._position=e}return this._position};t.prototype.previous=function(t){if(t===void 0){t=1}var e=this._position-t;if(e>=0){this._position=e}else{this._position=0}return this._position};t.prototype.submit=function(){var t=this.getTarget();if(t&&t.selectionStart!==this._position&&t.selectionEnd!==this._position){t.selectionStart=this._position;t.selectionEnd=this._position}};t.prototype.getTarget=function(){if(this._options.component&&this._options.component.nativeInput){return this._options.component.nativeInput}return undefined};return t}();var MaskContext=function(){function t(t){this._options=t;this._value="";if(this._options.component&&this._options.component.nativeInput){this._value=this._options.component.nativeInput.value}this.position=new MaskPosition(this._options);this.component=this._options.component}Object.defineProperty(t.prototype,"target",{get:function(){if(this._options.component&&this._options.component.nativeInput){return this._options.component.nativeInput}return undefined},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"value",{get:function(){return this._value},set:function(t){this._value=t},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"focused",{get:function(){return this._options.component.focused},enumerable:false,configurable:true});t.prototype.isValueEmpty=function(){return this.value===""||this.value===undefined||this.value===null};t.prototype.preventDefault=function(){if(this._options.event.preventDefault){this._options.event.preventDefault()}};t.prototype.stopPropagation=function(){this.preventDefault();if(this._options.event.stopPropagation){this._options.event.stopPropagation()}};t.prototype.submit=function(){return __awaiter(this,arguments,void 0,(function(t,e){if(t===void 0){t="input"}return __generator(this,(function(a){if(this.target){this.target.value=this.value;if(t!=="blur"&&t!=="tab"){this.position.submit()}if(this._options.component){if(t==="input"||t==="tab"){this._options.component.balInput.emit(this.value)}if((t==="change"||t==="blur")&&e!==undefined){if(hasValueChanged(this._options.component.value,e)){this._options.component.value=e;this._options.component.balChange.emit(e)}}}}return[2]}))}))};return t}();var MaskClipboardContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}Object.defineProperty(e.prototype,"clipboardData",{get:function(){var t;return(t=this._options.event.clipboardData)===null||t===void 0?void 0:t.getData("text")},enumerable:false,configurable:true});return e}(MaskContext);var MaskFocusContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(MaskContext);var MaskKeyboardContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}Object.defineProperty(e.prototype,"key",{get:function(){return this._options.event.key},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isCtrlOrCommandKey",{get:function(){return this._options.event.metaKey||this._options.event.ctrlKey},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isBackspaceKey",{get:function(){return this._options.event.key==="Backspace"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isTabKey",{get:function(){return this._options.event.key==="Tab"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isWhiteSpaceKey",{get:function(){return this._options.event.key===" "},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isDeleteKey",{get:function(){return this._options.event.key==="Delete"||this._options.event.key==="Del"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isNumberKey",{get:function(){return e.NUMBER_KEYS.includes(this._options.event.key)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isNavigationKey",{get:function(){return e.NAVIGATION_KEYS.includes(this._options.event.key)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isSelectAllCommand",{get:function(){return(this._options.event.ctrlKey||this._options.event.metaKey)&&this.key==="a"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isCopyCommand",{get:function(){return(this._options.event.ctrlKey||this._options.event.metaKey)&&this.key==="c"},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"isPasteCommand",{get:function(){return(this._options.event.ctrlKey||this._options.event.metaKey)&&this.key==="v"},enumerable:false,configurable:true});e.prototype.getCharAt=function(t){if(t===void 0){t=this.position.value}return this.value.charAt(t)};e.prototype.getCharAtBackspacePosition=function(){return this.getCharAt(this.position.value-1)};e.prototype.setChar=function(t,e){if(t===void 0){t=this._options.event.key}if(e===void 0){e=this.position.value}this.value=this.value.substring(0,e)+t+this.value.substring(e+1)};return e}(MaskContext);MaskKeyboardContext.NUMBER_KEYS=["0","1","2","3","4","5","6","7","8","9"];MaskKeyboardContext.NAVIGATION_KEYS=["Home","End","ArrowLeft","Left","ArrowRight","Right","Tab","Enter","Esc","Escape"];var MaskLocaleContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}Object.defineProperty(e.prototype,"locale",{get:function(){return this._options.event.locale},enumerable:false,configurable:true});return e}(MaskContext);var MaskMouseContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(MaskContext);var MaskValueChangedContext=function(t){__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}Object.defineProperty(e.prototype,"newValue",{get:function(){return this._options.event.newValue},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"oldValue",{get:function(){return this._options.event.oldValue},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"didValueChange",{get:function(){return this.newValue!==this.oldValue},enumerable:false,configurable:true});return e}(MaskContext);var MaskBlock=function(){function t(t){this._isSeparator=false;this._allowedKeys=[];this._locale="de-CH";this._from=t.from||0;this._to=t.to||0;this._isSeparator=t.isSeparator===undefined?false:t.isSeparator;this._mask=t.mask||"_";this._allowedKeys=t.allowedKeys?t.allowedKeys:this.allowedKeys;this._format=t.format}t.prototype.format=function(t){if(this._format){return this._format(t.replace(this.mask,""),this._locale,this.mask)}return t};Object.defineProperty(t.prototype,"isSeparator",{get:function(){return this._isSeparator},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"to",{get:function(){return this._to},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"from",{get:function(){return this._from},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"mask",{get:function(){if(typeof this._mask==="function"){return this._mask(this._locale)}return this._mask},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"allowedKeys",{get:function(){return this._allowedKeys},enumerable:false,configurable:true});t.prototype.onI18nChange=function(t){this._locale=t};t.prototype.getValueOfTheBlock=function(t){return t.slice(this._from,this._to)};t.prototype.isTouched=function(t){var e=this;var a=this.getValueOfTheBlock(t);return!a.split("").every((function(t){return t===e.mask}))};t.prototype.verifyAllowedKeyHits=function(t){if(this.isSeparator&&t===this.mask){return true}else if(this.allowedKeys.indexOf(t)>=0){return true}else{return false}};return t}();var MaskBlockList=function(){function t(t){if(t===void 0){t=[]}this._list=t}Object.defineProperty(t.prototype,"lastPosition",{get:function(){return this._list[this._list.length-1].to},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"list",{get:function(){return this._list},set:function(t){this._list=t},enumerable:false,configurable:true});t.prototype.clone=function(){return new t(__spreadArray([],this._list,true))};t.prototype.findByIndex=function(t,e){if(e===void 0){e=this.list}return e.find((function(e){return e.from<=t&&t<e.to}))};t.prototype.getPlaceholderMask=function(){var t=[];this.list.forEach((function(e){var a=e.to-e.from;for(var i=0;i<a;i++){t.push(e.mask)}}));return t.join("")};t.prototype.getRawValueWithoutMaskByContext=function(t){return this.getRawValueWithoutMask(t.value)};t.prototype.getRawValueWithoutMask=function(t){if(t){var e=[];var a=t.split("");for(var i=0;i<a.length;i++){var n=a[i];var r=this.findByIndex(i);if(r&&!r.isSeparator){e.push(n.replace(r.mask,""))}else{e.push(n)}}e=e.filter((function(t){return t}));var s=this.list.filter((function(t){return t.isSeparator})).length;if(s===e.length){return""}return e.join("")}return""};t.prototype.formatBlocks=function(t,e){var a="".concat(t);for(var i=0;i<this.list.length;i++){var n=this.list[i];if(e!==i&&!n.isSeparator&&n.isTouched(a)){var r=n.getValueOfTheBlock(a);var s=n.format(r);a=a.substring(0,n.from)+s+a.substring(n.to)}}return a};t.prototype.getBlockIndexFromPosition=function(t){var e=this.list.reduce((function(t,e){return t+e.to-e.from}),0);if(t===e){return this.list.length-1}var a=this.list.findIndex((function(e){return e.from<=t&&t<e.to}));return a<0?undefined:Math.min(e,a)};t.prototype.verifyCallOfNextSeparator=function(t,e){if(this.list.length-1>e){var a=this.list[e+1];if(a.isSeparator&&a.mask===t){return true}}return false};return t}();var AbstractMask=function(){function t(t){if(t===void 0){t=[]}this.inputMode="text";this.locale="de-CH";this.blocks=new MaskBlockList(t)}t.prototype.onLocaleChange=function(t,e,a){if(t.target){var i=t.value;var n=i.split("");for(var r=0;r<n.length;r++){var s=n[r];var l=this.blocks.findByIndex(r);var o=a.findByIndex(r);if(l&&o){if(l.isSeparator){n[r]=l.mask}else if(s===o.mask){n[r]=l.mask}}}t.value=n.join("")}};t.prototype.onFocus=function(t){};t.prototype.onBlur=function(t){};t.prototype.onChange=function(t){t.submit("change",this.onParseValue(t.value))};t.prototype.onNavigationDown=function(t,e,a){};t.prototype.onSelectAll=function(t,e,a){};t.prototype.onPaste=function(t,e,a){var i=t.clipboardData||"";t.value=i;t.position.toEnd()};t.prototype.onBlockChange=function(t,e,a){t.setChar();t.position.next();var i=this.blocks.list[a+1];if(t.position.value===e.to&&i&&i.isSeparator){t.position.next()}};t.prototype.onBackspaceDown=function(t,e,a){t.position.previous();if(!e.isSeparator){t.setChar(e.mask);var i=this.blocks.list[a-1];if(t.position.value===e.from&&i&&i.isSeparator){t.position.previous()}}};t.prototype.onDeleteDown=function(t,e,a){t.setChar(e.mask);t.position.next();var i=this.blocks.list[a+1];if(t.position.value===e.to&&i&&i.isSeparator){t.position.next()}};t.prototype.onValueChanged=function(t){var e=this.onFormatValue(t.newValue);var a=t.focused&&e===""?this.blocks.getPlaceholderMask():e;t.value=a;t.position.toEnd()};t.prototype.onParseValue=function(t,e){if(e===void 0){e={allowInvalidValue:false}}if(t){return t.trim()}return t||""};t.prototype.onFormatValue=function(t){if(t){return t.trim()}return t||""};t.prototype.toParsedValue=function(t){return this.onParseValue(t)};t.prototype.toFormattedValue=function(t){return this.onFormatValue(t)};t.prototype.fireI18nChange=function(t){var e=this.blocks.clone();var a="".concat(t.locale);this.locale=t.locale;this.blocks.list.forEach((function(e){return e.onI18nChange(t.locale)}));this.onLocaleChange(t,a,e)};t.prototype.fireValueChanged=function(t){if(t.didValueChange){this.onValueChanged(t)}};t.prototype.firePaste=function(t){var e=this.blocks.getBlockIndexFromPosition(t.position.value);if(e!==undefined){var a=this.blocks.list[e];this.onPaste(t,a,e);this.onChange(t)}};t.prototype.fireClick=function(t){var e=this.blocks.getPlaceholderMask();if(e===t.value){t.position.toStart()}};t.prototype.fireFocus=function(t){if(t.target&&t.isValueEmpty()){this.resetInputValueWithMask(t)}this.onFocus(t)};t.prototype.fireBlur=function(t){if(t.target){if(this.isValueEmptyMask(t)){this.emptyInputValue(t)}else{this.onBlur(t);t.submit("blur",this.onParseValue(t.value,{allowInvalidValue:t.component.allowInvalidValue}))}}};t.prototype.fireKeyDown=function(t){var e=t.isBackspaceKey?Math.max(0,t.position.value-1):t.position.value;var a=this.blocks.getBlockIndexFromPosition(e);if(e>=this.blocks.lastPosition&&!t.isNavigationKey&&!t.isSelectAllCommand){t.preventDefault();t.stopPropagation();return}if(a!==undefined&&!t.position.isRangeSelection){var i=this.blocks.list[a];if(t.isNavigationKey){this.onNavigationDown(t,i,a)}else if(t.isSelectAllCommand){this.onSelectAll(t,i,a)}else if(t.isCopyCommand);else if(t.isPasteCommand);else if(t.isBackspaceKey){t.preventDefault();this.onBackspaceDown(t,i,a)}else if(t.isDeleteKey){t.preventDefault();this.onDeleteDown(t,i,a)}else if(t.isWhiteSpaceKey){t.preventDefault();var n=t.value[t.position.value];if(n==="."){t.stopPropagation();var r=t.value;t.value=r.substring(0,t.position.value)+"_"+r.substring(t.position.value+1)}}else if(i.verifyAllowedKeyHits(t.key)){t.preventDefault();this.onBlockChange(t,i,a)}else if(this.blocks.verifyCallOfNextSeparator(t.key,a)){t.preventDefault();var s=this.blocks.list[a];if(t.position.value>s.from){var l=this.blocks.list[a+1];var r=t.value;var o=i.getValueOfTheBlock(r);var u=i.format(o);t.value=r.substring(0,i.from)+u+r.substring(i.to);t.position.value=l.to}}var d=this.blocks.getBlockIndexFromPosition(t.position.value);if(d&&!t.isBackspaceKey){var c=this.blocks.formatBlocks(t.value,d);var h=t.position.value;t.value=c;t.position.value=h}}else{if(!t.isTabKey){t.preventDefault()}if(t.isBackspaceKey||t.isDeleteKey){this.resetInputValueWithMask(t)}else if(this.blocks.list[0].verifyAllowedKeyHits(t.key)){this.onBlockChange(t,this.blocks.list[0],0)}}};t.prototype.resetInputValueWithMask=function(t){t.value=this.blocks.getPlaceholderMask();t.position.toStart()};t.prototype.isValueEmptyMask=function(t){var e=this.blocks.getPlaceholderMask();return e===t.value};t.prototype.emptyInputValue=function(t){t.value="";t.submit("blur",t.value)};return t}();var DateMask=function(t){__extends(e,t);function e(){var e=t.call(this,[new MaskBlock({from:0,to:2,allowedKeys:__spreadArray([],NUMBER_KEYS,true),format:function(t,e,a){if(Number.isNaN(parseInt(t,10))){return"".concat(a).concat(a)}return t.padStart(2,"0")},mask:function(t){return e.dayMask[t.split("-")[0]]||e.dayMask["de"]}}),new MaskBlock({from:2,to:3,mask:function(t){return dateSeparator(t)},isSeparator:true}),new MaskBlock({from:3,to:5,allowedKeys:__spreadArray([],NUMBER_KEYS,true),format:function(t,e,a){if(Number.isNaN(parseInt(t,10))){return"".concat(a).concat(a)}return t.padStart(2,"0")},mask:function(t){return e.monthMask[t.split("-")[0]]||e.monthMask["de"]}}),new MaskBlock({from:5,to:6,mask:function(t){return dateSeparator(t)},isSeparator:true}),new MaskBlock({from:6,to:10,allowedKeys:__spreadArray([],NUMBER_KEYS,true),mask:function(t){return e.yearMask[t.split("-")[0]]||e.yearMask["de"]}})])||this;e.maxLength=10;e.minLength=10;e.inputMode="decimal";e.dayMask={de:"T",en:"D",fr:"J",it:"G",nl:"D",es:"D",pl:"D",pt:"D",sv:"D",fi:"M"};e.monthMask={de:"M",en:"M",fr:"M",it:"M",nl:"M",es:"M",pl:"M",pt:"M",sv:"M",fi:"K"};e.yearMask={de:"J",en:"Y",fr:"A",it:"A",nl:"J",es:"A",pl:"R",pt:"A",sv:"Å",fi:"V"};return e}e.prototype.onParseValue=function(t,e){if(e===void 0){e={allowInvalidValue:false}}if(t){var a=BalDate.fromAnyFormat(this.blocks.getRawValueWithoutMask(t));if(a.isValid){return a.toISODate()}else if(e&&e.allowInvalidValue){return INVALID_VALUE}}return""};e.prototype.onFormatValue=function(t){if(t){var e=BalDate.fromISO(t);if(e.isValid){return e.toFormat()}}return""};e.prototype.onPaste=function(t,e,a){var i=t.clipboardData||"";var n=BalDate.fromAnyFormat(i);if(n.isValid){t.value=n.toFormat();t.position.toEnd()}};e.prototype.onBlur=function(t){var e=this.blocks.getRawValueWithoutMaskByContext(t);var a=BalDate.fromAnyFormat(e);if(a.isValid){var i=a.toFormat();if(i!==t.value){t.value=i}}else if(t.component.allowInvalidValue){if(e!==t.value){t.value=e}}};return e}(AbstractMask);var MaskComponentAdapter=function(){function t(t){this.mask=t}Object.defineProperty(t.prototype,"attributes",{get:function(){return{inputMode:this.mask.inputMode,maxLength:this.mask.maxLength,minLength:this.mask.minLength,type:"text",autoCapitalize:"off",autoCorrect:"off",spellcheck:false}},enumerable:false,configurable:true});t.prototype.bindComponent=function(t){this.component=t};t.prototype.bindComponentDidLoad=function(){if(this.component&&this.component.nativeInput){this.component.nativeInput.value=this.component.value||""}this.bindValueChanged(this.component.value,undefined)};t.prototype.bindConfigChanged=function(t){var e=this,a=e.component,i=e.mask;var n=new MaskLocaleContext({component:a,mask:i,event:{locale:"".concat(t.language,"-").concat(t.region)}});this.mask.fireI18nChange(n);n.submit()};t.prototype.bindValueChanged=function(t,e){var a=this,i=a.component,n=a.mask;var r=new MaskValueChangedContext({component:i,mask:n,event:{newValue:t,oldValue:e}});this.mask.fireValueChanged(r);r.submit("blur")};t.prototype.bindKeyDown=function(t){if(this.isComponentAccessible){var e=this,a=e.component,i=e.mask;var n=new MaskKeyboardContext({event:t,component:a,mask:i});this.mask.fireKeyDown(n);var r=t.key==="Tab";n.submit(r?"tab":"input");a.balKeyPress.emit(t)}};t.prototype.bindFocus=function(t){if(this.isComponentAccessible){var e=this,a=e.component,i=e.mask;a.focused=true;var n=new MaskFocusContext({event:t,component:a,mask:i});this.mask.fireFocus(n);n.submit();a.balFocus.emit(t)}};t.prototype.bindBlur=function(t){if(this.isComponentAccessible){var e=this,a=e.component,i=e.mask;a.focused=false;var n=new MaskFocusContext({event:t,component:a,mask:i});this.mask.fireBlur(n);n.submit("blur");a.balBlur.emit(t)}};t.prototype.bindPaste=function(t){if(this.isComponentAccessible){var e=this,a=e.component,i=e.mask;var n=new MaskClipboardContext({event:t,component:a,mask:i});this.mask.firePaste(n);n.submit()}};t.prototype.bindFormReset=function(t){var e=this;var a=t.target;if(a&&(a===this.component.el||a.contains(this.component.el))){this.component.value=this.component.initialValue;this.component.inputValue=this.component.initialValue;clearTimeout(this.resetHandlerTimer);this.resetHandlerTimer=setTimeout((function(){if(e.component.nativeInput){e.component.nativeInput.value=e.mask.toFormattedValue(e.component.value||"")}}))}};t.prototype.bindClick=function(t){if(this.isComponentAccessible){var e=this,a=e.component,i=e.mask;var n=new MaskMouseContext({event:t,component:a,mask:i});this.mask.fireClick(n);n.submit()}};t.prototype.bindHostClick=function(t){if(!this.isComponentAccessible){t.preventDefault();t.stopPropagation()}};t.prototype.bindGlobalClick=function(t){if(!this.isComponentAccessible){if(t.target&&t.target===this.component.el){t.preventDefault();t.stopPropagation()}}};Object.defineProperty(t.prototype,"isComponentAccessible",{get:function(){return!this.component.disabled&&!this.component.readonly},enumerable:false,configurable:true});return t}();var balInputDateCss=".bal-input-date{display:block;width:100%;-ms-flex:1;flex:1}.bal-input-date input:not(:-moz-placeholder-shown){letter-spacing:.4px}.bal-input-date input:not(:-ms-input-placeholder){letter-spacing:.4px}.bal-input-date input:not(:placeholder-shown){letter-spacing:.4px}.bal-input-date__native{position:absolute !important;left:0;top:0;margin:0;padding:0;opacity:0;outline:0;border:none;width:1px;height:1px;clip:rect(1px, 1px, 1px, 1px);overflow:hidden}";var InputDate=function(){function t(t){registerInstance(this,t);this.balKeyPress=createEvent(this,"balKeyPress");this.balChange=createEvent(this,"balChange");this.balInput=createEvent(this,"balInput");this.balBlur=createEvent(this,"balBlur");this.balFocus=createEvent(this,"balFocus");this.inputId="bal-i-date-".concat(inputDateIds++);this.inheritedAttributes={};this.maskAdapter=new MaskComponentAdapter(new DateMask);this.focused=false;this.isGrouped=false;this.ariaForm=defaultBalAriaForm;this.name=this.inputId;this.invalid=false;this.required=false;this.disabled=false;this.readonly=false;this.clickable=false;this.autocomplete="off";this.hasIconRight=false;this.value=undefined;this.inputValue=this.value;this.initialValue=this.value||"";this.autoInvalidOff=false;this.allowInvalidValue=false}t.prototype.createLogger=function(t){this.log=t};t.prototype.valueChanged=function(t,e){this.maskAdapter.bindValueChanged(t,e)};t.prototype.connectedCallback=function(){this.maskAdapter.bindComponent(this);this.isGrouped=hasParent("bal-input-group",this.el)};t.prototype.componentDidLoad=function(){this.maskAdapter.bindComponentDidLoad()};t.prototype.componentWillRender=function(){this.inheritedAttributes=inheritAttributes(this.el,["aria-label","tabindex","title"])};t.prototype.configChanged=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.maskAdapter.bindConfigChanged(t);return[2]}))}))};t.prototype.resetHandler=function(t){this.maskAdapter.bindFormReset(t)};t.prototype.listenOnClick=function(t){this.maskAdapter.bindGlobalClick(t)};t.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){inputSetFocus(this);return[2]}))}))};t.prototype.setBlur=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){inputSetBlur(this);return[2]}))}))};t.prototype.getInputElement=function(){return Promise.resolve(this.nativeInput)};t.prototype.setAriaForm=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.ariaForm=Object.assign({},t);return[2]}))}))};t.prototype.render=function(){var t=this;var e=BEM.block("input-date");var a=e.element("native");return h(Host,{key:"f40927d913ec705fdc87137c6b47aadd7549f187",onClick:function(e){return t.maskAdapter.bindHostClick(e)},class:Object.assign({},e.class())},h("input",Object.assign({key:"175e4b3d9ff2df12c4b663bd4927dee2fddd14ab",class:{input:true,"is-disabled":this.disabled||this.readonly,"is-danger":this.invalid,"is-clickable":this.clickable&&!(this.disabled||this.readonly),"bal-focusable":!this.disabled,"has-icon-right":this.hasIconRight},"data-testid":"bal-date-input",ref:function(e){return t.nativeInput=e},id:this.ariaForm.controlId||this.inputId,"aria-labelledby":this.ariaForm.labelId,"aria-describedby":this.ariaForm.messageId,"aria-invalid":this.invalid===true?"true":"false","aria-disabled":ariaBooleanToString(this.disabled),required:this.required,disabled:this.disabled,readonly:this.readonly,autoComplete:this.autocomplete},this.maskAdapter.attributes,this.inheritedAttributes,{placeholder:this.placeholder,value:this.inputValue,onKeyDown:function(e){return t.maskAdapter.bindKeyDown(e)},onClick:function(e){return t.maskAdapter.bindClick(e)},onFocus:function(e){return t.maskAdapter.bindFocus(e)},onBlur:function(e){return t.maskAdapter.bindBlur(e)},onPaste:function(e){return t.maskAdapter.bindPaste(e)}})),h("input",{key:"c1dfb6ccecd24a345e3de3dfb33e436dfbf98615",type:"date",class:Object.assign({},a.class()),name:this.name,min:this.min,max:this.max,value:this.value,tabindex:-1,"aria-hidden":"true"}))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{value:["valueChanged"]}},enumerable:false,configurable:true});return t}();__decorate([Logger("bal-input-date"),__metadata("design:type",Function),__metadata("design:paramtypes",[Function]),__metadata("design:returntype",void 0)],InputDate.prototype,"createLogger",null);__decorate([ListenToConfig(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],InputDate.prototype,"configChanged",null);var inputDateIds=0;InputDate.style=balInputDateCss;export{DateCalendar as bal_date_calendar,InputDate as bal_input_date};
@@ -1 +1 @@
1
- import{__awaiter,__generator}from"tslib";import{L as Logger,H as registerInstance,P as createEvent,f as defaultConfig,J as rIC,T as debounceEvent,a as balBrowser,R as addEventListener,S as removeEventListener,y as waitAfterIdleCallback,M as h,N as Host,O as getElement}from"./index-BtpJmRB8.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-dfXERft2.js";import{b as isEscapeKey}from"./index.esm-Btc0yydR.js";import{a as ariaBooleanToString}from"./aria-DBsOHTWj.js";import{i as inheritAttributes}from"./attributes-C4sZQbkT.js";import{B as BEM}from"./bem-ByiN-QjD.js";import{L as ListenToConfig}from"./config.decorator-CIdA1I1h.js";import{B as BalDate,i as i18nBalDate}from"./date-DPdjnaiY.js";import{b as balFloatingUi}from"./floating-ui-DbGhJUAh.js";import{F as FOCUS_KEYS}from"./focus-visible-DqCbGYzv.js";import{d as defaultBalAriaForm}from"./form-FCLKfv6B.js";import{s as stopEventBubbling}from"./form-input-C2vJzMPS.js";import{d as isSpaceKey}from"./keyboard.helpers-D1VPLQ5z.js";import"./index-zWZxKBfo.js";import"./_commonjsHelpers-BFTU3MAI.js";import"./index-B4k_dH6V.js";import"./index-BU7FUSdu.js";import"./index-D6JOtC1P.js";var balDateCss=":root{--bal-date-popup-z-index:var(--bal-z-index-tooltip);--bal-date-popup-shadow:var(--bal-shadow-normal);--bal-date-popup-radius:var(--bal-radius-normal)}:root{--bal-z-index-tooltip:1300}.bal-date{display:block;font-family:var(--bal-font-family-text);width:100%}.bal-date__icon--clickable{cursor:pointer}.bal-date__popup{display:none;width:-webkit-max-content;width:-moz-max-content;width:max-content;position:absolute;top:0;left:0;z-index:var(--bal-date-popup-z-index);-webkit-box-shadow:var(--bal-date-popup-shadow);box-shadow:var(--bal-date-popup-shadow);border-radius:var(--bal-date-popup-radius)}.bal-date__popup--visible{display:block}";var Date=function(){function t(t){var e=this;registerInstance(this,t);this.balInput=createEvent(this,"balInput");this.balChange=createEvent(this,"balChange");this.balWillAnimate=createEvent(this,"balWillAnimate");this.balDidAnimate=createEvent(this,"balDidAnimate");this.balBlur=createEvent(this,"balBlur");this.balFocus=createEvent(this,"balFocus");this.balInputClick=createEvent(this,"balInputClick");this.balIconClick=createEvent(this,"balIconClick");this.inputId="bal-da-".concat(dateIds++);this.inheritedAttributes={};this.isKeyboardMode=false;this.hasFocus=false;this.isExpanded=false;this.language=defaultConfig.language;this.ariaForm=defaultBalAriaForm;this.name=this.inputId;this.invalid=false;this.required=false;this.disabled=false;this.readonly=false;this.freeSolo=false;this.triggerIcon=false;this.closeOnSelect=true;this.autocomplete="off";this.value=undefined;this.allowedDates=undefined;this.allowInvalidValue=false;this.debounce=0;this.autoInvalidOff=false;this.hasConnected=false;this.handleKeydown=function(t){e.isKeyboardMode=FOCUS_KEYS.includes(t.key)};this.handlePointerDown=function(){e.isKeyboardMode=false};this.handleOutsideClick=function(t){if(e.isExpanded){if(!e.el.contains(t.target)){e.isExpanded=false;e.hasFocus=false;rIC((function(){return e.balBlur.emit(t)}))}}};this.handleFocus=function(t){stopEventBubbling(t);e.hasFocus=true;e.balFocus.emit(t.detail)};this.handleBlur=function(t){stopEventBubbling(t);if(!e.isExpanded){e.hasFocus=false;rIC((function(){return e.balBlur.emit(t.detail)}))}};this.onIconClick=function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!this.triggerIcon)return[3,2];return[4,this.toggle()];case 1:t.sent();return[3,4];case 2:return[4,this.open()];case 3:t.sent();t.label=4;case 4:return[2]}}))}))};this.onInputClick=function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!!this.triggerIcon)return[3,2];return[4,this.open()];case 1:t.sent();t.label=2;case 2:return[2]}}))}))};this.onCalendarChange=function(t){stopEventBubbling(t);e.value=t.detail;e.balChange.emit(e.value);if(e.closeOnSelect){e.close();e.hasFocus=false;rIC((function(){return e.balBlur.emit()}))}};this.onInputInput=function(t){stopEventBubbling(t);e.balInput.emit(t.detail);if(t.detail){var i=BalDate.fromAnyFormat(t.detail);if(i.isValid){e.calendarValue=i.toISODate()}}};this.onInputChange=function(t){stopEventBubbling(t);e.value=t.detail;e.balChange.emit(e.value)};this.onKeyPress=function(t){return __awaiter(e,[t],void 0,(function(t){var e=t.detail;return __generator(this,(function(t){switch(t.label){case 0:if(!(e&&e.key))return[3,5];if(!this.isExpanded)return[3,3];if(!(e.key==="Tab"||isEscapeKey(e)||isSpaceKey(e)))return[3,2];return[4,this.close()];case 1:t.sent();t.label=2;case 2:return[3,5];case 3:if(!isSpaceKey(e))return[3,5];return[4,this.open()];case 4:t.sent();t.label=5;case 5:return[2]}}))}))}}t.prototype.createLogger=function(t){this.log=t};t.prototype.valueChanged=function(){this.calendarValue=this.value};t.prototype.debounceChanged=function(){this.balChange=debounceEvent(this.balChange,this.debounce)};t.prototype.connectedCallback=function(){if(balBrowser.hasDocument){addEventListener(document,"keydown",this.handleKeydown);addEventListener(document,"touchstart",this.handlePointerDown);addEventListener(document,"mousedown",this.handlePointerDown);addEventListener(document,"click",this.handleOutsideClick)}this.hasConnected=true;this.valueChanged()};t.prototype.disconnectedCallback=function(){if(balBrowser.hasDocument){removeEventListener(document,"keydown",this.handleKeydown);removeEventListener(document,"touchstart",this.handlePointerDown);removeEventListener(document,"mousedown",this.handlePointerDown);removeEventListener(document,"click",this.handleOutsideClick)}};t.prototype.componentWillLoad=function(){this.inheritedAttributes=inheritAttributes(this.el,["aria-label","tabindex","title"])};t.prototype.configChanged=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.language=t.language;return[2]}))}))};t.prototype.open=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.expand()]}))}))};t.prototype.close=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.collapse()]}))}))};t.prototype.toggle=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.isExpanded){return[2,this.collapse()]}else{return[2,this.expand()]}return[2]}))}))};t.prototype.select=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){e=BalDate.fromISO(t);if(e.isValid){this.value=e.toISODate();this.calendarValue=this.value}return[2]}))}))};t.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!(this.inputEl&&!this.disabled&&!this.readonly))return[3,2];return[4,waitAfterIdleCallback()];case 1:t.sent();this.inputEl.focus();t.label=2;case 2:return[2]}}))}))};t.prototype.setBlur=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){switch(e.label){case 0:if(!(this.inputEl&&!this.disabled&&!this.readonly))return[3,2];return[4,waitAfterIdleCallback()];case 1:e.sent();(t=this.inputEl)===null||t===void 0?void 0:t.setBlur();e.label=2;case 2:return[2]}}))}))};t.prototype.getInputElement=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){return[2,(t=this.inputEl)===null||t===void 0?void 0:t.getInputElement()]}))}))};t.prototype.setAriaForm=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){this.ariaForm=Object.assign({},t);(e=this.inputEl)===null||e===void 0?void 0:e.setAriaForm(t);return[2]}))}))};t.prototype.expand=function(){return __awaiter(this,void 0,void 0,(function(){var t;var e=this;return __generator(this,(function(i){switch(i.label){case 0:if(!(this.referenceEl&&this.floatingEl))return[3,2];return[4,balFloatingUi.load()];case 1:t=i.sent();this.balWillAnimate.emit();this.isExpanded=true;this.popupCleanup=t.autoUpdate(this.referenceEl,this.floatingEl,(function(){e.updatePosition(e.referenceEl,e.floatingEl)}));i.label=2;case 2:return[2,this.isExpanded]}}))}))};t.prototype.collapse=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.floatingEl){this.balWillAnimate.emit();this.isExpanded=false;if(this.popupCleanup){this.popupCleanup()}this.balDidAnimate.emit()}return[2,this.isExpanded]}))}))};t.prototype.updatePosition=function(t,e){return __awaiter(this,void 0,void 0,(function(){var i;var n=this;return __generator(this,(function(a){switch(a.label){case 0:return[4,balFloatingUi.load()];case 1:i=a.sent();i.computePosition(t,e,{placement:"bottom-start",middleware:[i.offset(4),i.flip({crossAxis:false})]}).then((function(t){var i=t.x,a=t.y;Object.assign(e.style,{left:"".concat(i,"px"),top:"".concat(a,"px")});n.balDidAnimate.emit()}));return[2]}}))}))};t.prototype.render=function(){var t=this;var e=BEM.block("date");var i=e.element("icon");var n=e.element("popup");return h(Host,{key:"df763339a5267bc106d30ca6cc3d62bc75c8f05f",id:this.inputId,class:Object.assign({},e.class())},h("bal-input-group",{key:"55d4f91e6b77f56f38274bb984be9dc21a54a5a4",invalid:this.invalid,readonly:this.readonly,disabled:this.disabled,ref:function(e){return t.referenceEl=e}},h("bal-input-date",Object.assign({key:"bf2b5f66aaf62f45f01e42cdd3e236707094d9dd",name:this.name,required:this.required,placeholder:this.placeholder,value:this.value,min:this.min,max:this.max,invalid:this.invalid,readonly:this.readonly,disabled:this.disabled,allowInvalidValue:this.allowInvalidValue,autocomplete:this.autocomplete,onClick:this.onInputClick,onBalInput:this.onInputInput,onBalChange:this.onInputChange,onBalFocus:function(e){return t.handleFocus(e)},onBalBlur:function(e){return t.handleBlur(e)},onBalKeyPress:this.onKeyPress,ref:function(e){return t.inputEl=e}},this.inheritedAttributes)),!this.freeSolo?h("bal-icon",{name:"date",role:"button",tabindex:-1,class:Object.assign(Object.assign({},i.class()),i.modifier("clickable").class(!this.disabled&&!this.readonly)),"is-right":true,color:this.disabled||this.readonly?"grey":this.invalid?"danger":"primary",onClick:this.onIconClick,"aria-label":i18nBalDate[this.language].toggleDatepicker,"aria-haspopup":"true","aria-expanded":ariaBooleanToString(this.isExpanded)}):""),h("div",{key:"828597483d6ccc05c8fa9059b7d64941d8edc3d8",role:"dialog",class:Object.assign(Object.assign({},n.class()),n.modifier("visible").class(this.isExpanded)),ref:function(e){return t.floatingEl=e},"aria-hidden":"".concat(this.isExpanded!==true),"aria-presented":"".concat(this.isExpanded===true)},h("bal-date-calendar",{key:"781a4f0d0b8ebc2c8b05a883e9441f4483e25820",value:this.calendarValue,min:this.min,max:this.max,minYearProp:this.minYearProp,maxYearProp:this.maxYearProp,defaultDate:this.defaultDate,allowedDates:this.allowedDates,onBalChange:this.onCalendarChange})))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{value:["valueChanged"],debounce:["debounceChanged"]}},enumerable:false,configurable:true});return t}();__decorate([Logger("bal-date"),__metadata("design:type",Function),__metadata("design:paramtypes",[Function]),__metadata("design:returntype",void 0)],Date.prototype,"createLogger",null);__decorate([ListenToConfig(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],Date.prototype,"configChanged",null);var dateIds=0;Date.style=balDateCss;export{Date as bal_date};
1
+ import{__awaiter,__generator}from"tslib";import{L as Logger,H as registerInstance,P as createEvent,f as defaultConfig,J as rIC,T as debounceEvent,a as balBrowser,R as addEventListener,S as removeEventListener,y as waitAfterIdleCallback,M as h,N as Host,O as getElement}from"./index-BtpJmRB8.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-dfXERft2.js";import{b as isEscapeKey}from"./index.esm-Btc0yydR.js";import{a as ariaBooleanToString}from"./aria-DBsOHTWj.js";import{i as inheritAttributes}from"./attributes-C4sZQbkT.js";import{B as BEM}from"./bem-ByiN-QjD.js";import{L as ListenToConfig}from"./config.decorator-CIdA1I1h.js";import{B as BalDate}from"./date-B_izjCbq.js";import{b as balFloatingUi}from"./floating-ui-DbGhJUAh.js";import{F as FOCUS_KEYS}from"./focus-visible-DqCbGYzv.js";import{d as defaultBalAriaForm}from"./form-FCLKfv6B.js";import{s as stopEventBubbling}from"./form-input-C2vJzMPS.js";import{d as isSpaceKey}from"./keyboard.helpers-D1VPLQ5z.js";import{i as i18nBalDate}from"./bal-date.i18n-CLs4UZCO.js";import"./index-zWZxKBfo.js";import"./_commonjsHelpers-BFTU3MAI.js";import"./index-B4k_dH6V.js";import"./index-BU7FUSdu.js";import"./index-D6JOtC1P.js";var balDateCss=":root{--bal-date-popup-z-index:var(--bal-z-index-tooltip);--bal-date-popup-shadow:var(--bal-shadow-normal);--bal-date-popup-radius:var(--bal-radius-normal)}:root{--bal-z-index-tooltip:1300}.bal-date{display:block;font-family:var(--bal-font-family-text);width:100%}.bal-date__icon--clickable{cursor:pointer}.bal-date__popup{display:none;width:-webkit-max-content;width:-moz-max-content;width:max-content;position:absolute;top:0;left:0;z-index:var(--bal-date-popup-z-index);-webkit-box-shadow:var(--bal-date-popup-shadow);box-shadow:var(--bal-date-popup-shadow);border-radius:var(--bal-date-popup-radius)}.bal-date__popup--visible{display:block}";var Date=function(){function t(t){var e=this;registerInstance(this,t);this.balInput=createEvent(this,"balInput");this.balChange=createEvent(this,"balChange");this.balWillAnimate=createEvent(this,"balWillAnimate");this.balDidAnimate=createEvent(this,"balDidAnimate");this.balBlur=createEvent(this,"balBlur");this.balFocus=createEvent(this,"balFocus");this.balInputClick=createEvent(this,"balInputClick");this.balIconClick=createEvent(this,"balIconClick");this.inputId="bal-da-".concat(dateIds++);this.inheritedAttributes={};this.isKeyboardMode=false;this.hasFocus=false;this.isExpanded=false;this.language=defaultConfig.language;this.ariaForm=defaultBalAriaForm;this.name=this.inputId;this.invalid=false;this.required=false;this.disabled=false;this.readonly=false;this.freeSolo=false;this.triggerIcon=false;this.closeOnSelect=true;this.autocomplete="off";this.value=undefined;this.allowedDates=undefined;this.allowInvalidValue=false;this.debounce=0;this.autoInvalidOff=false;this.hasConnected=false;this.handleKeydown=function(t){e.isKeyboardMode=FOCUS_KEYS.includes(t.key)};this.handlePointerDown=function(){e.isKeyboardMode=false};this.handleOutsideClick=function(t){if(e.isExpanded){if(!e.el.contains(t.target)){e.isExpanded=false;e.hasFocus=false;rIC((function(){return e.balBlur.emit(t)}))}}};this.handleFocus=function(t){stopEventBubbling(t);e.hasFocus=true;e.balFocus.emit(t.detail)};this.handleBlur=function(t){stopEventBubbling(t);if(!e.isExpanded){e.hasFocus=false;rIC((function(){return e.balBlur.emit(t.detail)}))}};this.onIconClick=function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!this.triggerIcon)return[3,2];return[4,this.toggle()];case 1:t.sent();return[3,4];case 2:return[4,this.open()];case 3:t.sent();t.label=4;case 4:return[2]}}))}))};this.onInputClick=function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!!this.triggerIcon)return[3,2];return[4,this.open()];case 1:t.sent();t.label=2;case 2:return[2]}}))}))};this.onCalendarChange=function(t){stopEventBubbling(t);e.value=t.detail;e.balChange.emit(e.value);if(e.closeOnSelect){e.close();e.hasFocus=false;rIC((function(){return e.balBlur.emit()}))}};this.onInputInput=function(t){stopEventBubbling(t);e.balInput.emit(t.detail);if(t.detail){var i=BalDate.fromAnyFormat(t.detail);if(i.isValid){e.calendarValue=i.toISODate()}}};this.onInputChange=function(t){stopEventBubbling(t);e.value=t.detail;e.balChange.emit(e.value)};this.onKeyPress=function(t){return __awaiter(e,[t],void 0,(function(t){var e=t.detail;return __generator(this,(function(t){switch(t.label){case 0:if(!(e&&e.key))return[3,5];if(!this.isExpanded)return[3,3];if(!(e.key==="Tab"||isEscapeKey(e)||isSpaceKey(e)))return[3,2];return[4,this.close()];case 1:t.sent();t.label=2;case 2:return[3,5];case 3:if(!isSpaceKey(e))return[3,5];return[4,this.open()];case 4:t.sent();t.label=5;case 5:return[2]}}))}))}}t.prototype.createLogger=function(t){this.log=t};t.prototype.valueChanged=function(){this.calendarValue=this.value};t.prototype.debounceChanged=function(){this.balChange=debounceEvent(this.balChange,this.debounce)};t.prototype.connectedCallback=function(){if(balBrowser.hasDocument){addEventListener(document,"keydown",this.handleKeydown);addEventListener(document,"touchstart",this.handlePointerDown);addEventListener(document,"mousedown",this.handlePointerDown);addEventListener(document,"click",this.handleOutsideClick)}this.hasConnected=true;this.valueChanged()};t.prototype.disconnectedCallback=function(){if(balBrowser.hasDocument){removeEventListener(document,"keydown",this.handleKeydown);removeEventListener(document,"touchstart",this.handlePointerDown);removeEventListener(document,"mousedown",this.handlePointerDown);removeEventListener(document,"click",this.handleOutsideClick)}};t.prototype.componentWillLoad=function(){this.inheritedAttributes=inheritAttributes(this.el,["aria-label","tabindex","title"])};t.prototype.configChanged=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.language=t.language;return[2]}))}))};t.prototype.open=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.expand()]}))}))};t.prototype.close=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.collapse()]}))}))};t.prototype.toggle=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.isExpanded){return[2,this.collapse()]}else{return[2,this.expand()]}return[2]}))}))};t.prototype.select=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){e=BalDate.fromISO(t);if(e.isValid){this.value=e.toISODate();this.calendarValue=this.value}return[2]}))}))};t.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(!(this.inputEl&&!this.disabled&&!this.readonly))return[3,2];return[4,waitAfterIdleCallback()];case 1:t.sent();this.inputEl.focus();t.label=2;case 2:return[2]}}))}))};t.prototype.setBlur=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){switch(e.label){case 0:if(!(this.inputEl&&!this.disabled&&!this.readonly))return[3,2];return[4,waitAfterIdleCallback()];case 1:e.sent();(t=this.inputEl)===null||t===void 0?void 0:t.setBlur();e.label=2;case 2:return[2]}}))}))};t.prototype.getInputElement=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){return[2,(t=this.inputEl)===null||t===void 0?void 0:t.getInputElement()]}))}))};t.prototype.setAriaForm=function(t){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(i){this.ariaForm=Object.assign({},t);(e=this.inputEl)===null||e===void 0?void 0:e.setAriaForm(t);return[2]}))}))};t.prototype.expand=function(){return __awaiter(this,void 0,void 0,(function(){var t;var e=this;return __generator(this,(function(i){switch(i.label){case 0:if(!(this.referenceEl&&this.floatingEl))return[3,2];return[4,balFloatingUi.load()];case 1:t=i.sent();this.balWillAnimate.emit();this.isExpanded=true;this.popupCleanup=t.autoUpdate(this.referenceEl,this.floatingEl,(function(){e.updatePosition(e.referenceEl,e.floatingEl)}));i.label=2;case 2:return[2,this.isExpanded]}}))}))};t.prototype.collapse=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.floatingEl){this.balWillAnimate.emit();this.isExpanded=false;if(this.popupCleanup){this.popupCleanup()}this.balDidAnimate.emit()}return[2,this.isExpanded]}))}))};t.prototype.updatePosition=function(t,e){return __awaiter(this,void 0,void 0,(function(){var i;var n=this;return __generator(this,(function(a){switch(a.label){case 0:return[4,balFloatingUi.load()];case 1:i=a.sent();i.computePosition(t,e,{placement:"bottom-start",middleware:[i.offset(4),i.flip({crossAxis:false})]}).then((function(t){var i=t.x,a=t.y;Object.assign(e.style,{left:"".concat(i,"px"),top:"".concat(a,"px")});n.balDidAnimate.emit()}));return[2]}}))}))};t.prototype.render=function(){var t=this;var e=BEM.block("date");var i=e.element("icon");var n=e.element("popup");return h(Host,{key:"df763339a5267bc106d30ca6cc3d62bc75c8f05f",id:this.inputId,class:Object.assign({},e.class())},h("bal-input-group",{key:"55d4f91e6b77f56f38274bb984be9dc21a54a5a4",invalid:this.invalid,readonly:this.readonly,disabled:this.disabled,ref:function(e){return t.referenceEl=e}},h("bal-input-date",Object.assign({key:"bf2b5f66aaf62f45f01e42cdd3e236707094d9dd",name:this.name,required:this.required,placeholder:this.placeholder,value:this.value,min:this.min,max:this.max,invalid:this.invalid,readonly:this.readonly,disabled:this.disabled,allowInvalidValue:this.allowInvalidValue,autocomplete:this.autocomplete,onClick:this.onInputClick,onBalInput:this.onInputInput,onBalChange:this.onInputChange,onBalFocus:function(e){return t.handleFocus(e)},onBalBlur:function(e){return t.handleBlur(e)},onBalKeyPress:this.onKeyPress,ref:function(e){return t.inputEl=e}},this.inheritedAttributes)),!this.freeSolo?h("bal-icon",{name:"date",role:"button",tabindex:-1,class:Object.assign(Object.assign({},i.class()),i.modifier("clickable").class(!this.disabled&&!this.readonly)),"is-right":true,color:this.disabled||this.readonly?"grey":this.invalid?"danger":"primary",onClick:this.onIconClick,"aria-label":i18nBalDate[this.language].toggleDatepicker,"aria-haspopup":"true","aria-expanded":ariaBooleanToString(this.isExpanded)}):""),h("div",{key:"828597483d6ccc05c8fa9059b7d64941d8edc3d8",role:"dialog",class:Object.assign(Object.assign({},n.class()),n.modifier("visible").class(this.isExpanded)),ref:function(e){return t.floatingEl=e},"aria-hidden":"".concat(this.isExpanded!==true),"aria-presented":"".concat(this.isExpanded===true)},h("bal-date-calendar",{key:"781a4f0d0b8ebc2c8b05a883e9441f4483e25820",value:this.calendarValue,min:this.min,max:this.max,minYearProp:this.minYearProp,maxYearProp:this.maxYearProp,defaultDate:this.defaultDate,allowedDates:this.allowedDates,onBalChange:this.onCalendarChange})))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{value:["valueChanged"],debounce:["debounceChanged"]}},enumerable:false,configurable:true});return t}();__decorate([Logger("bal-date"),__metadata("design:type",Function),__metadata("design:paramtypes",[Function]),__metadata("design:returntype",void 0)],Date.prototype,"createLogger",null);__decorate([ListenToConfig(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],Date.prototype,"configChanged",null);var dateIds=0;Date.style=balDateCss;export{Date as bal_date};
@@ -0,0 +1 @@
1
+ var i18nBalDate={en:{toggleDatepicker:"Open datepicker",nextMonth:"Next month",previousMonth:"Previous month",selectMonth:"Select month and year"},fr:{toggleDatepicker:"Ouvrir le sélecteur de dates",nextMonth:"Mois suivant",previousMonth:"Mois précédent",selectMonth:"Sélectionner le mois et l'année"},it:{toggleDatepicker:"Apri il selettore della data",nextMonth:"Mese successivo",previousMonth:"Mese precedente",selectMonth:"Seleziona mese e anno"},nl:{toggleDatepicker:"Open datumkiezer",nextMonth:"Volgende maand",previousMonth:"Vorige maand",selectMonth:"Selecteer maand en jaar"},es:{toggleDatepicker:"Abrir selector de fechas",nextMonth:"Mes siguiente",previousMonth:"Mes anterior",selectMonth:"Seleccionar mes y año"},pt:{toggleDatepicker:"Abrir seletor de datas",nextMonth:"Próximo mês",previousMonth:"Mês anterior",selectMonth:"Selecionar mês e ano"},sv:{toggleDatepicker:"Öppna datumväljare",nextMonth:"Nästa månad",previousMonth:"Föregående månad",selectMonth:"Välj månad och år"},fi:{toggleDatepicker:"Avaa päivämäärän valitsin",nextMonth:"Seuraava kuukausi",previousMonth:"Edellinen kuukausi",selectMonth:"Valitse kuukausi ja vuosi"},de:{toggleDatepicker:"Öffne den Datumswähler",nextMonth:"Nächster Monat",previousMonth:"Vormonat",selectMonth:"Monat und Jahr auswählen"},pl:{toggleDatepicker:"Otwórz wybierak daty",nextMonth:"Następny miesiąc",previousMonth:"Poprzedni miesiąc",selectMonth:"Wybierz miesiąc i rok"}};export{i18nBalDate as i};
@@ -1 +1 @@
1
- import{__awaiter,__generator,__spreadArray}from"tslib";import{H as registerInstance,P as createEvent,r as deepReady,x as waitAfterFramePaint,M as h,N as Host,O as getElement}from"./index-BtpJmRB8.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-dfXERft2.js";import{L as ListenToMutation}from"./mutation.decorator-B31D1rO_.js";import{d as defaultBalAriaForm}from"./form-FCLKfv6B.js";import{B as BEM}from"./bem-ByiN-QjD.js";import"./listener-DI7AdrHk.js";var balFieldCss=":root{--bal-field-label-horizontal-width:33.3333%;--bal-field-label-column-gap:.5rem}.bal-field,.bal-field-label,.bal-field-control,.bal-field-message,.bal-field-hint{display:block;position:relative;font-family:var(--bal-font-family-text)}.bal-field-label{display:inline}.bal-field-label~.bal-field-control{margin-top:.25rem}.bal-field-hint{display:inline-block;margin-left:.25rem;height:1rem;width:1rem}.bal-field-hint__hint{position:absolute;top:2px;left:0}.bal-field-message{line-height:var(--bal-line-height-normal)}.bal-field-hidden{display:none !important;visibility:hidden !important}.bal-field-control{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;gap:.5rem}.bal-field-control .bal-input{-ms-flex:1;flex:1}@media screen and (max-width: 768px){.bal-field-control--expanded-on-mobile{-ms-flex-direction:column;flex-direction:column}.bal-field-control--expanded-on-mobile .bal-button,.bal-field-control--expanded-on-mobile .bal-button .button{width:100%}}.bal-field-message{margin-top:0 !important}.bal-field-control+.bal-field-message{min-height:1.375rem;line-height:1.375rem}.bal-field-control:not(:has(+.bal-field-message)){padding-bottom:1.375rem}.bal-field--horizontal{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-column-gap:var(--bal-field-label-column-gap);-moz-column-gap:var(--bal-field-label-column-gap);column-gap:var(--bal-field-label-column-gap);-ms-flex-align:center;align-items:center}.bal-field--horizontal .bal-field-label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-width:var(--bal-field-label-horizontal-width);max-width:var(--bal-field-label-horizontal-width);-ms-flex-pack:end;justify-content:flex-end;text-align:right;margin-bottom:0}.bal-field--horizontal .bal-field-control{-ms-flex:1;flex:1;padding-bottom:0;-ms-flex-item-align:end;align-self:flex-end}.bal-field--horizontal .bal-field-message{-ms-flex-preferred-size:100%;flex-basis:100%;margin-top:0 !important;margin-left:calc(var(--bal-field-label-horizontal-width) + var(--bal-field-label-column-gap))}.bal-field--horizontal .bal-field-hint{margin-left:0}.bal-field--horizontal .bal-field-hint .bal-hint{top:0}.bal-field--horizontal .bal-field-hint~.bal-field-message{margin-left:calc(var(--bal-field-label-horizontal-width) + var(--bal-field-label-column-gap)*2 + 1.125rem)}.bal-field--horizontal .bal-field-label~.bal-field-control{margin-top:0}";var Field=function(){function e(e){var i=this;registerInstance(this,e);this.balFormControlDidLoad=createEvent(this,"balFormControlDidLoad");this.fieldId="bal-field-".concat(FieldIds++);this.formControlElement=["bal-field-control"];this.inputElements=["bal-input","bal-number-input","bal-textarea","bal-select","bal-checkbox","bal-radio","bal-input-group","bal-date","bal-input-date","bal-input-stepper","bal-input-slider","bal-file-upload","bal-dropdown","bal-segment"];this.formElements=__spreadArray(__spreadArray([],this.formControlElement,true),["bal-field-label","bal-field-message"],false);this.required=undefined;this.horizontal=false;this.invalid=undefined;this.valid=false;this.disabled=undefined;this.readonly=undefined;this.loading=undefined;this.isDirectChild=function(e){if(!e){return false}var t=e.parentElement;if(!t){return false}if(t.nodeName.toLowerCase()==="bal-field"&&t!==i.el){return false}if(t===i.el){return true}return i.isDirectChild(t)};this.isVisible=function(e){if(!e){return false}return e.ariaHidden!=="true"};this.findDirectChild=function(e){var t=i.el.querySelector(e);var l=i.isDirectChild(t);if(l){if(i.isVisible(t)){return t}}return undefined};this.findDirectChildren=function(e){return e.map((function(e){return Array.from(i.el.querySelectorAll(e)).filter(i.isDirectChild).filter(i.isVisible)})).flat()};this.mutationObserverActive=true}e.prototype.requiredHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),["bal-field-label"],false),"required")};e.prototype.invalidHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),this.formElements,true),"invalid")};e.prototype.validHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),this.formElements,true),"valid")};e.prototype.disabledHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),this.formElements,true),"disabled")};e.prototype.readonlyHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),this.formElements,true),"readonly")};e.prototype.loadingHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),this.formControlElement,true),"loading")};e.prototype.connectedCallback=function(){this.triggerAllHandlers()};e.prototype.componentWillLoad=function(){this.triggerAllHandlers()};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.syncAriaAttributes()];case 1:e.sent();return[2]}}))}))};e.prototype.syncAriaAttributes=function(){return __awaiter(this,void 0,void 0,(function(){var e,i,t,l,a,n;return __generator(this,(function(r){switch(r.label){case 0:return[4,deepReady(this.el)];case 1:r.sent();return[4,waitAfterFramePaint()];case 2:r.sent();e=this.findDirectChild("bal-field-label bal-label");i=this.findDirectChild("bal-field-message");t=this.findDirectChildren(["bal-field-control bal-input","bal-field-control bal-select","bal-field-control bal-input-date","bal-field-control bal-dropdown","bal-field-control bal-checkbox","bal-field-control bal-radio","bal-field-control bal-segment","bal-field-control bal-segment-item","bal-field-control bal-checkbox-group","bal-field-control bal-radio-group","bal-field-control bal-number-input","bal-field-control bal-time-input","bal-field-control bal-input-slider","bal-field-control bal-input-stepper","bal-field-control bal-textarea","bal-field-control bal-file-upload"]);l=Object.assign({},defaultBalAriaForm);if(e){l.labelId="".concat(this.fieldId,"-lbl")}if(i){l.messageId="".concat(this.fieldId,"-msg")}a=0;r.label=3;case 3:if(!(a<t.length))return[3,10];n=t[a];if(!(a===0))return[3,7];l.controlId="".concat(this.fieldId,"-ctrl");return[4,e===null||e===void 0?void 0:e.setAriaForm(l)];case 4:r.sent();return[4,i===null||i===void 0?void 0:i.setAriaForm(l)];case 5:r.sent();return[4,n===null||n===void 0?void 0:n.setAriaForm(l)];case 6:r.sent();return[3,9];case 7:l.controlId="".concat(this.fieldId,"-ctrl-").concat(a);return[4,n===null||n===void 0?void 0:n.setAriaForm(l)];case 8:r.sent();r.label=9;case 9:a++;return[3,3];case 10:return[2]}}))}))};e.prototype.mutationListener=function(){this.triggerAllHandlers();this.syncAriaAttributes()};e.prototype.triggerAllHandlers=function(){this.requiredHandler();this.invalidHandler();this.validHandler();this.readonlyHandler();this.disabledHandler();this.loadingHandler()};e.prototype.updateProps=function(e,i){var t=this[i];if(t!==undefined){this.notifyComponents(e,(function(e){return e[i]=t}))}};e.prototype.notifyComponents=function(e,i){var t=this.el.querySelectorAll(e.join(", "));t.forEach((function(e){return i(e)}))};e.prototype.render=function(){return h(Host,{key:"2d5f00847eed504077334ab0a99e7d8ec2d5e933",id:this.fieldId,class:{"bal-field":true,field:true,"bal-field--invalid":this.invalid===true,"bal-field--horizontal":this.horizontal===true}},h("slot",{key:"7e84f2c3b7a5070c3d44616d4f61c798ed201708"}),h("span",{key:"b7999bd90707cf04144c23ee94cf6ef5e8605ba1",class:"bal-field-hidden"}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{required:["requiredHandler"],invalid:["invalidHandler"],valid:["validHandler"],disabled:["disabledHandler"],readonly:["readonlyHandler"],loading:["loadingHandler"]}},enumerable:false,configurable:true});return e}();__decorate([ListenToMutation({subtree:false,waitAfterFramePrint:true}),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",void 0)],Field.prototype,"mutationListener",null);var FieldIds=0;Field.style=balFieldCss;var FieldControl=function(){function e(e){registerInstance(this,e);this.iconRight="";this.iconLeft="";this.expandedOnMobile=undefined;this.loading=false}Object.defineProperty(e.prototype,"buildIconLeftTemplate",{get:function(){if(this.iconLeft){return h("bal-icon",{name:this.iconLeft,color:"info",class:"is-left",size:"small"})}return""},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"buildIconRightTemplate",{get:function(){if(this.iconRight){return h("bal-icon",{name:this.iconRight,color:"info",class:"is-right",size:"small"})}return""},enumerable:false,configurable:true});e.prototype.render=function(){return h(Host,{key:"4aecfd6cf7bc49df8feb26cd3161af9174097fcc",class:{"bal-field-control":true,control:true,"has-icons-left":!!this.iconLeft,"has-icons-right":!!this.iconRight,"is-loading":this.loading,"bal-field-control--expanded-on-mobile":!!this.expandedOnMobile}},h("slot",{key:"b1d4c61b4ba0cbd96c11d5540e12dafcc4b2518e"}),this.buildIconLeftTemplate,this.buildIconRightTemplate)};return e}();var FieldHint=function(){function e(e){registerInstance(this,e);this.subject="";this.closeLabel="Close";this.small=false}e.prototype.render=function(){var e=BEM.block("field-hint");return h(Host,{key:"77490edbe70ab5796e9359501cc7c7c13b38ff35",class:Object.assign({},e.class())},h("bal-hint",{key:"51c69843812a75f1b22629fb76f25c99aeb5104e",class:Object.assign({},e.element("hint").class()),"data-testid":"bal-field-hint",closeLabel:this.closeLabel,small:this.small},this.subject?h("bal-hint-title",null,this.subject):"",h("bal-hint-text",{key:"68f54f8473467fcfbbe7dde4d1fed735f57bdcd7"},h("slot",{key:"568fcc10257812cd18401d15819916f9ea2fb312"}))))};return e}();var FieldLabel=function(){function e(e){registerInstance(this,e);this.htmlFor=undefined;this.required=true;this.valid=undefined;this.invalid=undefined;this.disabled=undefined;this.readonly=undefined;this.size="small";this.weight="bold"}e.prototype.componentDidLoad=function(){if(this.element){this.parentBalFieldElement=this.element.closest("bal-field");if(this.parentBalFieldElement){this.parentBalFieldElement.classList.add("has-label")}}};e.prototype.disconnectedCallback=function(){if(this.parentBalFieldElement){this.parentBalFieldElement.classList.remove("has-label")}};e.prototype.render=function(){return h(Host,{key:"049f3e7c80126a7ffbc005e6c69a1bdc8203979b",class:"bal-field-label"},h("bal-label",{key:"269ecb6de6a5daf2f4d4504b37f3980d05b1a121",multiline:true,size:this.size,htmlFor:this.htmlFor,required:this.required,valid:this.valid,invalid:this.invalid,disabled:this.disabled,readonly:this.readonly,weight:this.weight},h("slot",{key:"d832133cb85456ec6b7b1a999b5459044579e783"})))};Object.defineProperty(e.prototype,"element",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();var FieldMessage=function(){function e(e){registerInstance(this,e);this.ariaForm=defaultBalAriaForm;this.color="";this.invalid=false;this.valid=false;this.disabled=false;this.readonly=false}e.prototype.setAriaForm=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.ariaForm=Object.assign({},e);return[2]}))}))};e.prototype.render=function(){var e;return h(Host,{key:"61a31ecf947fffa55b3cb3e18fdf3c4fb4348437",id:this.ariaForm.messageId,class:(e={"bal-field-message":true,help:true,"is-danger":this.invalid,"is-success":this.valid,"is-disabled":this.disabled||this.readonly},e["is-".concat(this.color)]=!!this.color,e)},h("slot",{key:"94cabb752b176e43e39e290afadeb706a7fc64cb"}))};return e}();export{Field as bal_field,FieldControl as bal_field_control,FieldHint as bal_field_hint,FieldLabel as bal_field_label,FieldMessage as bal_field_message};
1
+ import{__awaiter,__generator,__spreadArray}from"tslib";import{H as registerInstance,P as createEvent,r as deepReady,x as waitAfterFramePaint,M as h,N as Host,O as getElement}from"./index-BtpJmRB8.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-dfXERft2.js";import{L as ListenToMutation}from"./mutation.decorator-B31D1rO_.js";import{d as defaultBalAriaForm}from"./form-FCLKfv6B.js";import{B as BEM}from"./bem-ByiN-QjD.js";import"./bal-file-upload.type-rBUN7c88.js";import{b as balBreakpoints}from"./breakpoints.subject-BUhfnNwa.js";import{L as ListenToBreakpoints}from"./breakpoints.decorator-B5g2J7uh.js";import"./date-B_izjCbq.js";import"./window-resize.subject-nsxIxT5E.js";import"./listener-DI7AdrHk.js";import"./device-D0RSC50t.js";import"./tokens.esm-Dal-cGiQ.js";var balFieldCss=":root{--bal-field-label-horizontal-width:33.3333%;--bal-field-label-column-gap:.5rem}.bal-field,.bal-field-label,.bal-field-control,.bal-field-message,.bal-field-hint{display:block;position:relative;font-family:var(--bal-font-family-text)}.bal-field-label{display:inline}.bal-field-label~.bal-field-control{margin-top:.25rem}.bal-field-hint{display:inline-block;margin-left:.25rem;height:1rem;width:1rem}.bal-field-hint__hint{position:absolute;top:2px;left:0}.bal-field-message{line-height:var(--bal-line-height-normal)}.bal-field-hidden{display:none !important;visibility:hidden !important}.bal-field-control{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;gap:.5rem}.bal-field-control .bal-input{-ms-flex:1;flex:1}@media screen and (max-width: 768px){.bal-field-control--expanded-on-mobile{-ms-flex-direction:column;flex-direction:column}.bal-field-control--expanded-on-mobile .bal-button,.bal-field-control--expanded-on-mobile .bal-button .button{width:100%}}.bal-field-message{margin-top:0 !important}.bal-field-control+.bal-field-message{min-height:1.375rem;line-height:1.375rem}.bal-field-control:not(:has(+.bal-field-message)){padding-bottom:1.375rem}.bal-field--horizontal{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-column-gap:var(--bal-field-label-column-gap);-moz-column-gap:var(--bal-field-label-column-gap);column-gap:var(--bal-field-label-column-gap);-ms-flex-align:center;align-items:center}.bal-field--horizontal .bal-field-label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-width:var(--bal-field-label-horizontal-width);max-width:var(--bal-field-label-horizontal-width);-ms-flex-pack:end;justify-content:flex-end;text-align:right;margin-bottom:0}.bal-field--horizontal .bal-field-control{-ms-flex:1;flex:1;padding-bottom:0;-ms-flex-item-align:end;align-self:flex-end}.bal-field--horizontal .bal-field-message{-ms-flex-preferred-size:100%;flex-basis:100%;margin-top:0 !important;margin-left:calc(var(--bal-field-label-horizontal-width) + var(--bal-field-label-column-gap))}.bal-field--horizontal .bal-field-hint{margin-left:0}.bal-field--horizontal .bal-field-hint .bal-hint{top:0}.bal-field--horizontal .bal-field-hint~.bal-field-message{margin-left:calc(var(--bal-field-label-horizontal-width) + var(--bal-field-label-column-gap)*2 + 1.125rem)}.bal-field--horizontal .bal-field-label~.bal-field-control{margin-top:0}";var Field=function(){function e(e){var i=this;registerInstance(this,e);this.balFormControlDidLoad=createEvent(this,"balFormControlDidLoad");this.fieldId="bal-field-".concat(FieldIds++);this.formControlElement=["bal-field-control"];this.inputElements=["bal-input","bal-number-input","bal-textarea","bal-select","bal-checkbox","bal-radio","bal-input-group","bal-date","bal-input-date","bal-input-stepper","bal-input-slider","bal-file-upload","bal-dropdown","bal-segment"];this.formElements=__spreadArray(__spreadArray([],this.formControlElement,true),["bal-field-label","bal-field-message"],false);this.required=undefined;this.horizontal=false;this.invalid=undefined;this.valid=false;this.disabled=undefined;this.readonly=undefined;this.loading=undefined;this.isDirectChild=function(e){if(!e){return false}var t=e.parentElement;if(!t){return false}if(t.nodeName.toLowerCase()==="bal-field"&&t!==i.el){return false}if(t===i.el){return true}return i.isDirectChild(t)};this.isVisible=function(e){if(!e){return false}return e.ariaHidden!=="true"};this.findDirectChild=function(e){var t=i.el.querySelector(e);var l=i.isDirectChild(t);if(l){if(i.isVisible(t)){return t}}return undefined};this.findDirectChildren=function(e){return e.map((function(e){return Array.from(i.el.querySelectorAll(e)).filter(i.isDirectChild).filter(i.isVisible)})).flat()};this.mutationObserverActive=true}e.prototype.requiredHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),["bal-field-label"],false),"required")};e.prototype.invalidHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),this.formElements,true),"invalid")};e.prototype.validHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),this.formElements,true),"valid")};e.prototype.disabledHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),this.formElements,true),"disabled")};e.prototype.readonlyHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),this.formElements,true),"readonly")};e.prototype.loadingHandler=function(){this.updateProps(__spreadArray(__spreadArray([],this.inputElements,true),this.formControlElement,true),"loading")};e.prototype.connectedCallback=function(){this.triggerAllHandlers()};e.prototype.componentWillLoad=function(){this.triggerAllHandlers()};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.syncAriaAttributes()];case 1:e.sent();return[2]}}))}))};e.prototype.syncAriaAttributes=function(){return __awaiter(this,void 0,void 0,(function(){var e,i,t,l,a,n;return __generator(this,(function(r){switch(r.label){case 0:return[4,deepReady(this.el)];case 1:r.sent();return[4,waitAfterFramePaint()];case 2:r.sent();e=this.findDirectChild("bal-field-label bal-label");i=this.findDirectChild("bal-field-message");t=this.findDirectChildren(["bal-field-control bal-input","bal-field-control bal-select","bal-field-control bal-input-date","bal-field-control bal-dropdown","bal-field-control bal-checkbox","bal-field-control bal-radio","bal-field-control bal-segment","bal-field-control bal-segment-item","bal-field-control bal-checkbox-group","bal-field-control bal-radio-group","bal-field-control bal-number-input","bal-field-control bal-time-input","bal-field-control bal-input-slider","bal-field-control bal-input-stepper","bal-field-control bal-textarea","bal-field-control bal-file-upload"]);l=Object.assign({},defaultBalAriaForm);if(e){l.labelId="".concat(this.fieldId,"-lbl")}if(i){l.messageId="".concat(this.fieldId,"-msg")}a=0;r.label=3;case 3:if(!(a<t.length))return[3,10];n=t[a];if(!(a===0))return[3,7];l.controlId="".concat(this.fieldId,"-ctrl");return[4,e===null||e===void 0?void 0:e.setAriaForm(l)];case 4:r.sent();return[4,i===null||i===void 0?void 0:i.setAriaForm(l)];case 5:r.sent();return[4,n===null||n===void 0?void 0:n.setAriaForm(l)];case 6:r.sent();return[3,9];case 7:l.controlId="".concat(this.fieldId,"-ctrl-").concat(a);return[4,n===null||n===void 0?void 0:n.setAriaForm(l)];case 8:r.sent();r.label=9;case 9:a++;return[3,3];case 10:return[2]}}))}))};e.prototype.mutationListener=function(){this.triggerAllHandlers();this.syncAriaAttributes()};e.prototype.triggerAllHandlers=function(){this.requiredHandler();this.invalidHandler();this.validHandler();this.readonlyHandler();this.disabledHandler();this.loadingHandler()};e.prototype.updateProps=function(e,i){var t=this[i];if(t!==undefined){this.notifyComponents(e,(function(e){return e[i]=t}))}};e.prototype.notifyComponents=function(e,i){var t=this.el.querySelectorAll(e.join(", "));t.forEach((function(e){return i(e)}))};e.prototype.render=function(){return h(Host,{key:"2d5f00847eed504077334ab0a99e7d8ec2d5e933",id:this.fieldId,class:{"bal-field":true,field:true,"bal-field--invalid":this.invalid===true,"bal-field--horizontal":this.horizontal===true}},h("slot",{key:"7e84f2c3b7a5070c3d44616d4f61c798ed201708"}),h("span",{key:"b7999bd90707cf04144c23ee94cf6ef5e8605ba1",class:"bal-field-hidden"}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{required:["requiredHandler"],invalid:["invalidHandler"],valid:["validHandler"],disabled:["disabledHandler"],readonly:["readonlyHandler"],loading:["loadingHandler"]}},enumerable:false,configurable:true});return e}();__decorate([ListenToMutation({subtree:false,waitAfterFramePrint:true}),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",void 0)],Field.prototype,"mutationListener",null);var FieldIds=0;Field.style=balFieldCss;var FieldControl=function(){function e(e){registerInstance(this,e);this.iconRight="";this.iconLeft="";this.expandedOnMobile=undefined;this.loading=false}Object.defineProperty(e.prototype,"buildIconLeftTemplate",{get:function(){if(this.iconLeft){return h("bal-icon",{name:this.iconLeft,color:"info",class:"is-left",size:"small"})}return""},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"buildIconRightTemplate",{get:function(){if(this.iconRight){return h("bal-icon",{name:this.iconRight,color:"info",class:"is-right",size:"small"})}return""},enumerable:false,configurable:true});e.prototype.render=function(){return h(Host,{key:"4aecfd6cf7bc49df8feb26cd3161af9174097fcc",class:{"bal-field-control":true,control:true,"has-icons-left":!!this.iconLeft,"has-icons-right":!!this.iconRight,"is-loading":this.loading,"bal-field-control--expanded-on-mobile":!!this.expandedOnMobile}},h("slot",{key:"b1d4c61b4ba0cbd96c11d5540e12dafcc4b2518e"}),this.buildIconLeftTemplate,this.buildIconRightTemplate)};return e}();var FieldHint=function(){function e(e){registerInstance(this,e);this.hideTitleOnDesktop=false;this.subject="";this.closeLabel="Close";this.small=false;this.isDesktop=balBreakpoints.isDesktop}e.prototype.breakpointListener=function(e){this.isDesktop=e.desktop};e.prototype.render=function(){var e=BEM.block("field-hint");return h(Host,{key:"a5f895c418c0dfa249da93d3bc39f5563d31b547",class:Object.assign({},e.class())},h("bal-hint",{key:"83d9c59c6fce044b361fbd471bf83780314c62e9",class:Object.assign({},e.element("hint").class()),"data-testid":"bal-field-hint",closeLabel:this.closeLabel,small:this.small},this.subject&&!(this.hideTitleOnDesktop&&this.isDesktop)?h("bal-hint-title",null,this.subject):"",h("bal-hint-text",{key:"38b6ef5120c8b5adef31a05ad54f474ed55305f5"},h("slot",{key:"040d24c305badac88e0bb64d21e513a067f6e177"}))))};return e}();__decorate([ListenToBreakpoints(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",void 0)],FieldHint.prototype,"breakpointListener",null);var FieldLabel=function(){function e(e){registerInstance(this,e);this.htmlFor=undefined;this.required=true;this.valid=undefined;this.invalid=undefined;this.disabled=undefined;this.readonly=undefined;this.size="small";this.weight="bold"}e.prototype.componentDidLoad=function(){if(this.element){this.parentBalFieldElement=this.element.closest("bal-field");if(this.parentBalFieldElement){this.parentBalFieldElement.classList.add("has-label")}}};e.prototype.disconnectedCallback=function(){if(this.parentBalFieldElement){this.parentBalFieldElement.classList.remove("has-label")}};e.prototype.render=function(){return h(Host,{key:"049f3e7c80126a7ffbc005e6c69a1bdc8203979b",class:"bal-field-label"},h("bal-label",{key:"269ecb6de6a5daf2f4d4504b37f3980d05b1a121",multiline:true,size:this.size,htmlFor:this.htmlFor,required:this.required,valid:this.valid,invalid:this.invalid,disabled:this.disabled,readonly:this.readonly,weight:this.weight},h("slot",{key:"d832133cb85456ec6b7b1a999b5459044579e783"})))};Object.defineProperty(e.prototype,"element",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();var FieldMessage=function(){function e(e){registerInstance(this,e);this.ariaForm=defaultBalAriaForm;this.color="";this.invalid=false;this.valid=false;this.disabled=false;this.readonly=false;this.noReservedSpace=false}e.prototype.setAriaForm=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.ariaForm=Object.assign({},e);return[2]}))}))};e.prototype.render=function(){var e;return h(Host,{key:"f0425dd945959866c1edbfe0affa56a5c325a014",id:this.ariaForm.messageId,class:(e={"bal-field-message":true,help:true,"is-danger":this.invalid,"is-success":this.valid,"is-disabled":this.disabled||this.readonly},e["is-".concat(this.color)]=!!this.color,e),style:{minHeight:this.noReservedSpace?"0":undefined}},h("slot",{key:"c693909e5e98a82db73d2884a4f804cf20e24ab3"}))};return e}();export{Field as bal_field,FieldControl as bal_field_control,FieldHint as bal_field_hint,FieldLabel as bal_field_label,FieldMessage as bal_field_message};
@@ -1 +1 @@
1
- import{__awaiter,__generator,__spreadArray}from"tslib";import{M as h,L as Logger,H as registerInstance,P as createEvent,N as Host,O as getElement}from"./index-BtpJmRB8.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-dfXERft2.js";import{a as areArraysEqual}from"./array-CDfSqLEo.js";import{s as stopEventBubbling,i as inputHandleHostClick,a as inputHandleFocus,b as inputHandleBlur,c as inputSetFocus,d as inputSetBlur}from"./form-input-C2vJzMPS.js";import{g as getDefaultExportFromCjs}from"./_commonjsHelpers-BFTU3MAI.js";import{B as BEM}from"./bem-ByiN-QjD.js";import{F as FileUploadRejectionReason}from"./bal-file-upload.type-rBUN7c88.js";import{d as defaultBalAriaForm}from"./form-FCLKfv6B.js";import{a as ariaBooleanToString}from"./aria-DBsOHTWj.js";import"./index-zWZxKBfo.js";import"./index-B4k_dH6V.js";var lib={};var spec={};var hasRequiredSpec;function requireSpec(){if(hasRequiredSpec)return spec;hasRequiredSpec=1;Object.defineProperty(spec,"__esModule",{value:true});var i={radix:1e3,unit:["b","kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"]};var e={radix:1024,unit:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"]};var t={radix:1024,unit:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"]};spec.SPECS={si:i,iec:e,jedec:t};return spec}var hasRequiredLib;function requireLib(){if(hasRequiredLib)return lib;hasRequiredLib=1;Object.defineProperty(lib,"__esModule",{value:true});var i=requireSpec();function e(e,t,a){if(t===void 0){t=1}e=Math.abs(e);var r=i.SPECS[a]||i.SPECS["jedec"],s=r.radix,n=r.unit;var l=0;while(e>=s){e/=s;++l}return e.toFixed(t)+" "+n[l]}lib.default=e;return lib}var libExports=requireLib();var fileSize=getDefaultExportFromCjs(libExports);var bemListEl=BEM.block("file-upload").element("list");var FileListComponent=function(i){var e=i.files,t=i.disabled,a=i.subTitle,r=i.onRemoveFile;return h("bal-card",{class:Object.assign({},bemListEl.class()),flat:true},h("bal-list",{disabled:t,border:true,size:"large"},e.map((function(i,e){return h("bal-list-item",{key:i.name,disabled:t},h("bal-list-item-icon",null,h("bal-icon",{name:"document"})),h("bal-list-item-content",null,h("bal-list-item-title",null,i.name),h("bal-list-item-subtitle",null,a?a(i):fileSize(i.size))),h("bal-list-item-icon",{right:true,class:{"file-remove":true,"is-clickable":!t},onClick:function(i){return r(i,e)}},h("bal-icon",{name:"trash",color:t?"grey":"danger"})))}))))};var toFileArray=function(i){return Array.from(i?i:[])};var toFileList=function(i){var e=new DataTransfer;if(i&&i.length>0){i.forEach((function(i){return e.items.add(i)}))}return e.files};var validateFileArray=function(i,e,t){var a=[];var r=__spreadArray([],i,true);var s=[];var n=function(n){var l=e[n];if(l){var o=[];if(t.accept&&t.accept.split(" ").join("").split(",").indexOf(l.type)===-1){o.push(FileUploadRejectionReason.BAD_EXTENSION)}if(t.maxFileSize!==undefined&&l.size>t.maxFileSize){o.push(FileUploadRejectionReason.FILE_TOO_BIG)}var u=r.map((function(i){return i.size})).reduce((function(i,e){return i+e}),0);var d=u+l.size;if(t.maxBundleSize!==undefined&&d>t.maxBundleSize){o.push(FileUploadRejectionReason.FILE_SIZE_SUM_TOO_BIG)}var h=r.length+1;if(t.maxFiles!==undefined&&h>t.maxFiles){o.push(FileUploadRejectionReason.TOO_MANY_FILES)}var f=function(i,e){return i.size===e.size&&i.name===e.name&&i.type===e.type&&i.lastModified===e.lastModified};var c=i.filter((function(i){return f(i,l)}));if(c.length>0){o.push(FileUploadRejectionReason.DUPLICATED_FILE)}if(o.length>0){s.push({file:l,reasons:o})}else{r.push(l);a.push(l)}}};for(var l=0;l<e.length;l++){n(l)}return{validFiles:a,invalidFiles:s}};var balFileUploadCss=".bal-file-upload{display:block;position:static;width:100%}.bal-file-upload .file-label{word-break:break-word;white-space:normal}.bal-file-upload .bal-heading{word-break:break-all}.bal-file-upload__card{margin-top:var(--bal-space-normal)}.bal-file-upload__list{padding:0 !important}";var FileUpload=function(){function i(i){var e=this;registerInstance(this,i);this.balChange=createEvent(this,"balChange");this.balFilesAdded=createEvent(this,"balFilesAdded");this.balFilesRemoved=createEvent(this,"balFilesRemoved");this.balRejectedFile=createEvent(this,"balRejectedFile");this.balInputClick=createEvent(this,"balInputClick");this.balBlur=createEvent(this,"balBlur");this.balFocus=createEvent(this,"balFocus");this.fileUploadId="bal-file-upload-".concat(FileUploadIds++);this.files=[];this.focused=false;this.ariaForm=defaultBalAriaForm;this.name=this.fileUploadId;this.value=[];this.initialValue=this.value||[];this.label="Choose or drop a file...";this.multiple=true;this.disabled=false;this.readonly=false;this.loading=false;this.required=false;this.hasFileList=true;this.invalid=false;this.autoInvalidOff=false;this.addEventListenerDragAndDrop=function(){if(e.labelEl){e.labelEl.addEventListener("dragenter",e.onDragenter,false);e.labelEl.addEventListener("dragover",e.onDragover,false);e.labelEl.addEventListener("drop",e.onDrop,false)}};this.removeEventListenerDragAndDrop=function(){if(e.labelEl){e.labelEl.removeEventListener("dragenter",e.onDragenter,false);e.labelEl.removeEventListener("dragover",e.onDragover,false);e.labelEl.removeEventListener("drop",e.onDrop,false)}};this.handleFiles=function(i){var t=toFileArray(i);var a=validateFileArray(e.files,t,{accept:e.accept,maxFileSize:e.maxFileSize,maxBundleSize:e.maxBundleSize,maxFiles:e.maxFiles});if(a.invalidFiles.length>0){e.balRejectedFile.emit(a.invalidFiles[0])}if(a.validFiles.length>0){e.files=__spreadArray(__spreadArray([],e.files,true),a.validFiles,true);e.balChange.emit(e.files);e.balFilesAdded.emit(a.validFiles)}e.updateFileInput()};this.updateFileInput=function(){var i;if((i=e.nativeInput)===null||i===void 0?void 0:i.files){e.nativeInput.files=toFileList(e.files)}};this.onDragenter=function(i){stopEventBubbling(i)};this.onDragover=function(i){stopEventBubbling(i)};this.onDrop=function(i){stopEventBubbling(i);if(!e.disabled&&!e.readonly&&!e.loading){var t=i.dataTransfer;if(t){e.handleFiles(t.files)}}};this.onInputChange=function(){var i;if(!e.disabled&&!e.readonly&&!e.loading){if((i=e.nativeInput)===null||i===void 0?void 0:i.files){e.handleFiles(e.nativeInput.files)}}};this.onRemoveFile=function(i,t){stopEventBubbling(i);if(t>=0&&t<e.files.length){var a=e.files;var r=a.splice(t,1);e.balFilesRemoved.emit(r);e.files=__spreadArray([],a,true);e.balChange.emit(e.files);e.updateFileInput()}};this.onHostClick=function(i){return inputHandleHostClick(e,i)};this.onInputFocus=function(i){return inputHandleFocus(e,i)};this.onInputBlur=function(i){return inputHandleBlur(e,i)};this.onInputClick=function(i){if(e.nativeInput&&!e.disabled&&!e.readonly&&!e.loading){e.nativeInput.value=""}e.balInputClick.emit(i)}}i.prototype.createLogger=function(i){this.log=i};i.prototype.onValueChange=function(){if(!areArraysEqual(this.files,this.value)){this.files=this.value}};i.prototype.componentWillLoad=function(){this.onValueChange()};i.prototype.connectedCallback=function(){this.initialValue=this.value||[];this.addEventListenerDragAndDrop()};i.prototype.componentDidLoad=function(){this.addEventListenerDragAndDrop()};i.prototype.disconnectedCallback=function(){this.removeEventListenerDragAndDrop()};i.prototype.resetHandler=function(i){var e=this;var t=i.target;if(t===null||t===void 0?void 0:t.contains(this.el)){this.files=__spreadArray([],this.initialValue,true);clearTimeout(this.resetHandlerTimer);this.resetHandlerTimer=setTimeout((function(){if(e.nativeInput){e.nativeInput.files=toFileList(e.initialValue)}}))}};i.prototype.clear=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.files=[];this.updateFileInput();return[2]}))}))};i.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){inputSetFocus(this);return[2]}))}))};i.prototype.setBlur=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){inputSetBlur(this);return[2]}))}))};i.prototype.getInputElement=function(){return Promise.resolve(this.nativeInput)};i.prototype.setAriaForm=function(i){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.ariaForm=Object.assign({},i);return[2]}))}))};i.prototype.render=function(){var i=this;var e=this.ariaForm.controlId||this.fileUploadId;return h(Host,{key:"dc5b0ffa01094b304728a6bd20e8364ee410c877",onClick:this.onHostClick,"aria-disabled":ariaBooleanToString(this.disabled),class:{"bal-file-upload":true}},h("div",{key:"fa20226a3185331523ede065a729410b7a1469d6",class:{file:true,"is-disabled":this.disabled||this.readonly||this.loading,"is-danger":this.invalid}},h("label",{key:"a27ba82c67898305a907a24c1a5101c78d4c0859",htmlFor:e,ref:function(e){return i.labelEl=e},class:{"file-label":true,"is-disabled":this.disabled||this.loading||this.readonly}},h("input",{key:"7ee35dcb15d921f92a7055a4234d710253282f03",class:"file-input",type:"file",id:e,"aria-labelledby":this.ariaForm.labelId,"aria-describedby":this.ariaForm.messageId,"aria-invalid":this.invalid===true?"true":"false","aria-disabled":ariaBooleanToString(this.disabled),name:this.name,multiple:this.multiple,disabled:this.disabled||this.loading||this.readonly,readonly:this.readonly,required:this.required,accept:this.accept,onClick:this.onInputClick,onChange:this.onInputChange,onFocus:this.onInputFocus,onBlur:this.onInputBlur,ref:function(e){return i.nativeInput=e},"data-testid":"bal-file-upload-input"}),this.loading?h("span",{class:"file-cta"},h("bal-spinner",null)):h("span",{class:"file-cta"},h("span",{class:"file-icon"},h("bal-icon",{name:"upload",size:"medium",color:this.disabled||this.loading||this.readonly?"grey-light":this.invalid?"danger":"blue"})),h("span",{class:"file-label","data-testid":"bal-file-upload-label"},this.label)))),this.hasFileList&&this.files.length>0?h(FileListComponent,{files:this.files,disabled:this.disabled||this.readonly||this.loading,subTitle:this.subTitle,onRemoveFile:this.onRemoveFile}):"")};Object.defineProperty(i.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(i,"watchers",{get:function(){return{value:["onValueChange"]}},enumerable:false,configurable:true});return i}();__decorate([Logger("bal-file-upload"),__metadata("design:type",Function),__metadata("design:paramtypes",[Function]),__metadata("design:returntype",void 0)],FileUpload.prototype,"createLogger",null);var FileUploadIds=0;FileUpload.style=balFileUploadCss;export{FileUpload as bal_file_upload};
1
+ import{__awaiter,__generator,__spreadArray}from"tslib";import{M as h,L as Logger,H as registerInstance,P as createEvent,N as Host,O as getElement}from"./index-BtpJmRB8.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-dfXERft2.js";import{a as areArraysEqual}from"./array-CDfSqLEo.js";import{s as stopEventBubbling,i as inputHandleHostClick,a as inputHandleFocus,b as inputHandleBlur,c as inputSetFocus,d as inputSetBlur}from"./form-input-C2vJzMPS.js";import{g as getDefaultExportFromCjs}from"./_commonjsHelpers-BFTU3MAI.js";import{B as BEM}from"./bem-ByiN-QjD.js";import{F as FileUploadRejectionReason}from"./bal-file-upload.type-rBUN7c88.js";import{d as defaultBalAriaForm}from"./form-FCLKfv6B.js";import{a as ariaBooleanToString}from"./aria-DBsOHTWj.js";import"./index-zWZxKBfo.js";import"./index-B4k_dH6V.js";var lib={};var spec={};var hasRequiredSpec;function requireSpec(){if(hasRequiredSpec)return spec;hasRequiredSpec=1;Object.defineProperty(spec,"__esModule",{value:true});var i={radix:1e3,unit:["b","kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"]};var e={radix:1024,unit:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"]};var t={radix:1024,unit:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"]};spec.SPECS={si:i,iec:e,jedec:t};return spec}var hasRequiredLib;function requireLib(){if(hasRequiredLib)return lib;hasRequiredLib=1;Object.defineProperty(lib,"__esModule",{value:true});var i=requireSpec();function e(e,t,a){if(t===void 0){t=1}e=Math.abs(e);var r=i.SPECS[a]||i.SPECS["jedec"],s=r.radix,n=r.unit;var l=0;while(e>=s){e/=s;++l}return e.toFixed(t)+" "+n[l]}lib.default=e;return lib}var libExports=requireLib();var fileSize=getDefaultExportFromCjs(libExports);var bemListEl=BEM.block("file-upload").element("list");var FileListComponent=function(i){var e=i.files,t=i.disabled,a=i.subTitle,r=i.onRemoveFile;return h("bal-card",{class:Object.assign({},bemListEl.class()),flat:true},h("bal-list",{disabled:t,border:true,size:"large"},e.map((function(i,e){return h("bal-list-item",{key:i.name,disabled:t},h("bal-list-item-icon",null,h("bal-icon",{name:"document"})),h("bal-list-item-content",null,h("bal-list-item-title",null,i.name),h("bal-list-item-subtitle",null,a?a(i):fileSize(i.size))),h("bal-list-item-icon",{right:true,class:{"file-remove":true}},h("button",{class:"button is-square is-danger",disabled:t,onClick:function(i){return r(i,e)}},h("bal-icon",{name:"trash",color:t?"grey":"danger"}))))}))))};var toFileArray=function(i){return Array.from(i?i:[])};var toFileList=function(i){var e=new DataTransfer;if(i&&i.length>0){i.forEach((function(i){return e.items.add(i)}))}return e.files};var validateFileArray=function(i,e,t){var a=[];var r=__spreadArray([],i,true);var s=[];var n=function(n){var l=e[n];if(l){var o=[];if(t.accept&&t.accept.split(" ").join("").split(",").indexOf(l.type)===-1){o.push(FileUploadRejectionReason.BAD_EXTENSION)}if(t.maxFileSize!==undefined&&l.size>t.maxFileSize){o.push(FileUploadRejectionReason.FILE_TOO_BIG)}var u=r.map((function(i){return i.size})).reduce((function(i,e){return i+e}),0);var d=u+l.size;if(t.maxBundleSize!==undefined&&d>t.maxBundleSize){o.push(FileUploadRejectionReason.FILE_SIZE_SUM_TOO_BIG)}var h=r.length+1;if(t.maxFiles!==undefined&&h>t.maxFiles){o.push(FileUploadRejectionReason.TOO_MANY_FILES)}var f=function(i,e){return i.size===e.size&&i.name===e.name&&i.type===e.type&&i.lastModified===e.lastModified};var c=i.filter((function(i){return f(i,l)}));if(c.length>0){o.push(FileUploadRejectionReason.DUPLICATED_FILE)}if(o.length>0){s.push({file:l,reasons:o})}else{r.push(l);a.push(l)}}};for(var l=0;l<e.length;l++){n(l)}return{validFiles:a,invalidFiles:s}};var balFileUploadCss=".bal-file-upload{display:block;position:static;width:100%}.bal-file-upload .file-label{word-break:break-word;white-space:normal}.bal-file-upload .bal-heading{word-break:break-all}.bal-file-upload__card{margin-top:var(--bal-space-normal)}.bal-file-upload__list{padding:0 !important}";var FileUpload=function(){function i(i){var e=this;registerInstance(this,i);this.balChange=createEvent(this,"balChange");this.balFilesAdded=createEvent(this,"balFilesAdded");this.balFilesRemoved=createEvent(this,"balFilesRemoved");this.balRejectedFile=createEvent(this,"balRejectedFile");this.balInputClick=createEvent(this,"balInputClick");this.balBlur=createEvent(this,"balBlur");this.balFocus=createEvent(this,"balFocus");this.fileUploadId="bal-file-upload-".concat(FileUploadIds++);this.files=[];this.focused=false;this.ariaForm=defaultBalAriaForm;this.name=this.fileUploadId;this.value=[];this.initialValue=this.value||[];this.label="Choose or drop a file...";this.multiple=true;this.disabled=false;this.readonly=false;this.loading=false;this.required=false;this.hasFileList=true;this.invalid=false;this.autoInvalidOff=false;this.addEventListenerDragAndDrop=function(){if(e.labelEl){e.labelEl.addEventListener("dragenter",e.onDragenter,false);e.labelEl.addEventListener("dragover",e.onDragover,false);e.labelEl.addEventListener("drop",e.onDrop,false)}};this.removeEventListenerDragAndDrop=function(){if(e.labelEl){e.labelEl.removeEventListener("dragenter",e.onDragenter,false);e.labelEl.removeEventListener("dragover",e.onDragover,false);e.labelEl.removeEventListener("drop",e.onDrop,false)}};this.handleFiles=function(i){var t=toFileArray(i);var a=validateFileArray(e.files,t,{accept:e.accept,maxFileSize:e.maxFileSize,maxBundleSize:e.maxBundleSize,maxFiles:e.maxFiles});if(a.invalidFiles.length>0){e.balRejectedFile.emit(a.invalidFiles[0])}if(a.validFiles.length>0){e.files=__spreadArray(__spreadArray([],e.files,true),a.validFiles,true);e.balChange.emit(e.files);e.balFilesAdded.emit(a.validFiles)}e.updateFileInput()};this.updateFileInput=function(){var i;if((i=e.nativeInput)===null||i===void 0?void 0:i.files){e.nativeInput.files=toFileList(e.files)}};this.onDragenter=function(i){stopEventBubbling(i)};this.onDragover=function(i){stopEventBubbling(i)};this.onDrop=function(i){stopEventBubbling(i);if(!e.disabled&&!e.readonly&&!e.loading){var t=i.dataTransfer;if(t){e.handleFiles(t.files)}}};this.onInputChange=function(){var i;if(!e.disabled&&!e.readonly&&!e.loading){if((i=e.nativeInput)===null||i===void 0?void 0:i.files){e.handleFiles(e.nativeInput.files)}}};this.onRemoveFile=function(i,t){stopEventBubbling(i);if(t>=0&&t<e.files.length){var a=e.files;var r=a.splice(t,1);e.balFilesRemoved.emit(r);e.files=__spreadArray([],a,true);e.balChange.emit(e.files);e.updateFileInput()}};this.onHostClick=function(i){return inputHandleHostClick(e,i)};this.onInputFocus=function(i){return inputHandleFocus(e,i)};this.onInputBlur=function(i){return inputHandleBlur(e,i)};this.onInputClick=function(i){if(e.nativeInput&&!e.disabled&&!e.readonly&&!e.loading){e.nativeInput.value=""}e.balInputClick.emit(i)}}i.prototype.createLogger=function(i){this.log=i};i.prototype.onValueChange=function(){if(!areArraysEqual(this.files,this.value)){this.files=this.value}};i.prototype.componentWillLoad=function(){this.onValueChange()};i.prototype.connectedCallback=function(){this.initialValue=this.value||[];this.addEventListenerDragAndDrop()};i.prototype.componentDidLoad=function(){this.addEventListenerDragAndDrop()};i.prototype.disconnectedCallback=function(){this.removeEventListenerDragAndDrop()};i.prototype.resetHandler=function(i){var e=this;var t=i.target;if(t===null||t===void 0?void 0:t.contains(this.el)){this.files=__spreadArray([],this.initialValue,true);clearTimeout(this.resetHandlerTimer);this.resetHandlerTimer=setTimeout((function(){if(e.nativeInput){e.nativeInput.files=toFileList(e.initialValue)}}))}};i.prototype.clear=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.files=[];this.updateFileInput();return[2]}))}))};i.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){inputSetFocus(this);return[2]}))}))};i.prototype.setBlur=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){inputSetBlur(this);return[2]}))}))};i.prototype.getInputElement=function(){return Promise.resolve(this.nativeInput)};i.prototype.setAriaForm=function(i){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.ariaForm=Object.assign({},i);return[2]}))}))};i.prototype.render=function(){var i=this;var e=this.ariaForm.controlId||this.fileUploadId;return h(Host,{key:"dc5b0ffa01094b304728a6bd20e8364ee410c877",onClick:this.onHostClick,"aria-disabled":ariaBooleanToString(this.disabled),class:{"bal-file-upload":true}},h("div",{key:"fa20226a3185331523ede065a729410b7a1469d6",class:{file:true,"is-disabled":this.disabled||this.readonly||this.loading,"is-danger":this.invalid}},h("label",{key:"a27ba82c67898305a907a24c1a5101c78d4c0859",htmlFor:e,ref:function(e){return i.labelEl=e},class:{"file-label":true,"is-disabled":this.disabled||this.loading||this.readonly}},h("input",{key:"7ee35dcb15d921f92a7055a4234d710253282f03",class:"file-input",type:"file",id:e,"aria-labelledby":this.ariaForm.labelId,"aria-describedby":this.ariaForm.messageId,"aria-invalid":this.invalid===true?"true":"false","aria-disabled":ariaBooleanToString(this.disabled),name:this.name,multiple:this.multiple,disabled:this.disabled||this.loading||this.readonly,readonly:this.readonly,required:this.required,accept:this.accept,onClick:this.onInputClick,onChange:this.onInputChange,onFocus:this.onInputFocus,onBlur:this.onInputBlur,ref:function(e){return i.nativeInput=e},"data-testid":"bal-file-upload-input"}),this.loading?h("span",{class:"file-cta"},h("bal-spinner",null)):h("span",{class:"file-cta"},h("span",{class:"file-icon"},h("bal-icon",{name:"upload",size:"medium",color:this.disabled||this.loading||this.readonly?"grey-light":this.invalid?"danger":"blue"})),h("span",{class:"file-label","data-testid":"bal-file-upload-label"},this.label)))),this.hasFileList&&this.files.length>0?h(FileListComponent,{files:this.files,disabled:this.disabled||this.readonly||this.loading,subTitle:this.subTitle,onRemoveFile:this.onRemoveFile}):"")};Object.defineProperty(i.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(i,"watchers",{get:function(){return{value:["onValueChange"]}},enumerable:false,configurable:true});return i}();__decorate([Logger("bal-file-upload"),__metadata("design:type",Function),__metadata("design:paramtypes",[Function]),__metadata("design:returntype",void 0)],FileUpload.prototype,"createLogger",null);var FileUploadIds=0;FileUpload.style=balFileUploadCss;export{FileUpload as bal_file_upload};