@baloise/ds-core 17.2.0 → 17.2.1-nightly.20241218

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 (208) hide show
  1. package/components/all.d.ts +2 -0
  2. package/components/all.js +3 -0
  3. package/components/bal-app.js +1 -93
  4. package/components/bal-app2.js +95 -0
  5. package/components/bal-carousel2.js +1 -1
  6. package/components/bal-close2.js +1 -1
  7. package/components/bal-date-calendar2.js +1 -1
  8. package/components/bal-date.js +1 -1
  9. package/components/bal-doc-app.d.ts +11 -0
  10. package/components/bal-doc-app.js +262 -0
  11. package/components/bal-input-date2.js +2 -2
  12. package/components/bal-list-item-accordion-body2.js +3 -3
  13. package/components/bal-pagination2.js +4 -4
  14. package/components/bal-segment.js +1 -1
  15. package/components/bal-stage-image.js +1 -1
  16. package/components/bal-tabs2.js +12 -14
  17. package/components/index.js +5 -304
  18. package/components/initialize.js +303 -0
  19. package/components/mutation.decorator.js +11 -13
  20. package/components/tokens.esm.js +1 -1
  21. package/dist/baloise-design-system/baloise-design-system.esm.js +1 -1
  22. package/dist/baloise-design-system/baloise-design-system.js +1 -1
  23. package/dist/baloise-design-system/index.esm.js +1 -1
  24. package/dist/baloise-design-system/{p-eee34b1983.entry.js → p-012d9e742e.entry.js} +1 -1
  25. package/dist/baloise-design-system/{p-799a292492.entry.js → p-04979ee232.entry.js} +1 -1
  26. package/dist/baloise-design-system/p-153e72207a.entry.js +1 -0
  27. package/dist/baloise-design-system/{p-cc4dc17721.system.entry.js → p-18fbeec32d.system.entry.js} +1 -1
  28. package/dist/baloise-design-system/{p-aebb3198c4.system.entry.js → p-1cb1fb71d4.system.entry.js} +1 -1
  29. package/dist/baloise-design-system/{p-c045d5a57c.system.entry.js → p-20d7a74311.system.entry.js} +1 -1
  30. package/dist/baloise-design-system/{p-fd88b00c71.system.entry.js → p-2b2b1b7c93.system.entry.js} +1 -1
  31. package/dist/baloise-design-system/{p-8e244ba61a.entry.js → p-2cdc626e3f.entry.js} +1 -1
  32. package/dist/baloise-design-system/{p-e3a563de25.system.entry.js → p-374ce10b98.system.entry.js} +1 -1
  33. package/dist/baloise-design-system/{p-9f83acd71d.entry.js → p-39ad885d73.entry.js} +1 -1
  34. package/dist/baloise-design-system/{p-749fe3de.system.js → p-3cb1982c.system.js} +1 -1
  35. package/dist/baloise-design-system/p-3d1747bc.system.js +1 -0
  36. package/dist/baloise-design-system/{p-73efab2c3a.system.entry.js → p-42be32ba07.system.entry.js} +1 -1
  37. package/dist/baloise-design-system/{p-512a273a.js → p-4794d9aa.js} +1 -1
  38. package/dist/baloise-design-system/{p-d8fb982e61.system.entry.js → p-482fbfe677.system.entry.js} +1 -1
  39. package/dist/baloise-design-system/{p-4c8470249b.system.entry.js → p-5409f91b36.system.entry.js} +1 -1
  40. package/dist/baloise-design-system/{p-a7cf23072c.entry.js → p-5633d2268f.entry.js} +1 -1
  41. package/dist/baloise-design-system/p-576c7123.system.js +1 -0
  42. package/dist/baloise-design-system/{p-88be14c716.entry.js → p-5bbc6e33c0.entry.js} +1 -1
  43. package/dist/baloise-design-system/p-605cf17f30.entry.js +1 -0
  44. package/dist/baloise-design-system/{p-01cdb12b31.entry.js → p-63793834ec.entry.js} +1 -1
  45. package/dist/baloise-design-system/p-65b542bd.system.js +1 -1
  46. package/dist/baloise-design-system/{p-34b1a9a33b.entry.js → p-6a7e9ecb47.entry.js} +1 -1
  47. package/dist/baloise-design-system/{p-246e9e2585.system.entry.js → p-6b6a1e6e73.system.entry.js} +1 -1
  48. package/dist/baloise-design-system/{p-fb2a9f7542.system.entry.js → p-6da66e2b7e.system.entry.js} +1 -1
  49. package/dist/baloise-design-system/{p-5361e8255f.system.entry.js → p-7234f01079.system.entry.js} +1 -1
  50. package/dist/baloise-design-system/{p-749056f366.entry.js → p-775960260a.entry.js} +1 -1
  51. package/dist/baloise-design-system/{p-992c49c23e.system.entry.js → p-7d63b70a40.system.entry.js} +1 -1
  52. package/dist/baloise-design-system/{p-a68d21a21e.system.entry.js → p-83e1a5e2d8.system.entry.js} +1 -1
  53. package/dist/baloise-design-system/{p-c412a7d9f5.system.entry.js → p-85f853f154.system.entry.js} +1 -1
  54. package/dist/baloise-design-system/{p-38eaad35.js → p-87e8a649.js} +1 -1
  55. package/dist/baloise-design-system/{p-3c4bbee680.system.entry.js → p-8ef7318b76.system.entry.js} +1 -1
  56. package/dist/baloise-design-system/p-92a6c4407c.system.entry.js +1 -0
  57. package/dist/baloise-design-system/{p-9d3f7645.system.js → p-9ef02421.system.js} +1 -1
  58. package/dist/baloise-design-system/{p-737eb79c75.entry.js → p-a04605e550.entry.js} +1 -1
  59. package/dist/baloise-design-system/p-a24e650e.js +1 -0
  60. package/dist/baloise-design-system/p-a29f60e9.js +1 -0
  61. package/dist/baloise-design-system/{p-13e7a8817c.entry.js → p-a3d18d6e5c.entry.js} +1 -1
  62. package/dist/baloise-design-system/{p-b86876e144.entry.js → p-a6556b9bd0.entry.js} +1 -1
  63. package/dist/baloise-design-system/{p-30679d51bd.system.entry.js → p-ab64213bd1.system.entry.js} +1 -1
  64. package/dist/baloise-design-system/{p-c72669019f.system.entry.js → p-af956b48a1.system.entry.js} +1 -1
  65. package/dist/baloise-design-system/{p-8b8019c57c.entry.js → p-b715c1e68e.entry.js} +1 -1
  66. package/dist/baloise-design-system/{p-56f5e6d1.system.js → p-b79e4ef5.system.js} +1 -1
  67. package/dist/baloise-design-system/{p-55d6475b.js → p-b97dcbd9.js} +1 -1
  68. package/dist/baloise-design-system/{p-ba38ccde00.entry.js → p-ba0a53db6c.entry.js} +1 -1
  69. package/dist/baloise-design-system/{p-d1c71ad702.entry.js → p-c2c0d017b8.entry.js} +1 -1
  70. package/dist/baloise-design-system/{p-be6d3bde8f.entry.js → p-c486a8a8ed.entry.js} +1 -1
  71. package/dist/baloise-design-system/{p-de13d5c0.system.js → p-c4a29e1f.system.js} +1 -1
  72. package/dist/baloise-design-system/{p-faaf77375f.system.entry.js → p-c6ee7ff820.system.entry.js} +1 -1
  73. package/dist/baloise-design-system/p-ce674dca.js +1 -0
  74. package/dist/baloise-design-system/{p-4023b8977a.entry.js → p-cec4d35c92.entry.js} +1 -1
  75. package/dist/baloise-design-system/{p-34c50dfa1e.entry.js → p-dc032a0d49.entry.js} +1 -1
  76. package/dist/baloise-design-system/{p-ccee08eae1.system.entry.js → p-dc0b713dcb.system.entry.js} +1 -1
  77. package/dist/baloise-design-system/p-e3167218.js +1 -1
  78. package/dist/baloise-design-system/p-fabf47dd.system.js +1 -0
  79. package/dist/baloise-design-system/{p-b5152365.system.js → p-fdfe6d28.system.js} +1 -1
  80. package/dist/cjs/app-globals-d0a40f5b.js +7 -0
  81. package/dist/cjs/bal-carousel_2.cjs.entry.js +5 -5
  82. package/dist/cjs/bal-checkbox_2.cjs.entry.js +1 -1
  83. package/dist/cjs/bal-close.cjs.entry.js +1 -1
  84. package/dist/cjs/bal-date-calendar_2.cjs.entry.js +3 -3
  85. package/dist/cjs/bal-date.cjs.entry.js +1 -1
  86. package/dist/cjs/bal-doc-app.cjs.entry.js +233 -0
  87. package/dist/cjs/bal-field_5.cjs.entry.js +1 -1
  88. package/dist/cjs/bal-hint_5.cjs.entry.js +3 -3
  89. package/dist/cjs/bal-list_8.cjs.entry.js +6 -6
  90. package/dist/cjs/bal-logo.cjs.entry.js +3 -3
  91. package/dist/cjs/bal-nav_8.cjs.entry.js +4 -4
  92. package/dist/cjs/bal-navbar_5.cjs.entry.js +3 -3
  93. package/dist/cjs/bal-pagination.cjs.entry.js +7 -7
  94. package/dist/cjs/bal-progress-bar.cjs.entry.js +4 -4
  95. package/dist/cjs/bal-radio_2.cjs.entry.js +1 -1
  96. package/dist/cjs/bal-segment_2.cjs.entry.js +5 -5
  97. package/dist/cjs/bal-shape.cjs.entry.js +1 -1
  98. package/dist/cjs/bal-stage_6.cjs.entry.js +1 -1
  99. package/dist/cjs/bal-steps.cjs.entry.js +4 -4
  100. package/dist/cjs/bal-tab-item_2.cjs.entry.js +16 -18
  101. package/dist/cjs/baloise-design-system.cjs.js +3 -2
  102. package/dist/cjs/{breakpoints.decorator-8bde2bcf.js → breakpoints.decorator-1bb047c8.js} +1 -1
  103. package/dist/cjs/{breakpoints.subject-15687772.js → breakpoints.subject-28b3d733.js} +1 -1
  104. package/dist/cjs/{app-globals-661b320a.js → global-9176b6c7.js} +2 -4
  105. package/dist/cjs/index.cjs.js +2 -2
  106. package/dist/cjs/initialize-6421e1c1.js +1 -1
  107. package/dist/cjs/loader.cjs.js +3 -2
  108. package/dist/cjs/{mutation.decorator-d2ce6c1a.js → mutation.decorator-5ac1e198.js} +10 -12
  109. package/dist/cjs/{tokens.esm-bdae5d02.js → tokens.esm-635228ac.js} +1 -1
  110. package/dist/cjs/{window-resize.decorator-e1fbbe1f.js → window-resize.decorator-d77f1ae8.js} +1 -1
  111. package/dist/collection/collection-manifest.json +2 -1
  112. package/dist/collection/components/bal-carousel/bal-carousel.js +3 -3
  113. package/dist/collection/components/bal-close/bal-close.js +4 -4
  114. package/dist/collection/components/bal-date/bal-date-calendar/bal-date-calendar.js +1 -1
  115. package/dist/collection/components/bal-date/bal-date.js +3 -3
  116. package/dist/collection/components/bal-input/bal-input-date/bal-input-date.js +4 -4
  117. package/dist/collection/components/bal-list/bal-list-item-accordion-body/bal-list-item-accordion-body.js +3 -3
  118. package/dist/collection/components/bal-pagination/bal-pagination.js +6 -6
  119. package/dist/collection/components/bal-segment/bal-segment.js +1 -1
  120. package/dist/collection/components/bal-stage/bal-stage-image/bal-stage-image.js +1 -1
  121. package/dist/collection/components/bal-tabs/bal-tabs.js +12 -14
  122. package/dist/collection/components/docs/bal-doc-app/bal-doc-app.css +1 -0
  123. package/dist/collection/components/docs/bal-doc-app/bal-doc-app.js +229 -0
  124. package/dist/collection/utils/constants/version.constant.js +1 -1
  125. package/dist/collection/utils/mutation/mutation.subject.js +11 -13
  126. package/dist/esm/app-globals-10882328.js +5 -0
  127. package/dist/esm/bal-carousel_2.entry.js +5 -5
  128. package/dist/esm/bal-checkbox_2.entry.js +1 -1
  129. package/dist/esm/bal-close.entry.js +1 -1
  130. package/dist/esm/bal-date-calendar_2.entry.js +3 -3
  131. package/dist/esm/bal-date.entry.js +1 -1
  132. package/dist/esm/bal-doc-app.entry.js +229 -0
  133. package/dist/esm/bal-field_5.entry.js +1 -1
  134. package/dist/esm/bal-hint_5.entry.js +3 -3
  135. package/dist/esm/bal-list_8.entry.js +6 -6
  136. package/dist/esm/bal-logo.entry.js +3 -3
  137. package/dist/esm/bal-nav_8.entry.js +4 -4
  138. package/dist/esm/bal-navbar_5.entry.js +3 -3
  139. package/dist/esm/bal-pagination.entry.js +7 -7
  140. package/dist/esm/bal-progress-bar.entry.js +4 -4
  141. package/dist/esm/bal-radio_2.entry.js +1 -1
  142. package/dist/esm/bal-segment_2.entry.js +5 -5
  143. package/dist/esm/bal-shape.entry.js +1 -1
  144. package/dist/esm/bal-stage_6.entry.js +1 -1
  145. package/dist/esm/bal-steps.entry.js +4 -4
  146. package/dist/esm/bal-tab-item_2.entry.js +16 -18
  147. package/dist/esm/baloise-design-system.js +3 -2
  148. package/dist/esm/{breakpoints.decorator-7623ded8.js → breakpoints.decorator-67df716d.js} +1 -1
  149. package/dist/esm/{breakpoints.subject-ac2d9287.js → breakpoints.subject-23d0b623.js} +1 -1
  150. package/dist/esm/{app-globals-665b5c71.js → global-7dca4c85.js} +2 -4
  151. package/dist/esm/index.js +3 -3
  152. package/dist/esm/initialize-b9912138.js +1 -1
  153. package/dist/esm/loader.js +3 -2
  154. package/dist/esm/{mutation.decorator-985cc0a1.js → mutation.decorator-74831883.js} +11 -13
  155. package/dist/esm/{tokens.esm-44ff650d.js → tokens.esm-6e260a83.js} +1 -1
  156. package/dist/esm/{window-resize.decorator-ab11c379.js → window-resize.decorator-69b08b6f.js} +1 -1
  157. package/dist/esm-es5/app-globals-10882328.js +1 -0
  158. package/dist/esm-es5/bal-carousel_2.entry.js +1 -1
  159. package/dist/esm-es5/bal-checkbox_2.entry.js +1 -1
  160. package/dist/esm-es5/bal-close.entry.js +1 -1
  161. package/dist/esm-es5/bal-date-calendar_2.entry.js +1 -1
  162. package/dist/esm-es5/bal-date.entry.js +1 -1
  163. package/dist/esm-es5/bal-doc-app.entry.js +1 -0
  164. package/dist/esm-es5/bal-field_5.entry.js +1 -1
  165. package/dist/esm-es5/bal-hint_5.entry.js +1 -1
  166. package/dist/esm-es5/bal-list_8.entry.js +1 -1
  167. package/dist/esm-es5/bal-logo.entry.js +1 -1
  168. package/dist/esm-es5/bal-nav_8.entry.js +1 -1
  169. package/dist/esm-es5/bal-navbar_5.entry.js +1 -1
  170. package/dist/esm-es5/bal-pagination.entry.js +1 -1
  171. package/dist/esm-es5/bal-progress-bar.entry.js +1 -1
  172. package/dist/esm-es5/bal-radio_2.entry.js +1 -1
  173. package/dist/esm-es5/bal-segment_2.entry.js +1 -1
  174. package/dist/esm-es5/bal-shape.entry.js +1 -1
  175. package/dist/esm-es5/bal-stage_6.entry.js +1 -1
  176. package/dist/esm-es5/bal-steps.entry.js +1 -1
  177. package/dist/esm-es5/bal-tab-item_2.entry.js +1 -1
  178. package/dist/esm-es5/baloise-design-system.js +1 -1
  179. package/dist/esm-es5/{breakpoints.decorator-7623ded8.js → breakpoints.decorator-67df716d.js} +1 -1
  180. package/dist/esm-es5/{breakpoints.subject-ac2d9287.js → breakpoints.subject-23d0b623.js} +1 -1
  181. package/dist/esm-es5/global-7dca4c85.js +1 -0
  182. package/dist/esm-es5/index.js +1 -1
  183. package/dist/esm-es5/initialize-b9912138.js +1 -1
  184. package/dist/esm-es5/loader.js +1 -1
  185. package/dist/esm-es5/mutation.decorator-74831883.js +1 -0
  186. package/dist/esm-es5/{window-resize.decorator-ab11c379.js → window-resize.decorator-69b08b6f.js} +1 -1
  187. package/dist/types/components/bal-carousel/bal-carousel.d.ts +1 -2
  188. package/dist/types/components/bal-close/bal-close.d.ts +1 -2
  189. package/dist/types/components/bal-date/bal-date-calendar/bal-date-calendar.d.ts +1 -1
  190. package/dist/types/components/bal-date/bal-date.d.ts +1 -2
  191. package/dist/types/components/bal-input/bal-input-date/bal-input-date.d.ts +1 -1
  192. package/dist/types/components/bal-list/bal-list-item-accordion-body/bal-list-item-accordion-body.d.ts +1 -1
  193. package/dist/types/components/bal-pagination/bal-pagination.d.ts +1 -2
  194. package/dist/types/components/bal-segment/bal-segment.d.ts +1 -1
  195. package/dist/types/components/docs/bal-doc-app/bal-doc-app.d.ts +21 -0
  196. package/dist/types/components.d.ts +44 -7
  197. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/icons/src/index.d.ts +82 -0
  198. package/package.json +7 -7
  199. package/dist/baloise-design-system/p-12a557557c.entry.js +0 -1
  200. package/dist/baloise-design-system/p-51380295.system.js +0 -1
  201. package/dist/baloise-design-system/p-738ca720.system.js +0 -1
  202. package/dist/baloise-design-system/p-950bd476.js +0 -1
  203. package/dist/baloise-design-system/p-e563e447.js +0 -1
  204. package/dist/esm-es5/app-globals-665b5c71.js +0 -1
  205. package/dist/esm-es5/mutation.decorator-985cc0a1.js +0 -1
  206. /package/dist/baloise-design-system/{p-69313d59.system.js → p-677e8807.system.js} +0 -0
  207. /package/dist/baloise-design-system/{p-18a74018.js → p-e5a54078.js} +0 -0
  208. /package/dist/esm-es5/{tokens.esm-44ff650d.js → tokens.esm-6e260a83.js} +0 -0
