@ids-group-ltd/ids-design-system 0.11.3 → 0.12.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 (249) hide show
  1. package/CHANGELOG.md +253 -13
  2. package/components/README.md +86 -0
  3. package/components.md +12 -4
  4. package/docs/agent/INDEX.md +1 -0
  5. package/docs/agent/platform/body-scroll-lock-service.md +12 -0
  6. package/docs/agent/platform/toast-service.md +4 -6
  7. package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +85 -0
  8. package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs.map +1 -0
  9. package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +70 -0
  10. package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -0
  11. package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs +573 -0
  12. package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -0
  13. package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs +86 -0
  14. package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs.map +1 -0
  15. package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +615 -0
  16. package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -0
  17. package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs +30 -0
  18. package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs.map +1 -0
  19. package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs +188 -0
  20. package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs.map +1 -0
  21. package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +59 -0
  22. package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs.map +1 -0
  23. package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs +92 -0
  24. package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs.map +1 -0
  25. package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs +204 -0
  26. package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs.map +1 -0
  27. package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs +100 -0
  28. package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs.map +1 -0
  29. package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs +23 -0
  30. package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs.map +1 -0
  31. package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +180 -0
  32. package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -0
  33. package/fesm2022/ids-group-ltd-ids-design-system-components-calendar-day.mjs +78 -0
  34. package/fesm2022/ids-group-ltd-ids-design-system-components-calendar-day.mjs.map +1 -0
  35. package/fesm2022/ids-group-ltd-ids-design-system-components-card.mjs +49 -0
  36. package/fesm2022/ids-group-ltd-ids-design-system-components-card.mjs.map +1 -0
  37. package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +73 -0
  38. package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs.map +1 -0
  39. package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +397 -0
  40. package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -0
  41. package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +1231 -0
  42. package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -0
  43. package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs +51 -0
  44. package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs.map +1 -0
  45. package/fesm2022/ids-group-ltd-ids-design-system-components-divider.mjs +35 -0
  46. package/fesm2022/ids-group-ltd-ids-design-system-components-divider.mjs.map +1 -0
  47. package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +109 -0
  48. package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -0
  49. package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs +111 -0
  50. package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs.map +1 -0
  51. package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs +52 -0
  52. package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs.map +1 -0
  53. package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +92 -0
  54. package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -0
  55. package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs +62 -0
  56. package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs.map +1 -0
  57. package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs +164 -0
  58. package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs.map +1 -0
  59. package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs +85 -0
  60. package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs.map +1 -0
  61. package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +223 -0
  62. package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -0
  63. package/fesm2022/ids-group-ltd-ids-design-system-components-layout.mjs +63 -0
  64. package/fesm2022/ids-group-ltd-ids-design-system-components-layout.mjs.map +1 -0
  65. package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs +53 -0
  66. package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs.map +1 -0
  67. package/fesm2022/ids-group-ltd-ids-design-system-components-loading-overlay.mjs +43 -0
  68. package/fesm2022/ids-group-ltd-ids-design-system-components-loading-overlay.mjs.map +1 -0
  69. package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs +286 -0
  70. package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs.map +1 -0
  71. package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +329 -0
  72. package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -0
  73. package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +612 -0
  74. package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -0
  75. package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +69 -0
  76. package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs.map +1 -0
  77. package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +191 -0
  78. package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -0
  79. package/fesm2022/ids-group-ltd-ids-design-system-components-page-footer.mjs +23 -0
  80. package/fesm2022/ids-group-ltd-ids-design-system-components-page-footer.mjs.map +1 -0
  81. package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.mjs +43 -0
  82. package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.mjs.map +1 -0
  83. package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +85 -0
  84. package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -0
  85. package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs +95 -0
  86. package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs.map +1 -0
  87. package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs +240 -0
  88. package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs.map +1 -0
  89. package/fesm2022/ids-group-ltd-ids-design-system-components-progress.mjs +41 -0
  90. package/fesm2022/ids-group-ltd-ids-design-system-components-progress.mjs.map +1 -0
  91. package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +235 -0
  92. package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -0
  93. package/fesm2022/ids-group-ltd-ids-design-system-components-reserve-messages.mjs +62 -0
  94. package/fesm2022/ids-group-ltd-ids-design-system-components-reserve-messages.mjs.map +1 -0
  95. package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +173 -0
  96. package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs.map +1 -0
  97. package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +123 -0
  98. package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs.map +1 -0
  99. package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +461 -0
  100. package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -0
  101. package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs +107 -0
  102. package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs.map +1 -0
  103. package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs +185 -0
  104. package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -0
  105. package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs +32 -0
  106. package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs.map +1 -0
  107. package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +204 -0
  108. package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -0
  109. package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs +25 -0
  110. package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs.map +1 -0
  111. package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs +53 -0
  112. package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs.map +1 -0
  113. package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs +99 -0
  114. package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs.map +1 -0
  115. package/fesm2022/ids-group-ltd-ids-design-system-components-status-dot.mjs +26 -0
  116. package/fesm2022/ids-group-ltd-ids-design-system-components-status-dot.mjs.map +1 -0
  117. package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +74 -0
  118. package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs.map +1 -0
  119. package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +76 -0
  120. package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -0
  121. package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +1802 -0
  122. package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -0
  123. package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs +381 -0
  124. package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs.map +1 -0
  125. package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +44 -0
  126. package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs.map +1 -0
  127. package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +158 -0
  128. package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -0
  129. package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +671 -0
  130. package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -0
  131. package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs +41 -0
  132. package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs.map +1 -0
  133. package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +547 -0
  134. package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs.map +1 -0
  135. package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs +34 -0
  136. package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs.map +1 -0
  137. package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +218 -0
  138. package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -0
  139. package/fesm2022/ids-group-ltd-ids-design-system-components-topbar.mjs +18 -0
  140. package/fesm2022/ids-group-ltd-ids-design-system-components-topbar.mjs.map +1 -0
  141. package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs +153 -0
  142. package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -0
  143. package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs +48 -0
  144. package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs.map +1 -0
  145. package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +1338 -0
  146. package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -0
  147. package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +325 -0
  148. package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -0
  149. package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs +101 -0
  150. package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs.map +1 -0
  151. package/fesm2022/ids-group-ltd-ids-design-system-overlay.mjs +56 -0
  152. package/fesm2022/ids-group-ltd-ids-design-system-overlay.mjs.map +1 -0
  153. package/fesm2022/ids-group-ltd-ids-design-system-theme.mjs +37 -0
  154. package/fesm2022/ids-group-ltd-ids-design-system-theme.mjs.map +1 -0
  155. package/fesm2022/ids-group-ltd-ids-design-system.mjs +72 -14030
  156. package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
  157. package/migrations/0.11.0.json +0 -2
  158. package/migrations/0.11.1.json +2 -1
  159. package/migrations/0.11.2.json +2 -1
  160. package/migrations/0.11.3.json +3 -2
  161. package/migrations/0.11.4.json +247 -0
  162. package/migrations/0.12.0.json +22 -0
  163. package/migrations/0.4.0.json +2 -1
  164. package/migrations/0.7.1.json +2 -1
  165. package/migrations/0.8.0.json +6 -5
  166. package/package.json +573 -1
  167. package/styles/_control-label.scss +18 -0
  168. package/styles/_ds-color.scss +6 -0
  169. package/styles/_focus.scss +16 -0
  170. package/styles/_skeleton-shimmer.scss +10 -26
  171. package/themes/README.md +4 -4
  172. package/themes/_semantic.scss +11 -2
  173. package/types/ids-group-ltd-ids-design-system-components-accordion.d.ts +48 -0
  174. package/types/ids-group-ltd-ids-design-system-components-alert.d.ts +32 -0
  175. package/types/ids-group-ltd-ids-design-system-components-app-layout.d.ts +260 -0
  176. package/types/ids-group-ltd-ids-design-system-components-auth-layout.d.ts +75 -0
  177. package/types/ids-group-ltd-ids-design-system-components-autocomplete.d.ts +226 -0
  178. package/types/ids-group-ltd-ids-design-system-components-avatar-group.d.ts +13 -0
  179. package/types/ids-group-ltd-ids-design-system-components-avatar.d.ts +99 -0
  180. package/types/ids-group-ltd-ids-design-system-components-badge.d.ts +25 -0
  181. package/types/ids-group-ltd-ids-design-system-components-banner.d.ts +41 -0
  182. package/types/ids-group-ltd-ids-design-system-components-bottom-sheet.d.ts +61 -0
  183. package/types/ids-group-ltd-ids-design-system-components-breadcrumbs.d.ts +66 -0
  184. package/types/ids-group-ltd-ids-design-system-components-button-group.d.ts +10 -0
  185. package/types/ids-group-ltd-ids-design-system-components-button.d.ts +90 -0
  186. package/types/ids-group-ltd-ids-design-system-components-calendar-day.d.ts +41 -0
  187. package/types/ids-group-ltd-ids-design-system-components-card.d.ts +24 -0
  188. package/types/ids-group-ltd-ids-design-system-components-checkbox.d.ts +41 -0
  189. package/types/ids-group-ltd-ids-design-system-components-color-picker.d.ts +79 -0
  190. package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +251 -0
  191. package/types/ids-group-ltd-ids-design-system-components-description-list.d.ts +25 -0
  192. package/types/ids-group-ltd-ids-design-system-components-divider.d.ts +22 -0
  193. package/types/ids-group-ltd-ids-design-system-components-drawer.d.ts +38 -0
  194. package/types/ids-group-ltd-ids-design-system-components-dropzone.d.ts +45 -0
  195. package/types/ids-group-ltd-ids-design-system-components-empty-state.d.ts +22 -0
  196. package/types/ids-group-ltd-ids-design-system-components-field-group.d.ts +73 -0
  197. package/types/ids-group-ltd-ids-design-system-components-field-message.d.ts +36 -0
  198. package/types/ids-group-ltd-ids-design-system-components-filter-bar.d.ts +83 -0
  199. package/types/ids-group-ltd-ids-design-system-components-icon-button.d.ts +56 -0
  200. package/types/ids-group-ltd-ids-design-system-components-input.d.ts +121 -0
  201. package/types/ids-group-ltd-ids-design-system-components-layout.d.ts +39 -0
  202. package/types/ids-group-ltd-ids-design-system-components-list.d.ts +29 -0
  203. package/types/ids-group-ltd-ids-design-system-components-loading-overlay.d.ts +31 -0
  204. package/types/ids-group-ltd-ids-design-system-components-menu.d.ts +82 -0
  205. package/types/ids-group-ltd-ids-design-system-components-modal.d.ts +124 -0
  206. package/types/ids-group-ltd-ids-design-system-components-multi-select.d.ts +213 -0
  207. package/types/ids-group-ltd-ids-design-system-components-number-stepper.d.ts +31 -0
  208. package/types/ids-group-ltd-ids-design-system-components-otp-input.d.ts +52 -0
  209. package/types/ids-group-ltd-ids-design-system-components-page-footer.d.ts +13 -0
  210. package/types/ids-group-ltd-ids-design-system-components-page-header.d.ts +21 -0
  211. package/types/ids-group-ltd-ids-design-system-components-pagination.d.ts +32 -0
  212. package/types/ids-group-ltd-ids-design-system-components-password-rules.d.ts +80 -0
  213. package/types/ids-group-ltd-ids-design-system-components-popover.d.ts +48 -0
  214. package/types/ids-group-ltd-ids-design-system-components-progress.d.ts +22 -0
  215. package/types/ids-group-ltd-ids-design-system-components-radio-group.d.ts +106 -0
  216. package/types/ids-group-ltd-ids-design-system-components-reserve-messages.d.ts +33 -0
  217. package/types/ids-group-ltd-ids-design-system-components-search.d.ts +82 -0
  218. package/types/ids-group-ltd-ids-design-system-components-segmented.d.ts +40 -0
  219. package/types/ids-group-ltd-ids-design-system-components-select.d.ts +152 -0
  220. package/types/ids-group-ltd-ids-design-system-components-sidenav-footer.d.ts +92 -0
  221. package/types/ids-group-ltd-ids-design-system-components-sidenav.d.ts +131 -0
  222. package/types/ids-group-ltd-ids-design-system-components-skeleton.d.ts +16 -0
  223. package/types/ids-group-ltd-ids-design-system-components-slider.d.ts +51 -0
  224. package/types/ids-group-ltd-ids-design-system-components-spinner.d.ts +11 -0
  225. package/types/ids-group-ltd-ids-design-system-components-split-button.d.ts +38 -0
  226. package/types/ids-group-ltd-ids-design-system-components-stat.d.ts +44 -0
  227. package/types/ids-group-ltd-ids-design-system-components-status-dot.d.ts +12 -0
  228. package/types/ids-group-ltd-ids-design-system-components-stepper.d.ts +32 -0
  229. package/types/ids-group-ltd-ids-design-system-components-switch.d.ts +40 -0
  230. package/types/ids-group-ltd-ids-design-system-components-table.d.ts +791 -0
  231. package/types/ids-group-ltd-ids-design-system-components-tabs.d.ts +118 -0
  232. package/types/ids-group-ltd-ids-design-system-components-tag.d.ts +26 -0
  233. package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +85 -0
  234. package/types/ids-group-ltd-ids-design-system-components-time-picker.d.ts +188 -0
  235. package/types/ids-group-ltd-ids-design-system-components-timeline.d.ts +24 -0
  236. package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +167 -0
  237. package/types/ids-group-ltd-ids-design-system-components-toggle-button.d.ts +18 -0
  238. package/types/ids-group-ltd-ids-design-system-components-tooltip.d.ts +66 -0
  239. package/types/ids-group-ltd-ids-design-system-components-topbar.d.ts +8 -0
  240. package/types/ids-group-ltd-ids-design-system-components-tree.d.ts +46 -0
  241. package/types/ids-group-ltd-ids-design-system-components-w3w.d.ts +18 -0
  242. package/types/ids-group-ltd-ids-design-system-components.d.ts +604 -0
  243. package/types/ids-group-ltd-ids-design-system-core.d.ts +428 -0
  244. package/types/ids-group-ltd-ids-design-system-icons.d.ts +52 -0
  245. package/types/ids-group-ltd-ids-design-system-overlay.d.ts +32 -0
  246. package/types/ids-group-ltd-ids-design-system-theme.d.ts +29 -0
  247. package/types/ids-group-ltd-ids-design-system.d.ts +72 -5544
  248. package/LICENSE +0 -21
  249. package/README.md +0 -73
