@kirbydesign/designsystem 11.11.4 → 12.0.0-dev-286cdc0

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 (291) hide show
  1. package/README.md +7 -0
  2. package/fesm2022/kirbydesign-designsystem-accordion.mjs +246 -135
  3. package/fesm2022/kirbydesign-designsystem-accordion.mjs.map +1 -1
  4. package/fesm2022/kirbydesign-designsystem-action-group.mjs +229 -134
  5. package/fesm2022/kirbydesign-designsystem-action-group.mjs.map +1 -1
  6. package/fesm2022/kirbydesign-designsystem-avatar.mjs +102 -55
  7. package/fesm2022/kirbydesign-designsystem-avatar.mjs.map +1 -1
  8. package/fesm2022/kirbydesign-designsystem-badge.mjs +85 -42
  9. package/fesm2022/kirbydesign-designsystem-badge.mjs.map +1 -1
  10. package/fesm2022/kirbydesign-designsystem-button.mjs +203 -170
  11. package/fesm2022/kirbydesign-designsystem-button.mjs.map +1 -1
  12. package/fesm2022/kirbydesign-designsystem-calendar.mjs +524 -516
  13. package/fesm2022/kirbydesign-designsystem-calendar.mjs.map +1 -1
  14. package/fesm2022/kirbydesign-designsystem-card.mjs +439 -205
  15. package/fesm2022/kirbydesign-designsystem-card.mjs.map +1 -1
  16. package/fesm2022/kirbydesign-designsystem-chart.mjs +1388 -1469
  17. package/fesm2022/kirbydesign-designsystem-chart.mjs.map +1 -1
  18. package/fesm2022/kirbydesign-designsystem-checkbox.mjs +223 -176
  19. package/fesm2022/kirbydesign-designsystem-checkbox.mjs.map +1 -1
  20. package/fesm2022/kirbydesign-designsystem-config.mjs +50 -96
  21. package/fesm2022/kirbydesign-designsystem-config.mjs.map +1 -1
  22. package/fesm2022/kirbydesign-designsystem-data-table.mjs +180 -83
  23. package/fesm2022/kirbydesign-designsystem-data-table.mjs.map +1 -1
  24. package/fesm2022/kirbydesign-designsystem-divider.mjs +46 -19
  25. package/fesm2022/kirbydesign-designsystem-divider.mjs.map +1 -1
  26. package/fesm2022/kirbydesign-designsystem-dropdown.mjs +878 -752
  27. package/fesm2022/kirbydesign-designsystem-dropdown.mjs.map +1 -1
  28. package/fesm2022/kirbydesign-designsystem-empty-state.mjs +175 -91
  29. package/fesm2022/kirbydesign-designsystem-empty-state.mjs.map +1 -1
  30. package/fesm2022/kirbydesign-designsystem-fab-sheet.mjs +213 -85
  31. package/fesm2022/kirbydesign-designsystem-fab-sheet.mjs.map +1 -1
  32. package/fesm2022/kirbydesign-designsystem-flag.mjs +67 -33
  33. package/fesm2022/kirbydesign-designsystem-flag.mjs.map +1 -1
  34. package/fesm2022/kirbydesign-designsystem-form-field.mjs +1260 -891
  35. package/fesm2022/kirbydesign-designsystem-form-field.mjs.map +1 -1
  36. package/fesm2022/kirbydesign-designsystem-gesture.mjs +38 -23
  37. package/fesm2022/kirbydesign-designsystem-gesture.mjs.map +1 -1
  38. package/fesm2022/kirbydesign-designsystem-header.mjs +422 -182
  39. package/fesm2022/kirbydesign-designsystem-header.mjs.map +1 -1
  40. package/fesm2022/kirbydesign-designsystem-helpers-scss.mjs +16 -14
  41. package/fesm2022/kirbydesign-designsystem-helpers-scss.mjs.map +1 -1
  42. package/fesm2022/kirbydesign-designsystem-helpers.mjs +251 -361
  43. package/fesm2022/kirbydesign-designsystem-helpers.mjs.map +1 -1
  44. package/fesm2022/kirbydesign-designsystem-icon.mjs +881 -296
  45. package/fesm2022/kirbydesign-designsystem-icon.mjs.map +1 -1
  46. package/fesm2022/kirbydesign-designsystem-item-group.mjs +52 -23
  47. package/fesm2022/kirbydesign-designsystem-item-group.mjs.map +1 -1
  48. package/fesm2022/kirbydesign-designsystem-item-sliding.mjs +147 -43
  49. package/fesm2022/kirbydesign-designsystem-item-sliding.mjs.map +1 -1
  50. package/fesm2022/kirbydesign-designsystem-item.mjs +395 -151
  51. package/fesm2022/kirbydesign-designsystem-item.mjs.map +1 -1
  52. package/fesm2022/kirbydesign-designsystem-kirby-app.mjs +136 -54
  53. package/fesm2022/kirbydesign-designsystem-kirby-app.mjs.map +1 -1
  54. package/fesm2022/kirbydesign-designsystem-list.mjs +1188 -697
  55. package/fesm2022/kirbydesign-designsystem-list.mjs.map +1 -1
  56. package/fesm2022/kirbydesign-designsystem-loading-overlay.mjs +166 -76
  57. package/fesm2022/kirbydesign-designsystem-loading-overlay.mjs.map +1 -1
  58. package/fesm2022/kirbydesign-designsystem-menu.mjs +420 -311
  59. package/fesm2022/kirbydesign-designsystem-menu.mjs.map +1 -1
  60. package/fesm2022/kirbydesign-designsystem-modal.mjs +2476 -1912
  61. package/fesm2022/kirbydesign-designsystem-modal.mjs.map +1 -1
  62. package/fesm2022/kirbydesign-designsystem-page.mjs +1526 -905
  63. package/fesm2022/kirbydesign-designsystem-page.mjs.map +1 -1
  64. package/fesm2022/kirbydesign-designsystem-popover.mjs +204 -169
  65. package/fesm2022/kirbydesign-designsystem-popover.mjs.map +1 -1
  66. package/fesm2022/kirbydesign-designsystem-progress-circle.mjs +209 -158
  67. package/fesm2022/kirbydesign-designsystem-progress-circle.mjs.map +1 -1
  68. package/fesm2022/kirbydesign-designsystem-radio.mjs +537 -365
  69. package/fesm2022/kirbydesign-designsystem-radio.mjs.map +1 -1
  70. package/fesm2022/kirbydesign-designsystem-range.mjs +207 -150
  71. package/fesm2022/kirbydesign-designsystem-range.mjs.map +1 -1
  72. package/fesm2022/kirbydesign-designsystem-reorder-list.mjs +217 -104
  73. package/fesm2022/kirbydesign-designsystem-reorder-list.mjs.map +1 -1
  74. package/fesm2022/kirbydesign-designsystem-router-outlet.mjs +113 -38
  75. package/fesm2022/kirbydesign-designsystem-router-outlet.mjs.map +1 -1
  76. package/fesm2022/kirbydesign-designsystem-section-header.mjs +56 -18
  77. package/fesm2022/kirbydesign-designsystem-section-header.mjs.map +1 -1
  78. package/fesm2022/kirbydesign-designsystem-segmented-control.mjs +276 -232
  79. package/fesm2022/kirbydesign-designsystem-segmented-control.mjs.map +1 -1
  80. package/fesm2022/kirbydesign-designsystem-shared-floating.mjs +328 -382
  81. package/fesm2022/kirbydesign-designsystem-shared-floating.mjs.map +1 -1
  82. package/fesm2022/kirbydesign-designsystem-shared-portal.mjs +73 -84
  83. package/fesm2022/kirbydesign-designsystem-shared-portal.mjs.map +1 -1
  84. package/fesm2022/kirbydesign-designsystem-shared.mjs +665 -531
  85. package/fesm2022/kirbydesign-designsystem-shared.mjs.map +1 -1
  86. package/fesm2022/kirbydesign-designsystem-slide-button.mjs +140 -91
  87. package/fesm2022/kirbydesign-designsystem-slide-button.mjs.map +1 -1
  88. package/fesm2022/kirbydesign-designsystem-slide.mjs +360 -158
  89. package/fesm2022/kirbydesign-designsystem-slide.mjs.map +1 -1
  90. package/fesm2022/kirbydesign-designsystem-spinner.mjs +90 -32
  91. package/fesm2022/kirbydesign-designsystem-spinner.mjs.map +1 -1
  92. package/fesm2022/kirbydesign-designsystem-tab-navigation.mjs +348 -181
  93. package/fesm2022/kirbydesign-designsystem-tab-navigation.mjs.map +1 -1
  94. package/fesm2022/kirbydesign-designsystem-tabs.mjs +286 -121
  95. package/fesm2022/kirbydesign-designsystem-tabs.mjs.map +1 -1
  96. package/fesm2022/kirbydesign-designsystem-testing-base.mjs +6234 -3164
  97. package/fesm2022/kirbydesign-designsystem-testing-base.mjs.map +1 -1
  98. package/fesm2022/kirbydesign-designsystem-testing-jasmine.mjs +118 -95
  99. package/fesm2022/kirbydesign-designsystem-testing-jasmine.mjs.map +1 -1
  100. package/fesm2022/kirbydesign-designsystem-testing-jest.mjs +128 -101
  101. package/fesm2022/kirbydesign-designsystem-testing-jest.mjs.map +1 -1
  102. package/fesm2022/kirbydesign-designsystem-testing.mjs +236 -243
  103. package/fesm2022/kirbydesign-designsystem-testing.mjs.map +1 -1
  104. package/fesm2022/kirbydesign-designsystem-toast.mjs +98 -62
  105. package/fesm2022/kirbydesign-designsystem-toast.mjs.map +1 -1
  106. package/fesm2022/kirbydesign-designsystem-toggle-button.mjs +155 -127
  107. package/fesm2022/kirbydesign-designsystem-toggle-button.mjs.map +1 -1
  108. package/fesm2022/kirbydesign-designsystem-toggle.mjs +180 -150
  109. package/fesm2022/kirbydesign-designsystem-toggle.mjs.map +1 -1
  110. package/fesm2022/kirbydesign-designsystem-types.mjs +39 -24
  111. package/fesm2022/kirbydesign-designsystem-types.mjs.map +1 -1
  112. package/fesm2022/kirbydesign-designsystem.mjs +516 -407
  113. package/fesm2022/kirbydesign-designsystem.mjs.map +1 -1
  114. package/icons/svg/megaphone.svg +3 -0
  115. package/icons/svg/person-blocked.svg +3 -0
  116. package/icons/svg/person-check.svg +3 -0
  117. package/icons/svg/person-close.svg +3 -0
  118. package/icons/svg/person-cloud.svg +3 -0
  119. package/icons/svg/person-power.svg +3 -0
  120. package/icons/svg/person-warning.svg +3 -0
  121. package/icons/svg/phone-device-pin.svg +3 -0
  122. package/icons/svg/phone-device.svg +3 -2
  123. package/package.json +10 -10
  124. package/readme.md +37 -0
  125. package/types/kirbydesign-designsystem-accordion.d.ts +72 -39
  126. package/types/kirbydesign-designsystem-accordion.d.ts.map +1 -1
  127. package/types/kirbydesign-designsystem-action-group.d.ts +46 -39
  128. package/types/kirbydesign-designsystem-action-group.d.ts.map +1 -1
  129. package/types/kirbydesign-designsystem-avatar.d.ts +62 -26
  130. package/types/kirbydesign-designsystem-avatar.d.ts.map +1 -1
  131. package/types/kirbydesign-designsystem-badge.d.ts +30 -19
  132. package/types/kirbydesign-designsystem-badge.d.ts.map +1 -1
  133. package/types/kirbydesign-designsystem-button.d.ts +70 -45
  134. package/types/kirbydesign-designsystem-button.d.ts.map +1 -1
  135. package/types/kirbydesign-designsystem-calendar.d.ts +193 -132
  136. package/types/kirbydesign-designsystem-calendar.d.ts.map +1 -1
  137. package/types/kirbydesign-designsystem-card.d.ts +130 -66
  138. package/types/kirbydesign-designsystem-card.d.ts.map +1 -1
  139. package/types/kirbydesign-designsystem-chart.d.ts +198 -172
  140. package/types/kirbydesign-designsystem-chart.d.ts.map +1 -1
  141. package/types/kirbydesign-designsystem-checkbox.d.ts +102 -68
  142. package/types/kirbydesign-designsystem-checkbox.d.ts.map +1 -1
  143. package/types/kirbydesign-designsystem-config.d.ts +17 -21
  144. package/types/kirbydesign-designsystem-config.d.ts.map +1 -1
  145. package/types/kirbydesign-designsystem-data-table.d.ts +46 -26
  146. package/types/kirbydesign-designsystem-data-table.d.ts.map +1 -1
  147. package/types/kirbydesign-designsystem-divider.d.ts +11 -9
  148. package/types/kirbydesign-designsystem-divider.d.ts.map +1 -1
  149. package/types/kirbydesign-designsystem-dropdown.d.ts +219 -166
  150. package/types/kirbydesign-designsystem-dropdown.d.ts.map +1 -1
  151. package/types/kirbydesign-designsystem-empty-state.d.ts +58 -35
  152. package/types/kirbydesign-designsystem-empty-state.d.ts.map +1 -1
  153. package/types/kirbydesign-designsystem-fab-sheet.d.ts +34 -28
  154. package/types/kirbydesign-designsystem-fab-sheet.d.ts.map +1 -1
  155. package/types/kirbydesign-designsystem-flag.d.ts +18 -13
  156. package/types/kirbydesign-designsystem-flag.d.ts.map +1 -1
  157. package/types/kirbydesign-designsystem-form-field.d.ts +409 -242
  158. package/types/kirbydesign-designsystem-form-field.d.ts.map +1 -1
  159. package/types/kirbydesign-designsystem-gesture.d.ts +41 -46
  160. package/types/kirbydesign-designsystem-gesture.d.ts.map +1 -1
  161. package/types/kirbydesign-designsystem-header.d.ts +102 -64
  162. package/types/kirbydesign-designsystem-header.d.ts.map +1 -1
  163. package/types/kirbydesign-designsystem-helpers-scss.d.ts +6 -8
  164. package/types/kirbydesign-designsystem-helpers-scss.d.ts.map +1 -1
  165. package/types/kirbydesign-designsystem-helpers.d.ts +83 -97
  166. package/types/kirbydesign-designsystem-helpers.d.ts.map +1 -1
  167. package/types/kirbydesign-designsystem-icon.d.ts +63 -59
  168. package/types/kirbydesign-designsystem-icon.d.ts.map +1 -1
  169. package/types/kirbydesign-designsystem-item-group.d.ts +6 -9
  170. package/types/kirbydesign-designsystem-item-group.d.ts.map +1 -1
  171. package/types/kirbydesign-designsystem-item-sliding.d.ts +30 -26
  172. package/types/kirbydesign-designsystem-item-sliding.d.ts.map +1 -1
  173. package/types/kirbydesign-designsystem-item.d.ts +93 -54
  174. package/types/kirbydesign-designsystem-item.d.ts.map +1 -1
  175. package/types/kirbydesign-designsystem-kirby-app.d.ts +18 -19
  176. package/types/kirbydesign-designsystem-kirby-app.d.ts.map +1 -1
  177. package/types/kirbydesign-designsystem-list.d.ts +392 -263
  178. package/types/kirbydesign-designsystem-list.d.ts.map +1 -1
  179. package/types/kirbydesign-designsystem-loading-overlay.d.ts +35 -24
  180. package/types/kirbydesign-designsystem-loading-overlay.d.ts.map +1 -1
  181. package/types/kirbydesign-designsystem-menu.d.ts +119 -69
  182. package/types/kirbydesign-designsystem-menu.d.ts.map +1 -1
  183. package/types/kirbydesign-designsystem-modal.d.ts +578 -455
  184. package/types/kirbydesign-designsystem-modal.d.ts.map +1 -1
  185. package/types/kirbydesign-designsystem-page.d.ts +308 -226
  186. package/types/kirbydesign-designsystem-page.d.ts.map +1 -1
  187. package/types/kirbydesign-designsystem-popover.d.ts +48 -40
  188. package/types/kirbydesign-designsystem-popover.d.ts.map +1 -1
  189. package/types/kirbydesign-designsystem-progress-circle.d.ts +59 -61
  190. package/types/kirbydesign-designsystem-progress-circle.d.ts.map +1 -1
  191. package/types/kirbydesign-designsystem-radio.d.ts +147 -98
  192. package/types/kirbydesign-designsystem-radio.d.ts.map +1 -1
  193. package/types/kirbydesign-designsystem-range.d.ts +90 -45
  194. package/types/kirbydesign-designsystem-range.d.ts.map +1 -1
  195. package/types/kirbydesign-designsystem-reorder-list.d.ts +44 -32
  196. package/types/kirbydesign-designsystem-reorder-list.d.ts.map +1 -1
  197. package/types/kirbydesign-designsystem-router-outlet.d.ts +23 -18
  198. package/types/kirbydesign-designsystem-router-outlet.d.ts.map +1 -1
  199. package/types/kirbydesign-designsystem-section-header.d.ts +5 -8
  200. package/types/kirbydesign-designsystem-section-header.d.ts.map +1 -1
  201. package/types/kirbydesign-designsystem-segmented-control.d.ts +123 -100
  202. package/types/kirbydesign-designsystem-segmented-control.d.ts.map +1 -1
  203. package/types/kirbydesign-designsystem-shared-floating.d.ts +183 -128
  204. package/types/kirbydesign-designsystem-shared-floating.d.ts.map +1 -1
  205. package/types/kirbydesign-designsystem-shared-portal.d.ts +29 -28
  206. package/types/kirbydesign-designsystem-shared-portal.d.ts.map +1 -1
  207. package/types/kirbydesign-designsystem-shared.d.ts +143 -139
  208. package/types/kirbydesign-designsystem-shared.d.ts.map +1 -1
  209. package/types/kirbydesign-designsystem-slide-button.d.ts +43 -34
  210. package/types/kirbydesign-designsystem-slide-button.d.ts.map +1 -1
  211. package/types/kirbydesign-designsystem-slide.d.ts +80 -59
  212. package/types/kirbydesign-designsystem-slide.d.ts.map +1 -1
  213. package/types/kirbydesign-designsystem-spinner.d.ts +13 -14
  214. package/types/kirbydesign-designsystem-spinner.d.ts.map +1 -1
  215. package/types/kirbydesign-designsystem-tab-navigation.d.ts +78 -55
  216. package/types/kirbydesign-designsystem-tab-navigation.d.ts.map +1 -1
  217. package/types/kirbydesign-designsystem-tabs.d.ts +50 -45
  218. package/types/kirbydesign-designsystem-tabs.d.ts.map +1 -1
  219. package/types/kirbydesign-designsystem-testing-base.d.ts +2435 -815
  220. package/types/kirbydesign-designsystem-testing-base.d.ts.map +1 -1
  221. package/types/kirbydesign-designsystem-testing-jasmine.d.ts +9 -10
  222. package/types/kirbydesign-designsystem-testing-jasmine.d.ts.map +1 -1
  223. package/types/kirbydesign-designsystem-testing-jest.d.ts +9 -10
  224. package/types/kirbydesign-designsystem-testing-jest.d.ts.map +1 -1
  225. package/types/kirbydesign-designsystem-testing.d.ts +52 -58
  226. package/types/kirbydesign-designsystem-testing.d.ts.map +1 -1
  227. package/types/kirbydesign-designsystem-toast.d.ts +25 -31
  228. package/types/kirbydesign-designsystem-toast.d.ts.map +1 -1
  229. package/types/kirbydesign-designsystem-toggle-button.d.ts +62 -56
  230. package/types/kirbydesign-designsystem-toggle-button.d.ts.map +1 -1
  231. package/types/kirbydesign-designsystem-toggle.d.ts +71 -63
  232. package/types/kirbydesign-designsystem-toggle.d.ts.map +1 -1
  233. package/types/kirbydesign-designsystem-types.d.ts +15 -22
  234. package/types/kirbydesign-designsystem-types.d.ts.map +1 -1
  235. package/types/kirbydesign-designsystem.d.ts +135 -123
  236. package/types/kirbydesign-designsystem.d.ts.map +1 -1
  237. package/accordion/package.json +0 -4
  238. package/action-group/package.json +0 -4
  239. package/avatar/package.json +0 -4
  240. package/badge/package.json +0 -4
  241. package/button/package.json +0 -4
  242. package/calendar/package.json +0 -4
  243. package/card/package.json +0 -4
  244. package/chart/package.json +0 -4
  245. package/checkbox/package.json +0 -4
  246. package/config/package.json +0 -4
  247. package/data-table/package.json +0 -4
  248. package/divider/package.json +0 -4
  249. package/dropdown/package.json +0 -4
  250. package/empty-state/package.json +0 -4
  251. package/fab-sheet/package.json +0 -4
  252. package/flag/package.json +0 -4
  253. package/form-field/package.json +0 -4
  254. package/gesture/package.json +0 -4
  255. package/header/package.json +0 -4
  256. package/helpers/package.json +0 -4
  257. package/helpers/scss/package.json +0 -4
  258. package/icon/package.json +0 -4
  259. package/item/package.json +0 -4
  260. package/item-group/package.json +0 -4
  261. package/item-sliding/package.json +0 -4
  262. package/kirby-app/package.json +0 -4
  263. package/list/package.json +0 -4
  264. package/loading-overlay/package.json +0 -4
  265. package/menu/package.json +0 -4
  266. package/modal/package.json +0 -4
  267. package/page/package.json +0 -4
  268. package/popover/package.json +0 -4
  269. package/progress-circle/package.json +0 -4
  270. package/radio/package.json +0 -4
  271. package/range/package.json +0 -4
  272. package/reorder-list/package.json +0 -4
  273. package/router-outlet/package.json +0 -4
  274. package/section-header/package.json +0 -4
  275. package/segmented-control/package.json +0 -4
  276. package/shared/floating/package.json +0 -4
  277. package/shared/package.json +0 -4
  278. package/shared/portal/package.json +0 -4
  279. package/slide/package.json +0 -4
  280. package/slide-button/package.json +0 -4
  281. package/spinner/package.json +0 -4
  282. package/tab-navigation/package.json +0 -4
  283. package/tabs/package.json +0 -4
  284. package/testing/package.json +0 -4
  285. package/testing-base/package.json +0 -4
  286. package/testing-jasmine/package.json +0 -4
  287. package/testing-jest/package.json +0 -4
  288. package/toast/package.json +0 -4
  289. package/toggle/package.json +0 -4
  290. package/toggle-button/package.json +0 -4
  291. package/types/package.json +0 -4