@@ -1 +1 @@
1
- import{__awaiter,__extends,__generator,__spreadArray}from"tslib";import{h,r as registerInstance,c as createEvent,H as Host,g as getElement}from"./index-5b1faf93.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-654e2c24.js";import{l as lodash_padstart}from"./index-bba06972.js";import{l as lodash_isnil}from"./index-82aff103.js";import{B as BalDate,i as i18nBalDate,d as dateSeparator}from"./date-3b88d03c.js";import{L as Logger}from"./log-dfd1c19f.js";import{b as waitAfterFramePaint,p as hasParent}from"./helpers-72ae7307.js";import{B as BEM}from"./bem-8c7d2eb0.js";import{d as defaultConfig}from"./config.default-7efdc82d.js";import{L as ListenToConfig}from"./config.decorator-d18abfe1.js";import{L as ListenToSwipe}from"./swipe.decorator-56b6d574.js";import{i as inheritAttributes}from"./attributes-4fa7040f.js";import{m as hasValueChanged,c as inputSetFocus,d as inputSetBlur}from"./form-input-264ad739.js";import{d as defaultBalAriaForm}from"./form-fb8dd9f5.js";import{L as ListenTo}from"./listen-d1712e70.js";import{N as NUMBER_KEYS}from"./keys.constant-0eb059e0.js";import{I as INVALID_VALUE}from"./mask-util-71edc2b8.js";import"./_commonjsHelpers-1c8beb5f.js";import"./config.utils-6ac6c9bd.js";import"./browser-a8073d92.js";import"./icons.constant-a7885631.js";import"./swipe.subject-683f7c7b.js";import"./device-8c6d2881.js";import"./listener-04842ae9.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(lodash_padstart("".concat(e),2,"0"),"-").concat(lodash_padstart("".concat(t),2,"0"))}function isoDateOfToday(){var t=new Date;return"".concat(t.getFullYear(),"-").concat(lodash_padstart("".concat(t.getMonth()+1),2,"0"),"-").concat(lodash_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 d=BalDate.fromISO(a);var u=BalDate.fromISO(i);var c=function(t){if(lodash_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:d.isAfter(f)||u.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 d=o.getFullYear();var u=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===u&&e===d,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 d=o.element("list");return h("ul",{class:Object.assign(Object.assign(Object.assign({},d.class()),d.modifier(e).class()),d.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({},d.element("item").class()),d.element("item").modifier("today").class(t.today)),d.element("item").modifier("selected").class(t.selected)),d.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 d=o.element("body");var u=d.element("grid");return h("div",{role:"grid",class:Object.assign(Object.assign({},u.class()),u.modifier("visible").class(e)),"aria-hidden":e?"false":"true",ref:function(t){return a(t)}},h("div",{role:"row",class:Object.assign({},u.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({},u.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,d=t.onClickNextMonth;var u=BEM.block("date-calendar");var c=u.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:d,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{--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 BalDateCalendarStyle0=balDateCalendarCss;var DateCalendar=function(){function t(t){var e=this;registerInstance(this,t);this.balChange=createEvent(this,"balChange",7);this.oldMin="";this.oldMax="";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)};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.value=undefined;this.defaultDate=undefined;this.allowedDates=undefined;this.min=undefined;this.max=undefined;this.minYearProp=undefined;this.maxYearProp=undefined}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:"248e291f860cdb55eb13cce3afa9fd453efd9bb1",class:Object.assign({},i.class())},h(CalendarNav,{key:"b22fb7f5d3459b29b1bc7ad10925f797964a1bf2",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:"e7348e9fe457bd309ecf8645ae1af0138d6ea156",class:Object.assign({},n.class())},h(CalendarGrid,{key:"87bab404d1e8777b818c4d4df0d49092b29e96ff",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:"106142481bd53e6d24e91ef0245fe336704c0578",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:"9341dbb8c0f7ce5713a9cbdb5e4a22d3db83b43a",name:"month",isVisible:this.isMonthListVisible,girdHeight:a,list:this.months,onSelect:function(e){return t.onClickMonth(e.value)}})),h("div",{key:"5e74571cea6b858964554f3065eb40092535f1dd",class:Object.assign({},r.class())},h("slot",{key:"c3cc4f4f43d40b095ad03fe23a8645282e658765"})))};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=BalDateCalendarStyle0;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 d=i.format(o);t.value=r.substring(0,i.from)+d+r.substring(i.to);t.position.value=l.to}}var u=this.blocks.getBlockIndexFromPosition(t.position.value);if(u&&!t.isBackspaceKey){var c=this.blocks.formatBlocks(t.value,u);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 BalInputDateStyle0=balInputDateCss;var InputDate=function(){function t(t){registerInstance(this,t);this.balKeyPress=createEvent(this,"balKeyPress",7);this.balChange=createEvent(this,"balChange",7);this.balInput=createEvent(this,"balInput",7);this.balBlur=createEvent(this,"balBlur",7);this.balFocus=createEvent(this,"balFocus",7);this.inputId="bal-i-date-".concat(inputDateIds++);this.inheritedAttributes={};this.maskAdapter=new MaskComponentAdapter(new DateMask);this.inputValue=this.value;this.initialValue=this.value||"";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.placeholder=undefined;this.clickable=false;this.min=undefined;this.max=undefined;this.autocomplete="off";this.hasIconRight=false;this.value=undefined;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:"c19d0b61364480bbcb5067bf0c5d68b83dab6fa7",onClick:function(e){return t.maskAdapter.bindHostClick(e)},class:Object.assign({},e.class())},h("input",Object.assign({key:"e8cbf0a3372a06823953459eeb754f2c22fc0b22",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":this.disabled?"true":null,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:"b6acc3e893caf68b4823addac74e4cea27fdc98b",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);__decorate([ListenTo("reset",{capture:true,target:"document"}),__metadata("design:type",Function),__metadata("design:paramtypes",[UIEvent]),__metadata("design:returntype",void 0)],InputDate.prototype,"resetHandler",null);__decorate([ListenTo("click",{capture:true,target:"document"}),__metadata("design:type",Function),__metadata("design:paramtypes",[MouseEvent]),__metadata("design:returntype",void 0)],InputDate.prototype,"listenOnClick",null);var inputDateIds=0;InputDate.style=BalInputDateStyle0;export{DateCalendar as bal_date_calendar,InputDate as bal_input_date};
1
+ import{__awaiter,__extends,__generator,__spreadArray}from"tslib";import{h,r as registerInstance,c as createEvent,H as Host,g as getElement}from"./index-5b1faf93.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-654e2c24.js";import{l as lodash_padstart}from"./index-bba06972.js";import{l as lodash_isnil}from"./index-82aff103.js";import{B as BalDate,i as i18nBalDate,d as dateSeparator}from"./date-3b88d03c.js";import{L as Logger}from"./log-dfd1c19f.js";import{b as waitAfterFramePaint,p as hasParent}from"./helpers-72ae7307.js";import{B as BEM}from"./bem-8c7d2eb0.js";import{d as defaultConfig}from"./config.default-7efdc82d.js";import{L as ListenToConfig}from"./config.decorator-d18abfe1.js";import{L as ListenToSwipe}from"./swipe.decorator-56b6d574.js";import{i as inheritAttributes}from"./attributes-4fa7040f.js";import{m as hasValueChanged,c as inputSetFocus,d as inputSetBlur}from"./form-input-264ad739.js";import{d as defaultBalAriaForm}from"./form-fb8dd9f5.js";import{L as ListenTo}from"./listen-d1712e70.js";import{N as NUMBER_KEYS}from"./keys.constant-0eb059e0.js";import{I as INVALID_VALUE}from"./mask-util-71edc2b8.js";import"./_commonjsHelpers-1c8beb5f.js";import"./config.utils-6ac6c9bd.js";import"./browser-a8073d92.js";import"./icons.constant-a7885631.js";import"./swipe.subject-683f7c7b.js";import"./device-8c6d2881.js";import"./listener-04842ae9.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(lodash_padstart("".concat(e),2,"0"),"-").concat(lodash_padstart("".concat(t),2,"0"))}function isoDateOfToday(){var t=new Date;return"".concat(t.getFullYear(),"-").concat(lodash_padstart("".concat(t.getMonth()+1),2,"0"),"-").concat(lodash_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 d=BalDate.fromISO(a);var u=BalDate.fromISO(i);var c=function(t){if(lodash_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:d.isAfter(f)||u.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 d=o.getFullYear();var u=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===u&&e===d,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 d=o.element("list");return h("ul",{class:Object.assign(Object.assign(Object.assign({},d.class()),d.modifier(e).class()),d.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({},d.element("item").class()),d.element("item").modifier("today").class(t.today)),d.element("item").modifier("selected").class(t.selected)),d.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 d=o.element("body");var u=d.element("grid");return h("div",{role:"grid",class:Object.assign(Object.assign({},u.class()),u.modifier("visible").class(e)),"aria-hidden":e?"false":"true",ref:function(t){return a(t)}},h("div",{role:"row",class:Object.assign({},u.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({},u.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,d=t.onClickNextMonth;var u=BEM.block("date-calendar");var c=u.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:d,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{--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 BalDateCalendarStyle0=balDateCalendarCss;var DateCalendar=function(){function t(t){var e=this;registerInstance(this,t);this.balChange=createEvent(this,"balChange",7);this.oldMin="";this.oldMax="";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)};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.value=undefined;this.defaultDate=undefined;this.allowedDates=undefined;this.min=undefined;this.max=undefined;this.minYearProp=undefined;this.maxYearProp=undefined}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:"e6348fe5b0ddab2253f7c79cb41a16fd93fe9a63",class:Object.assign({},i.class())},h(CalendarNav,{key:"fc808b662835df468fe53a659cfdb048a2ce2325",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:"14a071d6e691964876d2a832a9d2a7b20e2b5139",class:Object.assign({},n.class())},h(CalendarGrid,{key:"d7d81606a5bcf10637f48ad9d5f095cac4851c60",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:"3804356a689232d66ecbac4ad02c152a7e11739f",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:"2721e28b96097dfb3f824c6ef085657c56c89342",name:"month",isVisible:this.isMonthListVisible,girdHeight:a,list:this.months,onSelect:function(e){return t.onClickMonth(e.value)}})),h("div",{key:"da53c2e514df3bf5d4890a16fdc5738e55366f31",class:Object.assign({},r.class())},h("slot",{key:"6b75be6d0ad833854a0eade0d014ee26b05bc868"})))};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=BalDateCalendarStyle0;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 d=i.format(o);t.value=r.substring(0,i.from)+d+r.substring(i.to);t.position.value=l.to}}var u=this.blocks.getBlockIndexFromPosition(t.position.value);if(u&&!t.isBackspaceKey){var c=this.blocks.formatBlocks(t.value,u);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 BalInputDateStyle0=balInputDateCss;var InputDate=function(){function t(t){registerInstance(this,t);this.balKeyPress=createEvent(this,"balKeyPress",7);this.balChange=createEvent(this,"balChange",7);this.balInput=createEvent(this,"balInput",7);this.balBlur=createEvent(this,"balBlur",7);this.balFocus=createEvent(this,"balFocus",7);this.inputId="bal-i-date-".concat(inputDateIds++);this.inheritedAttributes={};this.maskAdapter=new MaskComponentAdapter(new DateMask);this.inputValue=this.value;this.initialValue=this.value||"";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.placeholder=undefined;this.clickable=false;this.min=undefined;this.max=undefined;this.autocomplete="off";this.hasIconRight=false;this.value=undefined;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:"14148968dbe8593f608bb83cb80431c1af6c10cb",onClick:function(e){return t.maskAdapter.bindHostClick(e)},class:Object.assign({},e.class())},h("input",Object.assign({key:"7a9307a111eb7eaca7d043e6102220f83ed407ef",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":this.disabled?"true":null,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:"23e89b524f1cd68f76461720e386034d1872689a",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);__decorate([ListenTo("reset",{capture:true,target:"document"}),__metadata("design:type",Function),__metadata("design:paramtypes",[UIEvent]),__metadata("design:returntype",void 0)],InputDate.prototype,"resetHandler",null);__decorate([ListenTo("click",{capture:true,target:"document"}),__metadata("design:type",Function),__metadata("design:paramtypes",[MouseEvent]),__metadata("design:returntype",void 0)],InputDate.prototype,"listenOnClick",null);var inputDateIds=0;InputDate.style=BalInputDateStyle0;export{DateCalendar as bal_date_calendar,InputDate as bal_input_date};
@@ -1 +1 @@
1
- import{__awaiter,__generator}from"tslib";import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-5b1faf93.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-654e2c24.js";import{B as BalDate,i as i18nBalDate}from"./date-3b88d03c.js";import{B as BEM}from"./bem-8c7d2eb0.js";import{L as Logger}from"./log-dfd1c19f.js";import{i as inheritAttributes}from"./attributes-4fa7040f.js";import{s as stopEventBubbling}from"./form-input-264ad739.js";import{o as debounceEvent}from"./helpers-72ae7307.js";import{d as defaultBalAriaForm}from"./form-fb8dd9f5.js";import{b as balFloatingUi}from"./floating-ui-82413f23.js";import{L as ListenTo}from"./listen-d1712e70.js";import{d as isSpaceKey}from"./keyboard.helpers-b2dd6393.js";import{d as defaultConfig}from"./config.default-7efdc82d.js";import{L as ListenToConfig}from"./config.decorator-d18abfe1.js";import"./config.utils-6ac6c9bd.js";import"./browser-a8073d92.js";import"./icons.constant-a7885631.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 BalDateStyle0=balDateCss;var Date=function(){function t(t){var e=this;registerInstance(this,t);this.balInput=createEvent(this,"balInput",7);this.balChange=createEvent(this,"balChange",7);this.balWillAnimate=createEvent(this,"balWillAnimate",7);this.balDidAnimate=createEvent(this,"balDidAnimate",7);this.balBlur=createEvent(this,"balBlur",7);this.balFocus=createEvent(this,"balFocus",7);this.balInputClick=createEvent(this,"balInputClick",7);this.balIconClick=createEvent(this,"balIconClick",7);this.balPopoverPrepare=createEvent(this,"balPopoverPrepare",7);this.inputId="bal-da-".concat(dateIds++);this.inheritedAttributes={};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()}};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.onInputFocus=function(t){stopEventBubbling(t);e.balFocus.emit(t.detail)};this.onInputBlur=function(t){stopEventBubbling(t);e.balBlur.emit(t.detail)};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(!(isSpaceKey(e)&&!this.triggerIcon))return[3,4];if(!this.isExpanded)return[3,2];return[4,this.close()];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.isExpanded=false;this.language=defaultConfig.language;this.calendarValue=undefined;this.ariaForm=defaultBalAriaForm;this.name=this.inputId;this.invalid=false;this.required=false;this.disabled=false;this.readonly=false;this.freeSolo=false;this.placeholder=undefined;this.triggerIcon=false;this.closeOnSelect=true;this.autocomplete="off";this.value=undefined;this.min=undefined;this.max=undefined;this.minYearProp=undefined;this.maxYearProp=undefined;this.defaultDate=undefined;this.allowedDates=undefined;this.allowInvalidValue=false;this.debounce=0;this.autoInvalidOff=false}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(){this.valueChanged()};t.prototype.componentWillLoad=function(){this.inheritedAttributes=inheritAttributes(this.el,["aria-label","tabindex","title"])};t.prototype.listenToKeydown=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(!(this.isExpanded&&(t.key==="Escape"||t.key==="Esc")))return[3,2];t.preventDefault();return[4,this.close()];case 1:e.sent();e.label=2;case 2:return[2]}}))}))};t.prototype.listenOnKeyup=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(!(t.key==="Tab"&&!this.el.contains(document.activeElement)&&this.isExpanded))return[3,2];return[4,this.close()];case 1:e.sent();e.label=2;case 2:return[2]}}))}))};t.prototype.listenOnclick=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(!(this.isExpanded&&!this.el.contains(t.target)))return[3,2];return[4,this.close()];case 1:e.sent();e.label=2;case 2:return[2]}}))}))};t.prototype.listenOnPopoverPrepare=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(!(this.inputId!==t.detail))return[3,2];return[4,this.close()];case 1:e.sent();e.label=2;case 2:return[2]}}))}))};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(){var t;return __generator(this,(function(e){(t=this.inputEl)===null||t===void 0?void 0:t.setFocus();return[2]}))}))};t.prototype.setBlur=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){(t=this.inputEl)===null||t===void 0?void 0:t.setBlur();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.balPopoverPrepare.emit(this.inputId);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:"71ecc523323aea5b610663af71761730cafdf72d",id:this.inputId,class:Object.assign({},e.class())},h("bal-input-group",{key:"fac9940b61f22766e728f2025491f1d743b65a04",invalid:this.invalid,readonly:this.readonly,disabled:this.disabled,ref:function(e){return t.referenceEl=e}},h("bal-input-date",Object.assign({key:"9ff8ef04e188c3492419029967aedbb47f6cd80d",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:this.onInputFocus,onBalBlur:this.onInputBlur,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":this.isExpanded?"true":"false"}):""),h("div",{key:"a693f4ce01308178268a00e31ef08a052d1972b2",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:"8ac00879f736c54cb7662cd9811c44cdc80859ff",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([ListenTo("keydown",{target:"window"}),__metadata("design:type",Function),__metadata("design:paramtypes",[KeyboardEvent]),__metadata("design:returntype",Promise)],Date.prototype,"listenToKeydown",null);__decorate([ListenTo("keyup",{target:"window"}),__metadata("design:type",Function),__metadata("design:paramtypes",[KeyboardEvent]),__metadata("design:returntype",Promise)],Date.prototype,"listenOnKeyup",null);__decorate([ListenTo("click",{target:"document"}),__metadata("design:type",Function),__metadata("design:paramtypes",[UIEvent]),__metadata("design:returntype",Promise)],Date.prototype,"listenOnclick",null);__decorate([ListenTo("balPopoverPrepare",{target:"document"}),__metadata("design:type",Function),__metadata("design:paramtypes",[CustomEvent]),__metadata("design:returntype",Promise)],Date.prototype,"listenOnPopoverPrepare",null);__decorate([ListenToConfig(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],Date.prototype,"configChanged",null);var dateIds=0;Date.style=BalDateStyle0;export{Date as bal_date};
1
+ import{__awaiter,__generator}from"tslib";import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-5b1faf93.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-654e2c24.js";import{B as BalDate,i as i18nBalDate}from"./date-3b88d03c.js";import{B as BEM}from"./bem-8c7d2eb0.js";import{L as Logger}from"./log-dfd1c19f.js";import{i as inheritAttributes}from"./attributes-4fa7040f.js";import{s as stopEventBubbling}from"./form-input-264ad739.js";import{o as debounceEvent}from"./helpers-72ae7307.js";import{d as defaultBalAriaForm}from"./form-fb8dd9f5.js";import{b as balFloatingUi}from"./floating-ui-82413f23.js";import{L as ListenTo}from"./listen-d1712e70.js";import{d as isSpaceKey}from"./keyboard.helpers-b2dd6393.js";import{d as defaultConfig}from"./config.default-7efdc82d.js";import{L as ListenToConfig}from"./config.decorator-d18abfe1.js";import"./config.utils-6ac6c9bd.js";import"./browser-a8073d92.js";import"./icons.constant-a7885631.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 BalDateStyle0=balDateCss;var Date=function(){function t(t){var e=this;registerInstance(this,t);this.balInput=createEvent(this,"balInput",7);this.balChange=createEvent(this,"balChange",7);this.balWillAnimate=createEvent(this,"balWillAnimate",7);this.balDidAnimate=createEvent(this,"balDidAnimate",7);this.balBlur=createEvent(this,"balBlur",7);this.balFocus=createEvent(this,"balFocus",7);this.balInputClick=createEvent(this,"balInputClick",7);this.balIconClick=createEvent(this,"balIconClick",7);this.balPopoverPrepare=createEvent(this,"balPopoverPrepare",7);this.inputId="bal-da-".concat(dateIds++);this.inheritedAttributes={};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()}};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.onInputFocus=function(t){stopEventBubbling(t);e.balFocus.emit(t.detail)};this.onInputBlur=function(t){stopEventBubbling(t);e.balBlur.emit(t.detail)};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(!(isSpaceKey(e)&&!this.triggerIcon))return[3,4];if(!this.isExpanded)return[3,2];return[4,this.close()];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.isExpanded=false;this.language=defaultConfig.language;this.calendarValue=undefined;this.ariaForm=defaultBalAriaForm;this.name=this.inputId;this.invalid=false;this.required=false;this.disabled=false;this.readonly=false;this.freeSolo=false;this.placeholder=undefined;this.triggerIcon=false;this.closeOnSelect=true;this.autocomplete="off";this.value=undefined;this.min=undefined;this.max=undefined;this.minYearProp=undefined;this.maxYearProp=undefined;this.defaultDate=undefined;this.allowedDates=undefined;this.allowInvalidValue=false;this.debounce=0;this.autoInvalidOff=false}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(){this.valueChanged()};t.prototype.componentWillLoad=function(){this.inheritedAttributes=inheritAttributes(this.el,["aria-label","tabindex","title"])};t.prototype.listenToKeydown=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(!(this.isExpanded&&(t.key==="Escape"||t.key==="Esc")))return[3,2];t.preventDefault();return[4,this.close()];case 1:e.sent();e.label=2;case 2:return[2]}}))}))};t.prototype.listenOnKeyup=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(!(t.key==="Tab"&&!this.el.contains(document.activeElement)&&this.isExpanded))return[3,2];return[4,this.close()];case 1:e.sent();e.label=2;case 2:return[2]}}))}))};t.prototype.listenOnclick=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(!(this.isExpanded&&!this.el.contains(t.target)))return[3,2];return[4,this.close()];case 1:e.sent();e.label=2;case 2:return[2]}}))}))};t.prototype.listenOnPopoverPrepare=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:if(!(this.inputId!==t.detail))return[3,2];return[4,this.close()];case 1:e.sent();e.label=2;case 2:return[2]}}))}))};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(){var t;return __generator(this,(function(e){(t=this.inputEl)===null||t===void 0?void 0:t.setFocus();return[2]}))}))};t.prototype.setBlur=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){(t=this.inputEl)===null||t===void 0?void 0:t.setBlur();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.balPopoverPrepare.emit(this.inputId);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:"0cff526d6fd1f6855de72ec6b8515a0cd7132f71",id:this.inputId,class:Object.assign({},e.class())},h("bal-input-group",{key:"e7309e15124f27a90a977cccb8ee7b03052ce450",invalid:this.invalid,readonly:this.readonly,disabled:this.disabled,ref:function(e){return t.referenceEl=e}},h("bal-input-date",Object.assign({key:"6e344882e69619d3cc26bdb29601f417de5cf4fe",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:this.onInputFocus,onBalBlur:this.onInputBlur,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":this.isExpanded?"true":"false"}):""),h("div",{key:"4de1fda8322aa577c9f178f8183f0584591bb280",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:"c29fae49306412def5c835457c17224f93d4144d",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([ListenTo("keydown",{target:"window"}),__metadata("design:type",Function),__metadata("design:paramtypes",[KeyboardEvent]),__metadata("design:returntype",Promise)],Date.prototype,"listenToKeydown",null);__decorate([ListenTo("keyup",{target:"window"}),__metadata("design:type",Function),__metadata("design:paramtypes",[KeyboardEvent]),__metadata("design:returntype",Promise)],Date.prototype,"listenOnKeyup",null);__decorate([ListenTo("click",{target:"document"}),__metadata("design:type",Function),__metadata("design:paramtypes",[UIEvent]),__metadata("design:returntype",Promise)],Date.prototype,"listenOnclick",null);__decorate([ListenTo("balPopoverPrepare",{target:"document"}),__metadata("design:type",Function),__metadata("design:paramtypes",[CustomEvent]),__metadata("design:returntype",Promise)],Date.prototype,"listenOnPopoverPrepare",null);__decorate([ListenToConfig(),__metadata("design:type",Function),__metadata("design:paramtypes",[Object]),__metadata("design:returntype",Promise)],Date.prototype,"configChanged",null);var dateIds=0;Date.style=BalDateStyle0;export{Date as bal_date};