@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,367 +1,539 @@
1
- import * as i0 from '@angular/core';
2
- import { ElementRef, HostBinding, Input, ViewChild, ChangeDetectionStrategy, Component, EventEmitter, TemplateRef, HostListener, ContentChildren, ViewChildren, ContentChild, Output, NgModule } from '@angular/core';
3
- import { IonRadio, IonRadioGroup } from '@ionic/angular/standalone';
4
- import * as i1 from '@kirbydesign/designsystem/helpers';
5
- import { IonicElementPartHelper } from '@kirbydesign/designsystem/helpers';
6
- import { inheritAriaLabelText, setAccessibleLabel, forwardAttributes } from '@kirbydesign/designsystem/shared';
7
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
8
- import { ListItemTemplateDirective } from '@kirbydesign/designsystem/list';
9
- import { FORM_FIELD_CONTROL } from '@kirbydesign/designsystem/types';
10
- import { NgTemplateOutlet, CommonModule } from '@angular/common';
11
-
12
- class RadioComponent {
13
- get _isDisabled() {
14
- return this.disabled ? 'disabled' : null;
15
- }
16
- get buttonTabIndex() {
17
- return this.ionRadioElement ? this.ionRadioElement.nativeElement.tabIndex : -1;
18
- }
19
- constructor(element, ionicElementPartHelper) {
20
- this.element = element;
21
- this.ionicElementPartHelper = ionicElementPartHelper;
22
- this.size = 'md';
23
- this._justify = 'start';
24
- this._labelPlacement = 'end';
25
- }
26
- ngOnInit() {
27
- /**
28
- * We cannot query ion-checkbox for slotted content at this point as the slot has not been rendered.
29
- * But we need to know if content is slotted to set justify and labelPlacement BEFORE ion-checkbox is rendered.
30
- * So it has to be done by querying an additional wrapper around the default content slot like this.
31
- */
32
- this._hasSlottedContent = this.element.nativeElement
33
- .querySelector('.default-content')
34
- .hasChildNodes();
35
- const slot = this.element.nativeElement.getAttribute('slot');
36
- if (slot === 'end' && this._hasSlottedContent) {
37
- this._justify = 'space-between';
38
- this._labelPlacement = 'start';
39
- }
40
- }
41
- ngAfterViewInit() {
42
- this.ionicElementPartHelper.setPart('label', this.ionRadioElement, '.radio-wrapper');
43
- this.ionicElementPartHelper.setPart('label-text-wrapper', this.ionRadioElement, '.label-text-wrapper');
44
- this.ionicElementPartHelper.setPart('native-wrapper', this.ionRadioElement, '.native-wrapper');
45
- }
46
- ngAfterContentInit() {
47
- this._labelText = inheritAriaLabelText(this.element.nativeElement);
48
- if (!this.text && !this._labelText && !this._hasSlottedContent) {
49
- // if no label has been set try to find a label in an item and use its text content
50
- this._labelText = setAccessibleLabel(this.element.nativeElement);
51
- }
52
- }
53
- focus() {
54
- this.ionRadioElement?.nativeElement.focus();
55
- }
56
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: RadioComponent, deps: [{ token: i0.ElementRef }, { token: i1.IonicElementPartHelper }], target: i0.ɵɵFactoryTarget.Component }); }
57
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.18", type: RadioComponent, isStandalone: true, selector: "kirby-radio", inputs: { value: "value", text: "text", size: "size", disabled: "disabled" }, host: { properties: { "class": "this.size", "attr.disabled": "this._isDisabled", "class.has-hidden-label": "this._labelText" } }, providers: [IonicElementPartHelper], viewQueries: [{ propertyName: "ionRadioElement", first: true, predicate: IonRadio, descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<ion-radio\n [value]=\"value\"\n [disabled]=\"disabled\"\n mode=\"md\"\n [labelPlacement]=\"_labelPlacement\"\n [justify]=\"_justify\"\n>\n @if (_labelText) {\n <span class=\"hidden-label\">{{ _labelText }}</span>\n }\n @if (text) {\n <span [attr.aria-hidden]=\"_labelText ? true : undefined\">{{ text }}</span>\n }\n <span class=\"default-content\" [attr.aria-hidden]=\"_labelText ? true : undefined\">\n <ng-content></ng-content>\n </span>\n</ion-radio>\n", styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{display:flex}:host[disabled]{color:var(--kirby-text-color-semi-dark)}:host[disabled] ion-radio{--color: var(--kirby-medium);--color-checked: var(--kirby-medium)}:host[disabled] ion-radio::part(container){background-color:var(--kirby-semi-light)}:host[disabled] ion-radio::part(mark){--color-checked: var(--kirby-semi-dark)}:host[disabled] ion-radio::part(label-text-wrapper){opacity:1}:host[disabled] ion-radio::part(native-wrapper){opacity:1}:host:has(ion-radio.in-item.radio-justify-space-between){width:100%}:host.has-hidden-label:has(ion-radio.in-item){position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio{position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio::part(label){position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio.radio-label-placement-start::part(label-text-wrapper),:host.has-hidden-label:has(ion-radio.in-item) ion-radio.radio-label-placement-end::part(label-text-wrapper){margin-inline:0}:host.has-hidden-label[slot=end] ion-radio{margin-inline-start:12px}:host.has-hidden-label .hidden-label{position:absolute;inset:0;opacity:0}:host.xs ion-radio:not(.in-item)::part(label){padding-block:4px}:host.sm ion-radio:not(.in-item)::part(label){padding-block:10px}:host.md ion-radio:not(.in-item)::part(label){padding-block:16px}ion-radio:focus-within{--border-width: 0;--color: transparent}ion-radio:focus-visible::part(container){transition:box-shadow 80ms linear;box-shadow:var(--kirby-focus-ring-sm-inset)}ion-radio{box-sizing:border-box;--border-width: 1px;--color: var(--kirby-semi-dark);--color-checked: var(--kirby-success)}@media(hover:hover){ion-radio:hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer}ion-radio:hover::part(container){background-color:#ebebeb}}ion-radio:active,ion-radio.interaction-state-active{--state-layer-opacity: .12;--state-layer-background-color: var(--kirby-black);--color-checked: rgb(52.6486343612, 207.7113656388, 125.2311894273)}ion-radio:active::part(container),ion-radio.interaction-state-active::part(container){background-color:#e0e0e0}ion-radio::part(container){transition:all 80ms linear 0ms;transition-property:background-color,box-shadow;background-color:var(--kirby-white);margin:2px;width:20px;height:20px}ion-radio::part(mark){width:12px;height:12px}ion-radio::part(label){align-items:start;padding-inline:16px;line-height:1.5}ion-radio::part(label-text-wrapper){margin-inline:12px 0;white-space:pre-line}ion-radio::part(native-wrapper){height:1.5rem}ion-radio.in-item::part(label){align-items:center;padding-inline:0}ion-radio.in-item::part(label-text-wrapper){margin-block:0}ion-radio.in-item.radio-label-placement-start::part(label-text-wrapper){margin-inline:0 8px}ion-radio.in-item.radio-label-placement-end::part(label-text-wrapper){margin-inline:8px 0}ion-radio :host-context(kirby-radio-group.error) ion-radio,ion-radio :host-context(kirby-radio-group.error) ion-radio:active,ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio,ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio:active{--color: var(--kirby-danger)}ion-radio.radio-checked:not(:focus,.radio-disabled)::part(container){box-shadow:0 0 5px #1c1c1c0a,0 10px 15px -10px #1c1c1c26}ion-radio.radio-checked:not(:focus,:focus-within,.radio-disabled)::part(container){border-color:var(--kirby-semi-dark)}:host-context(kirby-item){z-index:1}:host-context(kirby-item) ion-radio{margin:0}:host-context(kirby-item)[slot=start]{margin-block:0;margin-inline-end:12px}\n"], dependencies: [{ kind: "component", type: IonRadio, selector: "ion-radio", inputs: ["alignment", "color", "disabled", "justify", "labelPlacement", "mode", "name", "value"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
58
- }
59
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: RadioComponent, decorators: [{
60
- type: Component,
61
- args: [{ selector: 'kirby-radio', changeDetection: ChangeDetectionStrategy.OnPush, providers: [IonicElementPartHelper], imports: [IonRadio], template: "<ion-radio\n [value]=\"value\"\n [disabled]=\"disabled\"\n mode=\"md\"\n [labelPlacement]=\"_labelPlacement\"\n [justify]=\"_justify\"\n>\n @if (_labelText) {\n <span class=\"hidden-label\">{{ _labelText }}</span>\n }\n @if (text) {\n <span [attr.aria-hidden]=\"_labelText ? true : undefined\">{{ text }}</span>\n }\n <span class=\"default-content\" [attr.aria-hidden]=\"_labelText ? true : undefined\">\n <ng-content></ng-content>\n </span>\n</ion-radio>\n", styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{display:flex}:host[disabled]{color:var(--kirby-text-color-semi-dark)}:host[disabled] ion-radio{--color: var(--kirby-medium);--color-checked: var(--kirby-medium)}:host[disabled] ion-radio::part(container){background-color:var(--kirby-semi-light)}:host[disabled] ion-radio::part(mark){--color-checked: var(--kirby-semi-dark)}:host[disabled] ion-radio::part(label-text-wrapper){opacity:1}:host[disabled] ion-radio::part(native-wrapper){opacity:1}:host:has(ion-radio.in-item.radio-justify-space-between){width:100%}:host.has-hidden-label:has(ion-radio.in-item){position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio{position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio::part(label){position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio.radio-label-placement-start::part(label-text-wrapper),:host.has-hidden-label:has(ion-radio.in-item) ion-radio.radio-label-placement-end::part(label-text-wrapper){margin-inline:0}:host.has-hidden-label[slot=end] ion-radio{margin-inline-start:12px}:host.has-hidden-label .hidden-label{position:absolute;inset:0;opacity:0}:host.xs ion-radio:not(.in-item)::part(label){padding-block:4px}:host.sm ion-radio:not(.in-item)::part(label){padding-block:10px}:host.md ion-radio:not(.in-item)::part(label){padding-block:16px}ion-radio:focus-within{--border-width: 0;--color: transparent}ion-radio:focus-visible::part(container){transition:box-shadow 80ms linear;box-shadow:var(--kirby-focus-ring-sm-inset)}ion-radio{box-sizing:border-box;--border-width: 1px;--color: var(--kirby-semi-dark);--color-checked: var(--kirby-success)}@media(hover:hover){ion-radio:hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer}ion-radio:hover::part(container){background-color:#ebebeb}}ion-radio:active,ion-radio.interaction-state-active{--state-layer-opacity: .12;--state-layer-background-color: var(--kirby-black);--color-checked: rgb(52.6486343612, 207.7113656388, 125.2311894273)}ion-radio:active::part(container),ion-radio.interaction-state-active::part(container){background-color:#e0e0e0}ion-radio::part(container){transition:all 80ms linear 0ms;transition-property:background-color,box-shadow;background-color:var(--kirby-white);margin:2px;width:20px;height:20px}ion-radio::part(mark){width:12px;height:12px}ion-radio::part(label){align-items:start;padding-inline:16px;line-height:1.5}ion-radio::part(label-text-wrapper){margin-inline:12px 0;white-space:pre-line}ion-radio::part(native-wrapper){height:1.5rem}ion-radio.in-item::part(label){align-items:center;padding-inline:0}ion-radio.in-item::part(label-text-wrapper){margin-block:0}ion-radio.in-item.radio-label-placement-start::part(label-text-wrapper){margin-inline:0 8px}ion-radio.in-item.radio-label-placement-end::part(label-text-wrapper){margin-inline:8px 0}ion-radio :host-context(kirby-radio-group.error) ion-radio,ion-radio :host-context(kirby-radio-group.error) ion-radio:active,ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio,ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio:active{--color: var(--kirby-danger)}ion-radio.radio-checked:not(:focus,.radio-disabled)::part(container){box-shadow:0 0 5px #1c1c1c0a,0 10px 15px -10px #1c1c1c26}ion-radio.radio-checked:not(:focus,:focus-within,.radio-disabled)::part(container){border-color:var(--kirby-semi-dark)}:host-context(kirby-item){z-index:1}:host-context(kirby-item) ion-radio{margin:0}:host-context(kirby-item)[slot=start]{margin-block:0;margin-inline-end:12px}\n"] }]
62
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.IonicElementPartHelper }], propDecorators: { ionRadioElement: [{
63
- type: ViewChild,
64
- args: [IonRadio, { read: ElementRef, static: true }]
65
- }], value: [{
66
- type: Input
67
- }], text: [{
68
- type: Input
69
- }], size: [{
70
- type: HostBinding,
71
- args: ['class']
72
- }, {
73
- type: Input
74
- }], disabled: [{
75
- type: Input
76
- }], _isDisabled: [{
77
- type: HostBinding,
78
- args: ['attr.disabled']
79
- }], _labelText: [{
80
- type: HostBinding,
81
- args: ['class.has-hidden-label']
82
- }] } });
83
-
84
- class RadioGroupComponent {
85
- constructor(cdr, element, renderer) {
86
- this.cdr = cdr;
87
- this.element = element;
88
- this.renderer = renderer;
89
- this._hasError = false;
90
- this.hasErrorChange = new EventEmitter();
91
- this.itemTextProperty = 'text';
92
- this.itemDisabledProperty = 'disabled';
93
- /**
94
- * Emitted when an option is selected
95
- */
96
- this.valueChange = new EventEmitter();
97
- // #endregion "protected" properties used by template
98
- // #region private fields
99
- this._disabled = false;
100
- this._items = [];
101
- this._onChangeCallback = () => { };
102
- this._onTouched = () => { };
103
- this._selectedIndex = -1;
104
- this._value = null;
105
- this._attributesToForward = ['aria-label', 'aria-labelledby'];
106
- }
107
- // #region public properties
108
- get disabled() {
109
- return this._disabled;
110
- }
111
- set disabled(value) {
112
- this._disabled = value;
113
- this.setProjectedRadiosDisabledState(value);
114
- }
115
- get hasError() {
116
- return this._hasError;
117
- }
118
- set hasError(value) {
119
- if (this._hasError !== value) {
120
- this._hasError = value;
121
- this.hasErrorChange.emit(this._hasError);
122
- }
123
- }
124
- get interactiveElement() {
125
- return this.element?.nativeElement?.querySelector('ion-radio-group');
126
- }
127
- get items() {
128
- return this._items || []; // Ensure items return empty array even if set to null/undefined
129
- }
130
- set items(value) {
131
- if ((!value || !value.length) && !this.items.length)
132
- return; // Nothing changed, no items before or after
133
- this._items = value;
134
- this.refreshSelectionState();
135
- }
136
- get selectedIndex() {
137
- return this._selectedIndex;
138
- }
139
- set selectedIndex(value) {
140
- if (typeof value === 'string')
141
- value = parseInt(value); // Ensure data type number, e.g. when used with template syntax without binding: <... selectedIndex="1"
142
- if (value === undefined || value === null || Number.isNaN(value))
143
- value = -1;
144
- if (value === this.selectedIndex)
145
- return;
146
- this._selectedIndex = value;
147
- this._value = this.getValueFromSelectedIndex() || null;
148
- }
149
- get value() {
150
- return this._value;
151
- }
152
- set value(value) {
153
- this.setSelectedItem(value);
154
- }
155
- get hasValue() {
156
- return this.value !== undefined && this.value !== null;
157
- }
158
- get hasItemsFromContentProjection() {
159
- return (!this.items.length &&
160
- !this._customItemTemplate &&
161
- this.projectedRadioButtons &&
162
- this.projectedRadioButtons.length > 0);
163
- }
164
- // #endregion private fields
165
- // #region public methods
166
- focus() {
167
- const findFocusable = (radios) => radios && radios.find((radio) => !isNaN(radio.buttonTabIndex) && radio.buttonTabIndex !== -1);
168
- const focusable = findFocusable(this.radioButtons) || findFocusable(this.projectedRadioButtons);
169
- focusable?.focus();
170
- }
171
- ngAfterContentInit() {
172
- this.initSelectionStateFromProjectedContent();
173
- this.listenForProjectedRadiosChange();
174
- }
175
- ngAfterViewInit() {
176
- forwardAttributes(this.element.nativeElement, this._attributesToForward, this.renderer, this.element.nativeElement.querySelector('ion-radio-group'));
177
- }
178
- registerOnChange(fn) {
179
- this._onChangeCallback = fn;
180
- }
181
- registerOnTouched(fn) {
182
- this._onTouched = fn;
183
- }
184
- setDisabledState(isDisabled) {
185
- this.disabled = isDisabled;
186
- this.cdr.markForCheck();
187
- }
188
- writeValue(value) {
189
- this.value = value;
190
- this.cdr.markForCheck();
191
- }
192
- // #endregion public methods
193
- // #region "protected" methods used by template
194
- _getTextFromItem(item) {
195
- if (!item)
196
- return null;
197
- return typeof item === 'string' ? item : item[this.itemTextProperty];
198
- }
199
- _getDisabledStateFromItem(item) {
200
- if (!item)
201
- return undefined;
202
- return typeof item === 'string' ? undefined : item[this.itemDisabledProperty];
203
- }
204
- get _hasItems() {
205
- return this.items.length > 0 || this.hasItemsFromContentProjection;
206
- }
207
- _onChange(value) {
208
- if (value === this._value)
209
- return;
210
- this.setSelectedItem(value);
211
- this.valueChange.emit(value);
212
- this._onChangeCallback(value);
213
- }
214
- _onRadioBlur() {
215
- this._onTouched();
216
- }
217
- // #endregion "protected" methods used by template
218
- // #region private methods
219
- getIndexOfSelectedValue() {
220
- if (!this.hasValue)
221
- return -1;
222
- return this.hasItemsFromContentProjection
223
- ? this.getIndexOfProjectedRadio(this.value)
224
- : this.items.indexOf(this.value);
225
- }
226
- getIndexOfProjectedRadio(value) {
227
- let selectedIndex = -1;
228
- this.projectedRadioButtons?.find((radio, i) => {
229
- const found = radio.value === value;
230
- if (found) {
231
- selectedIndex = i;
232
- }
233
- return found;
234
- });
235
- return selectedIndex;
236
- }
237
- getValueFromSelectedIndex() {
238
- if (this.selectedIndex === -1)
239
- return;
240
- return this.hasItemsFromContentProjection
241
- ? this.getValueFromProjectedRadios(this.selectedIndex)
242
- : this.items[this.selectedIndex];
243
- }
244
- getValueFromProjectedRadios(index) {
245
- const radio = this.projectedRadioButtons &&
246
- this.projectedRadioButtons.find((_, i) => {
247
- return i === index;
248
- });
249
- return radio && radio.value;
250
- }
251
- initSelectionStateFromProjectedContent() {
252
- if (this.hasItemsFromContentProjection) {
253
- this.refreshSelectionState(); // Initialize selected index and value from projected radios
254
- }
255
- }
256
- listenForProjectedRadiosChange() {
257
- this.projectedRadioButtons.changes.subscribe(() => {
258
- this.refreshStateFromProjectedContent();
259
- if (this.disabled) {
260
- // Ensure disabled state propagates when re-rendering projected radios.
261
- // setTimeout prevents ExpressionChangedAfterItHasBeenCheckedError when updating the DOM in QueryList.changes:
262
- setTimeout(() => this.setProjectedRadiosDisabledState(this.disabled));
263
- }
264
- });
265
- }
266
- refreshSelectionState() {
267
- if (this.hasValue) {
268
- this._selectedIndex = this.getIndexOfSelectedValue(); // Ensure selectedIndex reflects value within items
269
- }
270
- const valueFromSelectedIndex = this.getValueFromSelectedIndex();
271
- this._value = valueFromSelectedIndex !== undefined ? valueFromSelectedIndex : null;
272
- }
273
- refreshStateFromProjectedContent() {
274
- if (this._customItemTemplate)
275
- return; // Only refresh on changes to projected content, not when re-rendering custom template
276
- this.cdr.markForCheck(); // Ensure changes to projected content gets checked in next change detection cycle
277
- this.refreshSelectionState(); // Sync selected index and value from projected radios
278
- }
279
- setSelectedItem(value) {
280
- if (value === this._value)
281
- return; // Nothing changed
282
- this._value = value;
283
- this._selectedIndex = this.getIndexOfSelectedValue();
284
- }
285
- setProjectedRadiosDisabledState(isDisabled) {
286
- if (!this.projectedRadioButtons || !this.projectedRadioButtons.length)
287
- return;
288
- this.projectedRadioButtons.forEach((radio, index) => {
289
- // Disable all radios when group is disabled, otherwise fall back to each item's disabled state, if defined:
290
- radio.disabled = isDisabled || this._getDisabledStateFromItem(this.items[index]);
291
- });
292
- }
293
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: RadioGroupComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
294
- /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.18", type: RadioGroupComponent, isStandalone: true, selector: "kirby-radio-group", inputs: { disabled: "disabled", hasError: "hasError", items: "items", itemTextProperty: "itemTextProperty", itemDisabledProperty: "itemDisabledProperty", selectedIndex: "selectedIndex", value: "value" }, outputs: { hasErrorChange: "hasErrorChange", valueChange: "valueChange" }, host: { listeners: { "ionBlur": "_onRadioBlur()" }, properties: { "class.error": "this.hasError" } }, providers: [
295
- {
296
- provide: NG_VALUE_ACCESSOR,
297
- useExisting: RadioGroupComponent,
298
- multi: true,
299
- },
300
- { provide: FORM_FIELD_CONTROL, useExisting: RadioGroupComponent },
301
- ], queries: [{ propertyName: "_customItemTemplate", first: true, predicate: ListItemTemplateDirective, descendants: true, read: TemplateRef }, { propertyName: "projectedRadioButtons", predicate: RadioComponent, descendants: true }], viewQueries: [{ propertyName: "radioButtons", predicate: RadioComponent, descendants: true }], ngImport: i0, template: "@if (_hasItems) {\n <ion-radio-group\n [value]=\"value\"\n (ionChange)=\"_onChange($event.detail.value)\"\n [attr.aria-invalid]=\"hasError\"\n >\n @if (!items || !items.length) {\n <ng-content></ng-content>\n } @else {\n @for (item of items; track _getTextFromItem(item)) {\n <ng-container\n *ngTemplateOutlet=\"\n _customItemTemplate || defaultItemTemplate;\n context: { $implicit: item, selected: $index === selectedIndex, index: $index }\n \"\n ></ng-container>\n }\n }\n </ion-radio-group>\n}\n\n<ng-template #defaultItemTemplate let-item>\n <kirby-radio\n [value]=\"item\"\n [disabled]=\"disabled || _getDisabledStateFromItem(item)\"\n [text]=\"_getTextFromItem(item)\"\n ></kirby-radio>\n</ng-template>\n", styles: ["ion-radio-group{display:inherit;flex-wrap:inherit}\n"], dependencies: [{ kind: "component", type: IonRadioGroup, selector: "ion-radio-group", inputs: ["allowEmptySelection", "compareWith", "errorText", "helperText", "name", "value"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: RadioComponent, selector: "kirby-radio", inputs: ["value", "text", "size", "disabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
302
- }
303
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: RadioGroupComponent, decorators: [{
304
- type: Component,
305
- args: [{ selector: 'kirby-radio-group', providers: [
306
- {
307
- provide: NG_VALUE_ACCESSOR,
308
- useExisting: RadioGroupComponent,
309
- multi: true,
310
- },
311
- { provide: FORM_FIELD_CONTROL, useExisting: RadioGroupComponent },
312
- ], changeDetection: ChangeDetectionStrategy.OnPush, imports: [IonRadioGroup, NgTemplateOutlet, RadioComponent], template: "@if (_hasItems) {\n <ion-radio-group\n [value]=\"value\"\n (ionChange)=\"_onChange($event.detail.value)\"\n [attr.aria-invalid]=\"hasError\"\n >\n @if (!items || !items.length) {\n <ng-content></ng-content>\n } @else {\n @for (item of items; track _getTextFromItem(item)) {\n <ng-container\n *ngTemplateOutlet=\"\n _customItemTemplate || defaultItemTemplate;\n context: { $implicit: item, selected: $index === selectedIndex, index: $index }\n \"\n ></ng-container>\n }\n }\n </ion-radio-group>\n}\n\n<ng-template #defaultItemTemplate let-item>\n <kirby-radio\n [value]=\"item\"\n [disabled]=\"disabled || _getDisabledStateFromItem(item)\"\n [text]=\"_getTextFromItem(item)\"\n ></kirby-radio>\n</ng-template>\n", styles: ["ion-radio-group{display:inherit;flex-wrap:inherit}\n"] }]
313
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { disabled: [{
314
- type: Input
315
- }], hasError: [{
316
- type: HostBinding,
317
- args: ['class.error']
318
- }, {
319
- type: Input
320
- }], hasErrorChange: [{
321
- type: Output
322
- }], items: [{
323
- type: Input
324
- }], itemTextProperty: [{
325
- type: Input
326
- }], itemDisabledProperty: [{
327
- type: Input
328
- }], selectedIndex: [{
329
- type: Input
330
- }], value: [{
331
- type: Input
332
- }], valueChange: [{
333
- type: Output
334
- }], _customItemTemplate: [{
335
- type: ContentChild,
336
- args: [ListItemTemplateDirective, { read: TemplateRef }]
337
- }], radioButtons: [{
338
- type: ViewChildren,
339
- args: [RadioComponent]
340
- }], projectedRadioButtons: [{
341
- type: ContentChildren,
342
- args: [RadioComponent, { descendants: true }]
343
- }], _onRadioBlur: [{
344
- type: HostListener,
345
- args: ['ionBlur']
346
- }] } });
347
-
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, ContentChild, ContentChildren, ElementRef, EventEmitter, HostBinding, HostListener, Input, NgModule, Output, TemplateRef, ViewChild, ViewChildren } from "@angular/core";
3
+ import { IonRadio, IonRadioGroup } from "@ionic/angular";
4
+ import * as i1 from "@kirbydesign/designsystem/helpers";
5
+ import { IonicElementPartHelper } from "@kirbydesign/designsystem/helpers";
6
+ import { forwardAttributes, inheritAriaLabelText, setAccessibleLabel } from "@kirbydesign/designsystem/shared";
7
+ import { NG_VALUE_ACCESSOR } from "@angular/forms";
8
+ import { ListItemTemplateDirective } from "@kirbydesign/designsystem/list";
9
+ import { FORM_FIELD_CONTROL } from "@kirbydesign/designsystem/types";
10
+ import { CommonModule, NgTemplateOutlet } from "@angular/common";
11
+ var RadioComponent = class RadioComponent {
12
+ get _isDisabled() {
13
+ return this.disabled ? "disabled" : null;
14
+ }
15
+ get buttonTabIndex() {
16
+ return this.ionRadioElement ? this.ionRadioElement.nativeElement.tabIndex : -1;
17
+ }
18
+ constructor(element, ionicElementPartHelper) {
19
+ this.element = element;
20
+ this.ionicElementPartHelper = ionicElementPartHelper;
21
+ this.size = "md";
22
+ this._justify = "start";
23
+ this._labelPlacement = "end";
24
+ }
25
+ ngOnInit() {
26
+ this._hasSlottedContent = this.element.nativeElement.querySelector(".default-content").hasChildNodes();
27
+ if (this.element.nativeElement.getAttribute("slot") === "end" && this._hasSlottedContent) {
28
+ this._justify = "space-between";
29
+ this._labelPlacement = "start";
30
+ }
31
+ }
32
+ ngAfterViewInit() {
33
+ this.ionicElementPartHelper.setPart("label", this.ionRadioElement, ".radio-wrapper");
34
+ this.ionicElementPartHelper.setPart("label-text-wrapper", this.ionRadioElement, ".label-text-wrapper");
35
+ this.ionicElementPartHelper.setPart("native-wrapper", this.ionRadioElement, ".native-wrapper");
36
+ }
37
+ ngAfterContentInit() {
38
+ this._labelText = inheritAriaLabelText(this.element.nativeElement);
39
+ if (!this.text && !this._labelText && !this._hasSlottedContent) this._labelText = setAccessibleLabel(this.element.nativeElement);
40
+ }
41
+ focus() {
42
+ this.ionRadioElement?.nativeElement.focus();
43
+ }
44
+ static {
45
+ this.ɵfac = i0.ɵɵngDeclareFactory({
46
+ minVersion: "12.0.0",
47
+ version: "22.2.3",
48
+ ngImport: i0,
49
+ type: RadioComponent,
50
+ deps: [{ token: i0.ElementRef }, { token: i1.IonicElementPartHelper }],
51
+ target: i0.ɵɵFactoryTarget.Component
52
+ });
53
+ }
54
+ static {
55
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
56
+ minVersion: "17.0.0",
57
+ version: "22.2.3",
58
+ type: RadioComponent,
59
+ isStandalone: true,
60
+ selector: "kirby-radio",
61
+ inputs: {
62
+ value: "value",
63
+ text: "text",
64
+ size: "size",
65
+ disabled: "disabled"
66
+ },
67
+ host: { properties: {
68
+ "class": "this.size",
69
+ "attr.disabled": "this._isDisabled",
70
+ "class.has-hidden-label": "this._labelText"
71
+ } },
72
+ providers: [IonicElementPartHelper],
73
+ viewQueries: [{
74
+ propertyName: "ionRadioElement",
75
+ first: true,
76
+ predicate: IonRadio,
77
+ descendants: true,
78
+ read: ElementRef,
79
+ static: true
80
+ }],
81
+ ngImport: i0,
82
+ template: "<ion-radio\n [value]=\"value\"\n [disabled]=\"disabled\"\n mode=\"md\"\n [labelPlacement]=\"_labelPlacement\"\n [justify]=\"_justify\"\n>\n @if (_labelText) {\n <span class=\"hidden-label\">{{ _labelText }}</span>\n }\n @if (text) {\n <span [attr.aria-hidden]=\"_labelText ? true : undefined\">{{ text }}</span>\n }\n <span class=\"default-content\" [attr.aria-hidden]=\"_labelText ? true : undefined\">\n <ng-content></ng-content>\n </span>\n</ion-radio>\n",
83
+ styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{display:flex}:host[disabled] ion-radio::part(label-text-wrapper),:host[disabled] ion-radio::part(native-wrapper){opacity:var(--kirby-opacity-40)}:host:has(ion-radio.in-item.radio-justify-space-between){width:100%}:host.has-hidden-label:has(ion-radio.in-item){position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio{position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio::part(label){position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio.radio-label-placement-start::part(label-text-wrapper),:host.has-hidden-label:has(ion-radio.in-item) ion-radio.radio-label-placement-end::part(label-text-wrapper){margin-inline:0}:host.has-hidden-label[slot=end] ion-radio{margin-inline-start:12px}:host.has-hidden-label .hidden-label{position:absolute;inset:0;opacity:0}:host.xs ion-radio:not(.in-item)::part(label){padding-block:calc((32px - var(--kirby-spacing-m)) * .5)}:host.sm ion-radio:not(.in-item)::part(label){padding-block:calc((44px - var(--kirby-spacing-m)) * .5)}:host.md ion-radio:not(.in-item)::part(label){padding-block:calc((56px - var(--kirby-spacing-m)) * .5)}ion-radio{box-sizing:border-box;--border-width: var(--kirby-stroke-xs);--color: var(--kirby-color-border-raised);--color-checked: var(--kirby-color-border-raised)}@media(hover:hover){ion-radio:hover{--color: var(--kirby-color-border-raised-hover);--color-checked: var(--kirby-color-border-raised-hover)}ion-radio:hover::part(container){background-color:var(--kirby-color-fill-raised-hover)}ion-radio:hover::part(mark){--color-checked: var(--kirby-color-fill-engaged-hover)}}ion-radio:active{--color: var(--kirby-color-border-raised-active);--color-checked: var(--kirby-color-border-raised-active)}ion-radio:active::part(container){background-color:var(--kirby-color-fill-raised-active)}ion-radio:active::part(mark){--color-checked: var(--kirby-color-fill-engaged-active)}ion-radio:focus-visible{--color: var(--kirby-color-border-focus);--color-checked: var(--kirby-color-border-focus)}ion-radio:focus-visible::part(container){transition:box-shadow 80ms linear;box-shadow:var(--kirby-focus-ring-sm-combined-inset)}ion-radio::part(container){transition:all 80ms linear 0ms;transition-property:background-color,box-shadow;background-color:var(--kirby-color-fill-raised);margin:var(--kirby-spacing-xxxxs);width:20px;height:20px}ion-radio::part(mark){--color-checked: var(--kirby-color-fill-engaged);width:var(--kirby-spacing-xs);height:var(--kirby-spacing-xs)}ion-radio::part(label){align-items:start;padding-inline:16px;line-height:var(--kirby-line-height-n)}ion-radio::part(label-text-wrapper){margin-inline:12px 0;white-space:pre-line}ion-radio::part(native-wrapper){height:var(--kirby-relative-size-m)}ion-radio.in-item::part(label){align-items:center;padding-inline:0}ion-radio.in-item::part(label-text-wrapper){margin-block:0}ion-radio.in-item.radio-label-placement-start::part(label-text-wrapper){margin-inline:0 var(--kirby-spacing-xxs)}ion-radio.in-item.radio-label-placement-end::part(label-text-wrapper){margin-inline:var(--kirby-spacing-xxs) 0}ion-radio :host-context(kirby-radio-group.error) ion-radio,ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio{--color: var(--kirby-color-border-raised-danger);--color-checked: var(--kirby-color-border-raised-danger)}ion-radio :host-context(kirby-radio-group.error) ion-radio::part(container),ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio::part(container){box-shadow:var(--kirby-error-ring-combined-inset)}ion-radio :host-context(kirby-radio-group.error) ion-radio:focus-visible,ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio:focus-visible{--color: var(--kirby-color-border-focus);--color-checked: var(--kirby-color-border-focus)}ion-radio :host-context(kirby-radio-group.error) ion-radio:focus-visible::part(container),ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio:focus-visible::part(container){box-shadow:var(--kirby-focus-ring-sm-combined-inset)}:host-context(kirby-item){z-index:var(--kirby-z-index-default)}:host-context(kirby-item) ion-radio{margin:0}:host-context(kirby-item)[slot=start]{margin-block:0;margin-inline-end:12px}\n"],
84
+ dependencies: [{
85
+ kind: "component",
86
+ type: IonRadio,
87
+ selector: "ion-radio",
88
+ inputs: [
89
+ "alignment",
90
+ "color",
91
+ "disabled",
92
+ "justify",
93
+ "labelPlacement",
94
+ "mode",
95
+ "name",
96
+ "value"
97
+ ],
98
+ outputs: ["ionFocus", "ionBlur"]
99
+ }],
100
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
101
+ });
102
+ }
103
+ };
104
+ i0.ɵɵngDeclareClassMetadata({
105
+ minVersion: "12.0.0",
106
+ version: "22.2.3",
107
+ ngImport: i0,
108
+ type: RadioComponent,
109
+ decorators: [{
110
+ type: Component,
111
+ args: [{
112
+ selector: "kirby-radio",
113
+ changeDetection: ChangeDetectionStrategy.OnPush,
114
+ providers: [IonicElementPartHelper],
115
+ imports: [IonRadio],
116
+ template: "<ion-radio\n [value]=\"value\"\n [disabled]=\"disabled\"\n mode=\"md\"\n [labelPlacement]=\"_labelPlacement\"\n [justify]=\"_justify\"\n>\n @if (_labelText) {\n <span class=\"hidden-label\">{{ _labelText }}</span>\n }\n @if (text) {\n <span [attr.aria-hidden]=\"_labelText ? true : undefined\">{{ text }}</span>\n }\n <span class=\"default-content\" [attr.aria-hidden]=\"_labelText ? true : undefined\">\n <ng-content></ng-content>\n </span>\n</ion-radio>\n",
117
+ styles: [".kirby-line-clamp{display:-webkit-box;-webkit-line-clamp:var(--line-clamp, none);-webkit-box-orient:vertical;overflow:hidden}:host{display:flex}:host[disabled] ion-radio::part(label-text-wrapper),:host[disabled] ion-radio::part(native-wrapper){opacity:var(--kirby-opacity-40)}:host:has(ion-radio.in-item.radio-justify-space-between){width:100%}:host.has-hidden-label:has(ion-radio.in-item){position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio{position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio::part(label){position:initial}:host.has-hidden-label:has(ion-radio.in-item) ion-radio.radio-label-placement-start::part(label-text-wrapper),:host.has-hidden-label:has(ion-radio.in-item) ion-radio.radio-label-placement-end::part(label-text-wrapper){margin-inline:0}:host.has-hidden-label[slot=end] ion-radio{margin-inline-start:12px}:host.has-hidden-label .hidden-label{position:absolute;inset:0;opacity:0}:host.xs ion-radio:not(.in-item)::part(label){padding-block:calc((32px - var(--kirby-spacing-m)) * .5)}:host.sm ion-radio:not(.in-item)::part(label){padding-block:calc((44px - var(--kirby-spacing-m)) * .5)}:host.md ion-radio:not(.in-item)::part(label){padding-block:calc((56px - var(--kirby-spacing-m)) * .5)}ion-radio{box-sizing:border-box;--border-width: var(--kirby-stroke-xs);--color: var(--kirby-color-border-raised);--color-checked: var(--kirby-color-border-raised)}@media(hover:hover){ion-radio:hover{--color: var(--kirby-color-border-raised-hover);--color-checked: var(--kirby-color-border-raised-hover)}ion-radio:hover::part(container){background-color:var(--kirby-color-fill-raised-hover)}ion-radio:hover::part(mark){--color-checked: var(--kirby-color-fill-engaged-hover)}}ion-radio:active{--color: var(--kirby-color-border-raised-active);--color-checked: var(--kirby-color-border-raised-active)}ion-radio:active::part(container){background-color:var(--kirby-color-fill-raised-active)}ion-radio:active::part(mark){--color-checked: var(--kirby-color-fill-engaged-active)}ion-radio:focus-visible{--color: var(--kirby-color-border-focus);--color-checked: var(--kirby-color-border-focus)}ion-radio:focus-visible::part(container){transition:box-shadow 80ms linear;box-shadow:var(--kirby-focus-ring-sm-combined-inset)}ion-radio::part(container){transition:all 80ms linear 0ms;transition-property:background-color,box-shadow;background-color:var(--kirby-color-fill-raised);margin:var(--kirby-spacing-xxxxs);width:20px;height:20px}ion-radio::part(mark){--color-checked: var(--kirby-color-fill-engaged);width:var(--kirby-spacing-xs);height:var(--kirby-spacing-xs)}ion-radio::part(label){align-items:start;padding-inline:16px;line-height:var(--kirby-line-height-n)}ion-radio::part(label-text-wrapper){margin-inline:12px 0;white-space:pre-line}ion-radio::part(native-wrapper){height:var(--kirby-relative-size-m)}ion-radio.in-item::part(label){align-items:center;padding-inline:0}ion-radio.in-item::part(label-text-wrapper){margin-block:0}ion-radio.in-item.radio-label-placement-start::part(label-text-wrapper){margin-inline:0 var(--kirby-spacing-xxs)}ion-radio.in-item.radio-label-placement-end::part(label-text-wrapper){margin-inline:var(--kirby-spacing-xxs) 0}ion-radio :host-context(kirby-radio-group.error) ion-radio,ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio{--color: var(--kirby-color-border-raised-danger);--color-checked: var(--kirby-color-border-raised-danger)}ion-radio :host-context(kirby-radio-group.error) ion-radio::part(container),ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio::part(container){box-shadow:var(--kirby-error-ring-combined-inset)}ion-radio :host-context(kirby-radio-group.error) ion-radio:focus-visible,ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio:focus-visible{--color: var(--kirby-color-border-focus);--color-checked: var(--kirby-color-border-focus)}ion-radio :host-context(kirby-radio-group.error) ion-radio:focus-visible::part(container),ion-radio :host-context(kirby-radio-group.ng-touched.ng-invalid) ion-radio:focus-visible::part(container){box-shadow:var(--kirby-focus-ring-sm-combined-inset)}:host-context(kirby-item){z-index:var(--kirby-z-index-default)}:host-context(kirby-item) ion-radio{margin:0}:host-context(kirby-item)[slot=start]{margin-block:0;margin-inline-end:12px}\n"]
118
+ }]
119
+ }],
120
+ ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.IonicElementPartHelper }],
121
+ propDecorators: {
122
+ ionRadioElement: [{
123
+ type: ViewChild,
124
+ args: [IonRadio, {
125
+ read: ElementRef,
126
+ static: true
127
+ }]
128
+ }],
129
+ value: [{ type: Input }],
130
+ text: [{ type: Input }],
131
+ size: [{
132
+ type: HostBinding,
133
+ args: ["class"]
134
+ }, { type: Input }],
135
+ disabled: [{ type: Input }],
136
+ _isDisabled: [{
137
+ type: HostBinding,
138
+ args: ["attr.disabled"]
139
+ }],
140
+ _labelText: [{
141
+ type: HostBinding,
142
+ args: ["class.has-hidden-label"]
143
+ }]
144
+ }
145
+ });
146
+ var RadioGroupComponent = class RadioGroupComponent {
147
+ constructor(cdr, element, renderer) {
148
+ this.cdr = cdr;
149
+ this.element = element;
150
+ this.renderer = renderer;
151
+ this._hasError = false;
152
+ this.hasErrorChange = new EventEmitter();
153
+ this.itemTextProperty = "text";
154
+ this.itemDisabledProperty = "disabled";
155
+ this.valueChange = new EventEmitter();
156
+ this._disabled = false;
157
+ this._items = [];
158
+ this._onChangeCallback = () => {};
159
+ this._onTouched = () => {};
160
+ this._selectedIndex = -1;
161
+ this._value = null;
162
+ this._attributesToForward = ["aria-label", "aria-labelledby"];
163
+ }
164
+ get disabled() {
165
+ return this._disabled;
166
+ }
167
+ set disabled(value) {
168
+ this._disabled = value;
169
+ this.setProjectedRadiosDisabledState(value);
170
+ }
171
+ get hasError() {
172
+ return this._hasError;
173
+ }
174
+ set hasError(value) {
175
+ if (this._hasError !== value) {
176
+ this._hasError = value;
177
+ this.hasErrorChange.emit(this._hasError);
178
+ }
179
+ }
180
+ get interactiveElement() {
181
+ return this.element?.nativeElement?.querySelector("ion-radio-group");
182
+ }
183
+ get items() {
184
+ return this._items || [];
185
+ }
186
+ set items(value) {
187
+ if ((!value || !value.length) && !this.items.length) return;
188
+ this._items = value;
189
+ this.refreshSelectionState();
190
+ }
191
+ get selectedIndex() {
192
+ return this._selectedIndex;
193
+ }
194
+ set selectedIndex(value) {
195
+ if (typeof value === "string") value = parseInt(value);
196
+ if (value === void 0 || value === null || Number.isNaN(value)) value = -1;
197
+ if (value === this.selectedIndex) return;
198
+ this._selectedIndex = value;
199
+ this._value = this.getValueFromSelectedIndex() || null;
200
+ }
201
+ get value() {
202
+ return this._value;
203
+ }
204
+ set value(value) {
205
+ this.setSelectedItem(value);
206
+ }
207
+ get hasValue() {
208
+ return this.value !== void 0 && this.value !== null;
209
+ }
210
+ get hasItemsFromContentProjection() {
211
+ return !this.items.length && !this._customItemTemplate && this.projectedRadioButtons && this.projectedRadioButtons.length > 0;
212
+ }
213
+ focus() {
214
+ const findFocusable = (radios) => radios && radios.find((radio) => !isNaN(radio.buttonTabIndex) && radio.buttonTabIndex !== -1);
215
+ (findFocusable(this.radioButtons) || findFocusable(this.projectedRadioButtons))?.focus();
216
+ }
217
+ ngAfterContentInit() {
218
+ this.initSelectionStateFromProjectedContent();
219
+ this.listenForProjectedRadiosChange();
220
+ }
221
+ ngAfterViewInit() {
222
+ forwardAttributes(this.element.nativeElement, this._attributesToForward, this.renderer, this.element.nativeElement.querySelector("ion-radio-group"));
223
+ }
224
+ registerOnChange(fn) {
225
+ this._onChangeCallback = fn;
226
+ }
227
+ registerOnTouched(fn) {
228
+ this._onTouched = fn;
229
+ }
230
+ setDisabledState(isDisabled) {
231
+ this.disabled = isDisabled;
232
+ this.cdr.markForCheck();
233
+ }
234
+ writeValue(value) {
235
+ this.value = value;
236
+ this.cdr.markForCheck();
237
+ }
238
+ _getTextFromItem(item) {
239
+ if (!item) return null;
240
+ return typeof item === "string" ? item : item[this.itemTextProperty];
241
+ }
242
+ _getDisabledStateFromItem(item) {
243
+ if (!item) return void 0;
244
+ return typeof item === "string" ? void 0 : item[this.itemDisabledProperty];
245
+ }
246
+ _onChange(value) {
247
+ if (value === this._value) return;
248
+ this.setSelectedItem(value);
249
+ this.valueChange.emit(value);
250
+ this._onChangeCallback(value);
251
+ }
252
+ _onRadioBlur() {
253
+ this._onTouched();
254
+ }
255
+ getIndexOfSelectedValue() {
256
+ if (!this.hasValue) return -1;
257
+ return this.hasItemsFromContentProjection ? this.getIndexOfProjectedRadio(this.value) : this.items.indexOf(this.value);
258
+ }
259
+ getIndexOfProjectedRadio(value) {
260
+ let selectedIndex = -1;
261
+ this.projectedRadioButtons?.find((radio, i) => {
262
+ const found = radio.value === value;
263
+ if (found) selectedIndex = i;
264
+ return found;
265
+ });
266
+ return selectedIndex;
267
+ }
268
+ getValueFromSelectedIndex() {
269
+ if (this.selectedIndex === -1) return;
270
+ return this.hasItemsFromContentProjection ? this.getValueFromProjectedRadios(this.selectedIndex) : this.items[this.selectedIndex];
271
+ }
272
+ getValueFromProjectedRadios(index) {
273
+ const radio = this.projectedRadioButtons && this.projectedRadioButtons.find((_, i) => {
274
+ return i === index;
275
+ });
276
+ return radio && radio.value;
277
+ }
278
+ initSelectionStateFromProjectedContent() {
279
+ if (this.hasItemsFromContentProjection) this.refreshSelectionState();
280
+ }
281
+ listenForProjectedRadiosChange() {
282
+ this.projectedRadioButtons.changes.subscribe(() => {
283
+ this.refreshStateFromProjectedContent();
284
+ if (this.disabled) setTimeout(() => this.setProjectedRadiosDisabledState(this.disabled));
285
+ });
286
+ }
287
+ refreshSelectionState() {
288
+ if (this.hasValue) this._selectedIndex = this.getIndexOfSelectedValue();
289
+ const valueFromSelectedIndex = this.getValueFromSelectedIndex();
290
+ this._value = valueFromSelectedIndex !== void 0 ? valueFromSelectedIndex : null;
291
+ }
292
+ refreshStateFromProjectedContent() {
293
+ if (this._customItemTemplate) return;
294
+ this.cdr.markForCheck();
295
+ this.refreshSelectionState();
296
+ }
297
+ setSelectedItem(value) {
298
+ if (value === this._value) return;
299
+ this._value = value;
300
+ this._selectedIndex = this.getIndexOfSelectedValue();
301
+ }
302
+ setProjectedRadiosDisabledState(isDisabled) {
303
+ if (!this.projectedRadioButtons || !this.projectedRadioButtons.length) return;
304
+ this.projectedRadioButtons.forEach((radio, index) => {
305
+ radio.disabled = isDisabled || this._getDisabledStateFromItem(this.items[index]);
306
+ });
307
+ }
308
+ static {
309
+ this.ɵfac = i0.ɵɵngDeclareFactory({
310
+ minVersion: "12.0.0",
311
+ version: "22.2.3",
312
+ ngImport: i0,
313
+ type: RadioGroupComponent,
314
+ deps: [
315
+ { token: i0.ChangeDetectorRef },
316
+ { token: i0.ElementRef },
317
+ { token: i0.Renderer2 }
318
+ ],
319
+ target: i0.ɵɵFactoryTarget.Component
320
+ });
321
+ }
322
+ static {
323
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
324
+ minVersion: "17.0.0",
325
+ version: "22.2.3",
326
+ type: RadioGroupComponent,
327
+ isStandalone: true,
328
+ selector: "kirby-radio-group",
329
+ inputs: {
330
+ disabled: "disabled",
331
+ hasError: "hasError",
332
+ items: "items",
333
+ itemTextProperty: "itemTextProperty",
334
+ itemDisabledProperty: "itemDisabledProperty",
335
+ selectedIndex: "selectedIndex",
336
+ value: "value"
337
+ },
338
+ outputs: {
339
+ hasErrorChange: "hasErrorChange",
340
+ valueChange: "valueChange"
341
+ },
342
+ host: {
343
+ listeners: { "ionBlur": "_onRadioBlur()" },
344
+ properties: { "class.error": "this.hasError" }
345
+ },
346
+ providers: [{
347
+ provide: NG_VALUE_ACCESSOR,
348
+ useExisting: RadioGroupComponent,
349
+ multi: true
350
+ }, {
351
+ provide: FORM_FIELD_CONTROL,
352
+ useExisting: RadioGroupComponent
353
+ }],
354
+ queries: [{
355
+ propertyName: "_customItemTemplate",
356
+ first: true,
357
+ predicate: ListItemTemplateDirective,
358
+ descendants: true,
359
+ read: TemplateRef
360
+ }, {
361
+ propertyName: "projectedRadioButtons",
362
+ predicate: RadioComponent,
363
+ descendants: true
364
+ }],
365
+ viewQueries: [{
366
+ propertyName: "radioButtons",
367
+ predicate: RadioComponent,
368
+ descendants: true
369
+ }],
370
+ ngImport: i0,
371
+ template: "<ion-radio-group\n [value]=\"value\"\n (ionChange)=\"_onChange($event.detail.value)\"\n [attr.aria-invalid]=\"hasError\"\n>\n @if (!items || !items.length) {\n <ng-content></ng-content>\n } @else {\n @for (item of items; track _getTextFromItem(item)) {\n <ng-container\n *ngTemplateOutlet=\"\n _customItemTemplate || defaultItemTemplate;\n context: { $implicit: item, selected: $index === selectedIndex, index: $index }\n \"\n ></ng-container>\n }\n }\n</ion-radio-group>\n\n<ng-template #defaultItemTemplate let-item>\n <kirby-radio\n [value]=\"item\"\n [disabled]=\"disabled || _getDisabledStateFromItem(item)\"\n [text]=\"_getTextFromItem(item)\"\n ></kirby-radio>\n</ng-template>\n",
372
+ styles: ["ion-radio-group{display:inherit;flex-wrap:inherit}\n"],
373
+ dependencies: [
374
+ {
375
+ kind: "component",
376
+ type: IonRadioGroup,
377
+ selector: "ion-radio-group",
378
+ inputs: [
379
+ "allowEmptySelection",
380
+ "compareWith",
381
+ "errorText",
382
+ "helperText",
383
+ "name",
384
+ "value"
385
+ ]
386
+ },
387
+ {
388
+ kind: "directive",
389
+ type: NgTemplateOutlet,
390
+ selector: "[ngTemplateOutlet]",
391
+ inputs: [
392
+ "ngTemplateOutletContext",
393
+ "ngTemplateOutlet",
394
+ "ngTemplateOutletInjector"
395
+ ]
396
+ },
397
+ {
398
+ kind: "component",
399
+ type: RadioComponent,
400
+ selector: "kirby-radio",
401
+ inputs: [
402
+ "value",
403
+ "text",
404
+ "size",
405
+ "disabled"
406
+ ]
407
+ }
408
+ ],
409
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
410
+ });
411
+ }
412
+ };
413
+ i0.ɵɵngDeclareClassMetadata({
414
+ minVersion: "12.0.0",
415
+ version: "22.2.3",
416
+ ngImport: i0,
417
+ type: RadioGroupComponent,
418
+ decorators: [{
419
+ type: Component,
420
+ args: [{
421
+ selector: "kirby-radio-group",
422
+ providers: [{
423
+ provide: NG_VALUE_ACCESSOR,
424
+ useExisting: RadioGroupComponent,
425
+ multi: true
426
+ }, {
427
+ provide: FORM_FIELD_CONTROL,
428
+ useExisting: RadioGroupComponent
429
+ }],
430
+ changeDetection: ChangeDetectionStrategy.OnPush,
431
+ imports: [
432
+ IonRadioGroup,
433
+ NgTemplateOutlet,
434
+ RadioComponent
435
+ ],
436
+ template: "<ion-radio-group\n [value]=\"value\"\n (ionChange)=\"_onChange($event.detail.value)\"\n [attr.aria-invalid]=\"hasError\"\n>\n @if (!items || !items.length) {\n <ng-content></ng-content>\n } @else {\n @for (item of items; track _getTextFromItem(item)) {\n <ng-container\n *ngTemplateOutlet=\"\n _customItemTemplate || defaultItemTemplate;\n context: { $implicit: item, selected: $index === selectedIndex, index: $index }\n \"\n ></ng-container>\n }\n }\n</ion-radio-group>\n\n<ng-template #defaultItemTemplate let-item>\n <kirby-radio\n [value]=\"item\"\n [disabled]=\"disabled || _getDisabledStateFromItem(item)\"\n [text]=\"_getTextFromItem(item)\"\n ></kirby-radio>\n</ng-template>\n",
437
+ styles: ["ion-radio-group{display:inherit;flex-wrap:inherit}\n"]
438
+ }]
439
+ }],
440
+ ctorParameters: () => [
441
+ { type: i0.ChangeDetectorRef },
442
+ { type: i0.ElementRef },
443
+ { type: i0.Renderer2 }
444
+ ],
445
+ propDecorators: {
446
+ disabled: [{ type: Input }],
447
+ hasError: [{
448
+ type: HostBinding,
449
+ args: ["class.error"]
450
+ }, { type: Input }],
451
+ hasErrorChange: [{ type: Output }],
452
+ items: [{ type: Input }],
453
+ itemTextProperty: [{ type: Input }],
454
+ itemDisabledProperty: [{ type: Input }],
455
+ selectedIndex: [{ type: Input }],
456
+ value: [{ type: Input }],
457
+ valueChange: [{ type: Output }],
458
+ _customItemTemplate: [{
459
+ type: ContentChild,
460
+ args: [ListItemTemplateDirective, { read: TemplateRef }]
461
+ }],
462
+ radioButtons: [{
463
+ type: ViewChildren,
464
+ args: [RadioComponent]
465
+ }],
466
+ projectedRadioButtons: [{
467
+ type: ContentChildren,
468
+ args: [RadioComponent, { descendants: true }]
469
+ }],
470
+ _onRadioBlur: [{
471
+ type: HostListener,
472
+ args: ["ionBlur"]
473
+ }]
474
+ }
475
+ });
348
476
  const declarations = [RadioComponent, RadioGroupComponent];
349
- class RadioModule {
350
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: RadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
351
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.18", ngImport: i0, type: RadioModule, imports: [CommonModule, IonRadio, IonRadioGroup, RadioComponent, RadioGroupComponent], exports: [RadioComponent, RadioGroupComponent] }); }
352
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: RadioModule, imports: [CommonModule, IonRadio, IonRadioGroup, declarations] }); }
353
- }
354
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.18", ngImport: i0, type: RadioModule, decorators: [{
355
- type: NgModule,
356
- args: [{
357
- imports: [CommonModule, IonRadio, IonRadioGroup, ...declarations],
358
- exports: [...declarations],
359
- }]
360
- }] });
361
-
362
- /**
363
- * Generated bundle index. Do not edit.
364
- */
365
-
477
+ var RadioModule = class RadioModule {
478
+ static {
479
+ this.ɵfac = i0.ɵɵngDeclareFactory({
480
+ minVersion: "12.0.0",
481
+ version: "22.2.3",
482
+ ngImport: i0,
483
+ type: RadioModule,
484
+ deps: [],
485
+ target: i0.ɵɵFactoryTarget.NgModule
486
+ });
487
+ }
488
+ static {
489
+ this.ɵmod = i0.ɵɵngDeclareNgModule({
490
+ minVersion: "14.0.0",
491
+ version: "22.2.3",
492
+ ngImport: i0,
493
+ type: RadioModule,
494
+ imports: [
495
+ CommonModule,
496
+ IonRadio,
497
+ IonRadioGroup,
498
+ RadioComponent,
499
+ RadioGroupComponent
500
+ ],
501
+ exports: [RadioComponent, RadioGroupComponent]
502
+ });
503
+ }
504
+ static {
505
+ this.ɵinj = i0.ɵɵngDeclareInjector({
506
+ minVersion: "12.0.0",
507
+ version: "22.2.3",
508
+ ngImport: i0,
509
+ type: RadioModule,
510
+ imports: [
511
+ CommonModule,
512
+ IonRadio,
513
+ IonRadioGroup,
514
+ declarations
515
+ ]
516
+ });
517
+ }
518
+ };
519
+ i0.ɵɵngDeclareClassMetadata({
520
+ minVersion: "12.0.0",
521
+ version: "22.2.3",
522
+ ngImport: i0,
523
+ type: RadioModule,
524
+ decorators: [{
525
+ type: NgModule,
526
+ args: [{
527
+ imports: [
528
+ CommonModule,
529
+ IonRadio,
530
+ IonRadioGroup,
531
+ ...declarations
532
+ ],
533
+ exports: [...declarations]
534
+ }]
535
+ }]
536
+ });
366
537
  export { RadioComponent, RadioGroupComponent, RadioModule };
367
- //# sourceMappingURL=kirbydesign-designsystem-radio.mjs.map
538
+
539
+ //# sourceMappingURL=kirbydesign-designsystem-radio.mjs.map