@@ -1,894 +1,1263 @@
1
- import * as i0 from '@angular/core';
2
- import { Input, Directive, LOCALE_ID, HostListener, Inject, Optional, ChangeDetectionStrategy, Component, EventEmitter, Output, HostBinding, ContentChild, ContentChildren, NgModule } from '@angular/core';
3
- import * as i1$1 from '@kirbydesign/designsystem/helpers';
4
- import { extendValueAccessors, UniqueIdGenerator, DesignTokenHelper } from '@kirbydesign/designsystem/helpers';
5
- import { RadioGroupComponent } from '@kirbydesign/designsystem/radio';
6
- import * as i2 from '@kirbydesign/designsystem/types';
7
- import { FORM_FIELD_CONTROL } from '@kirbydesign/designsystem/types';
8
- import { getLocaleDateFormat, FormatWidth, NgTemplateOutlet, getLocaleNumberSymbol, NumberSymbol, CommonModule } from '@angular/common';
9
- import { IconComponent, IconModule } from '@kirbydesign/designsystem/icon';
10
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
11
- import Inputmask from 'inputmask';
12
- import { tap, filter, debounceTime } from 'rxjs';
13
- import * as i1 from '@kirbydesign/designsystem/shared';
14
-
15
- class AffixDirective {
16
- constructor(el) {
17
- this.el = el;
18
- }
19
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: AffixDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
20
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.18", type: AffixDirective, isStandalone: true, selector: "[kirby-affix]", inputs: { type: ["kirby-affix", "type"] }, ngImport: i0 }); }
21
- }
22
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: AffixDirective, decorators: [{
23
- type: Directive,
24
- args: [{
25
- // eslint-disable-next-line
26
- selector: '[kirby-affix]',
27
- }]
28
- }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { type: [{
29
- type: Input,
30
- args: ['kirby-affix']
31
- }] } });
32
-
33
- class DateInputDirective {
34
- onInput() {
35
- if (!this.isDateInput)
36
- return;
37
- if (this.enableInputMask) {
38
- this.updateMask(this.elementRef.nativeElement.value);
39
- }
40
- }
41
- constructor(elementRef, renderer, locale, valueAccessors) {
42
- this.elementRef = elementRef;
43
- this.renderer = renderer;
44
- this.locale = locale;
45
- this.prefillYear = false;
46
- this.useNativeDatePicker = false;
47
- /**
48
- * `isDateInput` is used to avoid removing the type attribute on the input element and calling updateMask()
49
- * when the directive is not used on a date input.
50
- * This is needed for the standalone component 'InputComponent', which includes the directive
51
- * using the `hostDirectives` component decorator prop. Angular ignores the selector of directives
52
- * applied in the `hostDirectives` property which effectively applies the directive to all kirby-inputs, not only date inputs.
53
- * This check prevents the directive from executing it's masking on non-date inputs.
54
- * See: https://angular.io/guide/directive-composition-api
55
- */
56
- this.isDateInput = false;
57
- /**
58
- * Inputmask should be enabled exclusively when _not_ using the platform
59
- * native date picker.
60
- *
61
- * `enableInputMask` should be ignored if the type attribute of the `<input>`
62
- * element is different from 'date' and/or the platform native date picker is
63
- * explicitly enabled.
64
- *
65
- * @private
66
- * @memberof DateInputDirective
67
- */
68
- this.enableInputMask = false;
69
- this.isDateInput = this.elementRef.nativeElement.type === 'date';
70
- if (this.isDateInput) {
71
- // Remove type to avoid user-agent specific behaviour for [type="date"]
72
- // Has to be done in constructor to avoid browser behavior kicking in
73
- this.elementRef.nativeElement.removeAttribute('type');
74
- extendValueAccessors(valueAccessors, {
75
- writeValue: {
76
- afterWriteValue: (value) => this.updateMask(value),
77
- },
78
- });
79
- }
80
- }
81
- ngOnChanges(changes) {
82
- if (changes.dateValue && this.isDateInput && this.maskingElement) {
83
- const newValue = changes.dateValue.currentValue;
84
- this.updateMask(newValue);
85
- if (newValue != null) {
86
- this.inputmask?.setValue(newValue);
87
- }
88
- }
89
- }
90
- ngAfterViewInit() {
91
- if (!this.isDateInput)
92
- return;
93
- this.enableInputMask = !this.useNativeDatePicker;
94
- // This case is identical to date input fields _before_ native date picker
95
- // option was introduced
96
- if (this.enableInputMask) {
97
- this.initMask();
98
- // Update mask with initial value if set via [value] binding on input
99
- if (this.dateValue && this.inputmask) {
100
- this.updateMask(this.dateValue);
101
- this.inputmask.setValue(this.dateValue);
102
- }
103
- }
104
- if (this.useNativeDatePicker) {
105
- this.elementRef.nativeElement.setAttribute('type', 'date');
106
- }
107
- }
108
- initMask() {
109
- const inputFormat = this.getInputFormat();
110
- const placeholder = this.getPlaceholder(inputFormat);
111
- // Set initial placeholder ex. dd/mm/yyyy
112
- this.renderer.setAttribute(this.elementRef.nativeElement, 'placeholder', placeholder);
113
- // Init InputMask
114
- new Inputmask('datetime', {
115
- inputFormat,
116
- placeholder,
117
- prefillYear: this.prefillYear,
118
- }).mask(this.elementRef.nativeElement);
119
- this.inputmask = this.elementRef.nativeElement.inputmask;
120
- // Append input overlay, so it's possible to style typed date differntly than the date-mask
121
- this.appendMaskingElement();
122
- }
123
- // Keeps order and seperator from speficied locale
124
- getInputFormat() {
125
- const localeDateFormat = getLocaleDateFormat(this.locale, FormatWidth.Short);
126
- return localeDateFormat
127
- .toLowerCase()
128
- .replace(/d+/, 'dd')
129
- .replace(/m+/, 'MM')
130
- .replace(/y+/, 'yyyy');
131
- }
132
- // The visual placeholder keeps the lowercase `mm` month token (e.g. mm/dd/yyyy),
133
- // independent of the uppercase `MM` used by the parse format above.
134
- getPlaceholder(inputFormat) {
135
- const placeholder = inputFormat.toLowerCase();
136
- return this.locale === 'da' ? placeholder.split('y').join('å') : placeholder;
137
- }
138
- appendMaskingElement() {
139
- const wrapper = this.wrapElement(this.elementRef.nativeElement);
140
- this.renderer.addClass(wrapper, 'date-mask-wrapper');
141
- this.maskingElement = this.renderer.createElement('div');
142
- this.renderer.appendChild(wrapper, this.maskingElement);
143
- this.renderer.addClass(this.maskingElement, 'date-mask');
144
- }
145
- wrapElement(element) {
146
- const wrapper = this.renderer.createElement('div');
147
- const parent = element.parentElement;
148
- this.renderer.insertBefore(parent, wrapper, element);
149
- this.renderer.appendChild(wrapper, element);
150
- return wrapper;
151
- }
152
- updateMask(value) {
153
- if (!this.maskingElement)
154
- return;
155
- if (!value) {
156
- this.maskingElement.innerHTML = '';
157
- return;
158
- }
159
- const lastNumber = value.match(/.*?(\d)[^\d]*$/); // get last number in string
160
- this.maskingElement.innerHTML = lastNumber
161
- ? value.slice(0, value.lastIndexOf(lastNumber[1]) + 1)
162
- : '';
163
- }
164
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: DateInputDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: LOCALE_ID }, { token: NG_VALUE_ACCESSOR, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
165
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.18", type: DateInputDirective, isStandalone: true, inputs: { prefillYear: "prefillYear", useNativeDatePicker: "useNativeDatePicker", dateValue: "dateValue" }, host: { listeners: { "input": "onInput()" } }, usesOnChanges: true, ngImport: i0 }); }
166
- }
167
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: DateInputDirective, decorators: [{
168
- type: Directive,
169
- args: [{}]
170
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
171
- type: Inject,
172
- args: [LOCALE_ID]
173
- }] }, { type: undefined, decorators: [{
174
- type: Optional
175
- }, {
176
- type: Inject,
177
- args: [NG_VALUE_ACCESSOR]
178
- }] }], propDecorators: { onInput: [{
179
- type: HostListener,
180
- args: ['input']
181
- }], prefillYear: [{
182
- type: Input
183
- }], useNativeDatePicker: [{
184
- type: Input
185
- }], dateValue: [{
186
- type: Input
187
- }] } });
188
-
189
- class FormFieldMessageComponent {
190
- constructor() {
191
- this.position = 'left';
192
- }
193
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: FormFieldMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
194
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.18", type: FormFieldMessageComponent, isStandalone: true, selector: "kirby-form-field-message", inputs: { text: "text", position: "position" }, ngImport: i0, template: "{{ text }}\n<ng-content></ng-content>\n", styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{font-style:italic;font-size:clamp(11px,.75rem,24px);font-weight:400;font-stretch:normal;line-height:1.3334;min-height:1rem;letter-spacing:normal;color:var(--kirby-text-color-black)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
195
- }
196
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: FormFieldMessageComponent, decorators: [{
197
- type: Component,
198
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'kirby-form-field-message', template: "{{ text }}\n<ng-content></ng-content>\n", styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{font-style:italic;font-size:clamp(11px,.75rem,24px);font-weight:400;font-stretch:normal;line-height:1.3334;min-height:1rem;letter-spacing:normal;color:var(--kirby-text-color-black)}\n"] }]
199
- }], propDecorators: { text: [{
200
- type: Input
201
- }], position: [{
202
- type: Input
203
- }] } });
204
-
205
- class InputCounterComponent {
206
- get text() {
207
- if (this.length === undefined) {
208
- return undefined;
209
- }
210
- const ofMaxlength = this.maxlength ? `/${this.maxlength}` : '';
211
- return `${this.length}${ofMaxlength}`;
212
- }
213
- constructor(translations, cdr) {
214
- this.translations = translations;
215
- this.cdr = cdr;
216
- this.skipNextAnnouncement = false;
217
- }
218
- ngAfterViewInit() {
219
- if (this.listenTo) {
220
- // A FormControl initialized with a value writes directly to the nativeElement.
221
- // Check for this scenario first, before checking for listenTo's value @Input.
222
- const initialValue = this.listenTo.nativeValue ?? this.listenTo.value ?? '';
223
- this.length = initialValue.length;
224
- this.skipNextAnnouncement = this.length > 0; // If there is already text in the input, skip the first announcement so we don't announce on refresh or prefilled text fields.
225
- this.maxlength = this.listenTo.maxlength ? +this.listenTo.maxlength : undefined;
226
- this.cdr.detectChanges();
227
- this._inputChangeSubscription = this.listenTo.kirbyChange
228
- .pipe(tap((value) => (this.length = value?.length || 0)), filter(() => this.skipAnnouncement()), debounceTime(1000))
229
- .subscribe(() => {
230
- this.announceText();
231
- });
232
- }
233
- }
234
- skipAnnouncement() {
235
- if (this.skipNextAnnouncement) {
236
- this.skipNextAnnouncement = false;
237
- return false;
238
- }
239
- return true;
240
- }
241
- ngOnDestroy() {
242
- this._inputChangeSubscription?.unsubscribe();
243
- }
244
- announceText() {
245
- const characters = this.translations.get('characters');
246
- const entered = this.translations.get('entered');
247
- if (this.maxlength === undefined) {
248
- this.textToAnnounce = `${characters} ${this.length} ${entered}`;
249
- }
250
- else {
251
- const outOf = this.translations.get('outOf');
252
- this.textToAnnounce = `${characters} ${this.length} ${outOf} ${this.maxlength} ${entered}`;
253
- }
254
- }
255
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: InputCounterComponent, deps: [{ token: i1.TranslationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
256
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.18", type: InputCounterComponent, isStandalone: true, selector: "kirby-input-counter", inputs: { listenTo: "listenTo" }, ngImport: i0, template: "<kirby-form-field-message [text]=\"text\"></kirby-form-field-message>\n<div class=\"kirby-visually-hidden\" aria-live=\"polite\">{{ textToAnnounce }}</div>\n", dependencies: [{ kind: "component", type: FormFieldMessageComponent, selector: "kirby-form-field-message", inputs: ["text", "position"] }] }); }
257
- }
258
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: InputCounterComponent, decorators: [{
259
- type: Component,
260
- args: [{ selector: 'kirby-input-counter', imports: [FormFieldMessageComponent], template: "<kirby-form-field-message [text]=\"text\"></kirby-form-field-message>\n<div class=\"kirby-visually-hidden\" aria-live=\"polite\">{{ textToAnnounce }}</div>\n" }]
261
- }], ctorParameters: () => [{ type: i1.TranslationService }, { type: i0.ChangeDetectorRef }], propDecorators: { listenTo: [{
262
- type: Input
263
- }] } });
264
-
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, ContentChild, ContentChildren, Directive, EventEmitter, HostBinding, HostListener, Inject, Input, LOCALE_ID, NgModule, Optional, Output } from "@angular/core";
3
+ import * as i1 from "@kirbydesign/designsystem/helpers";
4
+ import { DesignTokenHelper, UniqueIdGenerator, extendValueAccessors } from "@kirbydesign/designsystem/helpers";
5
+ import { RadioGroupComponent } from "@kirbydesign/designsystem/radio";
6
+ import * as i2 from "@kirbydesign/designsystem/types";
7
+ import { FORM_FIELD_CONTROL } from "@kirbydesign/designsystem/types";
8
+ import { CommonModule, FormatWidth, NgTemplateOutlet, NumberSymbol, getLocaleDateFormat, getLocaleNumberSymbol } from "@angular/common";
9
+ import { IconComponent, IconModule } from "@kirbydesign/designsystem/icon";
10
+ import { NG_VALUE_ACCESSOR } from "@angular/forms";
11
+ import Inputmask from "inputmask";
12
+ import { debounceTime, filter, tap } from "rxjs";
13
+ import * as i1$1 from "@kirbydesign/designsystem/shared";
14
+ var AffixDirective = class AffixDirective {
15
+ constructor(el) {
16
+ this.el = el;
17
+ }
18
+ static {
19
+ this.ɵfac = i0.ɵɵngDeclareFactory({
20
+ minVersion: "12.0.0",
21
+ version: "22.2.3",
22
+ ngImport: i0,
23
+ type: AffixDirective,
24
+ deps: [{ token: i0.ElementRef }],
25
+ target: i0.ɵɵFactoryTarget.Directive
26
+ });
27
+ }
28
+ static {
29
+ this.ɵdir = i0.ɵɵngDeclareDirective({
30
+ minVersion: "14.0.0",
31
+ version: "22.2.3",
32
+ type: AffixDirective,
33
+ isStandalone: true,
34
+ selector: "[kirby-affix]",
35
+ inputs: { type: ["kirby-affix", "type"] },
36
+ ngImport: i0
37
+ });
38
+ }
39
+ };
40
+ i0.ɵɵngDeclareClassMetadata({
41
+ minVersion: "12.0.0",
42
+ version: "22.2.3",
43
+ ngImport: i0,
44
+ type: AffixDirective,
45
+ decorators: [{
46
+ type: Directive,
47
+ args: [{ selector: "[kirby-affix]" }]
48
+ }],
49
+ ctorParameters: () => [{ type: i0.ElementRef }],
50
+ propDecorators: { type: [{
51
+ type: Input,
52
+ args: ["kirby-affix"]
53
+ }] }
54
+ });
55
+ var DateInputDirective = class DateInputDirective {
56
+ onInput() {
57
+ if (!this.isDateInput) return;
58
+ if (this.enableInputMask) this.updateMask(this.elementRef.nativeElement.value);
59
+ }
60
+ constructor(elementRef, renderer, locale, valueAccessors) {
61
+ this.elementRef = elementRef;
62
+ this.renderer = renderer;
63
+ this.locale = locale;
64
+ this.prefillYear = false;
65
+ this.useNativeDatePicker = false;
66
+ this.isDateInput = false;
67
+ this.enableInputMask = false;
68
+ this.isDateInput = this.elementRef.nativeElement.type === "date";
69
+ if (this.isDateInput) {
70
+ this.elementRef.nativeElement.removeAttribute("type");
71
+ extendValueAccessors(valueAccessors, { writeValue: { afterWriteValue: (value) => this.updateMask(value) } });
72
+ }
73
+ }
74
+ ngOnChanges(changes) {
75
+ if (changes.dateValue && this.isDateInput && this.maskingElement) {
76
+ const newValue = changes.dateValue.currentValue;
77
+ this.updateMask(newValue);
78
+ if (newValue != null) this.inputmask?.setValue(newValue);
79
+ }
80
+ }
81
+ ngAfterViewInit() {
82
+ if (!this.isDateInput) return;
83
+ this.enableInputMask = !this.useNativeDatePicker;
84
+ if (this.enableInputMask) {
85
+ this.initMask();
86
+ if (this.dateValue && this.inputmask) {
87
+ this.updateMask(this.dateValue);
88
+ this.inputmask.setValue(this.dateValue);
89
+ }
90
+ }
91
+ if (this.useNativeDatePicker) this.elementRef.nativeElement.setAttribute("type", "date");
92
+ }
93
+ initMask() {
94
+ const inputFormat = this.getInputFormat();
95
+ const placeholder = this.getPlaceholder(inputFormat);
96
+ this.renderer.setAttribute(this.elementRef.nativeElement, "placeholder", placeholder);
97
+ new Inputmask("datetime", {
98
+ inputFormat,
99
+ placeholder,
100
+ prefillYear: this.prefillYear
101
+ }).mask(this.elementRef.nativeElement);
102
+ this.inputmask = this.elementRef.nativeElement.inputmask;
103
+ this.appendMaskingElement();
104
+ }
105
+ getInputFormat() {
106
+ return getLocaleDateFormat(this.locale, FormatWidth.Short).toLowerCase().replace(/d+/, "dd").replace(/m+/, "MM").replace(/y+/, "yyyy");
107
+ }
108
+ getPlaceholder(inputFormat) {
109
+ const placeholder = inputFormat.toLowerCase();
110
+ return this.locale === "da" ? placeholder.split("y").join("å") : placeholder;
111
+ }
112
+ appendMaskingElement() {
113
+ const wrapper = this.wrapElement(this.elementRef.nativeElement);
114
+ this.renderer.addClass(wrapper, "date-mask-wrapper");
115
+ this.maskingElement = this.renderer.createElement("div");
116
+ this.renderer.appendChild(wrapper, this.maskingElement);
117
+ this.renderer.addClass(this.maskingElement, "date-mask");
118
+ }
119
+ wrapElement(element) {
120
+ const wrapper = this.renderer.createElement("div");
121
+ const parent = element.parentElement;
122
+ this.renderer.insertBefore(parent, wrapper, element);
123
+ this.renderer.appendChild(wrapper, element);
124
+ return wrapper;
125
+ }
126
+ updateMask(value) {
127
+ if (!this.maskingElement) return;
128
+ if (!value) {
129
+ this.maskingElement.innerHTML = "";
130
+ return;
131
+ }
132
+ const lastNumber = value.match(/.*?(\d)[^\d]*$/);
133
+ this.maskingElement.innerHTML = lastNumber ? value.slice(0, value.lastIndexOf(lastNumber[1]) + 1) : "";
134
+ }
135
+ static {
136
+ this.ɵfac = i0.ɵɵngDeclareFactory({
137
+ minVersion: "12.0.0",
138
+ version: "22.2.3",
139
+ ngImport: i0,
140
+ type: DateInputDirective,
141
+ deps: [
142
+ { token: i0.ElementRef },
143
+ { token: i0.Renderer2 },
144
+ { token: LOCALE_ID },
145
+ {
146
+ token: NG_VALUE_ACCESSOR,
147
+ optional: true
148
+ }
149
+ ],
150
+ target: i0.ɵɵFactoryTarget.Directive
151
+ });
152
+ }
153
+ static {
154
+ this.ɵdir = i0.ɵɵngDeclareDirective({
155
+ minVersion: "14.0.0",
156
+ version: "22.2.3",
157
+ type: DateInputDirective,
158
+ isStandalone: true,
159
+ inputs: {
160
+ prefillYear: "prefillYear",
161
+ useNativeDatePicker: "useNativeDatePicker",
162
+ dateValue: "dateValue"
163
+ },
164
+ host: { listeners: { "input": "onInput()" } },
165
+ usesOnChanges: true,
166
+ ngImport: i0
167
+ });
168
+ }
169
+ };
170
+ i0.ɵɵngDeclareClassMetadata({
171
+ minVersion: "12.0.0",
172
+ version: "22.2.3",
173
+ ngImport: i0,
174
+ type: DateInputDirective,
175
+ decorators: [{
176
+ type: Directive,
177
+ args: [{}]
178
+ }],
179
+ ctorParameters: () => [
180
+ { type: i0.ElementRef },
181
+ { type: i0.Renderer2 },
182
+ {
183
+ type: void 0,
184
+ decorators: [{
185
+ type: Inject,
186
+ args: [LOCALE_ID]
187
+ }]
188
+ },
189
+ {
190
+ type: void 0,
191
+ decorators: [{ type: Optional }, {
192
+ type: Inject,
193
+ args: [NG_VALUE_ACCESSOR]
194
+ }]
195
+ }
196
+ ],
197
+ propDecorators: {
198
+ onInput: [{
199
+ type: HostListener,
200
+ args: ["input"]
201
+ }],
202
+ prefillYear: [{ type: Input }],
203
+ useNativeDatePicker: [{ type: Input }],
204
+ dateValue: [{ type: Input }]
205
+ }
206
+ });
207
+ var FormFieldMessageComponent = class FormFieldMessageComponent {
208
+ constructor() {
209
+ this.position = "left";
210
+ }
211
+ static {
212
+ this.ɵfac = i0.ɵɵngDeclareFactory({
213
+ minVersion: "12.0.0",
214
+ version: "22.2.3",
215
+ ngImport: i0,
216
+ type: FormFieldMessageComponent,
217
+ deps: [],
218
+ target: i0.ɵɵFactoryTarget.Component
219
+ });
220
+ }
221
+ static {
222
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
223
+ minVersion: "14.0.0",
224
+ version: "22.2.3",
225
+ type: FormFieldMessageComponent,
226
+ isStandalone: true,
227
+ selector: "kirby-form-field-message",
228
+ inputs: {
229
+ text: "text",
230
+ position: "position"
231
+ },
232
+ ngImport: i0,
233
+ template: "{{ text }}\n<ng-content></ng-content>\n",
234
+ styles: [":host{font-style:italic;font-size:var(--kirby-font-size-xs);font-weight:var(--kirby-font-weight-normal);font-stretch:normal;line-height:var(--kirby-line-height-xs);min-height:var(--kirby-relative-size-s);letter-spacing:normal;color:var(--kirby-color-content-base)}\n"],
235
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
236
+ });
237
+ }
238
+ };
239
+ i0.ɵɵngDeclareClassMetadata({
240
+ minVersion: "12.0.0",
241
+ version: "22.2.3",
242
+ ngImport: i0,
243
+ type: FormFieldMessageComponent,
244
+ decorators: [{
245
+ type: Component,
246
+ args: [{
247
+ changeDetection: ChangeDetectionStrategy.OnPush,
248
+ selector: "kirby-form-field-message",
249
+ template: "{{ text }}\n<ng-content></ng-content>\n",
250
+ styles: [":host{font-style:italic;font-size:var(--kirby-font-size-xs);font-weight:var(--kirby-font-weight-normal);font-stretch:normal;line-height:var(--kirby-line-height-xs);min-height:var(--kirby-relative-size-s);letter-spacing:normal;color:var(--kirby-color-content-base)}\n"]
251
+ }]
252
+ }],
253
+ propDecorators: {
254
+ text: [{ type: Input }],
255
+ position: [{ type: Input }]
256
+ }
257
+ });
258
+ var InputCounterComponent = class InputCounterComponent {
259
+ get text() {
260
+ if (this.length === void 0) return;
261
+ const ofMaxlength = this.maxlength ? `/${this.maxlength}` : "";
262
+ return `${this.length}${ofMaxlength}`;
263
+ }
264
+ constructor(translations, cdr) {
265
+ this.translations = translations;
266
+ this.cdr = cdr;
267
+ this.skipNextAnnouncement = false;
268
+ }
269
+ ngAfterViewInit() {
270
+ if (this.listenTo) {
271
+ const initialValue = this.listenTo.nativeValue ?? this.listenTo.value ?? "";
272
+ this.length = initialValue.length;
273
+ this.skipNextAnnouncement = this.length > 0;
274
+ this.maxlength = this.listenTo.maxlength ? +this.listenTo.maxlength : void 0;
275
+ this.cdr.detectChanges();
276
+ this._inputChangeSubscription = this.listenTo.kirbyChange.pipe(tap((value) => this.length = value?.length || 0), filter(() => this.skipAnnouncement()), debounceTime(1e3)).subscribe(() => {
277
+ this.announceText();
278
+ });
279
+ }
280
+ }
281
+ skipAnnouncement() {
282
+ if (this.skipNextAnnouncement) {
283
+ this.skipNextAnnouncement = false;
284
+ return false;
285
+ }
286
+ return true;
287
+ }
288
+ ngOnDestroy() {
289
+ this._inputChangeSubscription?.unsubscribe();
290
+ }
291
+ announceText() {
292
+ const characters = this.translations.get("characters");
293
+ const entered = this.translations.get("entered");
294
+ if (this.maxlength === void 0) this.textToAnnounce = `${characters} ${this.length} ${entered}`;
295
+ else {
296
+ const outOf = this.translations.get("outOf");
297
+ this.textToAnnounce = `${characters} ${this.length} ${outOf} ${this.maxlength} ${entered}`;
298
+ }
299
+ }
300
+ static {
301
+ this.ɵfac = i0.ɵɵngDeclareFactory({
302
+ minVersion: "12.0.0",
303
+ version: "22.2.3",
304
+ ngImport: i0,
305
+ type: InputCounterComponent,
306
+ deps: [{ token: i1$1.TranslationService }, { token: i0.ChangeDetectorRef }],
307
+ target: i0.ɵɵFactoryTarget.Component
308
+ });
309
+ }
310
+ static {
311
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
312
+ minVersion: "14.0.0",
313
+ version: "22.2.3",
314
+ type: InputCounterComponent,
315
+ isStandalone: true,
316
+ selector: "kirby-input-counter",
317
+ inputs: { listenTo: "listenTo" },
318
+ ngImport: i0,
319
+ template: "<kirby-form-field-message [text]=\"text\"></kirby-form-field-message>\n<div class=\"kirby-visually-hidden\" aria-live=\"polite\">{{ textToAnnounce }}</div>\n",
320
+ dependencies: [{
321
+ kind: "component",
322
+ type: FormFieldMessageComponent,
323
+ selector: "kirby-form-field-message",
324
+ inputs: ["text", "position"]
325
+ }],
326
+ changeDetection: i0.ChangeDetectionStrategy.Eager
327
+ });
328
+ }
329
+ };
330
+ i0.ɵɵngDeclareClassMetadata({
331
+ minVersion: "12.0.0",
332
+ version: "22.2.3",
333
+ ngImport: i0,
334
+ type: InputCounterComponent,
335
+ decorators: [{
336
+ type: Component,
337
+ args: [{
338
+ selector: "kirby-input-counter",
339
+ imports: [FormFieldMessageComponent],
340
+ changeDetection: ChangeDetectionStrategy.Eager,
341
+ template: "<kirby-form-field-message [text]=\"text\"></kirby-form-field-message>\n<div class=\"kirby-visually-hidden\" aria-live=\"polite\">{{ textToAnnounce }}</div>\n"
342
+ }]
343
+ }],
344
+ ctorParameters: () => [{ type: i1$1.TranslationService }, { type: i0.ChangeDetectorRef }],
345
+ propDecorators: { listenTo: [{ type: Input }] }
346
+ });
265
347
  var InputSize;