@@ -0,0 +1,1338 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, computed, signal, untracked, afterRenderEffect, TemplateRef, Directive, Injector, DestroyRef, afterNextRender, isDevMode, input, booleanAttribute, effect, ElementRef, DOCUMENT } from '@angular/core';
3
+ import { DS_CONFIG } from '@ids-group-ltd/ids-design-system/core';
4
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
+ import { NgForm, FormGroupDirective, NgControl } from '@angular/forms';
6
+
7
+ /**
8
+ * Resolve one brand string against the app-level default. `ds-sidenav` and
9
+ * `ds-auth-layout` ask the same three questions and an app answers them
10
+ * identically on every screen, so the answer belongs in one provider rather than
11
+ * in four bindings per template.
12
+ *
13
+ * Same `null`-means-unset shape as `resolveReserveMessage` — here `''` is an
14
+ * explicit "this screen has no brand", and each field resolves on its own.
15
+ * @internal
16
+ */
17
+ function resolveBrandValue(value, key) {
18
+ const config = inject(DS_CONFIG);
19
+ return computed(() => value() ?? config.brand?.[key] ?? '');
20
+ }
21
+
22
+ /**
23
+ * @fileoverview How many chips fit one line of a trigger, measured rather than
24
+ * guessed.
25
+ *
26
+ * INVARIANT: nothing here may measure something the cut itself changes, or the
27
+ * measurement feeds back into its own input and the split never settles — a hung
28
+ * page, not a wrong number. Hence the budget comes off the trigger's PARENT
29
+ * content box (the trigger's own width is the fallback for when there is no usable
30
+ * parent), never the row, and the "+N more" marker gets a fixed reserve rather
31
+ * than a measurement.
32
+ *
33
+ * The caller owes two things: chips carry `data-chip`, and they sit in a row of
34
+ * their own that is a direct child of the trigger. `enabled` gates the whole thing
35
+ * because measuring forces layout.
36
+ */
37
+ /**
38
+ * Null when the host cannot supply a budget: a detached node, an inline one with no content box,
39
+ * or one whose own width DEPENDS on the trigger — which would feed the cut back into its own
40
+ * input.
41
+ *
42
+ * That last one is asked of layout, not read off a style: `getComputedStyle().width` is a used
43
+ * pixel value, so the `fit-content` a consumer wrote is not readable back. Pinning the trigger to
44
+ * zero and re-reading the host tests it directly — a host sized by its own parent does not move,
45
+ * one sized by its content collapses — at the cost of a second forced layout.
46
+ */
47
+ function hostContentWidth(host, trigger) {
48
+ if (!host || host.clientWidth === 0) {
49
+ return null;
50
+ }
51
+ const styles = getComputedStyle(host);
52
+ if (styles.display === 'inline') {
53
+ return null;
54
+ }
55
+ const before = host.clientWidth;
56
+ const pinned = trigger.style.width;
57
+ trigger.style.width = '0px';
58
+ const dependsOnTrigger = host.clientWidth !== before;
59
+ trigger.style.width = pinned;
60
+ if (dependsOnTrigger) {
61
+ return null;
62
+ }
63
+ return (before - parseFloat(styles.paddingLeft) - parseFloat(styles.paddingRight));
64
+ }
65
+ /** Room held for "+N more", in em so a retuned type scale carries. Measured at
66
+ * 4.5em wide with three digits; 5em keeps a chip from being dropped for a pixel. */
67
+ const MARKER_RESERVE_EM = 5;
68
+ /** What a sibling of the chip row costs the chips. One that can grow gives back
69
+ * what it does not use, so only its floor is owed; anything else owes its box. */
70
+ function reservedWidth(element) {
71
+ const styles = getComputedStyle(element);
72
+ return parseFloat(styles.flexGrow) > 0
73
+ ? parseFloat(styles.minWidth) || 0
74
+ : element.offsetWidth;
75
+ }
76
+ /** @internal */
77
+ function chipFit(count, chipRow, enabled,
78
+ /** The whole selection, which `count` may already cap. */
79
+ selectionSize = count) {
80
+ const available = signal(0, ...(ngDevMode ? [{ debugName: "available" }] : /* istanbul ignore next */ []));
81
+ const gap = signal(0, ...(ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []));
82
+ const markerReserve = signal(0, ...(ngDevMode ? [{ debugName: "markerReserve" }] : /* istanbul ignore next */ []));
83
+ /** Widths of ALL chips, from the last render that held all of them. */
84
+ const chipWidths = signal([], ...(ngDevMode ? [{ debugName: "chipWidths" }] : /* istanbul ignore next */ []));
85
+ /** `count` at that render, so a stale cache is never trusted. */
86
+ const measuredFor = signal(-1, ...(ngDevMode ? [{ debugName: "measuredFor" }] : /* istanbul ignore next */ []));
87
+ /** Geometry the last measure ran against, to skip one that would repeat it.
88
+ * Each forces layout: without this guard a single docs page load measured 214
89
+ * times across seven pickers. */
90
+ let lastWidth = -1;
91
+ let lastCount = -1;
92
+ const measure = (row) => {
93
+ const trigger = row.parentElement;
94
+ if (!trigger) {
95
+ return;
96
+ }
97
+ // A trigger that hugs its content (`width: fit-content`, which both compact
98
+ // modes set) has a width decided by the chips this cut removes, so reading it
99
+ // feeds the result back into its own input. The parent's content box is the
100
+ // space actually available and does not move when the chips do; for a `fill`
101
+ // trigger the two are the same number.
102
+ //
103
+ // The fallback is that same feedback loop, so it is a last resort, not a default: it runs
104
+ // only when the host cannot answer at all.
105
+ const host = trigger.parentElement;
106
+ const budget = hostContentWidth(host, trigger) ?? trigger.clientWidth;
107
+ const width = budget;
108
+ const currentCount = untracked(count);
109
+ const cacheIsCurrent = untracked(measuredFor) === currentCount;
110
+ if (width === lastWidth && currentCount === lastCount && cacheIsCurrent) {
111
+ return;
112
+ }
113
+ lastWidth = width;
114
+ lastCount = currentCount;
115
+ const triggerStyles = getComputedStyle(trigger);
116
+ const columnGap = parseFloat(triggerStyles.columnGap) || 0;
117
+ let free = budget -
118
+ parseFloat(triggerStyles.paddingLeft) -
119
+ parseFloat(triggerStyles.paddingRight) -
120
+ parseFloat(triggerStyles.borderLeftWidth) -
121
+ parseFloat(triggerStyles.borderRightWidth);
122
+ for (const sibling of trigger.children) {
123
+ if (sibling !== row) {
124
+ free -= reservedWidth(sibling) + columnGap;
125
+ }
126
+ }
127
+ gap.set(columnGap);
128
+ available.set(free);
129
+ markerReserve.set(MARKER_RESERVE_EM * parseFloat(getComputedStyle(row).fontSize));
130
+ const chips = row.querySelectorAll('[data-chip]');
131
+ // A partial render is the previous cut, not the selection: caching it would
132
+ // keep only the survivors' widths, and the row could never grow back.
133
+ if (chips.length === untracked(count)) {
134
+ chipWidths.set([...chips].map((chip) => chip.offsetWidth));
135
+ measuredFor.set(untracked(count));
136
+ }
137
+ };
138
+ afterRenderEffect((onCleanup) => {
139
+ const row = chipRow()?.nativeElement;
140
+ if (!enabled() || !row) {
141
+ return;
142
+ }
143
+ const observer = new ResizeObserver(() => measure(row));
144
+ // The trigger, not the row: the row's box follows the cut, so observing it
145
+ // would report this function's own output back to it.
146
+ observer.observe(row.parentElement ?? row);
147
+ onCleanup(() => observer.disconnect());
148
+ });
149
+ // A selection change does not resize the trigger, so it drives its own measure.
150
+ afterRenderEffect(() => {
151
+ count();
152
+ const row = chipRow()?.nativeElement;
153
+ if (enabled() && row) {
154
+ measure(row);
155
+ }
156
+ });
157
+ return computed(() => {
158
+ const total = count();
159
+ if (!enabled()) {
160
+ return total;
161
+ }
162
+ const widths = chipWidths();
163
+ // Until the widths for THIS selection are in, render all of them: that render
164
+ // is what gets measured, and the row clips it until the cut lands.
165
+ if (measuredFor() !== total || available() <= 0) {
166
+ return total;
167
+ }
168
+ let used = 0;
169
+ for (let index = 0; index < widths.length; index++) {
170
+ const next = used + widths[index] + (index > 0 ? gap() : 0);
171
+ // The marker is only owed room once something is actually hidden, so the
172
+ // last chip may spend what the marker would have taken — but only if this
173
+ // really is the end of the selection, not the end of a capped slice.
174
+ const isLast = index === widths.length - 1 && selectionSize() <= widths.length;
175
+ const budget = isLast
176
+ ? available()
177
+ : available() - markerReserve() - gap();
178
+ if (next > budget) {
179
+ // One chip always shows: a trigger too narrow for even that is a layout
180
+ // bug upstream, and 0 would render a bare "+N" with nothing to anchor it.
181
+ return Math.max(1, index);
182
+ }
183
+ used = next;
184
+ }
185
+ return total;
186
+ });
187
+ }
188
+
189
+ /**
190
+ * Fills a selected chip's content in the trigger of `ds-multi-select` and
191
+ * `ds-autocomplete`, so a picker whose rows carry an avatar does not lose it the
192
+ * moment the option is chosen.
193
+ *
194
+ * The chip is still a `ds-tag` owned by the library: its close button, its
195
+ * accessible remove label and the measured overflow cap are not projected.
196
+ */
197
+ class DsChipTemplateDirective {
198
+ template = inject(TemplateRef);
199
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsChipTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
200
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: DsChipTemplateDirective, isStandalone: true, selector: "[dsChipTemplate]", ngImport: i0 });
201
+ }
202
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsChipTemplateDirective, decorators: [{
203
+ type: Directive,
204
+ args: [{
205
+ selector: '[dsChipTemplate]',
206
+ standalone: true,
207
+ }]
208
+ }] });
209
+
210
+ /**
211
+ * Resolve a field's `reserveMessage` against the app-level default.
212
+ *
213
+ * Fields declare the input as `boolean | null` with a `null` default so "not set"
214
+ * stays distinguishable from an explicit `true` — a signal input cannot report
215
+ * whether it was bound. Precedence: the component input, then
216
+ * `DS_CONFIG.field.reserveMessage`, then `false`.
217
+ *
218
+ * Call from a field initializer (an injection context), e.g.
219
+ * `protected readonly reserve = resolveReserveMessage(this.reserveMessage);`
220
+ */
221
+ function resolveReserveMessage(reserveMessage) {
222
+ const config = inject(DS_CONFIG);
223
+ return computed(() => reserveMessage() ?? config.field?.reserveMessage ?? false);
224
+ }
225
+
226
+ const NO_ERRORS = [];
227
+ /**
228
+ * The one reserved `DsFieldError.kind`. An error carrying it is advisory: it shows
229
+ * in the warning state and does NOT make the control invalid, which is how a form
230
+ * model can raise a non-blocking remark — Angular's own `AbstractControl` has no
231
+ * channel for one, only `errors` and the validity derived from it.
232
+ */
233
+ const DS_FIELD_WARNING_KIND = 'warning';
234
+ /**
235
+ * `errors` input transform. Accepts a bare string (so a consumer that already
236
+ * has the text can pass it directly), a single error, or the array signal forms
237
+ * assigns.
238
+ */
239
+ function normalizeFieldErrors(value) {
240
+ if (!value) {
241
+ return NO_ERRORS;
242
+ }
243
+ if (typeof value === 'string') {
244
+ return value.trim() ? [{ kind: 'custom', message: value }] : NO_ERRORS;
245
+ }
246
+ return Array.isArray(value) ? value : [value];
247
+ }
248
+ /** @internal */
249
+ function trimmedText(value) {
250
+ return value?.trim() ?? '';
251
+ }
252
+ const EMPTY_MESSAGE = { text: '', state: 'default' };
253
+ const NO_CONTROL = { errors: NO_ERRORS, touched: false };
254
+ /**
255
+ * Resolve the one message a field shows, from every source that can supply one.
256
+ *
257
+ * Precedence, highest first — the ladder Carbon uses (`invalidText` →
258
+ * `warnText` → `helperText`) and Material's subscript follows, so only ONE line
259
+ * ever shows and the field's height does not depend on how many sources are
260
+ * populated:
261
+ *
262
+ * 1. `error` — an explicit string. Shown immediately: the consumer decided.
263
+ * 2. `errors` — validation errors. Shown once the user has interacted, so a
264
+ * `required` error does not greet an untouched form.
265
+ * 3. `warning` — advisory, not blocking.
266
+ * 4. `errors` whose kind is `DS_FIELD_WARNING_KIND` — the same, raised by the form model.
267
+ * 5. `success` — confirmation.
268
+ * 6. `hint` — helper text.
269
+ *
270
+ * Both form systems feed step 2 and neither needs the other. Signal forms binds
271
+ * `errors` and `touched` by input name (`FormUiControl`); reactive and
272
+ * template-driven forms expose the same through `NgControl`, read here. A given
273
+ * field instance is driven by exactly one of them, so they cannot disagree.
274
+ *
275
+ * Every rung carries its OWN text, and `hint` is never recoloured into somebody
276
+ * else's state. `invalid` is the one input with no text on purpose: it paints the
277
+ * control and sets `aria-invalid` for when the message lives elsewhere — a
278
+ * form-level error summary, or one message for a whole field group.
279
+ *
280
+ * Call from a field initializer (an injection context).
281
+ * @internal
282
+ */
283
+ function resolveFieldMessage(sources) {
284
+ const config = inject(DS_CONFIG);
285
+ const controlState = watchNgControl();
286
+ const errors = computed(() => {
287
+ const own = sources.errors();
288
+ return own.length ? own : controlState().errors;
289
+ }, ...(ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []));
290
+ const interacted = computed(() => (sources.touched?.() ?? false) ||
291
+ (sources.touchedSelf?.() ?? false) ||
292
+ controlState().touched, ...(ngDevMode ? [{ debugName: "interacted" }] : /* istanbul ignore next */ []));
293
+ // Both form systems land here, so one reserved kind serves both: signal forms
294
+ // assigns its own ValidationError[] (which already carries `kind`), and
295
+ // fromValidationErrors turns a reactive validator's `{ warning: 'text' }` KEY
296
+ // into the same kind.
297
+ const blocking = computed(() => errors().filter((error) => error.kind !== DS_FIELD_WARNING_KIND), ...(ngDevMode ? [{ debugName: "blocking" }] : /* istanbul ignore next */ []));
298
+ const advisory = computed(() => errors().filter((error) => error.kind === DS_FIELD_WARNING_KIND), ...(ngDevMode ? [{ debugName: "advisory" }] : /* istanbul ignore next */ []));
299
+ const errorText = computed(() => {
300
+ const current = blocking();
301
+ if (!current.length || !interacted()) {
302
+ return '';
303
+ }
304
+ return textFor(current, config.field?.errorMessages);
305
+ }, ...(ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []));
306
+ const advisoryText = computed(() => {
307
+ const current = advisory();
308
+ if (!current.length || !interacted()) {
309
+ return '';
310
+ }
311
+ return textFor(current, config.field?.errorMessages);
312
+ }, ...(ngDevMode ? [{ debugName: "advisoryText" }] : /* istanbul ignore next */ []));
313
+ // Advisory errors are deliberately absent: a warning does not make a control
314
+ // invalid, so it never sets aria-invalid and never blocks a submit guard.
315
+ const invalid = computed(() => sources.invalid() ||
316
+ sources.error().length > 0 ||
317
+ (blocking().length > 0 && interacted()), ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
318
+ // Message inputs trim via `trimmedText`, so a non-empty string here is real
319
+ // text — a new one declared without that transform breaks this quietly.
320
+ const message = computed(() => {
321
+ const explicit = sources.error();
322
+ if (explicit) {
323
+ return { text: explicit, state: 'error' };
324
+ }
325
+ const fromErrors = errorText();
326
+ if (fromErrors) {
327
+ return { text: fromErrors, state: 'error' };
328
+ }
329
+ const warning = sources.warning();
330
+ if (warning) {
331
+ return { text: warning, state: 'warning' };
332
+ }
333
+ const fromAdvisory = advisoryText();
334
+ if (fromAdvisory) {
335
+ return { text: fromAdvisory, state: 'warning' };
336
+ }
337
+ const success = sources.success?.();
338
+ if (success) {
339
+ return { text: success, state: 'success' };
340
+ }
341
+ const hint = sources.hint();
342
+ return hint ? { text: hint, state: 'default' } : EMPTY_MESSAGE;
343
+ }, ...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
344
+ const paintedState = computed(() => {
345
+ if (invalid()) {
346
+ return 'error';
347
+ }
348
+ if (sources.warning() || advisoryText()) {
349
+ return 'warning';
350
+ }
351
+ return sources.success?.() ? 'success' : null;
352
+ }, ...(ngDevMode ? [{ debugName: "paintedState" }] : /* istanbul ignore next */ []));
353
+ return { message, invalid, controlState: paintedState };
354
+ }
355
+ /**
356
+ * Reactive- and template-driven forms channel. `NgControl` cannot be injected
357
+ * directly: a field provides `NG_VALUE_ACCESSOR` pointing at itself, so asking
358
+ * for `NgControl` in the same constructor is a DI cycle. Resolving it after the
359
+ * first render is the documented way around that.
360
+ *
361
+ * `events` (not `statusChanges`) is the subscription, because touching a control
362
+ * does NOT emit a status change — it emits `TouchedChangeEvent`, and touched is
363
+ * half of the decision to show an error at all.
364
+ */
365
+ function watchNgControl() {
366
+ const injector = inject(Injector);
367
+ const destroyRef = inject(DestroyRef);
368
+ // Submitting a form does not reach the child control's own `events` — the
369
+ // event is pushed onto the ROOT form's stream — so the parent is read
370
+ // directly, as Angular Material's ErrorStateMatcher does.
371
+ const parentForm = inject(NgForm, { optional: true });
372
+ const parentFormGroup = inject(FormGroupDirective, { optional: true });
373
+ const state = signal(NO_CONTROL, ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
374
+ afterNextRender(() => {
375
+ const control = injector.get(NgControl, null)?.control;
376
+ if (!control) {
377
+ return;
378
+ }
379
+ const submitted = () => parentFormGroup?.submitted || parentForm?.submitted || false;
380
+ const sync = () => state.set({
381
+ errors: fromValidationErrors(control.errors),
382
+ touched: control.touched || submitted(),
383
+ });
384
+ // Signal forms bridges an NgControl whose `control` has no `events` stream, so
385
+ // there is nothing to subscribe to. Staying at NO_CONTROL is deliberate: on that
386
+ // path the component's own inputs carry errors and touched, and a snapshot that
387
+ // froze at first render would keep serving a stale error after the field went valid.
388
+ if (typeof control.events?.pipe !== 'function') {
389
+ return;
390
+ }
391
+ sync();
392
+ control.events.pipe(takeUntilDestroyed(destroyRef)).subscribe(sync);
393
+ const parentSubmit = parentFormGroup?.ngSubmit ?? parentForm?.ngSubmit;
394
+ parentSubmit?.pipe(takeUntilDestroyed(destroyRef)).subscribe(sync);
395
+ });
396
+ return state;
397
+ }
398
+ /**
399
+ * `ValidationErrors` is an untyped bag, so a message is picked up from the two
400
+ * shapes consumers actually write: `{ myError: 'text' }` and
401
+ * `{ myError: { message: 'text' } }`. Angular's own built-ins carry detail
402
+ * objects with no message (`{ minlength: { requiredLength, actualLength } }`) —
403
+ * those resolve through `DS_CONFIG.field.errorMessages` instead.
404
+ */
405
+ function fromValidationErrors(errors) {
406
+ if (!errors) {
407
+ return NO_ERRORS;
408
+ }
409
+ return Object.keys(errors).map((kind) => {
410
+ const detail = errors[kind];
411
+ if (typeof detail === 'string') {
412
+ return { kind, message: detail };
413
+ }
414
+ const message = detail?.message;
415
+ return typeof message === 'string' ? { kind, message } : { kind };
416
+ });
417
+ }
418
+ function textFor(errors, messages) {
419
+ for (const error of errors) {
420
+ const text = error.message ?? messages?.[error.kind];
421
+ if (text) {
422
+ return text;
423
+ }
424
+ }
425
+ if (isDevMode()) {
426
+ console.warn(`[ds-field] The control is invalid but no message could be resolved for ${errors
427
+ .map((error) => `"${error.kind}"`)
428
+ .join(', ')}, so the field paints the state with NO message under it. Give the validator a message — required(path, { message: '…' }) or { myError: 'text' } — or map the kind in provideDsConfig({ field: { errorMessages: … } }).`);
429
+ }
430
+ return '';
431
+ }
432
+
433
+ /**
434
+ * The inputs of anything that renders a `ds-field-message` line — the message half
435
+ * of a field, split out so `ds-button` can take it without also taking `errors`,
436
+ * `invalid` and `touched`, which describe a form control's validation state and
437
+ * mean nothing on a button.
438
+ *
439
+ * `@Directive()` is required, not decoration: Angular refuses to compile a base
440
+ * class that declares inputs without it.
441
+ * @internal
442
+ */
443
+ class DsMessageBase {
444
+ /** Helper text shown below the control. */
445
+ hint = input('', { ...(ngDevMode ? { debugName: "hint" } : /* istanbul ignore next */ {}), transform: trimmedText });
446
+ /** Error text. Shown immediately — binding it says the consumer has already
447
+ * decided this is in error. Takes precedence over `errors`. */
448
+ error = input('', { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), transform: trimmedText });
449
+ /** Advisory text, shown when there is no error. */
450
+ warning = input('', { ...(ngDevMode ? { debugName: "warning" } : /* istanbul ignore next */ {}), transform: trimmedText });
451
+ /** Reserve the message-row height even when empty, so the control doesn't shift
452
+ * the layout below it when a hint/error appears. Falls back to
453
+ * `DS_CONFIG.field.reserveMessage`, then off. */
454
+ reserveMessage = input(null, { ...(ngDevMode ? { debugName: "reserveMessage" } : /* istanbul ignore next */ {}), transform: (value) => (value == null ? null : booleanAttribute(value)) });
455
+ /** Glyph on the message line, overriding what the state resolves to. Unset
456
+ * follows `DS_CONFIG.field.stateIcons`; `false` removes the glyph here alone. */
457
+ messageIcon = input(null, ...(ngDevMode ? [{ debugName: "messageIcon" }] : /* istanbul ignore next */ []));
458
+ reserveMessageResolved = resolveReserveMessage(this.reserveMessage);
459
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsMessageBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
460
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.22", type: DsMessageBase, isStandalone: true, inputs: { hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, warning: { classPropertyName: "warning", publicName: "warning", isSignal: true, isRequired: false, transformFunction: null }, reserveMessage: { classPropertyName: "reserveMessage", publicName: "reserveMessage", isSignal: true, isRequired: false, transformFunction: null }, messageIcon: { classPropertyName: "messageIcon", publicName: "messageIcon", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
461
+ }
462
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsMessageBase, decorators: [{
463
+ type: Directive
464
+ }], propDecorators: { hint: [{ type: i0.Input, args: [{ isSignal: true, alias: "hint", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], warning: [{ type: i0.Input, args: [{ isSignal: true, alias: "warning", required: false }] }], reserveMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "reserveMessage", required: false }] }], messageIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "messageIcon", required: false }] }] } });
465
+
466
+ /**
467
+ * The inputs every DS form field has, declared once.
468
+ *
469
+ * Only the UNIVERSAL ones belong here. `success`, `label`, `required` and
470
+ * `optional` stay on the components: they exist on some fields and not others, so
471
+ * lifting them would hand a checkbox a `success` or a slider a `label` it never
472
+ * had — a silent public-API addition.
473
+ *
474
+ * The message half lives one level up in `DsMessageBase`, which anything with a
475
+ * message line can take. What stays here is the validation state a form control
476
+ * has and a plain control does not.
477
+ * @internal
478
+ */
479
+ class DsFieldBase extends DsMessageBase {
480
+ /** Validation errors, shown once the user has interacted. Bound automatically
481
+ * by signal forms; reactive and template-driven forms are read through
482
+ * `NgControl` and need nothing here. Accepts a string, one error, or an array. */
483
+ errors = input([], { ...(ngDevMode ? { debugName: "errors" } : /* istanbul ignore next */ {}), transform: normalizeFieldErrors });
484
+ /** Paints the error state and sets `aria-invalid`, WITHOUT a message of its own
485
+ * — for when the text lives elsewhere, such as a form-level error summary or
486
+ * one message covering a whole field group. Use `error` to show text. */
487
+ invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
488
+ /** Whether the user has interacted with the field. Bound by signal forms; gates
489
+ * `errors`, so a `required` error does not greet an untouched form. */
490
+ touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
491
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsFieldBase, deps: null, target: i0.ɵɵFactoryTarget.Directive });
492
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.22", type: DsFieldBase, isStandalone: true, inputs: { errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0 });
493
+ }
494
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsFieldBase, decorators: [{
495
+ type: Directive
496
+ }], propDecorators: { errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }] } });
497
+
498
+ /**
499
+ * Value-bearing elements come FIRST, and that ordering is the whole point: the
500
+ * number stepper renders its decrement button before its input, so "the first
501
+ * focusable descendant" would land on minus. `tabindex="-1"` is excluded from
502
+ * both passes so a roving-tabindex group (ds-radio-group) yields the radio that
503
+ * is actually tabbable rather than the first one in the DOM. Portaled panels are
504
+ * outside the host, so a closed picker cannot be focused by accident.
505
+ */
506
+ const NOT_ROVED = ':not([tabindex="-1"]):not([disabled])';
507
+ const VALUE_ELEMENTS = `input:not([type="hidden"])${NOT_ROVED}, textarea${NOT_ROVED}`;
508
+ const TRIGGER_ELEMENTS = `button${NOT_ROVED}, [tabindex="0"]${NOT_ROVED}`;
509
+ /**
510
+ * The `ControlValueAccessor` half of a DS value control, with no message API
511
+ * attached. `DsControlValueAccessor` is this plus `DsFieldBase`; a control that
512
+ * holds a value and renders no message row — `ds-search`, a toolbar filter rather
513
+ * than a validated field — takes this directly and gets no message inputs with it.
514
+ *
515
+ * The model arrives as a THUNK, not a signal: on a base class `value` is abstract
516
+ * and on a component it is a field initialiser, so it does not exist yet when this
517
+ * runs. Every read defers to call time, which is also when the effect first runs.
518
+ *
519
+ * Must be called from an injection context (it owns an `effect`).
520
+ * @internal
521
+ */
522
+ function valueControlBridge(model) {
523
+ const formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
524
+ const touchedSelf = signal(false, ...(ngDevMode ? [{ debugName: "touchedSelf" }] : /* istanbul ignore next */ []));
525
+ let onChange = () => { };
526
+ let onTouched = () => { };
527
+ // Last value synced with the forms API. Guards the watching effect from echoing
528
+ // a form-driven write back as a user change (which would dirty the control or
529
+ // loop), while still emitting every genuine model change.
530
+ let synced;
531
+ let hasSynced = false;
532
+ effect(() => {
533
+ const next = model()();
534
+ if (!hasSynced) {
535
+ // Adopt the initial value once, silently — never emit on init.
536
+ hasSynced = true;
537
+ synced = next;
538
+ return;
539
+ }
540
+ if (Object.is(next, synced)) {
541
+ return;
542
+ }
543
+ synced = next;
544
+ onChange(next);
545
+ });
546
+ return {
547
+ formDisabled,
548
+ touchedSelf,
549
+ markTouched: () => {
550
+ touchedSelf.set(true);
551
+ onTouched();
552
+ },
553
+ writeValue: (next) => {
554
+ hasSynced = true;
555
+ synced = next;
556
+ model().set(next);
557
+ },
558
+ registerOnChange: (fn) => {
559
+ onChange = fn;
560
+ },
561
+ registerOnTouched: (fn) => {
562
+ onTouched = fn;
563
+ },
564
+ setDisabledState: (isDisabled) => {
565
+ formDisabled.set(isDisabled);
566
+ },
567
+ };
568
+ }
569
+ function focusOwnControl(host, options) {
570
+ const target = host.querySelector(VALUE_ELEMENTS) ??
571
+ host.querySelector(TRIGGER_ELEMENTS);
572
+ target?.focus(options);
573
+ }
574
+ /**
575
+ * Shared `ControlValueAccessor` for DS form controls whose value is a signal
576
+ * `model()`. Bridges that model with Angular forms (reactive `formControl` /
577
+ * `formControlName` and template `ngModel`) in both directions, WITHOUT
578
+ * touching the existing `[(value)]` signal API — both keep working.
579
+ *
580
+ * A subclass must expose the `value` model and OR `formDisabled()` into its
581
+ * effective disabled state so `FormControl.disable()` actually reaches the
582
+ * control; it should also call `markTouched()` from a blur handler.
583
+ * @internal
584
+ */
585
+ class DsControlValueAccessor extends DsFieldBase {
586
+ /**
587
+ * Hides the control. On the base so signal forms reaches every control at once.
588
+ * Inline `display`, not the `hidden` attribute — each control sets its own
589
+ * `:host` display, which the attribute's weaker UA rule would lose to.
590
+ */
591
+ hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
592
+ hostElement = inject(ElementRef);
593
+ /**
594
+ * Signal forms calls this through `focusBoundControl()` — typically to reach
595
+ * the first invalid field after a failed submit. Without it the default is to
596
+ * focus the HOST, and a `<ds-*>` element is not focusable, so focus went
597
+ * nowhere. A control with a more precise target overrides this.
598
+ */
599
+ focus(options) {
600
+ focusOwnControl(this.hostElement.nativeElement, options);
601
+ }
602
+ bridge = valueControlBridge(() => this.value);
603
+ /** Driven by the forms API via `setDisabledState`. */
604
+ formDisabled = this.bridge.formDisabled;
605
+ // Separate from the control's `touched`, which only exists once `NgControl`
606
+ // resolves — too late to gate the first blur.
607
+ touchedSelf = this.bridge.touchedSelf;
608
+ /** Call from a blur handler so the control reports `ng-touched`. */
609
+ markTouched() {
610
+ this.bridge.markTouched();
611
+ }
612
+ writeValue(value) {
613
+ this.bridge.writeValue(value);
614
+ }
615
+ registerOnChange(fn) {
616
+ this.bridge.registerOnChange(fn);
617
+ }
618
+ registerOnTouched(fn) {
619
+ this.bridge.registerOnTouched(fn);
620
+ }
621
+ setDisabledState(isDisabled) {
622
+ this.bridge.setDisabledState(isDisabled);
623
+ }
624
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsControlValueAccessor, deps: null, target: i0.ɵɵFactoryTarget.Directive });
625
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.22", type: DsControlValueAccessor, isStandalone: true, inputs: { hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "hidden() ? \"none\" : null" } }, usesInheritance: true, ngImport: i0 });
626
+ }
627
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsControlValueAccessor, decorators: [{
628
+ type: Directive,
629
+ args: [{
630
+ host: { '[style.display]': 'hidden() ? "none" : null' },
631
+ }]
632
+ }], propDecorators: { hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }] } });
633
+ /**
634
+ * Shared `ControlValueAccessor` for DS boolean controls (checkbox, switch)
635
+ * whose state lives in a `checked` model signal rather than `value`. Bridges
636
+ * with Angular forms in both directions without affecting the `[(checked)]`
637
+ * signal API. Subclasses must OR `formDisabled()` into their effective disabled
638
+ * state and call `markTouched()` from a blur handler.
639
+ * @internal
640
+ */
641
+ class DsBooleanControlValueAccessor extends DsFieldBase {
642
+ /** Hides the control — see the note on `DsControlValueAccessor.hidden`. */
643
+ hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
644
+ hostElement = inject(ElementRef);
645
+ /**
646
+ * Signal forms calls this through `focusBoundControl()` — typically to reach
647
+ * the first invalid field after a failed submit. Without it the default is to
648
+ * focus the HOST, and a `<ds-*>` element is not focusable, so focus went
649
+ * nowhere. A control with a more precise target overrides this.
650
+ */
651
+ focus(options) {
652
+ focusOwnControl(this.hostElement.nativeElement, options);
653
+ }
654
+ /** Driven by the forms API via `setDisabledState`. */
655
+ formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
656
+ // Separate from the control's `touched`, which only exists once `NgControl`
657
+ // resolves — too late to gate the first blur.
658
+ touchedSelf = signal(false, ...(ngDevMode ? [{ debugName: "touchedSelf" }] : /* istanbul ignore next */ []));
659
+ onChange = () => { };
660
+ onTouched = () => { };
661
+ synced;
662
+ hasSynced = false;
663
+ constructor() {
664
+ super();
665
+ effect(() => {
666
+ const next = this.checked();
667
+ if (!this.hasSynced) {
668
+ this.hasSynced = true;
669
+ this.synced = next;
670
+ return;
671
+ }
672
+ if (Object.is(next, this.synced)) {
673
+ return;
674
+ }
675
+ this.synced = next;
676
+ this.onChange(next);
677
+ });
678
+ }
679
+ /** Call from a blur handler so the control reports `ng-touched`. */
680
+ markTouched() {
681
+ this.touchedSelf.set(true);
682
+ this.onTouched();
683
+ }
684
+ writeValue(value) {
685
+ this.hasSynced = true;
686
+ this.synced = value;
687
+ this.checked.set(value);
688
+ }
689
+ registerOnChange(fn) {
690
+ this.onChange = fn;
691
+ }
692
+ registerOnTouched(fn) {
693
+ this.onTouched = fn;
694
+ }
695
+ setDisabledState(isDisabled) {
696
+ this.formDisabled.set(isDisabled);
697
+ }
698
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsBooleanControlValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
699
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.22", type: DsBooleanControlValueAccessor, isStandalone: true, inputs: { hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "hidden() ? \"none\" : null" } }, usesInheritance: true, ngImport: i0 });
700
+ }
701
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsBooleanControlValueAccessor, decorators: [{
702
+ type: Directive,
703
+ args: [{
704
+ host: { '[style.display]': 'hidden() ? "none" : null' },
705
+ }]
706
+ }], ctorParameters: () => [], propDecorators: { hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }] } });
707
+
708
+ /**
709
+ * Replaces `ds-autocomplete`'s "Create «…»" row.
710
+ *
711
+ * Context: `query` is the typed text the row would create.
712
+ *
713
+ * The row stays a `role="option"` the keyboard can reach, and picking it still
714
+ * emits `create` — the template fills the row, it does not become the action.
715
+ */
716
+ class DsCreateTemplateDirective {
717
+ template = inject(TemplateRef);
718
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsCreateTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
719
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: DsCreateTemplateDirective, isStandalone: true, selector: "[dsCreateTemplate]", ngImport: i0 });
720
+ }
721
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsCreateTemplateDirective, decorators: [{
722
+ type: Directive,
723
+ args: [{
724
+ selector: '[dsCreateTemplate]',
725
+ standalone: true,
726
+ }]
727
+ }] });
728
+
729
+ /**
730
+ * Replaces a picker panel's "no matches" row — an icon, a sentence in the app's
731
+ * own language, a "clear the filter" button.
732
+ *
733
+ * Context: `query` is the text that matched nothing.
734
+ *
735
+ * The row keeps `role="status"`, so a reader is told the list emptied whatever
736
+ * the template puts inside it.
737
+ */
738
+ class DsEmptyTemplateDirective {
739
+ template = inject(TemplateRef);
740
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsEmptyTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
741
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: DsEmptyTemplateDirective, isStandalone: true, selector: "[dsEmptyTemplate]", ngImport: i0 });
742
+ }
743
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsEmptyTemplateDirective, decorators: [{
744
+ type: Directive,
745
+ args: [{
746
+ selector: '[dsEmptyTemplate]',
747
+ standalone: true,
748
+ }]
749
+ }] });
750
+
751
+ /**
752
+ * Focuses the field's inner `input`/`textarea` when the click lands on the
753
+ * frame chrome — padding, a leading/trailing icon, an addon slot — instead of
754
+ * the control itself. Applied to a field's wrapper element.
755
+ *
756
+ * `preventDefault` on that mousedown stops focus from bouncing off the
757
+ * non-focusable chrome; clicks that land on the control, or on a nested
758
+ * button/link/other input, are left untouched so caret placement, toggles and
759
+ * projected controls keep working.
760
+ */
761
+ class FieldClickFocusDirective {
762
+ host = inject(ElementRef).nativeElement;
763
+ onMousedown(event) {
764
+ const target = event.target;
765
+ if (target.closest('input, textarea, button, a, select, [contenteditable]')) {
766
+ return;
767
+ }
768
+ const field = this.host.querySelector('input, textarea');
769
+ if (field && !field.disabled && !field.readOnly) {
770
+ event.preventDefault();
771
+ field.focus();
772
+ }
773
+ }
774
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: FieldClickFocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
775
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: FieldClickFocusDirective, isStandalone: true, selector: "[dsFieldClickFocus]", host: { listeners: { "mousedown": "onMousedown($event)" } }, ngImport: i0 });
776
+ }
777
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: FieldClickFocusDirective, decorators: [{
778
+ type: Directive,
779
+ args: [{
780
+ selector: '[dsFieldClickFocus]',
781
+ standalone: true,
782
+ host: {
783
+ '(mousedown)': 'onMousedown($event)',
784
+ },
785
+ }]
786
+ }] });
787
+
788
+ let nextId = 0;
789
+ /** Process-wide counter for stable, SSR-safe control ids (no DOM dependency).
790
+ * Replaces the per-component `let nextId = 0` pattern.
791
+ * @internal
792
+ */
793
+ function nextControlId(prefix) {
794
+ return `${prefix}-${++nextId}`;
795
+ }
796
+
797
+ /**
798
+ * Fills an option group's heading — a count beside the name, a team glyph, a
799
+ * secondary line.
800
+ *
801
+ * Context: `$implicit` and `group` are the group itself, `count` how many of its
802
+ * options survived the filter.
803
+ *
804
+ * The heading element stays the library's: it keeps the id that the group's
805
+ * `aria-labelledby` points at, so replacing the text cannot detach a group from
806
+ * its name.
807
+ */
808
+ class DsGroupLabelTemplateDirective {
809
+ template = inject(TemplateRef);
810
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsGroupLabelTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
811
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: DsGroupLabelTemplateDirective, isStandalone: true, selector: "[dsGroupLabelTemplate]", ngImport: i0 });
812
+ }
813
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsGroupLabelTemplateDirective, decorators: [{
814
+ type: Directive,
815
+ args: [{
816
+ selector: '[dsGroupLabelTemplate]',
817
+ standalone: true,
818
+ }]
819
+ }] });
820
+
821
+ /**
822
+ * Fills an option row's LABEL AREA in `ds-select`, `ds-multi-select` and
823
+ * `ds-autocomplete` — an avatar, a colour dot, a second line of metadata.
824
+ *
825
+ * ```html
826
+ * <ds-multi-select [options]="assignees()">
827
+ * <ng-template dsOptionTemplate let-option>
828
+ * <ds-avatar size="xs" [seed]="option.label" /> {{ option.label }}
829
+ * </ng-template>
830
+ * </ds-multi-select>
831
+ * ```
832
+ *
833
+ * The row itself stays library-owned: `role="option"`, `aria-selected`, the
834
+ * active-row class, the checkbox and the check glyph are not projected, so a
835
+ * template cannot take the listbox semantics with it.
836
+ */
837
+ class DsOptionTemplateDirective {
838
+ template = inject(TemplateRef);
839
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsOptionTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
840
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: DsOptionTemplateDirective, isStandalone: true, selector: "[dsOptionTemplate]", ngImport: i0 });
841
+ }
842
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsOptionTemplateDirective, decorators: [{
843
+ type: Directive,
844
+ args: [{
845
+ selector: '[dsOptionTemplate]',
846
+ standalone: true,
847
+ }]
848
+ }] });
849
+
850
+ /** The theme's role layer, forwarded onto every portaled pane alongside whatever
851
+ * tokens the component names for itself. */
852
+ const ROLE_TOKENS = [
853
+ '--ds-radius-inner',
854
+ '--ds-radius-control',
855
+ '--ds-radius-panel',
856
+ '--ds-radius-pill',
857
+ '--ds-elevation-raised',
858
+ '--ds-elevation-overlay',
859
+ '--ds-elevation-floating',
860
+ '--ds-elevation-modal',
861
+ ];
862
+ /** Public enter-motion tokens read by every `ds-overlay-pane`
863
+ * (styles/_overlay-motion.scss). */
864
+ const OVERLAY_MOTION_TOKENS = [
865
+ '--ds-overlay-enter-keyframes',
866
+ '--ds-overlay-enter-duration',
867
+ '--ds-overlay-enter-easing',
868
+ '--ds-overlay-enter-offset',
869
+ '--ds-overlay-enter-scale',
870
+ ];
871
+ /** Styles `dropdownOverlay()`'s default panel class, so every connected picker
872
+ * gets it whether or not it names panel tokens of its own. */
873
+ const DROPDOWN_PANEL_TOKENS = [
874
+ '--ds-dropdown-panel-radius',
875
+ '--ds-dropdown-panel-maxh',
876
+ '--ds-option-padding',
877
+ '--ds-option-gap',
878
+ '--ds-option-radius',
879
+ '--ds-option-row-gap',
880
+ '--ds-option-bg-color-active',
881
+ ];
882
+ const DROPDOWN_GAP = 4;
883
+ /**
884
+ * The geometry every DS dropdown shares. Width is deliberately NOT set here —
885
+ * each caller has its own policy (the exact trigger width, or the trigger as a
886
+ * floor).
887
+ * @internal
888
+ */
889
+ function dropdownOverlay(overlay, trigger, panelClass = ['ds-dropdown-panel', 'ds-overlay-pane']) {
890
+ const positionStrategy = overlay
891
+ .position()
892
+ .flexibleConnectedTo(trigger)
893
+ .withPositions([
894
+ {
895
+ originX: 'start',
896
+ originY: 'bottom',
897
+ overlayX: 'start',
898
+ overlayY: 'top',
899
+ offsetY: DROPDOWN_GAP,
900
+ },
901
+ {
902
+ originX: 'start',
903
+ originY: 'top',
904
+ overlayX: 'start',
905
+ overlayY: 'bottom',
906
+ offsetY: -DROPDOWN_GAP,
907
+ },
908
+ ]);
909
+ return {
910
+ positionStrategy,
911
+ config: {
912
+ positionStrategy,
913
+ hasBackdrop: false,
914
+ // The global panel skin lives in styles/_dropdown-overlay.scss: a portaled
915
+ // node sits outside the host's DOM tree, so `:host ::ng-deep` cannot reach it.
916
+ panelClass,
917
+ scrollStrategy: overlay.scrollStrategies.reposition(),
918
+ },
919
+ };
920
+ }
921
+ // Backstop for the leave animation: if the class never produces an animation
922
+ // (a pane that is display:none, a consumer stylesheet that removed it), the
923
+ // panel must still go away. Comfortably past --ds-motion-exit-duration.
924
+ const LEAVE_TIMEOUT_MS = 400;
925
+ /**
926
+ * Close a DS overlay panel — instantly on a `'select'`, with a short fade on a
927
+ * `'dismiss'`. A fade after a deliberate pick reads as the panel lagging behind a
928
+ * decision already made; on a dismissal nothing was chosen, so the same fade reads
929
+ * as the panel backing out.
930
+ *
931
+ * NOTE: teardown paths dispose directly instead — a destroyed host has no time to
932
+ * animate, and `ModalService` owns its own scrim-and-card leave.
933
+ * @internal
934
+ */
935
+ function disposeWithLeave(overlayRef, cause = 'select') {
936
+ if (!overlayRef) {
937
+ return;
938
+ }
939
+ if (cause === 'select') {
940
+ overlayRef.dispose();
941
+ return;
942
+ }
943
+ const pane = overlayRef.overlayElement;
944
+ let disposed = false;
945
+ const finish = () => {
946
+ if (disposed) {
947
+ return;
948
+ }
949
+ disposed = true;
950
+ clearTimeout(timer);
951
+ pane.removeEventListener('animationend', onAnimationEnd);
952
+ overlayRef.dispose();
953
+ };
954
+ // The pane's ROOT CHILD is what animates (CDK owns transforms on the pane
955
+ // itself), so the event arrives from a descendant and bubbles up to here.
956
+ const onAnimationEnd = (event) => {
957
+ if (event.animationName.endsWith('ds-overlay-out')) {
958
+ finish();
959
+ }
960
+ };
961
+ const timer = setTimeout(finish, LEAVE_TIMEOUT_MS);
962
+ pane.addEventListener('animationend', onAnimationEnd);
963
+ pane.classList.add('ds-leaving');
964
+ }
965
+ /**
966
+ * Forward a portaled panel's public `--ds-*` override tokens from the component
967
+ * host onto the overlay pane. The pane is portaled into `document.body`, outside
968
+ * `:host`, so custom properties a consumer sets via `ds-x { … }` never inherit
969
+ * down to it. Only non-empty values are set, so an unset token still falls
970
+ * through to the panel's own `var(--ds-*, <default>)`. Call once per open, right
971
+ * after `overlay.create()`.
972
+ * @internal
973
+ */
974
+ function forwardOverlayTokens(overlayRef, host, tokens) {
975
+ const hostStyle = getComputedStyle(host);
976
+ const paneStyle = overlayRef.overlayElement.style;
977
+ for (const token of tokens) {
978
+ const value = hostStyle.getPropertyValue(token).trim();
979
+ if (value) {
980
+ paneStyle.setProperty(token, value);
981
+ }
982
+ }
983
+ // Roles resolve at :root, so every host has a value for them and copying it
984
+ // unconditionally would PIN it inline on the pane — an open panel would then
985
+ // ignore a theme switch until it was reopened. Forward only where the host
986
+ // actually overrides the root, which is the case the pane cannot see.
987
+ const rootStyle = getComputedStyle(host.ownerDocument.documentElement);
988
+ for (const token of ROLE_TOKENS) {
989
+ const value = hostStyle.getPropertyValue(token).trim();
990
+ if (value && value !== rootStyle.getPropertyValue(token).trim()) {
991
+ paneStyle.setProperty(token, value);
992
+ }
993
+ }
994
+ }
995
+ /** Read a CDK connection pair as the panel's placement. `overlayY` is the panel
996
+ * edge pinned to the trigger, so `top` means the panel hangs BELOW the trigger.
997
+ * @internal
998
+ */
999
+ function overlayPlacementOf(overlayY, overlayX) {
1000
+ if (overlayY === 'top') {
1001
+ return 'bottom';
1002
+ }
1003
+ if (overlayY === 'bottom') {
1004
+ return 'top';
1005
+ }
1006
+ if (overlayX === 'start') {
1007
+ return 'right';
1008
+ }
1009
+ return 'left';
1010
+ }
1011
+ /**
1012
+ * Prime a `ds-overlay-pane` for its enter animation. Call right after
1013
+ * `overlay.create()` — CDK applies the position in `afterNextRender`, so the
1014
+ * placement stamp still lands before the first painted frame. Until it does (or
1015
+ * with no strategy passed) the CSS default applies: entering from above.
1016
+ *
1017
+ * The subscription needs no teardown — disposing the overlay disposes the
1018
+ * strategy, which completes `positionChanges`.
1019
+ * @internal
1020
+ */
1021
+ function prepareOverlayEnter(overlayRef, host, positionStrategy) {
1022
+ forwardOverlayTokens(overlayRef, host, OVERLAY_MOTION_TOKENS);
1023
+ forwardOverlayTokens(overlayRef, host, DROPDOWN_PANEL_TOKENS);
1024
+ positionStrategy?.positionChanges.subscribe(({ connectionPair }) => {
1025
+ overlayRef.overlayElement.dataset['dsPlacement'] = overlayPlacementOf(connectionPair.overlayY, connectionPair.overlayX);
1026
+ });
1027
+ }
1028
+ /** Close a non-modal overlay on a pointer press outside it, EXCEPT when the press
1029
+ * lands on its trigger — so the trigger stays interactive (caret, re-focus) while
1030
+ * open. Use with `hasBackdrop: false` so hover/cursor/pointer reach the live page.
1031
+ * @internal
1032
+ */
1033
+ function closeOnOutsidePointer(overlayRef, isInsideTrigger, close) {
1034
+ overlayRef.outsidePointerEvents().subscribe((event) => {
1035
+ const target = event.target;
1036
+ if (target && isInsideTrigger(target)) {
1037
+ return;
1038
+ }
1039
+ close();
1040
+ });
1041
+ }
1042
+ /** Close a non-modal overlay when the page scrolls. CDK's scroll strategies only
1043
+ * observe `window` + registered `cdkScrollable`s, so they miss a plain
1044
+ * `overflow:auto` container (e.g. an app's scrolling `<main>`); this listens on
1045
+ * the document in the CAPTURE phase, which catches the non-bubbling `scroll`
1046
+ * event from ANY nested container. A scroll inside the panel itself is ignored.
1047
+ * @internal
1048
+ */
1049
+ function closeOnScroll(overlayRef, close) {
1050
+ const onScroll = (event) => {
1051
+ const target = event.target;
1052
+ if (target && overlayRef.overlayElement.contains(target)) {
1053
+ return;
1054
+ }
1055
+ // A form control scrolling its own text (e.g. typing past the visible edge
1056
+ // of a host-side filter input) never moves the panel's anchor — ignore it.
1057
+ if (target instanceof HTMLElement &&
1058
+ (target.tagName === 'INPUT' ||
1059
+ target.tagName === 'TEXTAREA' ||
1060
+ target.tagName === 'SELECT')) {
1061
+ return;
1062
+ }
1063
+ close();
1064
+ };
1065
+ const doc = overlayRef.overlayElement.ownerDocument;
1066
+ doc.addEventListener('scroll', onScroll, true);
1067
+ return () => doc.removeEventListener('scroll', onScroll, true);
1068
+ }
1069
+ /** True when keyboard focus currently sits inside the overlay pane. Read it
1070
+ * BEFORE disposing, to decide whether the close has to refocus the trigger
1071
+ * rather than strand focus on `<body>`. An outside-pointer close leaves focus on
1072
+ * the clicked element (mousedown moved it out of the pane first), so this
1073
+ * returns false there and focus is correctly left alone.
1074
+ * @internal
1075
+ */
1076
+ function focusIsInside(overlayRef) {
1077
+ const doc = overlayRef.overlayElement.ownerDocument;
1078
+ return overlayRef.overlayElement.contains(doc.activeElement);
1079
+ }
1080
+
1081
+ /**
1082
+ * Fills a strip below a picker panel's option list — a "create new" affordance
1083
+ * of your own, a count, a link, an apply button for a panel the user batches
1084
+ * choices in.
1085
+ *
1086
+ * Context: the same as the header slot — `count`, `total`, `query`.
1087
+ *
1088
+ * Like the header it sits OUTSIDE the `listbox` and does not scroll with the
1089
+ * options. Anything focusable you put here is reached by Tab from the panel, so
1090
+ * give it an accessible name.
1091
+ */
1092
+ class DsPanelFooterTemplateDirective {
1093
+ template = inject(TemplateRef);
1094
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsPanelFooterTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1095
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: DsPanelFooterTemplateDirective, isStandalone: true, selector: "[dsPanelFooterTemplate]", ngImport: i0 });
1096
+ }
1097
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsPanelFooterTemplateDirective, decorators: [{
1098
+ type: Directive,
1099
+ args: [{
1100
+ selector: '[dsPanelFooterTemplate]',
1101
+ standalone: true,
1102
+ }]
1103
+ }] });
1104
+
1105
+ /**
1106
+ * Fills a strip above a picker panel's option list — "3 of 40 selected", a
1107
+ * "clear all" button, a hint, a link to a fuller search.
1108
+ *
1109
+ * Context: `count` is how many options are visible after filtering, `total` how
1110
+ * many were given, and `query` the text that narrowed them.
1111
+ *
1112
+ * It sits OUTSIDE the `listbox`, so whatever you put here is not counted as an
1113
+ * option and does not break a screen reader's "N of M" position reporting. It
1114
+ * also stays put while the list scrolls under it — the panel clips and the list
1115
+ * is the scroller.
1116
+ */
1117
+ class DsPanelHeaderTemplateDirective {
1118
+ template = inject(TemplateRef);
1119
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsPanelHeaderTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1120
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: DsPanelHeaderTemplateDirective, isStandalone: true, selector: "[dsPanelHeaderTemplate]", ngImport: i0 });
1121
+ }
1122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsPanelHeaderTemplateDirective, decorators: [{
1123
+ type: Directive,
1124
+ args: [{
1125
+ selector: '[dsPanelHeaderTemplate]',
1126
+ standalone: true,
1127
+ }]
1128
+ }] });
1129
+
1130
+ /**
1131
+ * Announces how many options survived the filter.
1132
+ *
1133
+ * Deliberately NOT a row inside the listbox. A live region there is an invalid
1134
+ * child and, worse, a region created together with its text is the case screen
1135
+ * readers reliably do not announce — there is no content CHANGE to fire on. The
1136
+ * node here is created once, empty, and only its text changes.
1137
+ *
1138
+ * The text is English, which is the same debt every other library-invented string
1139
+ * in this package carries (see the localization item in `docs/todo.md`). It is a
1140
+ * count, so it is the cheapest of them to swap once a provider lands.
1141
+ * @internal
1142
+ */
1143
+ function announceOptionCount(count, active) {
1144
+ const documentRef = inject(DOCUMENT);
1145
+ const region = documentRef.createElement('div');
1146
+ region.setAttribute('aria-live', 'polite');
1147
+ region.setAttribute('aria-atomic', 'true');
1148
+ // Off-screen rather than `display: none`, which would take it out of the
1149
+ // accessibility tree and announce nothing at all.
1150
+ region.style.cssText =
1151
+ 'position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;margin:-1px;padding:0';
1152
+ documentRef.body.appendChild(region);
1153
+ effect((onCleanup) => {
1154
+ onCleanup(() => region.remove());
1155
+ if (!active()) {
1156
+ region.textContent = '';
1157
+ return;
1158
+ }
1159
+ const total = count();
1160
+ region.textContent =
1161
+ total === 0
1162
+ ? 'No results'
1163
+ : total === 1
1164
+ ? '1 result'
1165
+ : `${total} results`;
1166
+ });
1167
+ }
1168
+
1169
+ /**
1170
+ * Replaces the CONTENTS of a picker's trigger — the chips, the value, the
1171
+ * placeholder — with your own markup. The trigger ELEMENT stays library-owned,
1172
+ * so `aria-haspopup`, `aria-expanded`, `aria-controls`, the roving
1173
+ * `aria-activedescendant` and the Enter/Space/ArrowDown/Escape handling cannot
1174
+ * be lost with it.
1175
+ *
1176
+ * ```html
1177
+ * <ds-multi-select [options]="labels()" [(value)]="picked">
1178
+ * <ng-template dsPickerTrigger let-count="count">
1179
+ * Labels @if (count) { <ds-badge [count]="count" /> }
1180
+ * </ng-template>
1181
+ * </ds-multi-select>
1182
+ * ```
1183
+ *
1184
+ * Context: `$implicit` and `selected` are the selected options, `count` their
1185
+ * number, `open` whether the panel is showing, `disabled` the control's state.
1186
+ *
1187
+ * A projected template WINS over `triggerDisplay` — that input is then not read
1188
+ * at all, so there is no "compact plus a template" combination to explain.
1189
+ */
1190
+ class DsPickerTriggerDirective {
1191
+ template = inject(TemplateRef);
1192
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsPickerTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1193
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: DsPickerTriggerDirective, isStandalone: true, selector: "[dsPickerTrigger]", ngImport: i0 });
1194
+ }
1195
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsPickerTriggerDirective, decorators: [{
1196
+ type: Directive,
1197
+ args: [{
1198
+ selector: '[dsPickerTrigger]',
1199
+ standalone: true,
1200
+ }]
1201
+ }] });
1202
+
1203
+ /**
1204
+ * Dev-only guard for a component that DROPS whatever is projected into it, so the
1205
+ * author gets a warning instead of silence — there is no compile-time signal for
1206
+ * content a component chooses to ignore. Put it on a probe around the
1207
+ * `<ng-content>`, gated on dev mode so production renders no extra node:
1208
+ *
1209
+ * ```html
1210
+ * @if (devMode) {
1211
+ * <span dsProjectionDropped="ds-filter-bar"><ng-content></ng-content></span>
1212
+ * }
1213
+ * ```
1214
+ *
1215
+ * It is NOT projection support: the probe exists so the warning can see that
1216
+ * content arrived, and then hides it.
1217
+ *
1218
+ * `ds-filter-bar` is the only host today.
1219
+ *
1220
+ * `reason` replaces the default `[label]` wording for a host that drops content
1221
+ * for a different reason — `ds-filter-bar` drops anything that carries neither of
1222
+ * its slot attributes.
1223
+ * @internal
1224
+ */
1225
+ class ProjectionDroppedDirective {
1226
+ /** The host component's selector, named in the warning. */
1227
+ dsProjectionDropped = input.required(...(ngDevMode ? [{ debugName: "dsProjectionDropped" }] : /* istanbul ignore next */ []));
1228
+ /** Overrides the `[label]` explanation for a host that drops content for
1229
+ * another reason. Ends up after "renders nothing — ". */
1230
+ reason = input('', ...(ngDevMode ? [{ debugName: "reason" }] : /* istanbul ignore next */ []));
1231
+ probe = inject((ElementRef));
1232
+ constructor() {
1233
+ afterNextRender(() => {
1234
+ if (!this.probe.nativeElement.textContent?.trim()) {
1235
+ return;
1236
+ }
1237
+ const selector = this.dsProjectionDropped();
1238
+ const reason = this.reason() ||
1239
+ `the caption comes from the [label] input only, so \`<${selector}>Some text</${selector}>\` shows no caption at all. Move the text into [label].`;
1240
+ console.warn(`[${selector}] Projected content renders nothing — ${reason}`);
1241
+ });
1242
+ }
1243
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ProjectionDroppedDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1244
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.22", type: ProjectionDroppedDirective, isStandalone: true, selector: "[dsProjectionDropped]", inputs: { dsProjectionDropped: { classPropertyName: "dsProjectionDropped", publicName: "dsProjectionDropped", isSignal: true, isRequired: true, transformFunction: null }, reason: { classPropertyName: "reason", publicName: "reason", isSignal: true, isRequired: false, transformFunction: null } }, host: { styleAttribute: "display: none" }, ngImport: i0 });
1245
+ }
1246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ProjectionDroppedDirective, decorators: [{
1247
+ type: Directive,
1248
+ args: [{
1249
+ selector: '[dsProjectionDropped]',
1250
+ standalone: true,
1251
+ host: { style: 'display: none' },
1252
+ }]
1253
+ }], ctorParameters: () => [], propDecorators: { dsProjectionDropped: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsProjectionDropped", required: true }] }], reason: [{ type: i0.Input, args: [{ isSignal: true, alias: "reason", required: false }] }] } });
1254
+
1255
+ /**
1256
+ * Keeps the keyboard cursor's row visible inside a scrolling panel.
1257
+ *
1258
+ * KEYBOARD ONLY, and that is the load-bearing part. The option rows also set the
1259
+ * active index on `mouseenter`, so a version that reacted to every change pulled
1260
+ * a partially visible row up under the pointer while the user was reading with
1261
+ * the mouse.
1262
+ *
1263
+ * Rows are looked up by id rather than through a `viewChildren` query because they
1264
+ * live in a portaled template — and the id is the one `aria-activedescendant`
1265
+ * already points at, so a failed lookup means that reference is broken too.
1266
+ * @internal
1267
+ */
1268
+ function scrollActiveOptionIntoView(activeDescendantId, enabled, armed) {
1269
+ const documentRef = inject(DOCUMENT);
1270
+ afterRenderEffect(() => {
1271
+ const id = activeDescendantId();
1272
+ if (!enabled() || !armed() || !id) {
1273
+ return;
1274
+ }
1275
+ documentRef
1276
+ .getElementById(id)
1277
+ ?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
1278
+ });
1279
+ }
1280
+
1281
+ /** Showcase-only: renders the component's open/overlay surface inline in normal
1282
+ * flow instead of its real overlay mechanics (for static docs specimens).
1283
+ * Not part of the production contract. */
1284
+ class DsStaticPreview {
1285
+ staticPreview = input(false, { ...(ngDevMode ? { debugName: "staticPreview" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
1286
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsStaticPreview, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1287
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.22", type: DsStaticPreview, isStandalone: true, inputs: { staticPreview: { classPropertyName: "staticPreview", publicName: "staticPreview", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
1288
+ }
1289
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: DsStaticPreview, decorators: [{
1290
+ type: Directive,
1291
+ args: [{ standalone: true }]
1292
+ }], propDecorators: { staticPreview: [{ type: i0.Input, args: [{ isSignal: true, alias: "staticPreview", required: false }] }] } });
1293
+
1294
+ /**
1295
+ * The jump-to-option-by-typing that a native `<select>` has and ours did not.
1296
+ *
1297
+ * Typing "ba" on a closed control moves to the first option starting with "ba",
1298
+ * and keeps extending the buffer while the user keeps typing. The timeout is what
1299
+ * separates "ba" from two separate "b" and "a" presses; 500ms is the interval
1300
+ * every native control and APG example uses.
1301
+ */
1302
+ const RESET_AFTER_MS = 500;
1303
+ /** @internal */
1304
+ function createTypeAhead() {
1305
+ let buffer = '';
1306
+ let last = 0;
1307
+ return {
1308
+ match(key, labels, from) {
1309
+ // A modifier combination and any named key ("Enter", "ArrowDown") are not
1310
+ // text; only a single printable character extends the buffer.
1311
+ if (key.length !== 1 || !/\S/.test(key)) {
1312
+ return -1;
1313
+ }
1314
+ const now = Date.now();
1315
+ buffer = now - last > RESET_AFTER_MS ? key : buffer + key;
1316
+ last = now;
1317
+ const query = buffer.toLowerCase();
1318
+ const cycling = buffer.length > 1 &&
1319
+ [...buffer].every((character) => character === buffer[0]);
1320
+ const needle = cycling ? buffer[0].toLowerCase() : query;
1321
+ const start = cycling || buffer.length === 1 ? from + 1 : 0;
1322
+ for (let offset = 0; offset < labels.length; offset += 1) {
1323
+ const index = (start + offset + labels.length) % labels.length;
1324
+ if (labels[index].toLowerCase().startsWith(needle)) {
1325
+ return index;
1326
+ }
1327
+ }
1328
+ return -1;
1329
+ },
1330
+ };
1331
+ }
1332
+
1333
+ /**
1334
+ * Generated bundle index. Do not edit.
1335
+ */
1336
+
1337
+ export { DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, announceOptionCount, chipFit, closeOnOutsidePointer, closeOnScroll, createTypeAhead, disposeWithLeave, dropdownOverlay, focusIsInside, forwardOverlayTokens, nextControlId, overlayPlacementOf, prepareOverlayEnter, resolveBrandValue, resolveFieldMessage, scrollActiveOptionIntoView, trimmedText, valueControlBridge };
1338
+ //# sourceMappingURL=ids-group-ltd-ids-design-system-components.mjs.map