@koobiq/components 18.21.0 → 18.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/alert/_alert-theme.scss +4 -0
  2. package/alert/alert-tokens.scss +1 -1
  3. package/alert/alert.component.d.ts +8 -2
  4. package/badge/badge.component.d.ts +0 -1
  5. package/breadcrumbs/breadcrumbs.d.ts +19 -22
  6. package/breadcrumbs/breadcrumbs.scss +13 -4
  7. package/breadcrumbs/breadcrumbs.types.d.ts +22 -0
  8. package/breadcrumbs/public-api.d.ts +1 -0
  9. package/button/button.component.d.ts +11 -16
  10. package/checkbox/checkbox.d.ts +18 -23
  11. package/core/animation/animation.d.ts +5 -2
  12. package/core/common-behaviors/checkbox.d.ts +5 -0
  13. package/core/common-behaviors/color.d.ts +11 -0
  14. package/core/common-behaviors/index.d.ts +2 -1
  15. package/core/option/action.d.ts +5 -7
  16. package/core/option/optgroup.d.ts +6 -7
  17. package/core/pop-up/pop-up-trigger.d.ts +11 -3
  18. package/core/pop-up/pop-up.d.ts +8 -2
  19. package/core/selection/pseudo-checkbox/pseudo-checkbox.d.ts +3 -12
  20. package/core/utils/utils.d.ts +5 -0
  21. package/dropdown/dropdown-item.component.d.ts +6 -8
  22. package/empty-state/_empty-state-theme.scss +15 -5
  23. package/empty-state/empty-state-tokens.scss +12 -2
  24. package/empty-state/empty-state.component.d.ts +7 -2
  25. package/empty-state/empty-state.scss +29 -0
  26. package/esm2022/accordion/accordion-trigger.component.mjs +1 -1
  27. package/esm2022/actions-panel/actions-panel-container.mjs +2 -2
  28. package/esm2022/actions-panel/actions-panel.mjs +1 -1
  29. package/esm2022/alert/alert.component.mjs +11 -5
  30. package/esm2022/autocomplete/autocomplete-trigger.directive.mjs +1 -1
  31. package/esm2022/badge/badge.component.mjs +2 -5
  32. package/esm2022/breadcrumbs/breadcrumbs.mjs +55 -22
  33. package/esm2022/breadcrumbs/breadcrumbs.types.mjs +2 -0
  34. package/esm2022/breadcrumbs/public-api.mjs +2 -1
  35. package/esm2022/button/button.component.mjs +23 -27
  36. package/esm2022/button-toggle/button-toggle.component.mjs +4 -3
  37. package/esm2022/checkbox/checkbox.mjs +27 -28
  38. package/esm2022/code-block/code-block-highlight.mjs +1 -1
  39. package/esm2022/code-block/code-block.mjs +2 -2
  40. package/esm2022/core/animation/animation.mjs +4 -1
  41. package/esm2022/core/common-behaviors/checkbox.mjs +2 -0
  42. package/esm2022/core/common-behaviors/color.mjs +35 -1
  43. package/esm2022/core/common-behaviors/disabled.mjs +2 -1
  44. package/esm2022/core/common-behaviors/error-state.mjs +2 -1
  45. package/esm2022/core/common-behaviors/index.mjs +3 -2
  46. package/esm2022/core/common-behaviors/tabindex.mjs +2 -1
  47. package/esm2022/core/formatters/number/formatter.mjs +1 -1
  48. package/esm2022/core/forms/validators.mjs +1 -1
  49. package/esm2022/core/line/line.mjs +1 -1
  50. package/esm2022/core/option/action.mjs +17 -12
  51. package/esm2022/core/option/optgroup.mjs +18 -12
  52. package/esm2022/core/option/option.mjs +1 -1
  53. package/esm2022/core/overlay/overlay-position-map.mjs +1 -1
  54. package/esm2022/core/pop-up/pop-up-trigger.mjs +27 -12
  55. package/esm2022/core/pop-up/pop-up.mjs +18 -5
  56. package/esm2022/core/select/common.mjs +1 -1
  57. package/esm2022/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +10 -19
  58. package/esm2022/core/services/measure-scrollbar.service.mjs +1 -1
  59. package/esm2022/core/utils/utils.mjs +11 -1
  60. package/esm2022/core/version.mjs +2 -2
  61. package/esm2022/datepicker/calendar-header.component.mjs +2 -2
  62. package/esm2022/datepicker/datepicker-input.directive.mjs +1 -1
  63. package/esm2022/datepicker/datepicker-toggle.component.mjs +1 -1
  64. package/esm2022/datepicker/datepicker.component.mjs +1 -1
  65. package/esm2022/datepicker/month-view.component.mjs +1 -1
  66. package/esm2022/dropdown/dropdown-item.component.mjs +19 -14
  67. package/esm2022/dropdown/dropdown-trigger.directive.mjs +1 -1
  68. package/esm2022/dropdown/dropdown.component.mjs +1 -1
  69. package/esm2022/ellipsis-center/ellipsis-center.directive.mjs +1 -1
  70. package/esm2022/empty-state/empty-state.component.mjs +13 -8
  71. package/esm2022/file-upload/file-drop.mjs +1 -1
  72. package/esm2022/file-upload/file-upload.mjs +1 -1
  73. package/esm2022/file-upload/multiple-file-upload.component.mjs +2 -2
  74. package/esm2022/file-upload/single-file-upload.component.mjs +2 -2
  75. package/esm2022/filter-bar/filter-bar-button.mjs +2 -1
  76. package/esm2022/filter-bar/filter-bar.mjs +14 -1
  77. package/esm2022/filter-bar/filter-bar.module.mjs +5 -3
  78. package/esm2022/filter-bar/filter-bar.types.mjs +27 -2
  79. package/esm2022/filter-bar/filter-refresher.mjs +2 -2
  80. package/esm2022/filter-bar/filter-reset.mjs +16 -6
  81. package/esm2022/filter-bar/filter-search.mjs +19 -6
  82. package/esm2022/filter-bar/filters.mjs +22 -6
  83. package/esm2022/filter-bar/pipe-add.mjs +11 -2
  84. package/esm2022/filter-bar/pipe.directive.mjs +7 -25
  85. package/esm2022/filter-bar/pipes/base-pipe.mjs +23 -3
  86. package/esm2022/filter-bar/pipes/pipe-button.mjs +12 -6
  87. package/esm2022/filter-bar/pipes/pipe-date.mjs +26 -8
  88. package/esm2022/filter-bar/pipes/pipe-datetime.mjs +27 -8
  89. package/esm2022/filter-bar/pipes/pipe-multi-select.mjs +7 -2
  90. package/esm2022/filter-bar/pipes/pipe-select.mjs +7 -2
  91. package/esm2022/filter-bar/pipes/pipe-state.mjs +2 -1
  92. package/esm2022/filter-bar/pipes/pipe-text.mjs +7 -3
  93. package/esm2022/filter-bar/pipes/pipe-title.mjs +2 -1
  94. package/esm2022/form-field/cleaner.mjs +1 -1
  95. package/esm2022/form-field/form-field.mjs +13 -22
  96. package/esm2022/form-field/hint.mjs +10 -18
  97. package/esm2022/form-field/password-hint.mjs +7 -7
  98. package/esm2022/form-field/password-toggle.mjs +1 -1
  99. package/esm2022/form-field/stepper.mjs +1 -1
  100. package/esm2022/form-field/validate.directive.mjs +1 -1
  101. package/esm2022/icon/icon-button.component.mjs +13 -21
  102. package/esm2022/icon/icon-item.component.mjs +8 -15
  103. package/esm2022/icon/icon.component.mjs +15 -27
  104. package/esm2022/input/input-number.mjs +1 -1
  105. package/esm2022/input/input-password.mjs +20 -5
  106. package/esm2022/input/input.mjs +21 -22
  107. package/esm2022/link/link.component.mjs +46 -14
  108. package/esm2022/list/list-selection.component.mjs +19 -15
  109. package/esm2022/loader-overlay/loader-overlay.component.mjs +14 -9
  110. package/esm2022/markdown/markdown.component.mjs +2 -2
  111. package/esm2022/modal/modal.component.mjs +2 -2
  112. package/esm2022/modal/modal.directive.mjs +1 -1
  113. package/esm2022/modal/modal.service.mjs +1 -1
  114. package/esm2022/navbar/navbar-item.component.mjs +2 -2
  115. package/esm2022/navbar/navbar.component.mjs +9 -12
  116. package/esm2022/navbar/vertical-navbar.component.mjs +9 -13
  117. package/esm2022/overflow-items/overflow-items.mjs +1 -1
  118. package/esm2022/popover/popover-confirm.component.mjs +2 -2
  119. package/esm2022/popover/popover.component.mjs +5 -4
  120. package/esm2022/progress-bar/progress-bar.component.mjs +14 -21
  121. package/esm2022/progress-spinner/progress-spinner.component.mjs +17 -24
  122. package/esm2022/radio/radio.component.mjs +26 -36
  123. package/esm2022/scrollbar/scrollbar.component.mjs +1 -1
  124. package/esm2022/scrollbar/scrollbar.directive.mjs +1 -1
  125. package/esm2022/select/select.component.mjs +56 -37
  126. package/esm2022/sidepanel/sidepanel-directives.mjs +2 -2
  127. package/esm2022/sidepanel/sidepanel.service.mjs +1 -1
  128. package/esm2022/splitter/splitter.component.mjs +1 -1
  129. package/esm2022/tabs/paginated-tab-header.mjs +7 -4
  130. package/esm2022/tabs/tab-body.component.mjs +1 -1
  131. package/esm2022/tabs/tab-group.component.mjs +23 -19
  132. package/esm2022/tabs/tab-header.component.mjs +3 -3
  133. package/esm2022/tabs/tab-label-wrapper.directive.mjs +16 -13
  134. package/esm2022/tabs/tab-nav-bar.mjs +2 -2
  135. package/esm2022/tabs/tab.component.mjs +17 -12
  136. package/esm2022/tags/tag-input.mjs +1 -1
  137. package/esm2022/tags/tag-list.component.mjs +27 -22
  138. package/esm2022/tags/tag.component.mjs +7 -14
  139. package/esm2022/textarea/textarea.component.mjs +21 -22
  140. package/esm2022/timepicker/timepicker.directive.mjs +1 -1
  141. package/esm2022/timezone/timezone-select.component.mjs +3 -3
  142. package/esm2022/toast/toast.component.mjs +2 -2
  143. package/esm2022/toggle/toggle.component.mjs +111 -31
  144. package/esm2022/tree/control/base-tree-control.mjs +1 -1
  145. package/esm2022/tree/control/flat-tree-control.filters.mjs +1 -1
  146. package/esm2022/tree/control/nested-tree-control.mjs +1 -1
  147. package/esm2022/tree/data-source/flat-data-source.mjs +1 -1
  148. package/esm2022/tree/padding.directive.mjs +1 -1
  149. package/esm2022/tree/toggle.mjs +19 -14
  150. package/esm2022/tree/tree-base.mjs +1 -1
  151. package/esm2022/tree/tree-option.component.mjs +1 -1
  152. package/esm2022/tree/tree-selection.component.mjs +1 -1
  153. package/esm2022/tree-select/tree-select.component.mjs +58 -38
  154. package/fesm2022/koobiq-components-accordion.mjs +1 -1
  155. package/fesm2022/koobiq-components-accordion.mjs.map +1 -1
  156. package/fesm2022/koobiq-components-actions-panel.mjs +1 -1
  157. package/fesm2022/koobiq-components-actions-panel.mjs.map +1 -1
  158. package/fesm2022/koobiq-components-alert.mjs +10 -4
  159. package/fesm2022/koobiq-components-alert.mjs.map +1 -1
  160. package/fesm2022/koobiq-components-autocomplete.mjs.map +1 -1
  161. package/fesm2022/koobiq-components-badge.mjs +2 -5
  162. package/fesm2022/koobiq-components-badge.mjs.map +1 -1
  163. package/fesm2022/koobiq-components-breadcrumbs.mjs +54 -21
  164. package/fesm2022/koobiq-components-breadcrumbs.mjs.map +1 -1
  165. package/fesm2022/koobiq-components-button-toggle.mjs +3 -3
  166. package/fesm2022/koobiq-components-button-toggle.mjs.map +1 -1
  167. package/fesm2022/koobiq-components-button.mjs +23 -27
  168. package/fesm2022/koobiq-components-button.mjs.map +1 -1
  169. package/fesm2022/koobiq-components-checkbox.mjs +27 -28
  170. package/fesm2022/koobiq-components-checkbox.mjs.map +1 -1
  171. package/fesm2022/koobiq-components-code-block.mjs +1 -1
  172. package/fesm2022/koobiq-components-code-block.mjs.map +1 -1
  173. package/fesm2022/koobiq-components-core.mjs +130 -51
  174. package/fesm2022/koobiq-components-core.mjs.map +1 -1
  175. package/fesm2022/koobiq-components-datepicker.mjs +2 -2
  176. package/fesm2022/koobiq-components-datepicker.mjs.map +1 -1
  177. package/fesm2022/koobiq-components-dropdown.mjs +18 -13
  178. package/fesm2022/koobiq-components-dropdown.mjs.map +1 -1
  179. package/fesm2022/koobiq-components-ellipsis-center.mjs.map +1 -1
  180. package/fesm2022/koobiq-components-empty-state.mjs +12 -7
  181. package/fesm2022/koobiq-components-empty-state.mjs.map +1 -1
  182. package/fesm2022/koobiq-components-file-upload.mjs +2 -2
  183. package/fesm2022/koobiq-components-file-upload.mjs.map +1 -1
  184. package/fesm2022/koobiq-components-filter-bar.mjs +1381 -1233
  185. package/fesm2022/koobiq-components-filter-bar.mjs.map +1 -1
  186. package/fesm2022/koobiq-components-form-field.mjs +26 -43
  187. package/fesm2022/koobiq-components-form-field.mjs.map +1 -1
  188. package/fesm2022/koobiq-components-icon.mjs +33 -57
  189. package/fesm2022/koobiq-components-icon.mjs.map +1 -1
  190. package/fesm2022/koobiq-components-input.mjs +40 -25
  191. package/fesm2022/koobiq-components-input.mjs.map +1 -1
  192. package/fesm2022/koobiq-components-link.mjs +46 -14
  193. package/fesm2022/koobiq-components-link.mjs.map +1 -1
  194. package/fesm2022/koobiq-components-list.mjs +19 -15
  195. package/fesm2022/koobiq-components-list.mjs.map +1 -1
  196. package/fesm2022/koobiq-components-loader-overlay.mjs +13 -8
  197. package/fesm2022/koobiq-components-loader-overlay.mjs.map +1 -1
  198. package/fesm2022/koobiq-components-markdown.mjs +2 -2
  199. package/fesm2022/koobiq-components-markdown.mjs.map +1 -1
  200. package/fesm2022/koobiq-components-modal.mjs +2 -2
  201. package/fesm2022/koobiq-components-modal.mjs.map +1 -1
  202. package/fesm2022/koobiq-components-navbar.mjs +17 -24
  203. package/fesm2022/koobiq-components-navbar.mjs.map +1 -1
  204. package/fesm2022/koobiq-components-overflow-items.mjs.map +1 -1
  205. package/fesm2022/koobiq-components-popover.mjs +5 -4
  206. package/fesm2022/koobiq-components-popover.mjs.map +1 -1
  207. package/fesm2022/koobiq-components-progress-bar.mjs +13 -20
  208. package/fesm2022/koobiq-components-progress-bar.mjs.map +1 -1
  209. package/fesm2022/koobiq-components-progress-spinner.mjs +16 -23
  210. package/fesm2022/koobiq-components-progress-spinner.mjs.map +1 -1
  211. package/fesm2022/koobiq-components-radio.mjs +26 -36
  212. package/fesm2022/koobiq-components-radio.mjs.map +1 -1
  213. package/fesm2022/koobiq-components-scrollbar.mjs.map +1 -1
  214. package/fesm2022/koobiq-components-select.mjs +56 -37
  215. package/fesm2022/koobiq-components-select.mjs.map +1 -1
  216. package/fesm2022/koobiq-components-sidepanel.mjs +1 -1
  217. package/fesm2022/koobiq-components-sidepanel.mjs.map +1 -1
  218. package/fesm2022/koobiq-components-splitter.mjs.map +1 -1
  219. package/fesm2022/koobiq-components-tabs.mjs +60 -44
  220. package/fesm2022/koobiq-components-tabs.mjs.map +1 -1
  221. package/fesm2022/koobiq-components-tags.mjs +32 -34
  222. package/fesm2022/koobiq-components-tags.mjs.map +1 -1
  223. package/fesm2022/koobiq-components-textarea.mjs +21 -22
  224. package/fesm2022/koobiq-components-textarea.mjs.map +1 -1
  225. package/fesm2022/koobiq-components-timepicker.mjs.map +1 -1
  226. package/fesm2022/koobiq-components-timezone.mjs +2 -2
  227. package/fesm2022/koobiq-components-timezone.mjs.map +1 -1
  228. package/fesm2022/koobiq-components-toast.mjs +1 -1
  229. package/fesm2022/koobiq-components-toast.mjs.map +1 -1
  230. package/fesm2022/koobiq-components-toggle.mjs +111 -31
  231. package/fesm2022/koobiq-components-toggle.mjs.map +1 -1
  232. package/fesm2022/koobiq-components-tree-select.mjs +57 -37
  233. package/fesm2022/koobiq-components-tree-select.mjs.map +1 -1
  234. package/fesm2022/koobiq-components-tree.mjs +21 -15
  235. package/fesm2022/koobiq-components-tree.mjs.map +1 -1
  236. package/file-upload/multiple-file-upload.component.d.ts +2 -2
  237. package/file-upload/single-file-upload.component.d.ts +2 -2
  238. package/filter-bar/filter-bar-button.d.ts +1 -0
  239. package/filter-bar/filter-bar.d.ts +14 -0
  240. package/filter-bar/filter-bar.types.d.ts +13 -3
  241. package/filter-bar/filter-reset.d.ts +6 -2
  242. package/filter-bar/filter-search.d.ts +17 -10
  243. package/filter-bar/filters.d.ts +26 -11
  244. package/filter-bar/pipe-add.d.ts +10 -0
  245. package/filter-bar/pipe.directive.d.ts +5 -5
  246. package/filter-bar/pipes/base-pipe.d.ts +28 -2
  247. package/filter-bar/pipes/pipe-button.d.ts +6 -1
  248. package/filter-bar/pipes/pipe-date.d.ts +30 -10
  249. package/filter-bar/pipes/pipe-date.scss +29 -27
  250. package/filter-bar/pipes/pipe-datetime.d.ts +31 -10
  251. package/filter-bar/pipes/pipe-multi-select.d.ts +7 -0
  252. package/filter-bar/pipes/pipe-select.d.ts +7 -0
  253. package/filter-bar/pipes/pipe-state.d.ts +1 -0
  254. package/filter-bar/pipes/pipe-text.d.ts +5 -0
  255. package/form-field/form-field.d.ts +4 -12
  256. package/form-field/hint.d.ts +3 -12
  257. package/form-field/password-hint.d.ts +3 -3
  258. package/icon/icon-button.component.d.ts +5 -8
  259. package/icon/icon-item.component.d.ts +3 -7
  260. package/icon/icon.component.d.ts +7 -14
  261. package/input/input-password.d.ts +8 -2
  262. package/input/input.d.ts +9 -18
  263. package/link/_link-theme.scss +31 -8
  264. package/link/link.component.d.ts +13 -9
  265. package/list/list-selection.component.d.ts +8 -10
  266. package/loader-overlay/_loader-overlay-theme.scss +18 -8
  267. package/loader-overlay/loader-overlay-tokens.scss +6 -3
  268. package/loader-overlay/loader-overlay.component.d.ts +7 -2
  269. package/loader-overlay/loader-overlay.scss +19 -5
  270. package/markdown/markdown.scss +0 -4
  271. package/navbar/navbar.component.d.ts +2 -2
  272. package/navbar/vertical-navbar.component.d.ts +3 -3
  273. package/package.json +5 -5
  274. package/prebuilt-themes/dark-theme.css +1 -1
  275. package/prebuilt-themes/light-theme.css +1 -1
  276. package/prebuilt-themes/theme.css +1 -1
  277. package/progress-bar/progress-bar.component.d.ts +4 -12
  278. package/progress-spinner/progress-spinner.component.d.ts +4 -12
  279. package/radio/radio.component.d.ts +11 -25
  280. package/radio/radio.scss +0 -1
  281. package/schematics/collection.json +10 -0
  282. package/schematics/migrations/css-selectors/README.md +19 -0
  283. package/schematics/migrations/deprecated-icons/README.md +21 -0
  284. package/schematics/migrations/empty-state-size-attr/README.md +62 -0
  285. package/schematics/migrations/empty-state-size-attr/index.js +74 -0
  286. package/schematics/migrations/empty-state-size-attr/schema.json +15 -0
  287. package/schematics/migrations/loader-overlay-size-attr/README.md +62 -0
  288. package/schematics/migrations/loader-overlay-size-attr/index.js +74 -0
  289. package/schematics/migrations/loader-overlay-size-attr/schema.json +15 -0
  290. package/schematics/migrations/new-icons-pack/README.md +21 -0
  291. package/schematics/ng-add/index.js +3 -3
  292. package/schematics/utils/angular-parsing.js +153 -0
  293. package/schematics/utils/ast.js +28 -0
  294. package/schematics/utils/package-config.js +46 -0
  295. package/schematics/utils/typescript.js +171 -0
  296. package/select/select.component.d.ts +26 -25
  297. package/tabs/paginated-tab-header.d.ts +2 -1
  298. package/tabs/tab-group.component.d.ts +11 -13
  299. package/tabs/tab-header.component.d.ts +1 -1
  300. package/tabs/tab-label-wrapper.directive.d.ts +6 -8
  301. package/tabs/tab.component.d.ts +7 -8
  302. package/tags/tag-list.component.d.ts +15 -18
  303. package/tags/tag.component.d.ts +3 -10
  304. package/textarea/textarea.component.d.ts +8 -17
  305. package/toggle/_toggle-theme.scss +12 -3
  306. package/toggle/toggle-tokens.scss +2 -2
  307. package/toggle/toggle.component.d.ts +28 -14
  308. package/toggle/toggle.scss +37 -0
  309. package/tree/toggle.d.ts +7 -9
  310. package/tree/tree-selection.component.d.ts +2 -2
  311. package/tree-select/tree-select.component.d.ts +24 -26