266
- (function (InputSize) {
267
- InputSize["medium"] = "md";
268
- InputSize["large"] = "lg";
348
+ (function(InputSize) {
349
+ InputSize["medium"] = "md";
350
+ InputSize["large"] = "lg";
269
351
  })(InputSize || (InputSize = {}));
270
- class InputComponent {
271
- set type(value) {
272
- const mappedValue = InputComponent.typeToInputmodeMap[value];
273
- if (mappedValue && !this.inputmode) {
274
- this.inputmode = mappedValue;
275
- }
276
- }
277
- get hasError() {
278
- return this._hasError;
279
- }
280
- set hasError(value) {
281
- if (this._hasError !== value) {
282
- this._hasError = value;
283
- this.hasErrorChange.emit(this._hasError);
284
- }
285
- }
286
- get nativeValue() {
287
- return this.elementRef?.nativeElement?.value;
288
- }
289
- get interactiveElement() {
290
- return this.elementRef?.nativeElement;
291
- }
292
- constructor(elementRef, builtInValueAccessors) {
293
- this.elementRef = elementRef;
294
- this.kirbyChange = new EventEmitter();
295
- this._hasError = false;
296
- this.size = InputSize.large;
297
- this.autocomplete = 'off';
298
- this.autocorrect = 'off';
299
- this.hasErrorChange = new EventEmitter();
300
- extendValueAccessors(builtInValueAccessors, {
301
- writeValue: {
302
- afterWriteValue: (value) => this.kirbyChange.emit(value),
303
- },
304
- });
305
- }
306
- ngOnInit() {
307
- // The native input value is emitted here to make sure that
308
- // the InputCounterComponent receives the value onInit,
309
- // when [(ngModel)] is used on kirby-input.
310
- setTimeout(() => {
311
- const inputValue = this.elementRef.nativeElement.value;
312
- if (inputValue) {
313
- this.kirbyChange.emit(inputValue);
314
- }
315
- });
316
- }
317
- ngOnChanges(changes) {
318
- if (changes.value) {
319
- this.kirbyChange.emit(changes.value.currentValue);
320
- }
321
- }
322
- static { this.typeToInputmodeMap = {
323
- number: 'decimal',
324
- search: 'search',
325
- }; }
326
- _onKeyUp(value) {
327
- this.kirbyChange.emit(value);
328
- }
329
- _onCutPaste(target) {
330
- //Value of input element is updated after cut/paste:
331
- setTimeout(() => this.kirbyChange.emit(target.value));
332
- }
333
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: InputComponent, deps: [{ token: i0.ElementRef }, { token: NG_VALUE_ACCESSOR, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
334
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.18", type: InputComponent, isStandalone: true, selector: "input[kirby-input]", inputs: { type: "type", size: "size", borderless: "borderless", hasError: "hasError", autocomplete: "autocomplete", autocorrect: "autocorrect", value: "value", maxlength: "maxlength", inputmode: "inputmode" }, outputs: { hasErrorChange: "hasErrorChange" }, host: { listeners: { "keyup": "_onKeyUp($event.target.value)", "paste": "_onCutPaste($event.target)", "cut": "_onCutPaste($event.target)" }, properties: { "class": "this.size", "class.borderless": "this.borderless", "attr.aria-invalid": "this.hasError", "class.error": "this.hasError", "attr.autocomplete": "this.autocomplete", "attr.autocorrect": "this.autocorrect", "attr.value": "this.value", "attr.maxlength": "this.maxlength", "attr.inputmode": "this.inputmode" } }, providers: [{ provide: FORM_FIELD_CONTROL, useExisting: InputComponent }], usesOnChanges: true, hostDirectives: [{ directive: DateInputDirective, inputs: ["prefillYear", "prefillYear", "useNativeDatePicker", "useNativeDatePicker", "dateValue", "value"] }], ngImport: i0, template: '', isInline: true, styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host(.error){border:1px solid var(--kirby-danger);padding:15px}:host(.cloned-input){pointer-events:none;position:absolute;top:0;left:0}:host-context(label).cloned-input{top:24px}:host-context(ion-modal).cloned-input{top:0!important;transform:none!important}:host:focus-visible{transition:all 80ms linear 0ms;box-shadow:0 1px 24px #1c1c1c0a,var(--kirby-focus-ring-md-inset)}:host{background-color:var(--kirby-inputs-background-color);color:var(--kirby-inputs-color);border:none;box-sizing:border-box;font-family:var(--kirby-font-family);font-size:1rem;line-height:1.5;outline:none;margin:0;-webkit-appearance:none;appearance:none;border-radius:16px;box-shadow:var(--kirby-inputs-elevation);padding:16px;width:100%}:host.borderless{border-radius:0;box-shadow:none;padding-inline:0;width:auto}:host:disabled{background-color:var(--kirby-light-tint);color:var(--kirby-text-color-semi-dark);box-shadow:none}:host::placeholder{color:var(--kirby-inputs-placeholder-color)}@supports not (selector(::-webkit-date-and-time-value)){:host(input[type=date]::-webkit-date-and-time-value){min-height:1.5em;text-align:start}}@media(hover:hover){:host:not(:disabled):hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer;background-color:var(--kirby-inputs-background-color-hover);cursor:text}}:host:not(:disabled):active,:host:not(:disabled).interaction-state-active{--state-layer-opacity: .12;--state-layer-background-color: var(--kirby-black);background-color:var(--kirby-inputs-background-color-active)}:host:not(:disabled){transition:all 80ms linear 0ms;transition-property:background-color}:host[type=date]::-webkit-calendar-picker-indicator{display:none}:host[type=date]::ng-deep+.suffix{cursor:pointer}@supports (-moz-appearance: none){:host[type=date]::ng-deep+.suffix kirby-icon{display:none}}:host[type=number]{-webkit-appearance:textfield;appearance:textfield}:host::-webkit-outer-spin-button,:host::-webkit-inner-spin-button{-webkit-appearance:none;appearance:none;margin:0}:host(.md){border-radius:24px;padding-block:8px}:host(.md).error{padding-block:7px}:host-context(kirby-item kirby-form-field[slot=end])[type=number]{font-weight:700}.date-mask-wrapper{position:relative}:host-context(.date-mask-wrapper){color:var(--kirby-text-color-semi-dark)}.date-mask{font-family:var(--kirby-font-family);line-height:1.5;font-size:var(--kirby-font-size-n);color:var(--kirby-white-contrast);position:absolute;top:0;left:0;padding:16px}:host(.md)+.date-mask{padding-block:8px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
335
- }
336
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: InputComponent, decorators: [{
337
- type: Component,
338
- args: [{ hostDirectives: [
339
- {
340
- directive: DateInputDirective,
341
- inputs: [
342
- 'prefillYear',
343
- 'useNativeDatePicker',
344
- 'dateValue: value' /* sync input value updates with date-input mask */,
345
- ],
346
- },
347
- ], changeDetection: ChangeDetectionStrategy.OnPush, selector: 'input[kirby-input]', template: '', providers: [{ provide: FORM_FIELD_CONTROL, useExisting: InputComponent }], styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host(.error){border:1px solid var(--kirby-danger);padding:15px}:host(.cloned-input){pointer-events:none;position:absolute;top:0;left:0}:host-context(label).cloned-input{top:24px}:host-context(ion-modal).cloned-input{top:0!important;transform:none!important}:host:focus-visible{transition:all 80ms linear 0ms;box-shadow:0 1px 24px #1c1c1c0a,var(--kirby-focus-ring-md-inset)}:host{background-color:var(--kirby-inputs-background-color);color:var(--kirby-inputs-color);border:none;box-sizing:border-box;font-family:var(--kirby-font-family);font-size:1rem;line-height:1.5;outline:none;margin:0;-webkit-appearance:none;appearance:none;border-radius:16px;box-shadow:var(--kirby-inputs-elevation);padding:16px;width:100%}:host.borderless{border-radius:0;box-shadow:none;padding-inline:0;width:auto}:host:disabled{background-color:var(--kirby-light-tint);color:var(--kirby-text-color-semi-dark);box-shadow:none}:host::placeholder{color:var(--kirby-inputs-placeholder-color)}@supports not (selector(::-webkit-date-and-time-value)){:host(input[type=date]::-webkit-date-and-time-value){min-height:1.5em;text-align:start}}@media(hover:hover){:host:not(:disabled):hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer;background-color:var(--kirby-inputs-background-color-hover);cursor:text}}:host:not(:disabled):active,:host:not(:disabled).interaction-state-active{--state-layer-opacity: .12;--state-layer-background-color: var(--kirby-black);background-color:var(--kirby-inputs-background-color-active)}:host:not(:disabled){transition:all 80ms linear 0ms;transition-property:background-color}:host[type=date]::-webkit-calendar-picker-indicator{display:none}:host[type=date]::ng-deep+.suffix{cursor:pointer}@supports (-moz-appearance: none){:host[type=date]::ng-deep+.suffix kirby-icon{display:none}}:host[type=number]{-webkit-appearance:textfield;appearance:textfield}:host::-webkit-outer-spin-button,:host::-webkit-inner-spin-button{-webkit-appearance:none;appearance:none;margin:0}:host(.md){border-radius:24px;padding-block:8px}:host(.md).error{padding-block:7px}:host-context(kirby-item kirby-form-field[slot=end])[type=number]{font-weight:700}.date-mask-wrapper{position:relative}:host-context(.date-mask-wrapper){color:var(--kirby-text-color-semi-dark)}.date-mask{font-family:var(--kirby-font-family);line-height:1.5;font-size:var(--kirby-font-size-n);color:var(--kirby-white-contrast);position:absolute;top:0;left:0;padding:16px}:host(.md)+.date-mask{padding-block:8px}\n"] }]
348
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
349
- type: Optional
350
- }, {
351
- type: Inject,
352
- args: [NG_VALUE_ACCESSOR]
353
- }] }], propDecorators: { type: [{
354
- type: Input
355
- }], size: [{
356
- type: HostBinding,
357
- args: ['class']
358
- }, {
359
- type: Input
360
- }], borderless: [{
361
- type: HostBinding,
362
- args: ['class.borderless']
363
- }, {
364
- type: Input
365
- }], hasError: [{
366
- type: HostBinding,
367
- args: ['attr.aria-invalid']
368
- }, {
369
- type: HostBinding,
370
- args: ['class.error']
371
- }, {
372
- type: Input
373
- }], autocomplete: [{
374
- type: HostBinding,
375
- args: ['attr.autocomplete']
376
- }, {
377
- type: Input
378
- }], autocorrect: [{
379
- type: HostBinding,
380
- args: ['attr.autocorrect']
381
- }, {
382
- type: Input
383
- }], value: [{
384
- type: HostBinding,
385
- args: ['attr.value']
386
- }, {
387
- type: Input
388
- }], maxlength: [{
389
- type: HostBinding,
390
- args: ['attr.maxlength']
391
- }, {
392
- type: Input
393
- }], inputmode: [{
394
- type: HostBinding,
395
- args: ['attr.inputmode']
396
- }, {
397
- type: Input
398
- }], hasErrorChange: [{
399
- type: Output
400
- }], _onKeyUp: [{
401
- type: HostListener,
402
- args: ['keyup', ['$event.target.value']]
403
- }], _onCutPaste: [{
404
- type: HostListener,
405
- args: ['paste', ['$event.target']]
406
- }, {
407
- type: HostListener,
408
- args: ['cut', ['$event.target']]
409
- }] } });
410
-
411
- class TextareaComponent {
412
- get hasError() {
413
- return this._hasError;
414
- }
415
- set hasError(value) {
416
- if (this._hasError !== value) {
417
- this._hasError = value;
418
- this.hasErrorChange.emit(this._hasError);
419
- }
420
- }
421
- get nativeValue() {
422
- return this.elementRef?.nativeElement?.value;
423
- }
424
- get interactiveElement() {
425
- return this.elementRef?.nativeElement;
426
- }
427
- constructor(elementRef, builtInValueAccessors) {
428
- this.elementRef = elementRef;
429
- this.kirbyChange = new EventEmitter();
430
- this._hasError = false;
431
- this.autocomplete = 'off';
432
- this.autocorrect = 'off';
433
- this.hasErrorChange = new EventEmitter();
434
- extendValueAccessors(builtInValueAccessors, {
435
- writeValue: {
436
- afterWriteValue: (value) => this.kirbyChange.emit(value),
437
- },
438
- });
439
- }
440
- ngOnInit() {
441
- // The native input value is emitted here to make sure that
442
- // the InputCounterComponent receives the value onInit,
443
- // when [(ngModel)] is used on kirby-textarea.
444
- setTimeout(() => {
445
- const inputValue = this.elementRef.nativeElement.value;
446
- if (inputValue) {
447
- this.kirbyChange.emit(inputValue);
448
- }
449
- });
450
- }
451
- ngOnChanges(changes) {
452
- if (changes.value) {
453
- this.kirbyChange.emit(changes.value.currentValue);
454
- }
455
- }
456
- _onKeyUp(value) {
457
- this.kirbyChange.emit(value);
458
- }
459
- _onCutPaste(target) {
460
- //Value of textarea element is updated after cut/paste:
461
- setTimeout(() => this.kirbyChange.emit(target.value));
462
- }
463
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: TextareaComponent, deps: [{ token: i0.ElementRef }, { token: NG_VALUE_ACCESSOR, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
464
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.18", type: TextareaComponent, isStandalone: true, selector: "textarea[kirby-textarea]", inputs: { value: "value", borderless: "borderless", hasError: "hasError", autocomplete: "autocomplete", autocorrect: "autocorrect", maxlength: "maxlength" }, outputs: { hasErrorChange: "hasErrorChange" }, host: { listeners: { "keyup": "_onKeyUp($event.target.value)", "paste": "_onCutPaste($event.target)", "cut": "_onCutPaste($event.target)" }, properties: { "attr.value": "this.value", "class.borderless": "this.borderless", "attr.aria-invalid": "this.hasError", "class.error": "this.hasError", "attr.autocomplete": "this.autocomplete", "attr.autocorrect": "this.autocorrect", "attr.maxlength": "this.maxlength" } }, providers: [{ provide: FORM_FIELD_CONTROL, useExisting: TextareaComponent }], usesOnChanges: true, ngImport: i0, template: "@if (!value) {\n <ng-content></ng-content>\n}\n<!-- prettier-ignore -->\n@if (value) {{{value}}}\n", styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host(.error){border:1px solid var(--kirby-danger);padding:15px}:host(.cloned-input){pointer-events:none;position:absolute;top:0;left:0}:host-context(label).cloned-input{top:24px}:host-context(ion-modal).cloned-input{top:0!important;transform:none!important}:host:focus-visible{transition:all 80ms linear 0ms;box-shadow:0 1px 24px #1c1c1c0a,var(--kirby-focus-ring-md-inset)}:host{background-color:var(--kirby-inputs-background-color);color:var(--kirby-inputs-color);border:none;box-sizing:border-box;font-family:var(--kirby-font-family);font-size:1rem;line-height:1.5;outline:none;margin:0;-webkit-appearance:none;appearance:none;border-radius:16px;box-shadow:var(--kirby-inputs-elevation);padding:16px;width:100%}:host.borderless{border-radius:0;box-shadow:none;padding-inline:0;width:auto}:host:disabled{background-color:var(--kirby-light-tint);color:var(--kirby-text-color-semi-dark);box-shadow:none}:host::placeholder{color:var(--kirby-inputs-placeholder-color)}@supports not (selector(::-webkit-date-and-time-value)){:host(input[type=date]::-webkit-date-and-time-value){min-height:1.5em;text-align:start}}@media(hover:hover){:host:not(:disabled):hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer;background-color:#f5f5f5;cursor:text}}:host:not(:disabled):active,:host:not(:disabled).interaction-state-active{--state-layer-opacity: .12;--state-layer-background-color: var(--kirby-black);background-color:#ebebeb}:host:not(:disabled){transition:all 80ms linear 0ms;transition-property:background-color}:host{position:relative;font-family:var(--kirby-font-family);resize:none}@media(min-width:768px){:host{resize:vertical}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
465
- }
466
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: TextareaComponent, decorators: [{
467
- type: Component,
468
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'textarea[kirby-textarea]', providers: [{ provide: FORM_FIELD_CONTROL, useExisting: TextareaComponent }], template: "@if (!value) {\n <ng-content></ng-content>\n}\n<!-- prettier-ignore -->\n@if (value) {{{value}}}\n", styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host(.error){border:1px solid var(--kirby-danger);padding:15px}:host(.cloned-input){pointer-events:none;position:absolute;top:0;left:0}:host-context(label).cloned-input{top:24px}:host-context(ion-modal).cloned-input{top:0!important;transform:none!important}:host:focus-visible{transition:all 80ms linear 0ms;box-shadow:0 1px 24px #1c1c1c0a,var(--kirby-focus-ring-md-inset)}:host{background-color:var(--kirby-inputs-background-color);color:var(--kirby-inputs-color);border:none;box-sizing:border-box;font-family:var(--kirby-font-family);font-size:1rem;line-height:1.5;outline:none;margin:0;-webkit-appearance:none;appearance:none;border-radius:16px;box-shadow:var(--kirby-inputs-elevation);padding:16px;width:100%}:host.borderless{border-radius:0;box-shadow:none;padding-inline:0;width:auto}:host:disabled{background-color:var(--kirby-light-tint);color:var(--kirby-text-color-semi-dark);box-shadow:none}:host::placeholder{color:var(--kirby-inputs-placeholder-color)}@supports not (selector(::-webkit-date-and-time-value)){:host(input[type=date]::-webkit-date-and-time-value){min-height:1.5em;text-align:start}}@media(hover:hover){:host:not(:disabled):hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer;background-color:#f5f5f5;cursor:text}}:host:not(:disabled):active,:host:not(:disabled).interaction-state-active{--state-layer-opacity: .12;--state-layer-background-color: var(--kirby-black);background-color:#ebebeb}:host:not(:disabled){transition:all 80ms linear 0ms;transition-property:background-color}:host{position:relative;font-family:var(--kirby-font-family);resize:none}@media(min-width:768px){:host{resize:vertical}}\n"] }]
469
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
470
- type: Optional
471
- }, {
472
- type: Inject,
473
- args: [NG_VALUE_ACCESSOR]
474
- }] }], propDecorators: { value: [{
475
- type: HostBinding,
476
- args: ['attr.value']
477
- }, {
478
- type: Input
479
- }], borderless: [{
480
- type: HostBinding,
481
- args: ['class.borderless']
482
- }, {
483
- type: Input
484
- }], hasError: [{
485
- type: HostBinding,
486
- args: ['attr.aria-invalid']
487
- }, {
488
- type: HostBinding,
489
- args: ['class.error']
490
- }, {
491
- type: Input
492
- }], autocomplete: [{
493
- type: HostBinding,
494
- args: ['attr.autocomplete']
495
- }, {
496
- type: Input
497
- }], autocorrect: [{
498
- type: HostBinding,
499
- args: ['attr.autocorrect']
500
- }, {
501
- type: Input
502
- }], maxlength: [{
503
- type: HostBinding,
504
- args: ['attr.maxlength']
505
- }, {
506
- type: Input
507
- }], hasErrorChange: [{
508
- type: Output
509
- }], _onKeyUp: [{
510
- type: HostListener,
511
- args: ['keyup', ['$event.target.value']]
512
- }], _onCutPaste: [{
513
- type: HostListener,
514
- args: ['paste', ['$event.target']]
515
- }, {
516
- type: HostListener,
517
- args: ['cut', ['$event.target']]
518
- }] } });
519
-
520
- class FormFieldComponent {
521
- get label() {
522
- return this._label;
523
- }
524
- set label(value) {
525
- this._label = value;
526
- this.setNestedInteractiveLabelAttributes();
527
- }
528
- get message() {
529
- return this._message;
530
- }
531
- set message(value) {
532
- this._message = value;
533
- this.setNestedInteractiveMessageAttributes();
534
- }
535
- constructor(elementRef, platform, renderer, windowRef, resizeObserverService, cdr) {
536
- this.platform = platform;
537
- this.renderer = renderer;
538
- this.windowRef = windowRef;
539
- this.resizeObserverService = resizeObserverService;
540
- this.cdr = cdr;
541
- this.isRegistered = false;
542
- this.hasWarnedMissingControl = false;
543
- this.showDefaultCalendarIcon = false;
544
- this._labelId = UniqueIdGenerator.scopedTo('kirby-form-field-label').next();
545
- this._errorMessageId = UniqueIdGenerator.scopedTo('kirby-form-field-message').next();
546
- this._messageId = UniqueIdGenerator.scopedTo('kirby-form-field-message').next();
547
- this.element = elementRef.nativeElement;
548
- }
549
- isInputOrTextarea() {
550
- return (this.formFieldControl instanceof InputComponent ||
551
- this.formFieldControl instanceof TextareaComponent);
552
- }
553
- get _wrapContentInLabel() {
554
- return !!this.label && this.isInputOrTextarea();
555
- }
556
- dispatchLoadEvent() {
557
- // Dispatch an `ionInputDidLoad` event to register
558
- // form field + input/textarea with Ionic input shims
559
- // See: https://github.com/ionic-team/ionic-framework/blob/master/core/src/utils/input-shims/input-shims.ts
560
- this.windowRef.nativeWindow.document.dispatchEvent(new CustomEvent('ionInputDidLoad', {
561
- detail: this.element,
562
- }));
563
- }
564
- _onRegisterFormField() {
565
- this.dispatchLoadEvent();
566
- }
567
- onLabelClick() {
568
- // If its a radio group its focus method that contains advanced logic
569
- if (this.formFieldControl instanceof RadioGroupComponent) {
570
- this.formFieldControl.focus();
571
- }
572
- else {
573
- this.nestedInteractiveElement?.focus();
574
- }
575
- }
576
- openDatePicker() {
577
- if (!this.dateInput?.useNativeDatePicker)
578
- return;
579
- this.nestedInteractiveElement.showPicker();
580
- }
581
- focus() {
582
- if (!this.nestedInteractiveElement)
583
- return;
584
- if (this.isInputOrTextarea()) {
585
- /*
586
- * This timeout ensures that any previous manipulation of inputElement or textareaElement
587
- * (e.g. setting disabled state) has been synced to the DOM before trying to focus.
588
- */
589
- setTimeout(() => {
590
- if (this.isTouch) {
591
- // Trigger Ionic's input shims to ensure input is scrolled into view.
592
- // See: https://github.com/ionic-team/ionic-framework/blob/master/core/src/utils/input-shims/hacks/scroll-assist.ts
593
- const touchStart = new TouchEvent('touchstart');
594
- const touchEnd = new TouchEvent('touchend');
595
- this.nestedInteractiveElement.dispatchEvent(touchStart);
596
- this.nestedInteractiveElement.dispatchEvent(touchEnd);
597
- }
598
- else {
599
- this.nestedInteractiveElement.focus();
600
- }
601
- });
602
- }
603
- }
604
- ngOnInit() {
605
- this.isTouch = this.platform.isTouch();
606
- }
607
- ngAfterContentInit() {
608
- this.handleAffixOffset();
609
- }
610
- ngAfterContentChecked() {
611
- if (!this.formFieldControl) {
612
- this.warnMissingControl();
613
- return;
614
- }
615
- if (!this.nestedInteractiveElement) {
616
- this.registerNestedInteractive();
617
- }
618
- if (!this.isRegistered && this.element.isConnected && this.isInputOrTextarea()) {
619
- // Host is connected to dom and slotted input/textarea is present:
620
- this.isRegistered = true;
621
- this.dispatchLoadEvent();
622
- }
623
- // Decide if default calendar icon for date input should be shown
624
- this.showDefaultCalendarIcon = this.shouldShowDefaultCalendarIcon();
625
- }
626
- warnMissingControl() {
627
- if (!this.hasWarnedMissingControl) {
628
- this.hasWarnedMissingControl = true;
629
- console.warn('kirby-form-field: No form field control found. Ensure a component providing FORM_FIELD_CONTROL is projected.');
630
- }
631
- }
632
- ngOnDestroy() {
633
- // Dispatch an `ionInputDidUnload` event to unregister
634
- // form field + input/textarea from Ionic input shims
635
- // See: https://github.com/ionic-team/ionic-framework/blob/master/core/src/utils/input-shims/input-shims.ts
636
- this.windowRef.nativeWindow.document.dispatchEvent(new CustomEvent('ionInputDidUnload', {
637
- detail: this.element,
638
- }));
639
- this.affixElements?.forEach((affix) => {
640
- this.resizeObserverService.unobserve(affix.el);
641
- });
642
- this.nestedInteractiveErrorSubscription?.unsubscribe();
643
- }
644
- registerNestedInteractive() {
645
- this.getNestedInteractiveElement();
646
- this.setNestedInteractiveLabelAttributes();
647
- this.setNestedInteractiveMessageAttributes();
648
- this.subscribeToNestedInteractiveError();
649
- }
650
- getNestedInteractiveElement() {
651
- this.nestedInteractiveElement = this.formFieldControl.interactiveElement;
652
- }
653
- setNestedInteractiveMessageAttributes() {
654
- if (!this.nestedInteractiveElement)
655
- return;
656
- if (this.message) {
657
- this.renderer.setAttribute(this.nestedInteractiveElement, 'aria-describedby', this._messageId);
658
- this.renderer.setAttribute(this.nestedInteractiveElement, 'aria-errormessage', this._errorMessageId);
659
- }
660
- else {
661
- this.renderer.removeAttribute(this.nestedInteractiveElement, 'aria-describedby');
662
- this.renderer.removeAttribute(this.nestedInteractiveElement, 'aria-errormessage');
663
- }
664
- }
665
- setNestedInteractiveLabelAttributes() {
666
- if (!this.nestedInteractiveElement)
667
- return;
668
- if (this._wrapContentInLabel)
669
- return; // return if label is wrapping the nested interactive. No need for aria-labelledby.
670
- if (this.label) {
671
- this.renderer.setAttribute(this.nestedInteractiveElement, 'aria-labelledby', this._labelId);
672
- }
673
- else {
674
- this.renderer.removeAttribute(this.nestedInteractiveElement, 'aria-labelledby');
675
- }
676
- }
677
- subscribeToNestedInteractiveError() {
678
- // set current value, then listen for changes
679
- this._nestedInteractiveHasError = !!this.formFieldControl?.hasError;
680
- this.nestedInteractiveErrorSubscription = this.formFieldControl?.hasErrorChange.subscribe((hasError) => {
681
- this._nestedInteractiveHasError = hasError;
682
- this.cdr.markForCheck();
683
- });
684
- }
685
- shouldShowDefaultCalendarIcon() {
686
- return (this.dateInput?.useNativeDatePicker &&
687
- !this.affixElements.some((affix) => affix.type === 'suffix') // there are no suffix elements
688
- );
689
- }
690
- handleAffixOffset() {
691
- // Measure the width of all slotted affix elements,
692
- // and apply their width + standard padding to the input elements
693
- // padding, so the start/end of the input is correctly indented.
694
- if (this.formFieldControl instanceof InputComponent) {
695
- const inputElement = this.formFieldControl.interactiveElement;
696
- this.affixElements.forEach((affix) => {
697
- this.resizeObserverService.observe(affix.el, (entry) => {
698
- const padding = affix.type === 'prefix' ? 'padding-left' : 'padding-right';
699
- const affixWidth = inputElement.type === 'date' ? 0 : entry.contentRect.width;
700
- const existingPadding = parseInt(DesignTokenHelper.size('s'));
701
- this.renderer.setStyle(inputElement, `${padding}`, `${affixWidth + existingPadding}px`);
702
- const dateMask = this.element.querySelector('.date-mask');
703
- if (dateMask) {
704
- this.renderer.setStyle(dateMask, `${padding}`, `${affixWidth + existingPadding}px`);
705
- }
706
- });
707
- });
708
- }
709
- }
710
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: FormFieldComponent, deps: [{ token: i0.ElementRef }, { token: i1$1.PlatformService }, { token: i0.Renderer2 }, { token: i2.WindowRef }, { token: i1.ResizeObserverService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
711
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.18", type: FormFieldComponent, isStandalone: true, selector: "kirby-form-field", inputs: { label: "label", message: "message" }, host: { listeners: { "kirbyRegisterFormField": "_onRegisterFormField()" }, properties: { "class.wrap-content-in-label": "this._wrapContentInLabel" } }, queries: [{ propertyName: "counter", first: true, predicate: InputCounterComponent, descendants: true }, { propertyName: "formFieldControl", first: true, predicate: FORM_FIELD_CONTROL, descendants: true }, { propertyName: "dateInput", first: true, predicate: DateInputDirective, descendants: true }, { propertyName: "affixElements", predicate: AffixDirective }], ngImport: i0, template: "@if (_wrapContentInLabel) {\n <label>\n <ng-container *ngTemplateOutlet=\"labelTextTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"slottedInputTemplate\"></ng-container>\n <!-- add error message inside label if nested interative is in error state -->\n @if (_nestedInteractiveHasError) {\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n }\n </label>\n}\n\n<!-- add message outside label if nested interative is in valid state -->\n@if (!_nestedInteractiveHasError && _wrapContentInLabel) {\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n}\n\n@if (!_wrapContentInLabel) {\n <ng-container *ngTemplateOutlet=\"labelTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"slottedInputTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n}\n\n<ng-template #messageTemplate>\n @if (message !== undefined || counter) {\n <div class=\"texts\">\n <div\n aria-live=\"polite\"\n class=\"message\"\n [id]=\"_nestedInteractiveHasError ? _errorMessageId : _messageId\"\n >\n @if (message !== undefined) {\n <kirby-form-field-message [text]=\"message\"></kirby-form-field-message>\n }\n </div>\n @if (counter) {\n <div class=\"counter\">\n <ng-content select=\"kirby-input-counter\"></ng-content>\n </div>\n }\n </div>\n }\n</ng-template>\n\n<ng-template #slottedInputTemplate>\n <div class=\"affix-container\">\n <div class=\"prefix vertical-align semi-dark-text\">\n <ng-content select=\"[kirby-affix='prefix']\"></ng-content>\n </div>\n <ng-content></ng-content>\n <div class=\"suffix vertical-align semi-dark-text\" (click)=\"openDatePicker()\">\n <ng-content select=\"[kirby-affix='suffix']\"></ng-content>\n @if (showDefaultCalendarIcon) {\n <kirby-icon name=\"calendar\"></kirby-icon>\n }\n </div>\n </div>\n</ng-template>\n\n<ng-template #labelTextTemplate>\n @if (label) {\n <span class=\"text\">{{ label }}</span>\n }\n</ng-template>\n\n<ng-template #labelTemplate>\n @if (label) {\n <label class=\"text\" [id]=\"_labelId\" (click)=\"onLabelClick()\">{{ label }}</label>\n }\n</ng-template>\n", styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{display:block;position:relative;margin-bottom:16px}:host-context(kirby-item){margin-bottom:0}.texts{display:flex;justify-content:space-between;padding:2px 16px 0}.texts .message{flex:75%}.texts .message:only-child{flex-basis:auto}.texts .message>kirby-form-field-message{width:100%;display:flex}.texts .counter{flex:25%;text-align:right}label{display:block}.text{display:block;font-size:clamp(12px,.875rem,28px);font-weight:300;line-height:1.4286;margin-bottom:4px;padding:0 16px}.affix-container{position:relative}.affix-container .vertical-align{display:flex;align-items:center;position:absolute;top:0;bottom:0}.affix-container .prefix{left:12px;z-index:1}.affix-container .suffix{right:12px}.affix-container .semi-dark-text ::ng-deep>span,.affix-container .semi-dark-text ::ng-deep>h1,.affix-container .semi-dark-text ::ng-deep>h2,.affix-container .semi-dark-text ::ng-deep>h3,.affix-container .semi-dark-text ::ng-deep>h4,.affix-container .semi-dark-text ::ng-deep>h5,.affix-container .semi-dark-text ::ng-deep>h6,.affix-container .semi-dark-text ::ng-deep>p,.affix-container .semi-dark-text ::ng-deep>data{color:var(--kirby-text-color-semi-dark)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FormFieldMessageComponent, selector: "kirby-form-field-message", inputs: ["text", "position"] }, { kind: "component", type: IconComponent, selector: "kirby-icon", inputs: ["size", "name"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
712
- }
713
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: FormFieldComponent, decorators: [{
714
- type: Component,
715
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'kirby-form-field', imports: [NgTemplateOutlet, FormFieldMessageComponent, IconComponent], template: "@if (_wrapContentInLabel) {\n <label>\n <ng-container *ngTemplateOutlet=\"labelTextTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"slottedInputTemplate\"></ng-container>\n <!-- add error message inside label if nested interative is in error state -->\n @if (_nestedInteractiveHasError) {\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n }\n </label>\n}\n\n<!-- add message outside label if nested interative is in valid state -->\n@if (!_nestedInteractiveHasError && _wrapContentInLabel) {\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n}\n\n@if (!_wrapContentInLabel) {\n <ng-container *ngTemplateOutlet=\"labelTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"slottedInputTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n}\n\n<ng-template #messageTemplate>\n @if (message !== undefined || counter) {\n <div class=\"texts\">\n <div\n aria-live=\"polite\"\n class=\"message\"\n [id]=\"_nestedInteractiveHasError ? _errorMessageId : _messageId\"\n >\n @if (message !== undefined) {\n <kirby-form-field-message [text]=\"message\"></kirby-form-field-message>\n }\n </div>\n @if (counter) {\n <div class=\"counter\">\n <ng-content select=\"kirby-input-counter\"></ng-content>\n </div>\n }\n </div>\n }\n</ng-template>\n\n<ng-template #slottedInputTemplate>\n <div class=\"affix-container\">\n <div class=\"prefix vertical-align semi-dark-text\">\n <ng-content select=\"[kirby-affix='prefix']\"></ng-content>\n </div>\n <ng-content></ng-content>\n <div class=\"suffix vertical-align semi-dark-text\" (click)=\"openDatePicker()\">\n <ng-content select=\"[kirby-affix='suffix']\"></ng-content>\n @if (showDefaultCalendarIcon) {\n <kirby-icon name=\"calendar\"></kirby-icon>\n }\n </div>\n </div>\n</ng-template>\n\n<ng-template #labelTextTemplate>\n @if (label) {\n <span class=\"text\">{{ label }}</span>\n }\n</ng-template>\n\n<ng-template #labelTemplate>\n @if (label) {\n <label class=\"text\" [id]=\"_labelId\" (click)=\"onLabelClick()\">{{ label }}</label>\n }\n</ng-template>\n", styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{display:block;position:relative;margin-bottom:16px}:host-context(kirby-item){margin-bottom:0}.texts{display:flex;justify-content:space-between;padding:2px 16px 0}.texts .message{flex:75%}.texts .message:only-child{flex-basis:auto}.texts .message>kirby-form-field-message{width:100%;display:flex}.texts .counter{flex:25%;text-align:right}label{display:block}.text{display:block;font-size:clamp(12px,.875rem,28px);font-weight:300;line-height:1.4286;margin-bottom:4px;padding:0 16px}.affix-container{position:relative}.affix-container .vertical-align{display:flex;align-items:center;position:absolute;top:0;bottom:0}.affix-container .prefix{left:12px;z-index:1}.affix-container .suffix{right:12px}.affix-container .semi-dark-text ::ng-deep>span,.affix-container .semi-dark-text ::ng-deep>h1,.affix-container .semi-dark-text ::ng-deep>h2,.affix-container .semi-dark-text ::ng-deep>h3,.affix-container .semi-dark-text ::ng-deep>h4,.affix-container .semi-dark-text ::ng-deep>h5,.affix-container .semi-dark-text ::ng-deep>h6,.affix-container .semi-dark-text ::ng-deep>p,.affix-container .semi-dark-text ::ng-deep>data{color:var(--kirby-text-color-semi-dark)}\n"] }]
716
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1$1.PlatformService }, { type: i0.Renderer2 }, { type: i2.WindowRef }, { type: i1.ResizeObserverService }, { type: i0.ChangeDetectorRef }], propDecorators: { label: [{
717
- type: Input
718
- }], message: [{
719
- type: Input
720
- }], affixElements: [{
721
- type: ContentChildren,
722
- args: [AffixDirective]
723
- }], counter: [{
724
- type: ContentChild,
725
- args: [InputCounterComponent, { static: false }]
726
- }], formFieldControl: [{
727
- type: ContentChild,
728
- args: [FORM_FIELD_CONTROL]
729
- }], dateInput: [{
730
- type: ContentChild,
731
- args: [DateInputDirective]
732
- }], _wrapContentInLabel: [{
733
- type: HostBinding,
734
- args: ['class.wrap-content-in-label']
735
- }], _onRegisterFormField: [{
736
- type: HostListener,
737
- args: ['kirbyRegisterFormField']
738
- }] } });
739
-
740
- class DecimalMaskDirective {
741
- set allowMinus(allowMinus) {
742
- this._allowMinus = allowMinus || (this.min || 0) < 0;
743
- }
744
- set disableGroupSeperator(disabled) {
745
- this._groupSeperatorDisabled = String(disabled) === '' || String(disabled) === 'true';
746
- }
747
- set maxlength(maxlength) {
748
- this._maxlength = maxlength;
749
- const maxlengthValue = parseInt('9'.repeat(maxlength));
750
- this.max = this.getMax(maxlengthValue);
751
- this.min = this.getMin(maxlengthValue);
752
- }
753
- constructor(elementRef, locale, valueAccessors) {
754
- this.elementRef = elementRef;
755
- this.locale = locale;
756
- this.valueAccessors = valueAccessors;
757
- this.precision = 2;
758
- this.setMaxOnOverflow = false;
759
- this.alignment = 'right';
760
- this.padPrecisionDigits = false;
761
- this.groupSeparator = getLocaleNumberSymbol(this.locale, NumberSymbol.Group);
762
- this.radixPoint = getLocaleNumberSymbol(this.locale, NumberSymbol.Decimal);
763
- this._allowMinus = false;
764
- this.extendBuiltinValueAccessor();
765
- }
766
- ngOnInit() {
767
- const element = this.elementRef.nativeElement;
768
- // Set type="text", because functionality like 'setSelectionRange' are not supported on type="number"
769
- element.setAttribute('type', 'text');
770
- // Remove maxlength as this is handled by the mask
771
- element.removeAttribute('maxlength');
772
- if (element.value) {
773
- element.value = this.toLocaleRadixPoint(element.value);
774
- }
775
- this.initMask();
776
- }
777
- initMask() {
778
- new Inputmask('decimal', {
779
- groupSeparator: this._groupSeperatorDisabled ? '' : this.groupSeparator,
780
- radixPoint: this.radixPoint,
781
- digits: this._maxlength ? 0 : this.precision,
782
- digitsOptional: !this.padPrecisionDigits,
783
- min: this.min,
784
- max: this.max,
785
- allowMinus: this._allowMinus,
786
- negationSymbol: {
787
- front: getLocaleNumberSymbol(this.locale, NumberSymbol.MinusSign),
788
- back: '',
789
- },
790
- SetMaxOnOverflow: this.setMaxOnOverflow,
791
- showMaskOnFocus: false,
792
- showMaskOnHover: false,
793
- placeholder: this.padPrecisionDigits ? undefined : '',
794
- rightAlign: this.alignment === 'right',
795
- onBeforeWrite: () => {
796
- if (!this.inputmask)
797
- return;
798
- },
799
- }).mask(this.elementRef.nativeElement);
800
- this.inputmask = this.elementRef.nativeElement.inputmask;
801
- }
802
- getMax(maxlengthValue) {
803
- return this.max === undefined ? maxlengthValue : Math.min(this.max, maxlengthValue);
804
- }
805
- getMin(maxlengthValue) {
806
- if (!this.allowMinus)
807
- return;
808
- maxlengthValue = -Math.abs(maxlengthValue);
809
- return this.min === undefined ? maxlengthValue : -Math.abs(Math.max(this.min, maxlengthValue));
810
- }
811
- toLocaleRadixPoint(value) {
812
- return value.replace('.', this.radixPoint);
813
- }
814
- toStandardRadixPoint(value) {
815
- return value.replace(this.radixPoint, '.');
816
- }
817
- extendBuiltinValueAccessor() {
818
- extendValueAccessors(this.valueAccessors, {
819
- writeValue: {
820
- afterWriteValue: (value) => {
821
- // Update the inputmask display when value is set programmatically
822
- if (this.inputmask && value != null) {
823
- this.inputmask.setValue(this.toLocaleRadixPoint(String(value)));
824
- }
825
- },
826
- },
827
- registerOnChange: {
828
- transformValue: (value) => {
829
- // Provide unmasked and normalized values to the form control
830
- if (this.inputmask) {
831
- return this.toStandardRadixPoint(this.inputmask.unmaskedvalue());
832
- }
833
- return value;
834
- },
835
- },
836
- });
837
- }
838
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: DecimalMaskDirective, deps: [{ token: i0.ElementRef }, { token: LOCALE_ID }, { token: NG_VALUE_ACCESSOR, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
839
- /** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.18", type: DecimalMaskDirective, isStandalone: true, selector: "[kirby-decimal-mask]", inputs: { min: "min", max: "max", precision: "precision", setMaxOnOverflow: "setMaxOnOverflow", alignment: "alignment", padPrecisionDigits: "padPrecisionDigits", allowMinus: "allowMinus", disableGroupSeperator: "disableGroupSeperator", maxlength: "maxlength" }, ngImport: i0 }); }
840
- }
841
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: DecimalMaskDirective, decorators: [{
842
- type: Directive,
843
- args: [{
844
- // eslint-disable-next-line
845
- selector: '[kirby-decimal-mask]',
846
- }]
847
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
848
- type: Inject,
849
- args: [LOCALE_ID]
850
- }] }, { type: undefined, decorators: [{
851
- type: Optional
852
- }, {
853
- type: Inject,
854
- args: [NG_VALUE_ACCESSOR]
855
- }] }], propDecorators: { min: [{
856
- type: Input
857
- }], max: [{
858
- type: Input
859
- }], precision: [{
860
- type: Input
861
- }], setMaxOnOverflow: [{
862
- type: Input
863
- }], alignment: [{
864
- type: Input
865
- }], padPrecisionDigits: [{
866
- type: Input
867
- }], allowMinus: [{
868
- type: Input
869
- }], disableGroupSeperator: [{
870
- type: Input
871
- }], maxlength: [{
872
- type: Input
873
- }] } });
874
-
875
- const imports = [FormFieldComponent, FormFieldMessageComponent, InputCounterComponent];
876
- class FormFieldModule {
877
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: FormFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
878
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.18", ngImport: i0, type: FormFieldModule, imports: [CommonModule, DecimalMaskDirective, IconModule, AffixDirective, FormFieldComponent, FormFieldMessageComponent, InputCounterComponent], exports: [FormFieldComponent, FormFieldMessageComponent, InputCounterComponent, DecimalMaskDirective, AffixDirective] }); }
879
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: FormFieldModule, imports: [CommonModule, IconModule, FormFieldComponent] }); }
880
- }
881
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: FormFieldModule, decorators: [{
882
- type: NgModule,
883
- args: [{
884
- imports: [CommonModule, DecimalMaskDirective, IconModule, AffixDirective, ...imports],
885
- exports: [...imports, DecimalMaskDirective, AffixDirective],
886
- }]
887
- }] });
888
-
889
- /**
890
- * Generated bundle index. Do not edit.
891
- */
892
-
352
+ var InputComponent = class InputComponent {
353
+ set type(value) {
354
+ const mappedValue = InputComponent.typeToInputmodeMap[value];
355
+ if (mappedValue && !this.inputmode) this.inputmode = mappedValue;
356
+ }
357
+ get hasError() {
358
+ return this._hasError;
359
+ }
360
+ set hasError(value) {
361
+ if (this._hasError !== value) {
362
+ this._hasError = value;
363
+ this.hasErrorChange.emit(this._hasError);
364
+ }
365
+ }
366
+ get nativeValue() {
367
+ return this.elementRef?.nativeElement?.value;
368
+ }
369
+ get interactiveElement() {
370
+ return this.elementRef?.nativeElement;
371
+ }
372
+ constructor(elementRef, builtInValueAccessors) {
373
+ this.elementRef = elementRef;
374
+ this.kirbyChange = new EventEmitter();
375
+ this._hasError = false;
376
+ this.size = InputSize.large;
377
+ this.autocomplete = "off";
378
+ this.autocorrect = "off";
379
+ this.hasErrorChange = new EventEmitter();
380
+ extendValueAccessors(builtInValueAccessors, { writeValue: { afterWriteValue: (value) => this.kirbyChange.emit(value) } });
381
+ }
382
+ ngOnInit() {
383
+ setTimeout(() => {
384
+ const inputValue = this.elementRef.nativeElement.value;
385
+ if (inputValue) this.kirbyChange.emit(inputValue);
386
+ });
387
+ }
388
+ ngOnChanges(changes) {
389
+ if (changes.value) this.kirbyChange.emit(changes.value.currentValue);
390
+ }
391
+ static {
392
+ this.typeToInputmodeMap = {
393
+ number: "decimal",
394
+ search: "search"
395
+ };
396
+ }
397
+ _onKeyUp(value) {
398
+ this.kirbyChange.emit(value);
399
+ }
400
+ _onCutPaste(target) {
401
+ setTimeout(() => this.kirbyChange.emit(target.value));
402
+ }
403
+ static {
404
+ this.ɵfac = i0.ɵɵngDeclareFactory({
405
+ minVersion: "12.0.0",
406
+ version: "22.2.3",
407
+ ngImport: i0,
408
+ type: InputComponent,
409
+ deps: [{ token: i0.ElementRef }, {
410
+ token: NG_VALUE_ACCESSOR,
411
+ optional: true
412
+ }],
413
+ target: i0.ɵɵFactoryTarget.Component
414
+ });
415
+ }
416
+ static {
417
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
418
+ minVersion: "14.0.0",
419
+ version: "22.2.3",
420
+ type: InputComponent,
421
+ isStandalone: true,
422
+ selector: "input[kirby-input]",
423
+ inputs: {
424
+ type: "type",
425
+ size: "size",
426
+ borderless: "borderless",
427
+ hasError: "hasError",
428
+ autocomplete: "autocomplete",
429
+ autocorrect: "autocorrect",
430
+ value: "value",
431
+ maxlength: "maxlength",
432
+ inputmode: "inputmode"
433
+ },
434
+ outputs: { hasErrorChange: "hasErrorChange" },
435
+ host: {
436
+ listeners: {
437
+ "keyup": "_onKeyUp($event.target.value)",
438
+ "paste": "_onCutPaste($event.target)",
439
+ "cut": "_onCutPaste($event.target)"
440
+ },
441
+ properties: {
442
+ "class": "this.size",
443
+ "class.borderless": "this.borderless",
444
+ "attr.aria-invalid": "this.hasError",
445
+ "class.error": "this.hasError",
446
+ "attr.autocomplete": "this.autocomplete",
447
+ "attr.autocorrect": "this.autocorrect",
448
+ "attr.value": "this.value",
449
+ "attr.maxlength": "this.maxlength",
450
+ "attr.inputmode": "this.inputmode"
451
+ }
452
+ },
453
+ providers: [{
454
+ provide: FORM_FIELD_CONTROL,
455
+ useExisting: InputComponent
456
+ }],
457
+ usesOnChanges: true,
458
+ hostDirectives: [{
459
+ directive: DateInputDirective,
460
+ inputs: [
461
+ "prefillYear",
462
+ "prefillYear",
463
+ "useNativeDatePicker",
464
+ "useNativeDatePicker",
465
+ "dateValue",
466
+ "value"
467
+ ]
468
+ }],
469
+ ngImport: i0,
470
+ template: "",
471
+ isInline: true,
472
+ styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host(.cloned-input){pointer-events:none;position:absolute;top:0;left:0}:host-context(label).cloned-input{top:24px}:host-context(ion-modal).cloned-input{top:0!important;transform:none!important}:host.error{border-color:var(--kirby-color-border-raised-danger);box-shadow:var(--kirby-error-ring-combined-inset)}@media(hover:hover){:host:not(:disabled):hover{background-color:var(--kirby-color-fill-raised-hover);border-color:var(--kirby-input-color-border-raised-hover);cursor:text}:host:not(:disabled):hover::placeholder{color:var(--kirby-color-content-raised-quiet-hover)}}:host:not(:disabled):active{border-color:var(--kirby-color-border-raised-loud)}:host:not(:disabled).borderless{border-color:transparent}:host:not(:disabled).error{border-color:var(--kirby-color-border-raised-danger);box-shadow:var(--kirby-error-ring-combined-inset)}:host:not(:disabled):focus-visible{box-shadow:var(--kirby-focus-ring-md-combined-inset);border-color:var(--kirby-color-border-focus)}:host:not(:disabled){transition:all 80ms linear 0ms;transition-property:background-color,border-color,box-shadow}:host{background-color:var(--kirby-color-fill-raised);color:var(--kirby-color-content-raised);border:var(--kirby-stroke-xs) solid var(--kirby-input-color-border-raised);box-sizing:border-box;font-family:var(--kirby-font-family);font-size:1rem;line-height:var(--kirby-line-height-n);outline:none;margin:0;-webkit-appearance:none;appearance:none;border-radius:var(--kirby-border-radius-n);padding:calc(var(--kirby-spacing-s) - var(--kirby-stroke-xs));width:100%}:host.borderless{border-color:transparent;border-radius:0;padding-inline:0;width:auto}:host:disabled{opacity:var(--kirby-opacity-40)}:host::placeholder{color:var(--kirby-color-content-raised-quiet)}@supports not (selector(::-webkit-date-and-time-value)){:host(input[type=date]::-webkit-date-and-time-value){min-height:calc(var(--kirby-line-height-n) * 1em);text-align:start}}:host[type=date]::-webkit-calendar-picker-indicator{display:none}:host[type=date]::ng-deep+.suffix{cursor:pointer}@supports (-moz-appearance: none){:host[type=date]::ng-deep+.suffix kirby-icon{display:none}}:host[type=number]{-webkit-appearance:textfield;appearance:textfield}:host::-webkit-outer-spin-button,:host::-webkit-inner-spin-button{-webkit-appearance:none;appearance:none;margin:0}:host(.md){border-radius:var(--kirby-border-radius-l);padding-block:calc(calc(var(--kirby-spacing-s) * .5) - var(--kirby-stroke-xs))}:host-context(kirby-item kirby-form-field[slot=end])[type=number]{font-weight:var(--kirby-font-weight-bold)}.date-mask-wrapper{position:relative}:host-context(.date-mask-wrapper){color:var(--kirby-color-content-raised-quiet)}.date-mask{font-family:var(--kirby-font-family);line-height:var(--kirby-line-height-n);font-size:var(--kirby-font-size-n);color:var(--kirby-color-content-raised);position:absolute;top:0;left:0;padding:var(--kirby-spacing-s)}:host(.md)+.date-mask{padding-block:calc(var(--kirby-spacing-s) * .5)}\n"],
473
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
474
+ });
475
+ }
476
+ };
477
+ i0.ɵɵngDeclareClassMetadata({
478
+ minVersion: "12.0.0",
479
+ version: "22.2.3",
480
+ ngImport: i0,
481
+ type: InputComponent,
482
+ decorators: [{
483
+ type: Component,
484
+ args: [{
485
+ hostDirectives: [{
486
+ directive: DateInputDirective,
487
+ inputs: [
488
+ "prefillYear",
489
+ "useNativeDatePicker",
490
+ "dateValue: value"
491
+ ]
492
+ }],
493
+ changeDetection: ChangeDetectionStrategy.OnPush,
494
+ selector: "input[kirby-input]",
495
+ template: "",
496
+ providers: [{
497
+ provide: FORM_FIELD_CONTROL,
498
+ useExisting: InputComponent
499
+ }],
500
+ styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host(.cloned-input){pointer-events:none;position:absolute;top:0;left:0}:host-context(label).cloned-input{top:24px}:host-context(ion-modal).cloned-input{top:0!important;transform:none!important}:host.error{border-color:var(--kirby-color-border-raised-danger);box-shadow:var(--kirby-error-ring-combined-inset)}@media(hover:hover){:host:not(:disabled):hover{background-color:var(--kirby-color-fill-raised-hover);border-color:var(--kirby-input-color-border-raised-hover);cursor:text}:host:not(:disabled):hover::placeholder{color:var(--kirby-color-content-raised-quiet-hover)}}:host:not(:disabled):active{border-color:var(--kirby-color-border-raised-loud)}:host:not(:disabled).borderless{border-color:transparent}:host:not(:disabled).error{border-color:var(--kirby-color-border-raised-danger);box-shadow:var(--kirby-error-ring-combined-inset)}:host:not(:disabled):focus-visible{box-shadow:var(--kirby-focus-ring-md-combined-inset);border-color:var(--kirby-color-border-focus)}:host:not(:disabled){transition:all 80ms linear 0ms;transition-property:background-color,border-color,box-shadow}:host{background-color:var(--kirby-color-fill-raised);color:var(--kirby-color-content-raised);border:var(--kirby-stroke-xs) solid var(--kirby-input-color-border-raised);box-sizing:border-box;font-family:var(--kirby-font-family);font-size:1rem;line-height:var(--kirby-line-height-n);outline:none;margin:0;-webkit-appearance:none;appearance:none;border-radius:var(--kirby-border-radius-n);padding:calc(var(--kirby-spacing-s) - var(--kirby-stroke-xs));width:100%}:host.borderless{border-color:transparent;border-radius:0;padding-inline:0;width:auto}:host:disabled{opacity:var(--kirby-opacity-40)}:host::placeholder{color:var(--kirby-color-content-raised-quiet)}@supports not (selector(::-webkit-date-and-time-value)){:host(input[type=date]::-webkit-date-and-time-value){min-height:calc(var(--kirby-line-height-n) * 1em);text-align:start}}:host[type=date]::-webkit-calendar-picker-indicator{display:none}:host[type=date]::ng-deep+.suffix{cursor:pointer}@supports (-moz-appearance: none){:host[type=date]::ng-deep+.suffix kirby-icon{display:none}}:host[type=number]{-webkit-appearance:textfield;appearance:textfield}:host::-webkit-outer-spin-button,:host::-webkit-inner-spin-button{-webkit-appearance:none;appearance:none;margin:0}:host(.md){border-radius:var(--kirby-border-radius-l);padding-block:calc(calc(var(--kirby-spacing-s) * .5) - var(--kirby-stroke-xs))}:host-context(kirby-item kirby-form-field[slot=end])[type=number]{font-weight:var(--kirby-font-weight-bold)}.date-mask-wrapper{position:relative}:host-context(.date-mask-wrapper){color:var(--kirby-color-content-raised-quiet)}.date-mask{font-family:var(--kirby-font-family);line-height:var(--kirby-line-height-n);font-size:var(--kirby-font-size-n);color:var(--kirby-color-content-raised);position:absolute;top:0;left:0;padding:var(--kirby-spacing-s)}:host(.md)+.date-mask{padding-block:calc(var(--kirby-spacing-s) * .5)}\n"]
501
+ }]
502
+ }],
503
+ ctorParameters: () => [{ type: i0.ElementRef }, {
504
+ type: void 0,
505
+ decorators: [{ type: Optional }, {
506
+ type: Inject,
507
+ args: [NG_VALUE_ACCESSOR]
508
+ }]
509
+ }],
510
+ propDecorators: {
511
+ type: [{ type: Input }],
512
+ size: [{
513
+ type: HostBinding,
514
+ args: ["class"]
515
+ }, { type: Input }],
516
+ borderless: [{
517
+ type: HostBinding,
518
+ args: ["class.borderless"]
519
+ }, { type: Input }],
520
+ hasError: [
521
+ {
522
+ type: HostBinding,
523
+ args: ["attr.aria-invalid"]
524
+ },
525
+ {
526
+ type: HostBinding,
527
+ args: ["class.error"]
528
+ },
529
+ { type: Input }
530
+ ],
531
+ autocomplete: [{
532
+ type: HostBinding,
533
+ args: ["attr.autocomplete"]
534
+ }, { type: Input }],
535
+ autocorrect: [{
536
+ type: HostBinding,
537
+ args: ["attr.autocorrect"]
538
+ }, { type: Input }],
539
+ value: [{
540
+ type: HostBinding,
541
+ args: ["attr.value"]
542
+ }, { type: Input }],
543
+ maxlength: [{
544
+ type: HostBinding,
545
+ args: ["attr.maxlength"]
546
+ }, { type: Input }],
547
+ inputmode: [{
548
+ type: HostBinding,
549
+ args: ["attr.inputmode"]
550
+ }, { type: Input }],
551
+ hasErrorChange: [{ type: Output }],
552
+ _onKeyUp: [{
553
+ type: HostListener,
554
+ args: ["keyup", ["$event.target.value"]]
555
+ }],
556
+ _onCutPaste: [{
557
+ type: HostListener,
558
+ args: ["paste", ["$event.target"]]
559
+ }, {
560
+ type: HostListener,
561
+ args: ["cut", ["$event.target"]]
562
+ }]
563
+ }
564
+ });
565
+ var TextareaComponent = class TextareaComponent {
566
+ get hasError() {
567
+ return this._hasError;
568
+ }
569
+ set hasError(value) {
570
+ if (this._hasError !== value) {
571
+ this._hasError = value;
572
+ this.hasErrorChange.emit(this._hasError);
573
+ }
574
+ }
575
+ get nativeValue() {
576
+ return this.elementRef?.nativeElement?.value;
577
+ }
578
+ get interactiveElement() {
579
+ return this.elementRef?.nativeElement;
580
+ }
581
+ constructor(elementRef, builtInValueAccessors) {
582
+ this.elementRef = elementRef;
583
+ this.kirbyChange = new EventEmitter();
584
+ this._hasError = false;
585
+ this.autocomplete = "off";
586
+ this.autocorrect = "off";
587
+ this.hasErrorChange = new EventEmitter();
588
+ extendValueAccessors(builtInValueAccessors, { writeValue: { afterWriteValue: (value) => this.kirbyChange.emit(value) } });
589
+ }
590
+ ngOnInit() {
591
+ setTimeout(() => {
592
+ const inputValue = this.elementRef.nativeElement.value;
593
+ if (inputValue) this.kirbyChange.emit(inputValue);
594
+ });
595
+ }
596
+ ngOnChanges(changes) {
597
+ if (changes.value) this.kirbyChange.emit(changes.value.currentValue);
598
+ }
599
+ _onKeyUp(value) {
600
+ this.kirbyChange.emit(value);
601
+ }
602
+ _onCutPaste(target) {
603
+ setTimeout(() => this.kirbyChange.emit(target.value));
604
+ }
605
+ static {
606
+ this.ɵfac = i0.ɵɵngDeclareFactory({
607
+ minVersion: "12.0.0",
608
+ version: "22.2.3",
609
+ ngImport: i0,
610
+ type: TextareaComponent,
611
+ deps: [{ token: i0.ElementRef }, {
612
+ token: NG_VALUE_ACCESSOR,
613
+ optional: true
614
+ }],
615
+ target: i0.ɵɵFactoryTarget.Component
616
+ });
617
+ }
618
+ static {
619
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
620
+ minVersion: "17.0.0",
621
+ version: "22.2.3",
622
+ type: TextareaComponent,
623
+ isStandalone: true,
624
+ selector: "textarea[kirby-textarea]",
625
+ inputs: {
626
+ value: "value",
627
+ borderless: "borderless",
628
+ hasError: "hasError",
629
+ autocomplete: "autocomplete",
630
+ autocorrect: "autocorrect",
631
+ maxlength: "maxlength"
632
+ },
633
+ outputs: { hasErrorChange: "hasErrorChange" },
634
+ host: {
635
+ listeners: {
636
+ "keyup": "_onKeyUp($event.target.value)",
637
+ "paste": "_onCutPaste($event.target)",
638
+ "cut": "_onCutPaste($event.target)"
639
+ },
640
+ properties: {
641
+ "attr.value": "this.value",
642
+ "class.borderless": "this.borderless",
643
+ "attr.aria-invalid": "this.hasError",
644
+ "class.error": "this.hasError",
645
+ "attr.autocomplete": "this.autocomplete",
646
+ "attr.autocorrect": "this.autocorrect",
647
+ "attr.maxlength": "this.maxlength"
648
+ }
649
+ },
650
+ providers: [{
651
+ provide: FORM_FIELD_CONTROL,
652
+ useExisting: TextareaComponent
653
+ }],
654
+ usesOnChanges: true,
655
+ ngImport: i0,
656
+ template: "@if (!value) {\n <ng-content></ng-content>\n}\n<!-- prettier-ignore -->\n@if (value) {{{value}}}\n",
657
+ styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host(.cloned-input){pointer-events:none;position:absolute;top:0;left:0}:host-context(label).cloned-input{top:24px}:host-context(ion-modal).cloned-input{top:0!important;transform:none!important}:host.error{border-color:var(--kirby-color-border-raised-danger);box-shadow:var(--kirby-error-ring-combined-inset)}@media(hover:hover){:host:not(:disabled):hover{background-color:var(--kirby-color-fill-raised-hover);border-color:var(--kirby-input-color-border-raised-hover);cursor:text}:host:not(:disabled):hover::placeholder{color:var(--kirby-color-content-raised-quiet-hover)}}:host:not(:disabled):active{border-color:var(--kirby-color-border-raised-loud)}:host:not(:disabled).borderless{border-color:transparent}:host:not(:disabled).error{border-color:var(--kirby-color-border-raised-danger);box-shadow:var(--kirby-error-ring-combined-inset)}:host:not(:disabled):focus-visible{box-shadow:var(--kirby-focus-ring-md-combined-inset);border-color:var(--kirby-color-border-focus)}:host:not(:disabled){transition:all 80ms linear 0ms;transition-property:background-color,border-color,box-shadow}:host{background-color:var(--kirby-color-fill-raised);color:var(--kirby-color-content-raised);border:var(--kirby-stroke-xs) solid var(--kirby-input-color-border-raised);box-sizing:border-box;font-family:var(--kirby-font-family);font-size:1rem;line-height:var(--kirby-line-height-n);outline:none;margin:0;-webkit-appearance:none;appearance:none;border-radius:var(--kirby-border-radius-n);padding:calc(var(--kirby-spacing-s) - var(--kirby-stroke-xs));width:100%}:host.borderless{border-color:transparent;border-radius:0;padding-inline:0;width:auto}:host:disabled{opacity:var(--kirby-opacity-40)}:host::placeholder{color:var(--kirby-color-content-raised-quiet)}@supports not (selector(::-webkit-date-and-time-value)){:host(input[type=date]::-webkit-date-and-time-value){min-height:calc(var(--kirby-line-height-n) * 1em);text-align:start}}:host{position:relative;font-family:var(--kirby-font-family);resize:none}@media(min-width:768px){:host{resize:vertical}}\n"],
658
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
659
+ });
660
+ }
661
+ };
662
+ i0.ɵɵngDeclareClassMetadata({
663
+ minVersion: "12.0.0",
664
+ version: "22.2.3",
665
+ ngImport: i0,
666
+ type: TextareaComponent,
667
+ decorators: [{
668
+ type: Component,
669
+ args: [{
670
+ changeDetection: ChangeDetectionStrategy.OnPush,
671
+ selector: "textarea[kirby-textarea]",
672
+ providers: [{
673
+ provide: FORM_FIELD_CONTROL,
674
+ useExisting: TextareaComponent
675
+ }],
676
+ template: "@if (!value) {\n <ng-content></ng-content>\n}\n<!-- prettier-ignore -->\n@if (value) {{{value}}}\n",
677
+ styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host(.cloned-input){pointer-events:none;position:absolute;top:0;left:0}:host-context(label).cloned-input{top:24px}:host-context(ion-modal).cloned-input{top:0!important;transform:none!important}:host.error{border-color:var(--kirby-color-border-raised-danger);box-shadow:var(--kirby-error-ring-combined-inset)}@media(hover:hover){:host:not(:disabled):hover{background-color:var(--kirby-color-fill-raised-hover);border-color:var(--kirby-input-color-border-raised-hover);cursor:text}:host:not(:disabled):hover::placeholder{color:var(--kirby-color-content-raised-quiet-hover)}}:host:not(:disabled):active{border-color:var(--kirby-color-border-raised-loud)}:host:not(:disabled).borderless{border-color:transparent}:host:not(:disabled).error{border-color:var(--kirby-color-border-raised-danger);box-shadow:var(--kirby-error-ring-combined-inset)}:host:not(:disabled):focus-visible{box-shadow:var(--kirby-focus-ring-md-combined-inset);border-color:var(--kirby-color-border-focus)}:host:not(:disabled){transition:all 80ms linear 0ms;transition-property:background-color,border-color,box-shadow}:host{background-color:var(--kirby-color-fill-raised);color:var(--kirby-color-content-raised);border:var(--kirby-stroke-xs) solid var(--kirby-input-color-border-raised);box-sizing:border-box;font-family:var(--kirby-font-family);font-size:1rem;line-height:var(--kirby-line-height-n);outline:none;margin:0;-webkit-appearance:none;appearance:none;border-radius:var(--kirby-border-radius-n);padding:calc(var(--kirby-spacing-s) - var(--kirby-stroke-xs));width:100%}:host.borderless{border-color:transparent;border-radius:0;padding-inline:0;width:auto}:host:disabled{opacity:var(--kirby-opacity-40)}:host::placeholder{color:var(--kirby-color-content-raised-quiet)}@supports not (selector(::-webkit-date-and-time-value)){:host(input[type=date]::-webkit-date-and-time-value){min-height:calc(var(--kirby-line-height-n) * 1em);text-align:start}}:host{position:relative;font-family:var(--kirby-font-family);resize:none}@media(min-width:768px){:host{resize:vertical}}\n"]
678
+ }]
679
+ }],
680
+ ctorParameters: () => [{ type: i0.ElementRef }, {
681
+ type: void 0,
682
+ decorators: [{ type: Optional }, {
683
+ type: Inject,
684
+ args: [NG_VALUE_ACCESSOR]
685
+ }]
686
+ }],
687
+ propDecorators: {
688
+ value: [{
689
+ type: HostBinding,
690
+ args: ["attr.value"]
691
+ }, { type: Input }],
692
+ borderless: [{
693
+ type: HostBinding,
694
+ args: ["class.borderless"]
695
+ }, { type: Input }],
696
+ hasError: [
697
+ {
698
+ type: HostBinding,
699
+ args: ["attr.aria-invalid"]
700
+ },
701
+ {
702
+ type: HostBinding,
703
+ args: ["class.error"]
704
+ },
705
+ { type: Input }
706
+ ],
707
+ autocomplete: [{
708
+ type: HostBinding,
709
+ args: ["attr.autocomplete"]
710
+ }, { type: Input }],
711
+ autocorrect: [{
712
+ type: HostBinding,
713
+ args: ["attr.autocorrect"]
714
+ }, { type: Input }],
715
+ maxlength: [{
716
+ type: HostBinding,
717
+ args: ["attr.maxlength"]
718
+ }, { type: Input }],
719
+ hasErrorChange: [{ type: Output }],
720
+ _onKeyUp: [{
721
+ type: HostListener,
722
+ args: ["keyup", ["$event.target.value"]]
723
+ }],
724
+ _onCutPaste: [{
725
+ type: HostListener,
726
+ args: ["paste", ["$event.target"]]
727
+ }, {
728
+ type: HostListener,
729
+ args: ["cut", ["$event.target"]]
730
+ }]
731
+ }
732
+ });
733
+ var FormFieldComponent = class FormFieldComponent {
734
+ get label() {
735
+ return this._label;
736
+ }
737
+ set label(value) {
738
+ this._label = value;
739
+ this.setNestedInteractiveLabelAttributes();
740
+ }
741
+ get message() {
742
+ return this._message;
743
+ }
744
+ set message(value) {
745
+ this._message = value;
746
+ this.setNestedInteractiveMessageAttributes();
747
+ }
748
+ constructor(elementRef, platform, renderer, windowRef, resizeObserverService, cdr) {
749
+ this.platform = platform;
750
+ this.renderer = renderer;
751
+ this.windowRef = windowRef;
752
+ this.resizeObserverService = resizeObserverService;
753
+ this.cdr = cdr;
754
+ this.isRegistered = false;
755
+ this.hasWarnedMissingControl = false;
756
+ this.showDefaultCalendarIcon = false;
757
+ this._labelId = UniqueIdGenerator.scopedTo("kirby-form-field-label").next();
758
+ this._errorMessageId = UniqueIdGenerator.scopedTo("kirby-form-field-message").next();
759
+ this._messageId = UniqueIdGenerator.scopedTo("kirby-form-field-message").next();
760
+ this.element = elementRef.nativeElement;
761
+ }
762
+ isInputOrTextarea() {
763
+ return this.formFieldControl instanceof InputComponent || this.formFieldControl instanceof TextareaComponent;
764
+ }
765
+ get _wrapContentInLabel() {
766
+ return !!this.label && this.isInputOrTextarea();
767
+ }
768
+ dispatchLoadEvent() {
769
+ this.windowRef.nativeWindow.document.dispatchEvent(new CustomEvent("ionInputDidLoad", { detail: this.element }));
770
+ }
771
+ _onRegisterFormField() {
772
+ this.dispatchLoadEvent();
773
+ }
774
+ onLabelClick() {
775
+ if (this.formFieldControl instanceof RadioGroupComponent) this.formFieldControl.focus();
776
+ else this.nestedInteractiveElement?.focus();
777
+ }
778
+ openDatePicker() {
779
+ if (!this.dateInput?.useNativeDatePicker) return;
780
+ this.nestedInteractiveElement.showPicker();
781
+ }
782
+ focus() {
783
+ if (!this.nestedInteractiveElement) return;
784
+ if (this.isInputOrTextarea()) setTimeout(() => {
785
+ if (this.isTouch) {
786
+ const touchStart = new TouchEvent("touchstart");
787
+ const touchEnd = new TouchEvent("touchend");
788
+ this.nestedInteractiveElement.dispatchEvent(touchStart);
789
+ this.nestedInteractiveElement.dispatchEvent(touchEnd);
790
+ } else this.nestedInteractiveElement.focus();
791
+ });
792
+ }
793
+ ngOnInit() {
794
+ this.isTouch = this.platform.isTouch();
795
+ }
796
+ ngAfterContentInit() {
797
+ this.handleAffixOffset();
798
+ }
799
+ ngAfterContentChecked() {
800
+ if (!this.formFieldControl) {
801
+ this.warnMissingControl();
802
+ return;
803
+ }
804
+ if (!this.nestedInteractiveElement) this.registerNestedInteractive();
805
+ if (!this.isRegistered && this.element.isConnected && this.isInputOrTextarea()) {
806
+ this.isRegistered = true;
807
+ this.dispatchLoadEvent();
808
+ }
809
+ this.showDefaultCalendarIcon = this.shouldShowDefaultCalendarIcon();
810
+ }
811
+ warnMissingControl() {
812
+ if (!this.hasWarnedMissingControl) {
813
+ this.hasWarnedMissingControl = true;
814
+ console.warn("kirby-form-field: No form field control found. Ensure a component providing FORM_FIELD_CONTROL is projected.");
815
+ }
816
+ }
817
+ ngOnDestroy() {
818
+ this.windowRef.nativeWindow.document.dispatchEvent(new CustomEvent("ionInputDidUnload", { detail: this.element }));
819
+ this.affixElements?.forEach((affix) => {
820
+ this.resizeObserverService.unobserve(affix.el);
821
+ });
822
+ this.nestedInteractiveErrorSubscription?.unsubscribe();
823
+ }
824
+ registerNestedInteractive() {
825
+ this.getNestedInteractiveElement();
826
+ this.setNestedInteractiveLabelAttributes();
827
+ this.setNestedInteractiveMessageAttributes();
828
+ this.subscribeToNestedInteractiveError();
829
+ }
830
+ getNestedInteractiveElement() {
831
+ this.nestedInteractiveElement = this.formFieldControl.interactiveElement;
832
+ }
833
+ setNestedInteractiveMessageAttributes() {
834
+ if (!this.nestedInteractiveElement) return;
835
+ if (this.message) {
836
+ this.renderer.setAttribute(this.nestedInteractiveElement, "aria-describedby", this._messageId);
837
+ this.renderer.setAttribute(this.nestedInteractiveElement, "aria-errormessage", this._errorMessageId);
838
+ } else {
839
+ this.renderer.removeAttribute(this.nestedInteractiveElement, "aria-describedby");
840
+ this.renderer.removeAttribute(this.nestedInteractiveElement, "aria-errormessage");
841
+ }
842
+ }
843
+ setNestedInteractiveLabelAttributes() {
844
+ if (!this.nestedInteractiveElement) return;
845
+ if (this._wrapContentInLabel) return;
846
+ if (this.label) this.renderer.setAttribute(this.nestedInteractiveElement, "aria-labelledby", this._labelId);
847
+ else this.renderer.removeAttribute(this.nestedInteractiveElement, "aria-labelledby");
848
+ }
849
+ subscribeToNestedInteractiveError() {
850
+ this._nestedInteractiveHasError = !!this.formFieldControl?.hasError;
851
+ this.nestedInteractiveErrorSubscription = this.formFieldControl?.hasErrorChange.subscribe((hasError) => {
852
+ this._nestedInteractiveHasError = hasError;
853
+ this.cdr.markForCheck();
854
+ });
855
+ }
856
+ shouldShowDefaultCalendarIcon() {
857
+ return this.dateInput?.useNativeDatePicker && !this.affixElements.some((affix) => affix.type === "suffix");
858
+ }
859
+ handleAffixOffset() {
860
+ if (this.formFieldControl instanceof InputComponent) {
861
+ const inputElement = this.formFieldControl.interactiveElement;
862
+ this.affixElements.forEach((affix) => {
863
+ this.resizeObserverService.observe(affix.el, (entry) => {
864
+ const padding = affix.type === "prefix" ? "padding-left" : "padding-right";
865
+ const affixWidth = inputElement.type === "date" ? 0 : entry.contentRect.width;
866
+ const existingPadding = parseInt(DesignTokenHelper.size("s"));
867
+ this.renderer.setStyle(inputElement, `${padding}`, `${affixWidth + existingPadding}px`);
868
+ const dateMask = this.element.querySelector(".date-mask");
869
+ if (dateMask) this.renderer.setStyle(dateMask, `${padding}`, `${affixWidth + existingPadding}px`);
870
+ });
871
+ });
872
+ }
873
+ }
874
+ static {
875
+ this.ɵfac = i0.ɵɵngDeclareFactory({
876
+ minVersion: "12.0.0",
877
+ version: "22.2.3",
878
+ ngImport: i0,
879
+ type: FormFieldComponent,
880
+ deps: [
881
+ { token: i0.ElementRef },
882
+ { token: i1.PlatformService },
883
+ { token: i0.Renderer2 },
884
+ { token: i2.WindowRef },
885
+ { token: i1$1.ResizeObserverService },
886
+ { token: i0.ChangeDetectorRef }
887
+ ],
888
+ target: i0.ɵɵFactoryTarget.Component
889
+ });
890
+ }
891
+ static {
892
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
893
+ minVersion: "17.0.0",
894
+ version: "22.2.3",
895
+ type: FormFieldComponent,
896
+ isStandalone: true,
897
+ selector: "kirby-form-field",
898
+ inputs: {
899
+ label: "label",
900
+ message: "message"
901
+ },
902
+ host: {
903
+ listeners: { "kirbyRegisterFormField": "_onRegisterFormField()" },
904
+ properties: { "class.wrap-content-in-label": "this._wrapContentInLabel" }
905
+ },
906
+ queries: [
907
+ {
908
+ propertyName: "counter",
909
+ first: true,
910
+ predicate: InputCounterComponent,
911
+ descendants: true
912
+ },
913
+ {
914
+ propertyName: "formFieldControl",
915
+ first: true,
916
+ predicate: FORM_FIELD_CONTROL,
917
+ descendants: true
918
+ },
919
+ {
920
+ propertyName: "dateInput",
921
+ first: true,
922
+ predicate: DateInputDirective,
923
+ descendants: true
924
+ },
925
+ {
926
+ propertyName: "affixElements",
927
+ predicate: AffixDirective
928
+ }
929
+ ],
930
+ ngImport: i0,
931
+ template: "@if (_wrapContentInLabel) {\n <label>\n <ng-container *ngTemplateOutlet=\"labelTextTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"slottedInputTemplate\"></ng-container>\n <!-- add error message inside label if nested interative is in error state -->\n @if (_nestedInteractiveHasError) {\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n }\n </label>\n}\n\n<!-- add message outside label if nested interative is in valid state -->\n@if (!_nestedInteractiveHasError && _wrapContentInLabel) {\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n}\n\n@if (!_wrapContentInLabel) {\n <ng-container *ngTemplateOutlet=\"labelTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"slottedInputTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n}\n\n<ng-template #messageTemplate>\n @if (message !== undefined || counter) {\n <div class=\"texts\">\n <div\n aria-live=\"polite\"\n class=\"message\"\n [id]=\"_nestedInteractiveHasError ? _errorMessageId : _messageId\"\n >\n @if (message !== undefined) {\n <kirby-form-field-message [text]=\"message\"></kirby-form-field-message>\n }\n </div>\n @if (counter) {\n <div class=\"counter\">\n <ng-content select=\"kirby-input-counter\"></ng-content>\n </div>\n }\n </div>\n }\n</ng-template>\n\n<ng-template #slottedInputTemplate>\n <div class=\"affix-container\">\n <div class=\"prefix vertical-align semi-dark-text\">\n <ng-content select=\"[kirby-affix='prefix']\"></ng-content>\n </div>\n <ng-content></ng-content>\n <div class=\"suffix vertical-align semi-dark-text\" (click)=\"openDatePicker()\">\n <ng-content select=\"[kirby-affix='suffix']\"></ng-content>\n @if (showDefaultCalendarIcon) {\n <kirby-icon name=\"calendar\"></kirby-icon>\n }\n </div>\n </div>\n</ng-template>\n\n<ng-template #labelTextTemplate>\n @if (label) {\n <span class=\"text\">{{ label }}</span>\n }\n</ng-template>\n\n<ng-template #labelTemplate>\n @if (label) {\n <label class=\"text\" [id]=\"_labelId\" (click)=\"onLabelClick()\">{{ label }}</label>\n }\n</ng-template>\n",
932
+ styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{display:block;position:relative;margin-bottom:var(--kirby-spacing-s)}:host-context(kirby-item){margin-bottom:0}.texts{display:flex;justify-content:space-between;padding:2px var(--kirby-spacing-s) 0 var(--kirby-spacing-s)}.texts .message{flex:75%}.texts .message:only-child{flex-basis:auto}.texts .message>kirby-form-field-message{width:100%;display:flex}.texts .counter{flex:25%;text-align:right}label{display:block}.text{display:block;font-size:var(--kirby-font-size-s);font-weight:var(--kirby-font-weight-light);line-height:var(--kirby-line-height-s);margin-bottom:var(--kirby-spacing-xxxs);padding:0 var(--kirby-spacing-s)}.affix-container{position:relative}.affix-container .vertical-align{display:flex;align-items:center;position:absolute;top:0;bottom:0}.affix-container .prefix{left:var(--kirby-spacing-xs);z-index:var(--kirby-z-index-default)}.affix-container .suffix{right:var(--kirby-spacing-xs)}.affix-container .semi-dark-text ::ng-deep>span,.affix-container .semi-dark-text ::ng-deep>h1,.affix-container .semi-dark-text ::ng-deep>h2,.affix-container .semi-dark-text ::ng-deep>h3,.affix-container .semi-dark-text ::ng-deep>h4,.affix-container .semi-dark-text ::ng-deep>h5,.affix-container .semi-dark-text ::ng-deep>h6,.affix-container .semi-dark-text ::ng-deep>p,.affix-container .semi-dark-text ::ng-deep>data{color:var(--kirby-color-content-raised-quiet)}\n"],
933
+ dependencies: [
934
+ {
935
+ kind: "directive",
936
+ type: NgTemplateOutlet,
937
+ selector: "[ngTemplateOutlet]",
938
+ inputs: [
939
+ "ngTemplateOutletContext",
940
+ "ngTemplateOutlet",
941
+ "ngTemplateOutletInjector"
942
+ ]
943
+ },
944
+ {
945
+ kind: "component",
946
+ type: FormFieldMessageComponent,
947
+ selector: "kirby-form-field-message",
948
+ inputs: ["text", "position"]
949
+ },
950
+ {
951
+ kind: "component",
952
+ type: IconComponent,
953
+ selector: "kirby-icon",
954
+ inputs: ["size", "name"]
955
+ }
956
+ ],
957
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
958
+ });
959
+ }
960
+ };
961
+ i0.ɵɵngDeclareClassMetadata({
962
+ minVersion: "12.0.0",
963
+ version: "22.2.3",
964
+ ngImport: i0,
965
+ type: FormFieldComponent,
966
+ decorators: [{
967
+ type: Component,
968
+ args: [{
969
+ changeDetection: ChangeDetectionStrategy.OnPush,
970
+ selector: "kirby-form-field",
971
+ imports: [
972
+ NgTemplateOutlet,
973
+ FormFieldMessageComponent,
974
+ IconComponent
975
+ ],
976
+ template: "@if (_wrapContentInLabel) {\n <label>\n <ng-container *ngTemplateOutlet=\"labelTextTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"slottedInputTemplate\"></ng-container>\n <!-- add error message inside label if nested interative is in error state -->\n @if (_nestedInteractiveHasError) {\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n }\n </label>\n}\n\n<!-- add message outside label if nested interative is in valid state -->\n@if (!_nestedInteractiveHasError && _wrapContentInLabel) {\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n}\n\n@if (!_wrapContentInLabel) {\n <ng-container *ngTemplateOutlet=\"labelTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"slottedInputTemplate\"></ng-container>\n <ng-container *ngTemplateOutlet=\"messageTemplate\"></ng-container>\n}\n\n<ng-template #messageTemplate>\n @if (message !== undefined || counter) {\n <div class=\"texts\">\n <div\n aria-live=\"polite\"\n class=\"message\"\n [id]=\"_nestedInteractiveHasError ? _errorMessageId : _messageId\"\n >\n @if (message !== undefined) {\n <kirby-form-field-message [text]=\"message\"></kirby-form-field-message>\n }\n </div>\n @if (counter) {\n <div class=\"counter\">\n <ng-content select=\"kirby-input-counter\"></ng-content>\n </div>\n }\n </div>\n }\n</ng-template>\n\n<ng-template #slottedInputTemplate>\n <div class=\"affix-container\">\n <div class=\"prefix vertical-align semi-dark-text\">\n <ng-content select=\"[kirby-affix='prefix']\"></ng-content>\n </div>\n <ng-content></ng-content>\n <div class=\"suffix vertical-align semi-dark-text\" (click)=\"openDatePicker()\">\n <ng-content select=\"[kirby-affix='suffix']\"></ng-content>\n @if (showDefaultCalendarIcon) {\n <kirby-icon name=\"calendar\"></kirby-icon>\n }\n </div>\n </div>\n</ng-template>\n\n<ng-template #labelTextTemplate>\n @if (label) {\n <span class=\"text\">{{ label }}</span>\n }\n</ng-template>\n\n<ng-template #labelTemplate>\n @if (label) {\n <label class=\"text\" [id]=\"_labelId\" (click)=\"onLabelClick()\">{{ label }}</label>\n }\n</ng-template>\n",
977
+ styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{display:block;position:relative;margin-bottom:var(--kirby-spacing-s)}:host-context(kirby-item){margin-bottom:0}.texts{display:flex;justify-content:space-between;padding:2px var(--kirby-spacing-s) 0 var(--kirby-spacing-s)}.texts .message{flex:75%}.texts .message:only-child{flex-basis:auto}.texts .message>kirby-form-field-message{width:100%;display:flex}.texts .counter{flex:25%;text-align:right}label{display:block}.text{display:block;font-size:var(--kirby-font-size-s);font-weight:var(--kirby-font-weight-light);line-height:var(--kirby-line-height-s);margin-bottom:var(--kirby-spacing-xxxs);padding:0 var(--kirby-spacing-s)}.affix-container{position:relative}.affix-container .vertical-align{display:flex;align-items:center;position:absolute;top:0;bottom:0}.affix-container .prefix{left:var(--kirby-spacing-xs);z-index:var(--kirby-z-index-default)}.affix-container .suffix{right:var(--kirby-spacing-xs)}.affix-container .semi-dark-text ::ng-deep>span,.affix-container .semi-dark-text ::ng-deep>h1,.affix-container .semi-dark-text ::ng-deep>h2,.affix-container .semi-dark-text ::ng-deep>h3,.affix-container .semi-dark-text ::ng-deep>h4,.affix-container .semi-dark-text ::ng-deep>h5,.affix-container .semi-dark-text ::ng-deep>h6,.affix-container .semi-dark-text ::ng-deep>p,.affix-container .semi-dark-text ::ng-deep>data{color:var(--kirby-color-content-raised-quiet)}\n"]
978
+ }]
979
+ }],
980
+ ctorParameters: () => [
981
+ { type: i0.ElementRef },
982
+ { type: i1.PlatformService },
983
+ { type: i0.Renderer2 },
984
+ { type: i2.WindowRef },
985
+ { type: i1$1.ResizeObserverService },
986
+ { type: i0.ChangeDetectorRef }
987
+ ],
988
+ propDecorators: {
989
+ label: [{ type: Input }],
990
+ message: [{ type: Input }],
991
+ affixElements: [{
992
+ type: ContentChildren,
993
+ args: [AffixDirective]
994
+ }],
995
+ counter: [{
996
+ type: ContentChild,
997
+ args: [InputCounterComponent, { static: false }]
998
+ }],
999
+ formFieldControl: [{
1000
+ type: ContentChild,
1001
+ args: [FORM_FIELD_CONTROL]
1002
+ }],
1003
+ dateInput: [{
1004
+ type: ContentChild,
1005
+ args: [DateInputDirective]
1006
+ }],
1007
+ _wrapContentInLabel: [{
1008
+ type: HostBinding,
1009
+ args: ["class.wrap-content-in-label"]
1010
+ }],
1011
+ _onRegisterFormField: [{
1012
+ type: HostListener,
1013
+ args: ["kirbyRegisterFormField"]
1014
+ }]
1015
+ }
1016
+ });
1017
+ var DecimalMaskDirective = class DecimalMaskDirective {
1018
+ set allowMinus(allowMinus) {
1019
+ this._allowMinus = allowMinus || (this.min || 0) < 0;
1020
+ }
1021
+ set disableGroupSeperator(disabled) {
1022
+ this._groupSeperatorDisabled = String(disabled) === "" || String(disabled) === "true";
1023
+ }
1024
+ set maxlength(maxlength) {
1025
+ this._maxlength = maxlength;
1026
+ const maxlengthValue = parseInt("9".repeat(maxlength));
1027
+ this.max = this.getMax(maxlengthValue);
1028
+ this.min = this.getMin(maxlengthValue);
1029
+ }
1030
+ constructor(elementRef, locale, valueAccessors) {
1031
+ this.elementRef = elementRef;
1032
+ this.locale = locale;
1033
+ this.valueAccessors = valueAccessors;
1034
+ this.precision = 2;
1035
+ this.setMaxOnOverflow = false;
1036
+ this.alignment = "right";
1037
+ this.padPrecisionDigits = false;
1038
+ this.groupSeparator = getLocaleNumberSymbol(this.locale, NumberSymbol.Group);
1039
+ this.radixPoint = getLocaleNumberSymbol(this.locale, NumberSymbol.Decimal);
1040
+ this._allowMinus = false;
1041
+ this.extendBuiltinValueAccessor();
1042
+ }
1043
+ ngOnInit() {
1044
+ const element = this.elementRef.nativeElement;
1045
+ element.setAttribute("type", "text");
1046
+ element.removeAttribute("maxlength");
1047
+ if (element.value) element.value = this.toLocaleRadixPoint(element.value);
1048
+ this.initMask();
1049
+ }
1050
+ initMask() {
1051
+ const element = this.elementRef.nativeElement;
1052
+ new Inputmask("decimal", {
1053
+ groupSeparator: this._groupSeperatorDisabled ? "" : this.groupSeparator,
1054
+ radixPoint: this.radixPoint,
1055
+ digits: this._maxlength ? 0 : this.precision,
1056
+ digitsOptional: !this.padPrecisionDigits,
1057
+ min: this.min,
1058
+ max: this.max,
1059
+ allowMinus: this._allowMinus,
1060
+ negationSymbol: {
1061
+ front: getLocaleNumberSymbol(this.locale, NumberSymbol.MinusSign),
1062
+ back: ""
1063
+ },
1064
+ SetMaxOnOverflow: this.setMaxOnOverflow,
1065
+ showMaskOnFocus: false,
1066
+ showMaskOnHover: false,
1067
+ placeholder: this.padPrecisionDigits ? void 0 : "",
1068
+ rightAlign: this.alignment === "right",
1069
+ onBeforeWrite: () => {
1070
+ if (!this.inputmask) return;
1071
+ },
1072
+ onBeforePaste: (value, options) => {
1073
+ const replacesValue = element.selectionStart === 0 && element.selectionEnd === element.value.length;
1074
+ if (!this.padPrecisionDigits || !replacesValue) return options.onBeforeMask(value, options);
1075
+ element.value = value;
1076
+ element.dispatchEvent(new Event("input", { bubbles: true }));
1077
+ return false;
1078
+ }
1079
+ }).mask(element);
1080
+ this.inputmask = element.inputmask;
1081
+ }
1082
+ getMax(maxlengthValue) {
1083
+ return this.max === void 0 ? maxlengthValue : Math.min(this.max, maxlengthValue);
1084
+ }
1085
+ getMin(maxlengthValue) {
1086
+ if (!this.allowMinus) return;
1087
+ maxlengthValue = -Math.abs(maxlengthValue);
1088
+ return this.min === void 0 ? maxlengthValue : -Math.abs(Math.max(this.min, maxlengthValue));
1089
+ }
1090
+ toLocaleRadixPoint(value) {
1091
+ return value.replace(".", this.radixPoint);
1092
+ }
1093
+ toStandardRadixPoint(value) {
1094
+ return value.replace(this.radixPoint, ".");
1095
+ }
1096
+ extendBuiltinValueAccessor() {
1097
+ extendValueAccessors(this.valueAccessors, {
1098
+ writeValue: { afterWriteValue: (value) => {
1099
+ if (this.inputmask && value != null) this.inputmask.setValue(this.toLocaleRadixPoint(String(value)));
1100
+ } },
1101
+ registerOnChange: { transformValue: (value) => {
1102
+ if (this.inputmask) return this.toStandardRadixPoint(this.inputmask.unmaskedvalue());
1103
+ return value;
1104
+ } }
1105
+ });
1106
+ }
1107
+ static {
1108
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1109
+ minVersion: "12.0.0",
1110
+ version: "22.2.3",
1111
+ ngImport: i0,
1112
+ type: DecimalMaskDirective,
1113
+ deps: [
1114
+ { token: i0.ElementRef },
1115
+ { token: LOCALE_ID },
1116
+ {
1117
+ token: NG_VALUE_ACCESSOR,
1118
+ optional: true
1119
+ }
1120
+ ],
1121
+ target: i0.ɵɵFactoryTarget.Directive
1122
+ });
1123
+ }
1124
+ static {
1125
+ this.ɵdir = i0.ɵɵngDeclareDirective({
1126
+ minVersion: "14.0.0",
1127
+ version: "22.2.3",
1128
+ type: DecimalMaskDirective,
1129
+ isStandalone: true,
1130
+ selector: "[kirby-decimal-mask]",
1131
+ inputs: {
1132
+ min: "min",
1133
+ max: "max",
1134
+ precision: "precision",
1135
+ setMaxOnOverflow: "setMaxOnOverflow",
1136
+ alignment: "alignment",
1137
+ padPrecisionDigits: "padPrecisionDigits",
1138
+ allowMinus: "allowMinus",
1139
+ disableGroupSeperator: "disableGroupSeperator",
1140
+ maxlength: "maxlength"
1141
+ },
1142
+ ngImport: i0
1143
+ });
1144
+ }
1145
+ };
1146
+ i0.ɵɵngDeclareClassMetadata({
1147
+ minVersion: "12.0.0",
1148
+ version: "22.2.3",
1149
+ ngImport: i0,
1150
+ type: DecimalMaskDirective,
1151
+ decorators: [{
1152
+ type: Directive,
1153
+ args: [{ selector: "[kirby-decimal-mask]" }]
1154
+ }],
1155
+ ctorParameters: () => [
1156
+ { type: i0.ElementRef },
1157
+ {
1158
+ type: void 0,
1159
+ decorators: [{
1160
+ type: Inject,
1161
+ args: [LOCALE_ID]
1162
+ }]
1163
+ },
1164
+ {
1165
+ type: void 0,
1166
+ decorators: [{ type: Optional }, {
1167
+ type: Inject,
1168
+ args: [NG_VALUE_ACCESSOR]
1169
+ }]
1170
+ }
1171
+ ],
1172
+ propDecorators: {
1173
+ min: [{ type: Input }],
1174
+ max: [{ type: Input }],
1175
+ precision: [{ type: Input }],
1176
+ setMaxOnOverflow: [{ type: Input }],
1177
+ alignment: [{ type: Input }],
1178
+ padPrecisionDigits: [{ type: Input }],
1179
+ allowMinus: [{ type: Input }],
1180
+ disableGroupSeperator: [{ type: Input }],
1181
+ maxlength: [{ type: Input }]
1182
+ }
1183
+ });
1184
+ const imports = [
1185
+ FormFieldComponent,
1186
+ FormFieldMessageComponent,
1187
+ InputCounterComponent
1188
+ ];
1189
+ var FormFieldModule = class FormFieldModule {
1190
+ static {
1191
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1192
+ minVersion: "12.0.0",
1193
+ version: "22.2.3",
1194
+ ngImport: i0,
1195
+ type: FormFieldModule,
1196
+ deps: [],
1197
+ target: i0.ɵɵFactoryTarget.NgModule
1198
+ });
1199
+ }
1200
+ static {
1201
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
1202
+ minVersion: "14.0.0",
1203
+ version: "22.2.3",
1204
+ ngImport: i0,
1205
+ type: FormFieldModule,
1206
+ imports: [
1207
+ CommonModule,
1208
+ DecimalMaskDirective,
1209
+ IconModule,
1210
+ AffixDirective,
1211
+ FormFieldComponent,
1212
+ FormFieldMessageComponent,
1213
+ InputCounterComponent
1214
+ ],
1215
+ exports: [
1216
+ FormFieldComponent,
1217
+ FormFieldMessageComponent,
1218
+ InputCounterComponent,
1219
+ DecimalMaskDirective,
1220
+ AffixDirective
1221
+ ]
1222
+ });
1223
+ }
1224
+ static {
1225
+ this.ɵinj = i0.ɵɵngDeclareInjector({
1226
+ minVersion: "12.0.0",
1227
+ version: "22.2.3",
1228
+ ngImport: i0,
1229
+ type: FormFieldModule,
1230
+ imports: [
1231
+ CommonModule,
1232
+ IconModule,
1233
+ FormFieldComponent
1234
+ ]
1235
+ });
1236
+ }
1237
+ };
1238
+ i0.ɵɵngDeclareClassMetadata({
1239
+ minVersion: "12.0.0",
1240
+ version: "22.2.3",
1241
+ ngImport: i0,
1242
+ type: FormFieldModule,
1243
+ decorators: [{
1244
+ type: NgModule,
1245
+ args: [{
1246
+ imports: [
1247
+ CommonModule,
1248
+ DecimalMaskDirective,
1249
+ IconModule,
1250
+ AffixDirective,
1251
+ ...imports
1252
+ ],
1253
+ exports: [
1254
+ ...imports,
1255
+ DecimalMaskDirective,
1256
+ AffixDirective
1257
+ ]
1258
+ }]
1259
+ }]
1260
+ });
893
1261
  export { AffixDirective, DateInputDirective, DecimalMaskDirective, FormFieldComponent, FormFieldMessageComponent, FormFieldModule, InputComponent, InputCounterComponent, InputSize, TextareaComponent };
894
- //# sourceMappingURL=kirbydesign-designsystem-form-field.mjs.map
1262
+
1263
+ //# sourceMappingURL=kirbydesign-designsystem-form-field.mjs.map