@@ -2,7 +2,7 @@ import { FocusMonitor } from '@angular/cdk/a11y';
2
2
  import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
3
3
  import { AfterContentInit, AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList } from '@angular/core';
4
4
  import { ControlValueAccessor } from '@angular/forms';
5
- import { CanColor, CanColorCtor, CanDisable, CanDisableCtor, HasTabIndex, HasTabIndexCtor } from '@koobiq/components/core';
5
+ import { KbqColorDirective } from '@koobiq/components/core';
6
6
  import * as i0 from "@angular/core";
7
7
  /** Change event object emitted by KbqRadio. */
8
8
  export declare class KbqRadioChange {
@@ -16,20 +16,13 @@ export declare class KbqRadioChange {
16
16
  /** The value of the KbqRadioButton. */
17
17
  value: any);
18
18
  }
19
- /** @docs-private */
20
- export declare class KbqRadioGroupBase {
21
- elementRef: ElementRef;
22
- constructor(elementRef: ElementRef);
23
- }
24
- /** @docs-private */
25
- export declare const KbqRadioGroupMixinBase: CanDisableCtor & typeof KbqRadioGroupBase;
26
19
  /**
27
20
  * Provider Expression that allows kbq-radio-group to register as a ControlValueAccessor. This
28
21
  * allows it to support [(ngModel)] and ngControl.
29
22
  * @docs-private
30
23
  */
31
24
  export declare const KBQ_RADIO_GROUP_CONTROL_VALUE_ACCESSOR: any;
32
- export declare class KbqRadioGroup extends KbqRadioGroupMixinBase implements AfterContentInit, ControlValueAccessor, CanDisable {
25
+ export declare class KbqRadioGroup implements AfterContentInit, ControlValueAccessor {
33
26
  private readonly changeDetector;
34
27
  big: boolean;
35
28
  /** Name of the radio button group. All radio buttons inside this group will use this name. */
@@ -47,7 +40,6 @@ export declare class KbqRadioGroup extends KbqRadioGroupMixinBase implements Aft
47
40
  /** Whether the radio group is disabled */
48
41
  get disabled(): boolean;
49
42
  set disabled(value: boolean);
50
- /** Whether the radio group is disabled. */
51
43
  private _disabled;
52
44
  /** Whether the radio group is required */
53
45
  get required(): boolean;
@@ -77,7 +69,7 @@ export declare class KbqRadioGroup extends KbqRadioGroupMixinBase implements Aft
77
69
  private isInitialized;
78
70
  /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */
79
71
  private _labelPosition;
80
- constructor(elementRef: ElementRef, changeDetector: ChangeDetectorRef);
72
+ constructor(changeDetector: ChangeDetectorRef);
81
73
  /** The method to be called in order to update ngModel */
82
74
  controlValueAccessorChangeFn: (value: any) => void;
83
75
  /**
@@ -128,15 +120,7 @@ export declare class KbqRadioGroup extends KbqRadioGroupMixinBase implements Aft
128
120
  static ngAcceptInputType_disabled: unknown;
129
121
  static ngAcceptInputType_required: unknown;
130
122
  }
131
- /** @docs-private */
132
- declare abstract class KbqRadioButtonBase {
133
- elementRef: ElementRef;
134
- abstract disabled: boolean;
135
- constructor(elementRef: ElementRef);
136
- }
137
- /** @docs-private */
138
- export declare const KbqRadioButtonMixinBase: CanColorCtor & HasTabIndexCtor & typeof KbqRadioButtonBase;
139
- export declare class KbqRadioButton extends KbqRadioButtonMixinBase implements OnInit, AfterViewInit, OnDestroy, CanColor, HasTabIndex {
123
+ export declare class KbqRadioButton extends KbqColorDirective implements OnInit, AfterViewInit, OnDestroy {
140
124
  private readonly changeDetector;
141
125
  private focusMonitor;
142
126
  private readonly radioDispatcher;
@@ -149,8 +133,10 @@ export declare class KbqRadioButton extends KbqRadioButtonMixinBase implements O
149
133
  /** Whether the radio button is disabled. */
150
134
  get disabled(): boolean;
151
135
  set disabled(value: boolean);
152
- /** Whether this radio is disabled. */
153
136
  private _disabled;
137
+ get tabIndex(): number;
138
+ set tabIndex(value: number);
139
+ private _tabIndex;
154
140
  /** Whether the radio button is required. */
155
141
  get required(): boolean;
156
142
  set required(value: boolean);
@@ -182,7 +168,7 @@ export declare class KbqRadioButton extends KbqRadioButtonMixinBase implements O
182
168
  private _checked;
183
169
  /** Value assigned to this radio. */
184
170
  private _value;
185
- constructor(radioGroup: KbqRadioGroup, elementRef: ElementRef, changeDetector: ChangeDetectorRef, focusMonitor: FocusMonitor, radioDispatcher: UniqueSelectionDispatcher);
171
+ constructor(radioGroup: KbqRadioGroup, changeDetector: ChangeDetectorRef, focusMonitor: FocusMonitor, radioDispatcher: UniqueSelectionDispatcher);
186
172
  ngOnInit(): void;
187
173
  ngAfterViewInit(): void;
188
174
  ngOnDestroy(): void;
@@ -200,10 +186,10 @@ export declare class KbqRadioButton extends KbqRadioButtonMixinBase implements O
200
186
  private readonly removeUniqueSelectionListener;
201
187
  /** Dispatch change event with current value. */
202
188
  private emitChangeEvent;
203
- static ɵfac: i0.ɵɵFactoryDeclaration<KbqRadioButton, [{ optional: true; }, null, null, null, null]>;
204
- static ɵcmp: i0.ɵɵComponentDeclaration<KbqRadioButton, "kbq-radio-button", ["kbqRadioButton"], { "color": { "alias": "color"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "required": { "alias": "required"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "name": { "alias": "name"; "required": false; }; "isFocused": { "alias": "isFocused"; "required": false; }; "id": { "alias": "id"; "required": false; }; }, { "change": "change"; }, never, ["*", "kbq-hint"], false, never>;
189
+ static ɵfac: i0.ɵɵFactoryDeclaration<KbqRadioButton, [{ optional: true; }, null, null, null]>;
190
+ static ɵcmp: i0.ɵɵComponentDeclaration<KbqRadioButton, "kbq-radio-button", ["kbqRadioButton"], { "checked": { "alias": "checked"; "required": false; }; "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "required": { "alias": "required"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "name": { "alias": "name"; "required": false; }; "isFocused": { "alias": "isFocused"; "required": false; }; "id": { "alias": "id"; "required": false; }; }, { "change": "change"; }, never, ["*", "kbq-hint"], false, never>;
205
191
  static ngAcceptInputType_checked: unknown;
206
192
  static ngAcceptInputType_disabled: unknown;
193
+ static ngAcceptInputType_tabIndex: unknown;
207
194
  static ngAcceptInputType_required: unknown;
208
195
  }
209
- export {};
package/radio/radio.scss CHANGED
@@ -27,7 +27,6 @@
27
27
 
28
28
  cursor: pointer;
29
29
 
30
- white-space: nowrap;
31
30
  // for maximum clickable area.
32
31
  width: 100%;
33
32
  }
@@ -21,6 +21,16 @@
21
21
  "description": "Updates prefixes and names of changed/removed icons",
22
22
  "factory": "./migrations/deprecated-icons/index",
23
23
  "schema": "./migrations/deprecated-icons/schema.json"
24
+ },
25
+ "empty-state-size-attr": {
26
+ "description": "Updates attr name and value in ts and html",
27
+ "factory": "./migrations/empty-state-size-attr/index",
28
+ "schema": "./migrations/empty-state-size-attr/schema.json"
29
+ },
30
+ "loader-overlay-size-attr": {
31
+ "description": "Updates attr name and value in ts and html",
32
+ "factory": "./migrations/loader-overlay-size-attr/index",
33
+ "schema": "./migrations/loader-overlay-size-attr/schema.json"
24
34
  }
25
35
  }
26
36
  }
@@ -0,0 +1,19 @@
1
+ ### New Icons Pack schematics
2
+
3
+ This schematic provides migration for css-selectors of typography. It includes:
4
+
5
+ - Update css-classes for updated typography styles according to [mapping](data.ts)
6
+
7
+ [Params](schema.ts)
8
+
9
+ Usage for Angular Cli:
10
+
11
+ ```shell
12
+ ng g @koobiq/components:css-selectors --fix=true --project <your project>
13
+ ```
14
+
15
+ Usage for Nx:
16
+
17
+ ```shell
18
+ nx g @koobiq/components:css-selectors --fix=true --project <your project>
19
+ ```
@@ -0,0 +1,21 @@
1
+ ### New Icons Pack schematics
2
+
3
+ This schematic provides migration for update icons pack. It includes:
4
+
5
+ - Change prefixes from `mc` to `kbq` for ts, html, styles
6
+ - Update icon names for updated/removed icons according to [mapping](data.ts)
7
+ - Fix icons package prefix in styles
8
+
9
+ [Params](schema.ts)
10
+
11
+ Usage for Angular Cli:
12
+
13
+ ```shell
14
+ ng g @koobiq/components:deprecated-icons --fix=true --project <your project>
15
+ ```
16
+
17
+ Usage for Nx:
18
+
19
+ ```shell
20
+ nx g @koobiq/components:deprecated-icons --fix=true --project <your project>
21
+ ```
@@ -0,0 +1,62 @@
1
+ ### Empty State Size Attr schematics
2
+
3
+ This schematic provides migration for `KbqEmptyState` new `size` attribute. It includes:
4
+
5
+ - Removal of `big` attribute usage
6
+ - Replacement with `size` attribute
7
+
8
+ [Params](schema.ts)
9
+
10
+ Usage for Angular Cli:
11
+
12
+ ```shell
13
+ ng g @koobiq/components:empty-state-size-attr --project <your project>
14
+ ```
15
+
16
+ Usage for Nx:
17
+
18
+ ```shell
19
+ nx g @koobiq/components:empty-state-size-attr --project <your project>
20
+ ```
21
+
22
+ ### Run locally
23
+
24
+ Build package
25
+
26
+ ```shell
27
+ yarn run build:schematics
28
+ ```
29
+
30
+ Run command (for example, `koobiq-docs project`)
31
+
32
+ ```shell
33
+ ng g ./dist/components/schematics/collection.json:empty-state-size-attr --project koobiq-docs
34
+ ```
35
+
36
+ ### Result
37
+
38
+ #### Before
39
+
40
+ ```ts
41
+ import { Component } from '@angular/core';
42
+
43
+ @Component({
44
+ template: `
45
+ <kbq-empty-state [big]="true">...</kbq-empty-state>
46
+ `
47
+ })
48
+ export class MyComp {}
49
+ ```
50
+
51
+ #### After
52
+
53
+ ```ts
54
+ import { Component } from '@angular/core';
55
+
56
+ @Component({
57
+ template: `
58
+ <kbq-empty-state size="big">...</kbq-empty-state>
59
+ `
60
+ })
61
+ export class MyComp {}
62
+ ```
@@ -0,0 +1,74 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var node_path = require('node:path');
6
+ var process = require('node:process');
7
+ var ts = require('typescript');
8
+ var utils_angularParsing = require('../../utils/angular-parsing.js');
9
+ var utils_packageConfig = require('../../utils/package-config.js');
10
+ var utils_typescript = require('../../utils/typescript.js');
11
+ require('path');
12
+ require('../../utils/ast.js');
13
+ require('@angular-devkit/schematics');
14
+ require('@schematics/angular/utility');
15
+ require('../../utils/messages.js');
16
+
17
+ function _interopNamespaceDefault(e) {
18
+ var n = Object.create(null);
19
+ if (e) {
20
+ Object.keys(e).forEach(function (k) {
21
+ if (k !== 'default') {
22
+ var d = Object.getOwnPropertyDescriptor(e, k);
23
+ Object.defineProperty(n, k, d.get ? d : {
24
+ enumerable: true,
25
+ get: function () { return e[k]; }
26
+ });
27
+ }
28
+ });
29
+ }
30
+ n.default = e;
31
+ return Object.freeze(n);
32
+ }
33
+
34
+ var process__namespace = /*#__PURE__*/_interopNamespaceDefault(process);
35
+
36
+ const migrationData = {
37
+ elementName: 'kbq-empty-state',
38
+ attrs: {
39
+ key: {
40
+ from: 'big',
41
+ to: 'size'
42
+ },
43
+ value: {
44
+ replacements: [
45
+ { from: 'true', to: 'big' },
46
+ { from: 'false', to: 'compact' }
47
+ ],
48
+ default: 'normal'
49
+ }
50
+ }
51
+ };
52
+ function migrate(options) {
53
+ return async (tree, context) => {
54
+ const { project } = options;
55
+ const { tsPaths, templatePaths, projectDefinition } = await utils_packageConfig.getParsingInfo(project, tree);
56
+ const program = ts.createProgram(Array.from(tsPaths, (item) => node_path.resolve(projectDefinition.root, `.${item}`)), {
57
+ baseUrl: projectDefinition.root,
58
+ rootDir: projectDefinition.root,
59
+ _enableTemplateTypeChecker: true, // Required for the template type checker to work.
60
+ compileNonExportedClasses: true, // We want to migrate non-exported classes too.
61
+ // Avoid checking libraries to speed up the migration.
62
+ skipLibCheck: true,
63
+ skipDefaultLibCheck: true
64
+ });
65
+ // Update external html
66
+ await utils_angularParsing.migrateTemplate(tree, Array.from(templatePaths), context, migrationData);
67
+ // Update inline html
68
+ await utils_angularParsing.migrateTs(tree, program.getSourceFiles().filter((sourceFile) => utils_typescript.canMigrateFile(sourceFile, program)), process__namespace.cwd(), context, migrationData);
69
+ context.logger.warn('Warning! Run linter in updated files since line breaks or indents maybe be broken.');
70
+ };
71
+ }
72
+
73
+ exports.default = migrate;
74
+ exports.migrationData = migrationData;
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "koobiq-components-empty-state-size-attr",
4
+ "title": "koobiq-components empty-state-size-attr schematic",
5
+ "type": "object",
6
+ "properties": {
7
+ "project": {
8
+ "type": "string",
9
+ "description": "Name of the project",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,62 @@
1
+ ### Loader Overlay Size Attr schematics
2
+
3
+ This schematic provides migration for `KbqLoaderOverlay` new `size` attribute. It includes:
4
+
5
+ - Removal of `compact` attribute usage
6
+ - Replacement with `size` attribute
7
+
8
+ [Params](schema.ts)
9
+
10
+ Usage for Angular Cli:
11
+
12
+ ```shell
13
+ ng g @koobiq/components:loader-overlay-size-attr --project <your project>
14
+ ```
15
+
16
+ Usage for Nx:
17
+
18
+ ```shell
19
+ nx g @koobiq/components:loader-overlay-size-attr --project <your project>
20
+ ```
21
+
22
+ ### Run locally
23
+
24
+ Build package
25
+
26
+ ```shell
27
+ yarn run build:schematics
28
+ ```
29
+
30
+ Run command (for example, for `koobiq-docs` project)
31
+
32
+ ```shell
33
+ ng g ./dist/components/schematics/collection.json:loader-overlay-size-attr --project koobiq-docs
34
+ ```
35
+
36
+ ### Result
37
+
38
+ #### Before
39
+
40
+ ```ts
41
+ import { Component } from '@angular/core';
42
+
43
+ @Component({
44
+ template: `
45
+ <kbq-loader-overlay [compact]="true">...</kbq-loader-overlay>
46
+ `
47
+ })
48
+ export class MyComp {}
49
+ ```
50
+
51
+ #### After
52
+
53
+ ```ts
54
+ import { Component } from '@angular/core';
55
+
56
+ @Component({
57
+ template: `
58
+ <kbq-loader-overlay size="compact">...</kbq-loader-overlay>
59
+ `
60
+ })
61
+ export class MyComp {}
62
+ ```
@@ -0,0 +1,74 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var node_path = require('node:path');
6
+ var process = require('node:process');
7
+ var ts = require('typescript');
8
+ var utils_angularParsing = require('../../utils/angular-parsing.js');
9
+ var utils_packageConfig = require('../../utils/package-config.js');
10
+ var utils_typescript = require('../../utils/typescript.js');
11
+ require('path');
12
+ require('../../utils/ast.js');
13
+ require('@angular-devkit/schematics');
14
+ require('@schematics/angular/utility');
15
+ require('../../utils/messages.js');
16
+
17
+ function _interopNamespaceDefault(e) {
18
+ var n = Object.create(null);
19
+ if (e) {
20
+ Object.keys(e).forEach(function (k) {
21
+ if (k !== 'default') {
22
+ var d = Object.getOwnPropertyDescriptor(e, k);
23
+ Object.defineProperty(n, k, d.get ? d : {
24
+ enumerable: true,
25
+ get: function () { return e[k]; }
26
+ });
27
+ }
28
+ });
29
+ }
30
+ n.default = e;
31
+ return Object.freeze(n);
32
+ }
33
+
34
+ var process__namespace = /*#__PURE__*/_interopNamespaceDefault(process);
35
+
36
+ const migrationData = {
37
+ elementName: 'kbq-loader-overlay',
38
+ attrs: {
39
+ key: {
40
+ from: 'compact',
41
+ to: 'size'
42
+ },
43
+ value: {
44
+ replacements: [
45
+ { from: 'true', to: 'compact' },
46
+ { from: 'false', to: 'big' }
47
+ ],
48
+ default: 'big'
49
+ }
50
+ }
51
+ };
52
+ function migrate(options) {
53
+ return async (tree, context) => {
54
+ const { project } = options;
55
+ const { tsPaths, templatePaths, projectDefinition } = await utils_packageConfig.getParsingInfo(project, tree);
56
+ const program = ts.createProgram(Array.from(tsPaths, (item) => node_path.resolve(projectDefinition.root, `.${item}`)), {
57
+ baseUrl: projectDefinition.root,
58
+ rootDir: projectDefinition.root,
59
+ _enableTemplateTypeChecker: true, // Required for the template type checker to work.
60
+ compileNonExportedClasses: true, // We want to migrate non-exported classes too.
61
+ // Avoid checking libraries to speed up the migration.
62
+ skipLibCheck: true,
63
+ skipDefaultLibCheck: true
64
+ });
65
+ // Update external html
66
+ await utils_angularParsing.migrateTemplate(tree, Array.from(templatePaths), context, migrationData);
67
+ // Update inline html
68
+ await utils_angularParsing.migrateTs(tree, program.getSourceFiles().filter((sourceFile) => utils_typescript.canMigrateFile(sourceFile, program)), process__namespace.cwd(), context, migrationData);
69
+ context.logger.warn('Warning! Run linter in updated files since line breaks or indents maybe be broken.');
70
+ };
71
+ }
72
+
73
+ exports.default = migrate;
74
+ exports.migrationData = migrationData;
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "koobiq-components-loader-overlay-size-attr",
4
+ "title": "koobiq-components loader-overlay-size-attr schematic",
5
+ "type": "object",
6
+ "properties": {
7
+ "project": {
8
+ "type": "string",
9
+ "description": "Name of the project",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,21 @@
1
+ ### New Icons Pack schematics
2
+
3
+ This schematic provides migration for update icons pack. It includes:
4
+
5
+ - Change prefixes from `mc` to `kbq` for ts, html, styles
6
+ - Update icon names for updated/removed icons according to [mapping](data.ts)
7
+ - Fix icons package prefix in styles
8
+
9
+ [Params](schema.ts)
10
+
11
+ Usage for Angular Cli:
12
+
13
+ ```shell
14
+ ng g @koobiq/components:new-icons-pack --fix=true --project <your project>
15
+ ```
16
+
17
+ Usage for Nx:
18
+
19
+ ```shell
20
+ nx g @koobiq/components:new-icons-pack --fix=true --project <your project>
21
+ ```
@@ -27,15 +27,15 @@ function ngAdd(options) {
27
27
  }
28
28
  // Installing dependencies
29
29
  utils_packageConfig.addPackageToPackageJson(tree, '@angular/cdk', "^18.2.6");
30
- utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/cdk', "^18.21.0");
31
- utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/angular-luxon-adapter', "^18.21.0");
30
+ utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/cdk', "^18.23.0");
31
+ utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/angular-luxon-adapter', "^18.23.0");
32
32
  utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/date-formatter', "^3.2.3");
33
33
  utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/date-adapter', "^3.2.3");
34
34
  utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/icons', "^9.4.0");
35
35
  utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/tokens-builder', "^3.11.0");
36
36
  utils_packageConfig.addPackageToPackageJson(tree, '@koobiq/design-tokens', "^3.12.1");
37
37
  utils_packageConfig.addPackageToPackageJson(tree, '@messageformat/core', "^3.0.1");
38
- utils_packageConfig.addPackageToPackageJson(tree, '@radix-ng/primitives', "^0.20.2");
38
+ utils_packageConfig.addPackageToPackageJson(tree, '@radix-ng/primitives', "^0.23.0");
39
39
  utils_packageConfig.addPackageToPackageJson(tree, 'luxon', "^3.4.4");
40
40
  };
41
41
  }
@@ -0,0 +1,153 @@
1
+ 'use strict';
2
+
3
+ var path = require('path');
4
+ var ts = require('typescript');
5
+ var utils_ast = require('./ast.js');
6
+ var utils_typescript = require('./typescript.js');
7
+
8
+ /**
9
+ * Update separate html file
10
+ * @param tree
11
+ * @param filePaths
12
+ * @param context
13
+ * @param migrationData
14
+ */
15
+ async function migrateTemplate(tree, filePaths, context, migrationData) {
16
+ for (const templatePath of filePaths) {
17
+ const parsedFilePath = `.${templatePath}`;
18
+ let res = Promise.resolve({
19
+ fileContent: '',
20
+ changed: false,
21
+ errors: []
22
+ });
23
+ const template = tree.read(parsedFilePath)?.toString();
24
+ if (!template) {
25
+ context.logger.error(`Cannot read "${parsedFilePath}" because it does not exist.`);
26
+ continue;
27
+ }
28
+ res = transformTemplateAttributes(template, parsedFilePath, migrationData);
29
+ const { fileContent, changed, errors } = await res;
30
+ if (changed) {
31
+ tree.overwrite(templatePath, fileContent);
32
+ }
33
+ if (errors.length > 0) {
34
+ context.logger.error(errors.map(({ error }) => error.toString()).join('\n'));
35
+ }
36
+ }
37
+ }
38
+ /**
39
+ * Update typescript file if classes with @Component decorator and `template` property exists
40
+ * @param tree
41
+ * @param sourceFiles
42
+ * @param basePath
43
+ * @param context
44
+ * @param migrationData
45
+ */
46
+ async function migrateTs(tree, sourceFiles, basePath, context, migrationData) {
47
+ // run and track changed components
48
+ const analysis = new Map();
49
+ for (const sourceFile of sourceFiles) {
50
+ utils_typescript.forEachClass(sourceFile, (node) => {
51
+ analyzeDecorators(node, sourceFile, analysis);
52
+ });
53
+ }
54
+ // update source file
55
+ for (const path$1 of analysis.keys()) {
56
+ const file = analysis.get(path$1);
57
+ const ranges = file.getSortedRanges();
58
+ const relativePath = path.relative(basePath, path$1);
59
+ const content = tree.readText(relativePath);
60
+ const update = tree.beginUpdate(relativePath);
61
+ for (const { start, end } of ranges) {
62
+ const template = content.slice(start, end);
63
+ const length = (end ?? content.length) - start;
64
+ const { fileContent, changed, errors } = await transformTemplateAttributes(template, relativePath, migrationData);
65
+ if (changed) {
66
+ update.remove(start, length);
67
+ update.insertLeft(start, fileContent);
68
+ }
69
+ if (errors.length > 0) {
70
+ context.logger.error(errors.map(({ error }) => error.toString()).join('\n'));
71
+ }
72
+ }
73
+ tree.commitUpdate(update);
74
+ }
75
+ }
76
+ /**
77
+ * Analyzes the decorators of a given class declaration to find and save
78
+ * inline `template` metadata within `@Component` decorators.
79
+ */
80
+ function analyzeDecorators(node, sourceFile, analyzedFiles) {
81
+ const decorator = ts.getDecorators(node)?.find((dec) => {
82
+ return (ts.isCallExpression(dec.expression) &&
83
+ ts.isIdentifier(dec.expression.expression) &&
84
+ dec.expression?.expression?.text === 'Component');
85
+ });
86
+ const metadata = decorator &&
87
+ decorator.expression.arguments.length > 0 &&
88
+ ts.isObjectLiteralExpression(decorator.expression.arguments[0])
89
+ ? decorator.expression.arguments[0]
90
+ : null;
91
+ // Exit early if there's no metadata or it's not an object literal
92
+ if (!metadata) {
93
+ return;
94
+ }
95
+ for (const prop of metadata.properties) {
96
+ // All the properties we care about should have static
97
+ // names and be initialized to a static string.
98
+ if (!ts.isPropertyAssignment(prop) || (!ts.isIdentifier(prop.name) && !ts.isStringLiteralLike(prop.name))) {
99
+ continue;
100
+ }
101
+ // check decorator 'template' property, check for text content parse
102
+ if (prop.name.text === 'template' && ts.isStringLiteralLike(prop.initializer) && prop.initializer.text) {
103
+ // +1/-1 to exclude the opening/closing characters from the range.
104
+ utils_typescript.AnalyzedFile.addRange(sourceFile.fileName, sourceFile, analyzedFiles, {
105
+ start: prop.initializer.getStart(sourceFile) + 1,
106
+ end: prop.initializer.getEnd() - 1,
107
+ node: prop,
108
+ type: 'template',
109
+ remove: true
110
+ });
111
+ }
112
+ }
113
+ }
114
+ /**
115
+ * Migrates attribute values in an Angular template based on predefined cases.
116
+ */
117
+ async function transformTemplateAttributes(template, fileName, migrationData) {
118
+ const parsed = await utils_typescript.parseTemplate(template);
119
+ let updatedTemplate = template;
120
+ // extra text offset as result of text replacement;
121
+ let offset = 0;
122
+ if (parsed.tree !== undefined) {
123
+ const visitor = new utils_typescript.ElementCollector(migrationData, fileName);
124
+ utils_ast.visitAll(visitor, parsed.tree.rootNodes);
125
+ for (const el of visitor.elementsToMigrate) {
126
+ const migrationAttr = el.attrs.find((attr) => utils_ast.getSimpleAttributeName(attr.name) === migrationData.attrs.key.from);
127
+ let updatedAttrValue;
128
+ if (migrationAttr) {
129
+ const cleanAttrValue = utils_ast.getSimpleAttributeValue(migrationAttr.value);
130
+ const replacement = migrationData.attrs.value.replacements.find(({ from }) => from === cleanAttrValue);
131
+ if (replacement) {
132
+ updatedAttrValue = replacement.to;
133
+ }
134
+ else {
135
+ console.warn(`Element is using dynamic value. Check the code and change value on your own.${(fileName && ' File: ' + fileName) || ''}`);
136
+ continue;
137
+ }
138
+ updatedTemplate =
139
+ updatedTemplate.slice(0, migrationAttr.keySpan.start.offset - offset) +
140
+ `${migrationData.attrs.key.to}="${updatedAttrValue}"` +
141
+ updatedTemplate.slice(migrationAttr.valueSpan.end.offset + 1 - offset, updatedTemplate.length);
142
+ offset += migrationAttr.name.length - migrationData.attrs.key.to.length;
143
+ offset += migrationAttr.value.length - updatedAttrValue.length;
144
+ }
145
+ }
146
+ return { fileContent: updatedTemplate, changed: visitor.elementsToMigrate.length > 0, errors: parsed.errors };
147
+ }
148
+ return { fileContent: updatedTemplate, changed: undefined, errors: parsed.errors };
149
+ }
150
+
151
+ exports.analyzeDecorators = analyzeDecorators;
152
+ exports.migrateTemplate = migrateTemplate;
153
+ exports.migrateTs = migrateTs;