ng-primitives 0.89.0 → 0.91.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 (389) hide show
  1. package/a11y/index.d.ts +98 -3
  2. package/accordion/index.d.ts +361 -7
  3. package/ai/index.d.ts +238 -16
  4. package/autofill/index.d.ts +62 -1
  5. package/avatar/index.d.ts +155 -5
  6. package/breadcrumbs/index.d.ts +200 -7
  7. package/button/index.d.ts +39 -3
  8. package/checkbox/index.d.ts +137 -2
  9. package/combobox/index.d.ts +414 -8
  10. package/common/index.d.ts +31 -4
  11. package/date-picker/index.d.ts +714 -18
  12. package/date-time/index.d.ts +289 -3
  13. package/date-time-luxon/index.d.ts +31 -1
  14. package/dialog/index.d.ts +253 -9
  15. package/fesm2022/ng-primitives-a11y.mjs +42 -58
  16. package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
  17. package/fesm2022/ng-primitives-accordion.mjs +249 -225
  18. package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
  19. package/fesm2022/ng-primitives-ai.mjs +61 -58
  20. package/fesm2022/ng-primitives-ai.mjs.map +1 -1
  21. package/fesm2022/ng-primitives-autofill.mjs +55 -38
  22. package/fesm2022/ng-primitives-autofill.mjs.map +1 -1
  23. package/fesm2022/ng-primitives-avatar.mjs +105 -145
  24. package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
  25. package/fesm2022/ng-primitives-breadcrumbs.mjs +106 -49
  26. package/fesm2022/ng-primitives-breadcrumbs.mjs.map +1 -1
  27. package/fesm2022/ng-primitives-button.mjs +20 -42
  28. package/fesm2022/ng-primitives-button.mjs.map +1 -1
  29. package/fesm2022/ng-primitives-checkbox.mjs +110 -84
  30. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  31. package/fesm2022/ng-primitives-combobox.mjs +82 -78
  32. package/fesm2022/ng-primitives-combobox.mjs.map +1 -1
  33. package/fesm2022/ng-primitives-common.mjs +5 -5
  34. package/fesm2022/ng-primitives-common.mjs.map +1 -1
  35. package/fesm2022/ng-primitives-date-picker.mjs +119 -112
  36. package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
  37. package/fesm2022/ng-primitives-dialog.mjs +48 -47
  38. package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
  39. package/fesm2022/ng-primitives-file-upload.mjs +56 -48
  40. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  41. package/fesm2022/ng-primitives-focus-trap.mjs +9 -8
  42. package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
  43. package/fesm2022/ng-primitives-form-field.mjs +97 -64
  44. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  45. package/fesm2022/ng-primitives-input-otp.mjs +44 -43
  46. package/fesm2022/ng-primitives-input-otp.mjs.map +1 -1
  47. package/fesm2022/ng-primitives-input.mjs +38 -54
  48. package/fesm2022/ng-primitives-input.mjs.map +1 -1
  49. package/fesm2022/ng-primitives-interactions.mjs +59 -54
  50. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  51. package/fesm2022/ng-primitives-internal.mjs +14 -14
  52. package/fesm2022/ng-primitives-internal.mjs.map +1 -1
  53. package/fesm2022/ng-primitives-listbox.mjs +52 -50
  54. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  55. package/fesm2022/ng-primitives-menu.mjs +86 -72
  56. package/fesm2022/ng-primitives-menu.mjs.map +1 -1
  57. package/fesm2022/ng-primitives-meter.mjs +38 -35
  58. package/fesm2022/ng-primitives-meter.mjs.map +1 -1
  59. package/fesm2022/ng-primitives-pagination.mjs +83 -74
  60. package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
  61. package/fesm2022/ng-primitives-popover.mjs +67 -60
  62. package/fesm2022/ng-primitives-popover.mjs.map +1 -1
  63. package/fesm2022/ng-primitives-portal.mjs +11 -12
  64. package/fesm2022/ng-primitives-portal.mjs.map +1 -1
  65. package/fesm2022/ng-primitives-progress.mjs +43 -40
  66. package/fesm2022/ng-primitives-progress.mjs.map +1 -1
  67. package/fesm2022/ng-primitives-radio.mjs +35 -33
  68. package/fesm2022/ng-primitives-radio.mjs.map +1 -1
  69. package/fesm2022/ng-primitives-resize.mjs +4 -4
  70. package/fesm2022/ng-primitives-resize.mjs.map +1 -1
  71. package/fesm2022/ng-primitives-roving-focus.mjs +264 -237
  72. package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
  73. package/fesm2022/ng-primitives-search.mjs +9 -9
  74. package/fesm2022/ng-primitives-search.mjs.map +1 -1
  75. package/fesm2022/ng-primitives-select.mjs +73 -69
  76. package/fesm2022/ng-primitives-select.mjs.map +1 -1
  77. package/fesm2022/ng-primitives-separator.mjs +7 -7
  78. package/fesm2022/ng-primitives-separator.mjs.map +1 -1
  79. package/fesm2022/ng-primitives-slider.mjs +287 -253
  80. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  81. package/fesm2022/ng-primitives-state.mjs +173 -3
  82. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  83. package/fesm2022/ng-primitives-switch.mjs +105 -101
  84. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  85. package/fesm2022/ng-primitives-tabs.mjs +48 -43
  86. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  87. package/fesm2022/ng-primitives-textarea.mjs +33 -41
  88. package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
  89. package/fesm2022/ng-primitives-toast.mjs +19 -19
  90. package/fesm2022/ng-primitives-toast.mjs.map +1 -1
  91. package/fesm2022/ng-primitives-toggle-group.mjs +160 -159
  92. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  93. package/fesm2022/ng-primitives-toggle.mjs +81 -68
  94. package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
  95. package/fesm2022/ng-primitives-toolbar.mjs +31 -40
  96. package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
  97. package/fesm2022/ng-primitives-tooltip.mjs +68 -60
  98. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  99. package/fesm2022/ng-primitives-utils.mjs +50 -37
  100. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  101. package/file-upload/index.d.ts +148 -4
  102. package/focus-trap/index.d.ts +98 -2
  103. package/form-field/index.d.ts +266 -7
  104. package/index.d.ts +2 -2
  105. package/input/index.d.ts +84 -2
  106. package/input-otp/index.d.ts +247 -4
  107. package/interactions/index.d.ts +295 -16
  108. package/internal/index.d.ts +201 -10
  109. package/listbox/index.d.ts +209 -6
  110. package/menu/index.d.ts +297 -8
  111. package/meter/index.d.ts +67 -6
  112. package/package.json +28 -28
  113. package/pagination/index.d.ts +211 -7
  114. package/popover/index.d.ts +224 -5
  115. package/portal/index.d.ts +389 -6
  116. package/progress/index.d.ts +124 -6
  117. package/radio/index.d.ts +140 -5
  118. package/resize/index.d.ts +29 -1
  119. package/roving-focus/index.d.ts +154 -4
  120. package/schematics/ng-add/schema.d.ts +0 -1
  121. package/schematics/ng-generate/__snapshots__/index.spec.ts.snap +1 -1
  122. package/schematics/ng-generate/templates/checkbox/checkbox.__fileSuffix@dasherize__.ts.template +2 -2
  123. package/schematics/ng-generate/templates/slider/slider.__fileSuffix@dasherize__.ts.template +6 -3
  124. package/schematics/ng-generate/templates/switch/switch.__fileSuffix@dasherize__.ts.template +2 -2
  125. package/schematics/ng-generate/templates/toggle/toggle.__fileSuffix@dasherize__.ts.template +2 -2
  126. package/schematics/ng-generate/templates/toggle-group/toggle-group.__fileSuffix@dasherize__.ts.template +2 -2
  127. package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +1 -1
  128. package/search/index.d.ts +66 -3
  129. package/select/index.d.ts +341 -8
  130. package/separator/index.d.ts +30 -2
  131. package/slider/index.d.ts +471 -10
  132. package/state/index.d.ts +68 -11
  133. package/switch/index.d.ts +151 -3
  134. package/tabs/index.d.ts +222 -7
  135. package/textarea/index.d.ts +87 -2
  136. package/toast/index.d.ts +219 -4
  137. package/toggle/index.d.ts +98 -2
  138. package/toggle-group/index.d.ts +168 -5
  139. package/toolbar/index.d.ts +43 -2
  140. package/tooltip/index.d.ts +214 -5
  141. package/utils/index.d.ts +170 -9
  142. package/a11y/active-descendant/active-descendant.d.ts +0 -42
  143. package/a11y/visually-hidden/visually-hidden-state.d.ts +0 -17
  144. package/a11y/visually-hidden/visually-hidden.d.ts +0 -50
  145. package/accordion/accordion/accordion-state.d.ts +0 -17
  146. package/accordion/accordion/accordion.d.ts +0 -50
  147. package/accordion/accordion-content/accordion-content.d.ts +0 -40
  148. package/accordion/accordion-item/accordion-item-state.d.ts +0 -17
  149. package/accordion/accordion-item/accordion-item.d.ts +0 -50
  150. package/accordion/accordion-trigger/accordion-trigger.d.ts +0 -31
  151. package/accordion/config/accordion-config.d.ts +0 -32
  152. package/ai/prompt-composer/prompt-composer-state.d.ts +0 -17
  153. package/ai/prompt-composer/prompt-composer.d.ts +0 -23
  154. package/ai/prompt-composer-dictation/prompt-composer-dictation-state.d.ts +0 -17
  155. package/ai/prompt-composer-dictation/prompt-composer-dictation.d.ts +0 -29
  156. package/ai/prompt-composer-input/prompt-composer-input-state.d.ts +0 -17
  157. package/ai/prompt-composer-input/prompt-composer-input.d.ts +0 -16
  158. package/ai/prompt-composer-submit/prompt-composer-submit-state.d.ts +0 -17
  159. package/ai/prompt-composer-submit/prompt-composer-submit.d.ts +0 -15
  160. package/ai/thread/thread-state.d.ts +0 -17
  161. package/ai/thread/thread.d.ts +0 -23
  162. package/ai/thread-message/thread-message-state.d.ts +0 -17
  163. package/ai/thread-message/thread-message.d.ts +0 -11
  164. package/ai/thread-suggestion/thread-suggestion-state.d.ts +0 -17
  165. package/ai/thread-suggestion/thread-suggestion.d.ts +0 -14
  166. package/ai/thread-viewport/thread-viewport-state.d.ts +0 -17
  167. package/ai/thread-viewport/thread-viewport.d.ts +0 -34
  168. package/autofill/autofill/autofill.d.ts +0 -19
  169. package/avatar/avatar/avatar-state.d.ts +0 -17
  170. package/avatar/avatar/avatar.d.ts +0 -29
  171. package/avatar/avatar-fallback/avatar-fallback.d.ts +0 -37
  172. package/avatar/avatar-image/avatar-image.d.ts +0 -27
  173. package/avatar/config/avatar-config.d.ts +0 -21
  174. package/breadcrumbs/breadcrumb-ellipsis/breadcrumb-ellipsis.d.ts +0 -8
  175. package/breadcrumbs/breadcrumb-item/breadcrumb-item.d.ts +0 -8
  176. package/breadcrumbs/breadcrumb-link/breadcrumb-link.d.ts +0 -9
  177. package/breadcrumbs/breadcrumb-list/breadcrumb-list.d.ts +0 -8
  178. package/breadcrumbs/breadcrumb-page/breadcrumb-page.d.ts +0 -8
  179. package/breadcrumbs/breadcrumb-separator/breadcrumb-separator.d.ts +0 -8
  180. package/breadcrumbs/breadcrumbs/breadcrumbs.d.ts +0 -8
  181. package/button/button/button-state.d.ts +0 -17
  182. package/button/button/button.d.ts +0 -15
  183. package/button/button/setup-button.d.ts +0 -15
  184. package/checkbox/checkbox/checkbox-state.d.ts +0 -17
  185. package/checkbox/checkbox/checkbox.d.ts +0 -45
  186. package/combobox/combobox/combobox-state.d.ts +0 -17
  187. package/combobox/combobox/combobox.d.ts +0 -222
  188. package/combobox/combobox-button/combobox-button.d.ts +0 -18
  189. package/combobox/combobox-dropdown/combobox-dropdown.d.ts +0 -21
  190. package/combobox/combobox-input/combobox-input.d.ts +0 -36
  191. package/combobox/combobox-option/combobox-option.d.ts +0 -51
  192. package/combobox/combobox-portal/combobox-portal.d.ts +0 -37
  193. package/combobox/config/combobox-config.d.ts +0 -28
  194. package/combobox/utils.d.ts +0 -9
  195. package/common/header/header-token.d.ts +0 -10
  196. package/common/header/header.d.ts +0 -13
  197. package/common/types/orientation.d.ts +0 -1
  198. package/common/types/selection.d.ts +0 -1
  199. package/date-picker/config/date-picker-config.d.ts +0 -22
  200. package/date-picker/date-picker/date-picker-first-day-of-week.d.ts +0 -29
  201. package/date-picker/date-picker/date-picker-state.d.ts +0 -9
  202. package/date-picker/date-picker/date-picker.d.ts +0 -129
  203. package/date-picker/date-picker-cell/date-picker-cell.d.ts +0 -20
  204. package/date-picker/date-picker-cell-render/date-picker-cell-render-token.d.ts +0 -12
  205. package/date-picker/date-picker-cell-render/date-picker-cell-render.d.ts +0 -39
  206. package/date-picker/date-picker-date-button/date-picker-date-button-token.d.ts +0 -7
  207. package/date-picker/date-picker-date-button/date-picker-date-button.d.ts +0 -114
  208. package/date-picker/date-picker-grid/date-picker-grid.d.ts +0 -16
  209. package/date-picker/date-picker-label/date-picker-label-token.d.ts +0 -7
  210. package/date-picker/date-picker-label/date-picker-label.d.ts +0 -20
  211. package/date-picker/date-picker-next-month/date-picker-next-month.d.ts +0 -34
  212. package/date-picker/date-picker-previous-month/date-picker-previous-month.d.ts +0 -34
  213. package/date-picker/date-picker-row-render/date-picker-row-render-token.d.ts +0 -12
  214. package/date-picker/date-picker-row-render/date-picker-row-render.d.ts +0 -65
  215. package/date-picker/date-range-picker/date-range-picker-state.d.ts +0 -19
  216. package/date-picker/date-range-picker/date-range-picker.d.ts +0 -149
  217. package/date-time/date-adapter/date-adapter-token.d.ts +0 -11
  218. package/date-time/date-adapter/date-adapter.d.ts +0 -169
  219. package/date-time/native-date-adapter/native-date-adapter.d.ts +0 -106
  220. package/date-time-luxon/luxon-date-adapter/luxon-date-adapter.d.ts +0 -28
  221. package/dialog/config/dialog-config.d.ts +0 -41
  222. package/dialog/dialog/dialog-ref.d.ts +0 -45
  223. package/dialog/dialog/dialog-state.d.ts +0 -17
  224. package/dialog/dialog/dialog.d.ts +0 -37
  225. package/dialog/dialog/dialog.service.d.ts +0 -69
  226. package/dialog/dialog-description/dialog-description.d.ts +0 -12
  227. package/dialog/dialog-overlay/dialog-overlay.d.ts +0 -16
  228. package/dialog/dialog-title/dialog-title.d.ts +0 -12
  229. package/dialog/dialog-trigger/dialog-trigger.d.ts +0 -26
  230. package/file-upload/file-dropzone/file-drop-filter.d.ts +0 -2
  231. package/file-upload/file-dropzone/file-dropzone-state.d.ts +0 -17
  232. package/file-upload/file-dropzone/file-dropzone.d.ts +0 -55
  233. package/file-upload/file-upload/file-upload-state.d.ts +0 -17
  234. package/file-upload/file-upload/file-upload.d.ts +0 -72
  235. package/focus-trap/focus-trap/focus-trap-state.d.ts +0 -17
  236. package/focus-trap/focus-trap/focus-trap.d.ts +0 -85
  237. package/form-field/description/description.d.ts +0 -17
  238. package/form-field/error/error.d.ts +0 -32
  239. package/form-field/form-control/form-control-state.d.ts +0 -17
  240. package/form-field/form-control/form-control.d.ts +0 -44
  241. package/form-field/form-field/form-field-state.d.ts +0 -17
  242. package/form-field/form-field/form-field.d.ts +0 -119
  243. package/form-field/label/label.d.ts +0 -30
  244. package/input/input/input-state.d.ts +0 -17
  245. package/input/input/input.d.ts +0 -34
  246. package/input-otp/input-otp/input-otp-state.d.ts +0 -17
  247. package/input-otp/input-otp/input-otp.d.ts +0 -133
  248. package/input-otp/input-otp-input/input-otp-input.d.ts +0 -57
  249. package/input-otp/input-otp-slot/input-otp-slot.d.ts +0 -45
  250. package/interactions/config/interactions-config.d.ts +0 -30
  251. package/interactions/focus/focus-interaction.d.ts +0 -14
  252. package/interactions/focus/focus.d.ts +0 -19
  253. package/interactions/focus-visible/focus-visible-interaction.d.ts +0 -12
  254. package/interactions/focus-visible/focus-visible.d.ts +0 -19
  255. package/interactions/hover/hover-interaction.d.ts +0 -17
  256. package/interactions/hover/hover.d.ts +0 -31
  257. package/interactions/interactions/interactions.d.ts +0 -20
  258. package/interactions/move/move.d.ts +0 -114
  259. package/interactions/press/press-interaction.d.ts +0 -14
  260. package/interactions/press/press.d.ts +0 -26
  261. package/internal/exit-animation/exit-animation-manager.d.ts +0 -17
  262. package/internal/exit-animation/exit-animation.d.ts +0 -26
  263. package/internal/signals/explicit-effect.d.ts +0 -19
  264. package/internal/style-injector/style-injector.d.ts +0 -44
  265. package/internal/utilities/dom-removal.d.ts +0 -6
  266. package/internal/utilities/element-ref.d.ts +0 -6
  267. package/internal/utilities/mutation-observer.d.ts +0 -39
  268. package/internal/utilities/overflow.d.ts +0 -13
  269. package/internal/utilities/resize.d.ts +0 -31
  270. package/internal/utilities/scrolling.d.ts +0 -1
  271. package/listbox/listbox/listbox-state.d.ts +0 -17
  272. package/listbox/listbox/listbox.d.ts +0 -101
  273. package/listbox/listbox-header/listbox-header.d.ts +0 -9
  274. package/listbox/listbox-option/listbox-option.d.ts +0 -68
  275. package/listbox/listbox-section/listbox-section.d.ts +0 -9
  276. package/listbox/listbox-trigger/listbox-trigger.d.ts +0 -13
  277. package/menu/config/menu-config.d.ts +0 -44
  278. package/menu/menu/menu-token.d.ts +0 -11
  279. package/menu/menu/menu.d.ts +0 -22
  280. package/menu/menu-item/menu-item.d.ts +0 -30
  281. package/menu/menu-trigger/menu-trigger-state.d.ts +0 -17
  282. package/menu/menu-trigger/menu-trigger.d.ts +0 -98
  283. package/menu/submenu-trigger/submenu-trigger-state.d.ts +0 -17
  284. package/menu/submenu-trigger/submenu-trigger.d.ts +0 -88
  285. package/meter/meter/meter-state.d.ts +0 -17
  286. package/meter/meter/meter.d.ts +0 -27
  287. package/meter/meter-indicator/meter-indicator.d.ts +0 -7
  288. package/meter/meter-label/meter-label.d.ts +0 -10
  289. package/meter/meter-track/meter-track.d.ts +0 -5
  290. package/meter/meter-value/meter-value.d.ts +0 -5
  291. package/pagination/pagination/pagination-state.d.ts +0 -17
  292. package/pagination/pagination/pagination.d.ts +0 -45
  293. package/pagination/pagination-button/pagination-button.d.ts +0 -39
  294. package/pagination/pagination-first/pagination-first.d.ts +0 -28
  295. package/pagination/pagination-last/pagination-last.d.ts +0 -28
  296. package/pagination/pagination-next/pagination-next.d.ts +0 -31
  297. package/pagination/pagination-previous/pagination-previous.d.ts +0 -31
  298. package/popover/config/popover-config.d.ts +0 -64
  299. package/popover/popover/popover.d.ts +0 -18
  300. package/popover/popover-arrow/popover-arrow.d.ts +0 -6
  301. package/popover/popover-trigger/popover-trigger-state.d.ts +0 -19
  302. package/popover/popover-trigger/popover-trigger.d.ts +0 -128
  303. package/portal/offset.d.ts +0 -39
  304. package/portal/overlay-arrow.d.ts +0 -1
  305. package/portal/overlay-token.d.ts +0 -12
  306. package/portal/overlay.d.ts +0 -214
  307. package/portal/portal.d.ts +0 -94
  308. package/portal/scroll-strategy.d.ts +0 -23
  309. package/progress/progress/progress-state.d.ts +0 -17
  310. package/progress/progress/progress.d.ts +0 -61
  311. package/progress/progress-indicator/progress-indicator.d.ts +0 -17
  312. package/progress/progress-label/progress-label.d.ts +0 -14
  313. package/progress/progress-track/progress-track.d.ts +0 -9
  314. package/progress/progress-value/progress-value.d.ts +0 -9
  315. package/radio/radio-group/radio-group-state.d.ts +0 -18
  316. package/radio/radio-group/radio-group.d.ts +0 -54
  317. package/radio/radio-indicator/radio-indicator.d.ts +0 -21
  318. package/radio/radio-item/radio-item-state.d.ts +0 -18
  319. package/radio/radio-item/radio-item.d.ts +0 -45
  320. package/resize/resize/resize.d.ts +0 -26
  321. package/roving-focus/roving-focus-group/roving-focus-group-state.d.ts +0 -17
  322. package/roving-focus/roving-focus-group/roving-focus-group-token.d.ts +0 -21
  323. package/roving-focus/roving-focus-group/roving-focus-group.d.ts +0 -94
  324. package/roving-focus/roving-focus-item/roving-focus-item.d.ts +0 -53
  325. package/search/search/search-state.d.ts +0 -17
  326. package/search/search/search.d.ts +0 -36
  327. package/search/search-clear/search-clear.d.ts +0 -16
  328. package/select/config/select-config.d.ts +0 -28
  329. package/select/native-select/native-select-state.d.ts +0 -17
  330. package/select/native-select/native-select.d.ts +0 -22
  331. package/select/select/select-state.d.ts +0 -17
  332. package/select/select/select.d.ts +0 -172
  333. package/select/select-dropdown/select-dropdown.d.ts +0 -17
  334. package/select/select-option/select-option.d.ts +0 -51
  335. package/select/select-portal/select-portal.d.ts +0 -37
  336. package/separator/config/separator-config.d.ts +0 -22
  337. package/separator/separator/separator.d.ts +0 -11
  338. package/slider/range-slider/range-slider/range-slider-state.d.ts +0 -17
  339. package/slider/range-slider/range-slider/range-slider.d.ts +0 -115
  340. package/slider/range-slider/range-slider-range/range-slider-range.d.ts +0 -12
  341. package/slider/range-slider/range-slider-thumb/range-slider-thumb.d.ts +0 -44
  342. package/slider/range-slider/range-slider-track/range-slider-track.d.ts +0 -22
  343. package/slider/slider/slider-state.d.ts +0 -17
  344. package/slider/slider/slider.d.ts +0 -58
  345. package/slider/slider-range/slider-range.d.ts +0 -12
  346. package/slider/slider-thumb/slider-thumb.d.ts +0 -29
  347. package/slider/slider-track/slider-track.d.ts +0 -22
  348. package/switch/switch/switch-state.d.ts +0 -17
  349. package/switch/switch/switch.d.ts +0 -49
  350. package/switch/switch-thumb/switch-thumb.d.ts +0 -13
  351. package/tabs/config/tabs-config.d.ts +0 -32
  352. package/tabs/tab-button/tab-button.d.ts +0 -59
  353. package/tabs/tab-list/tab-list.d.ts +0 -12
  354. package/tabs/tab-panel/tab-panel-token.d.ts +0 -8
  355. package/tabs/tab-panel/tab-panel.d.ts +0 -38
  356. package/tabs/tabset/tabset-state.d.ts +0 -17
  357. package/tabs/tabset/tabset.d.ts +0 -71
  358. package/textarea/textarea/textarea-state.d.ts +0 -17
  359. package/textarea/textarea/textarea.d.ts +0 -19
  360. package/toast/config/toast-config.d.ts +0 -70
  361. package/toast/toast/toast-context.d.ts +0 -3
  362. package/toast/toast/toast-manager.d.ts +0 -49
  363. package/toast/toast/toast-options.d.ts +0 -34
  364. package/toast/toast/toast-timer.d.ts +0 -14
  365. package/toast/toast/toast.d.ts +0 -72
  366. package/toggle/toggle/toggle-state.d.ts +0 -17
  367. package/toggle/toggle/toggle.d.ts +0 -44
  368. package/toggle-group/config/toggle-group-config.d.ts +0 -32
  369. package/toggle-group/toggle-group/toggle-group-state.d.ts +0 -17
  370. package/toggle-group/toggle-group/toggle-group.d.ts +0 -64
  371. package/toggle-group/toggle-group-item/toggle-group-item-state.d.ts +0 -17
  372. package/toggle-group/toggle-group-item/toggle-group-item.d.ts +0 -34
  373. package/toolbar/toolbar/toolbar-state.d.ts +0 -17
  374. package/toolbar/toolbar/toolbar.d.ts +0 -20
  375. package/tooltip/config/tooltip-config.d.ts +0 -59
  376. package/tooltip/tooltip/tooltip.d.ts +0 -17
  377. package/tooltip/tooltip-arrow/tooltip-arrow.d.ts +0 -6
  378. package/tooltip/tooltip-text-content/tooltip-text-content.component.d.ts +0 -14
  379. package/tooltip/tooltip-trigger/tooltip-trigger-state.d.ts +0 -17
  380. package/tooltip/tooltip-trigger/tooltip-trigger.d.ts +0 -126
  381. package/utils/forms/providers.d.ts +0 -6
  382. package/utils/forms/status.d.ts +0 -16
  383. package/utils/forms/types.d.ts +0 -8
  384. package/utils/helpers/attributes.d.ts +0 -2
  385. package/utils/helpers/disposables.d.ts +0 -40
  386. package/utils/helpers/unique-id.d.ts +0 -6
  387. package/utils/helpers/validators.d.ts +0 -51
  388. package/utils/observables/take-until-destroyed.d.ts +0 -10
  389. package/utils/signals/index.d.ts +0 -22
@@ -168,10 +168,10 @@ class NgpInputOtpInput {
168
168
  const end = input.selectionEnd || 0;
169
169
  this.state().updateSelection(start, end);
170
170
  }
171
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpInputOtpInput, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
172
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.11", type: NgpInputOtpInput, isStandalone: true, selector: "input[ngpInputOtpInput]", host: { attributes: { "autocomplete": "one-time-code" }, listeners: { "input": "onInput($event)", "paste": "onPaste($event)", "focus": "onFocus()", "blur": "onBlur()", "keyup": "onKeyup()", "select": "onSelect()" }, properties: { "attr.inputmode": "state().inputMode()", "attr.maxlength": "state().maxLength()", "attr.pattern": "state().pattern() || null", "attr.disabled": "state().disabled() ? \"\" : null" } }, exportAs: ["ngpInputOtpInput"], hostDirectives: [{ directive: i1.NgpVisuallyHidden }], ngImport: i0 }); }
171
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpInputOtpInput, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
172
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.9", type: NgpInputOtpInput, isStandalone: true, selector: "input[ngpInputOtpInput]", host: { attributes: { "autocomplete": "one-time-code" }, listeners: { "input": "onInput($event)", "paste": "onPaste($event)", "focus": "onFocus()", "blur": "onBlur()", "keyup": "onKeyup()", "select": "onSelect()" }, properties: { "attr.inputmode": "state().inputMode()", "attr.maxlength": "state().maxLength()", "attr.pattern": "state().pattern() || null", "attr.disabled": "state().disabled() ? \"\" : null" } }, exportAs: ["ngpInputOtpInput"], hostDirectives: [{ directive: i1.NgpVisuallyHidden }], ngImport: i0 }); }
173
173
  }
174
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpInputOtpInput, decorators: [{
174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpInputOtpInput, decorators: [{
175
175
  type: Directive,
176
176
  args: [{
177
177
  selector: 'input[ngpInputOtpInput]',
@@ -214,7 +214,7 @@ class NgpInputOtpSlot {
214
214
  /**
215
215
  * The computed index of this slot based on registration order.
216
216
  */
217
- this.index = computed(() => this.state().getSlotIndex(this));
217
+ this.index = computed(() => this.state().getSlotIndex(this), ...(ngDevMode ? [{ debugName: "index" }] : []));
218
218
  /**
219
219
  * The character for this slot from the value string.
220
220
  */
@@ -222,7 +222,7 @@ class NgpInputOtpSlot {
222
222
  const value = this.state().value();
223
223
  const currentIndex = this.index();
224
224
  return currentIndex >= 0 && currentIndex < value.length ? value[currentIndex] : null;
225
- });
225
+ }, ...(ngDevMode ? [{ debugName: "char" }] : []));
226
226
  /**
227
227
  * Whether this slot is focused (active).
228
228
  */
@@ -235,7 +235,7 @@ class NgpInputOtpSlot {
235
235
  return (isFocused &&
236
236
  (currentIndex === selectionStart ||
237
237
  (value.length === maxLength && currentIndex === maxLength - 1)));
238
- });
238
+ }, ...(ngDevMode ? [{ debugName: "focused" }] : []));
239
239
  /**
240
240
  * Whether this slot should show the caret.
241
241
  */
@@ -250,18 +250,18 @@ class NgpInputOtpSlot {
250
250
  currentIndex === selectionStart &&
251
251
  selectionStart === selectionEnd &&
252
252
  value.length < maxLength);
253
- });
253
+ }, ...(ngDevMode ? [{ debugName: "caret" }] : []));
254
254
  /**
255
255
  * Whether this slot is filled with a character.
256
256
  */
257
- this.filled = computed(() => this.char() !== null);
257
+ this.filled = computed(() => this.char() !== null, ...(ngDevMode ? [{ debugName: "filled" }] : []));
258
258
  /**
259
259
  * Whether to show placeholder for this slot.
260
260
  */
261
261
  this.showPlaceholder = computed(() => {
262
262
  const placeholder = this.state().placeholder();
263
263
  return !this.filled() && !!placeholder;
264
- });
264
+ }, ...(ngDevMode ? [{ debugName: "showPlaceholder" }] : []));
265
265
  /**
266
266
  * The display character for this slot (character or placeholder).
267
267
  */
@@ -272,7 +272,7 @@ class NgpInputOtpSlot {
272
272
  if (this.showPlaceholder())
273
273
  return this.state().placeholder();
274
274
  return '';
275
- });
275
+ }, ...(ngDevMode ? [{ debugName: "displayChar" }] : []));
276
276
  this.state().registerSlot(this);
277
277
  }
278
278
  ngOnDestroy() {
@@ -294,10 +294,10 @@ class NgpInputOtpSlot {
294
294
  event.preventDefault();
295
295
  event.stopPropagation();
296
296
  }
297
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpInputOtpSlot, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
298
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.11", type: NgpInputOtpSlot, isStandalone: true, selector: "[ngpInputOtpSlot]", host: { attributes: { "role": "presentation" }, listeners: { "click": "onClick($event)" }, properties: { "attr.data-slot-index": "index()", "attr.data-active": "focused() ? \"\" : null", "attr.data-filled": "filled() ? \"\" : null", "attr.data-caret": "caret() ? \"\" : null", "attr.data-placeholder": "showPlaceholder() ? \"\" : null", "textContent": "displayChar()" } }, exportAs: ["ngpInputOtpSlot"], ngImport: i0 }); }
297
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpInputOtpSlot, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
298
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.9", type: NgpInputOtpSlot, isStandalone: true, selector: "[ngpInputOtpSlot]", host: { attributes: { "role": "presentation" }, listeners: { "click": "onClick($event)" }, properties: { "attr.data-slot-index": "index()", "attr.data-active": "focused() ? \"\" : null", "attr.data-filled": "filled() ? \"\" : null", "attr.data-caret": "caret() ? \"\" : null", "attr.data-placeholder": "showPlaceholder() ? \"\" : null", "textContent": "displayChar()" } }, exportAs: ["ngpInputOtpSlot"], ngImport: i0 }); }
299
299
  }
300
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpInputOtpSlot, decorators: [{
300
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpInputOtpSlot, decorators: [{
301
301
  type: Directive,
302
302
  args: [{
303
303
  selector: '[ngpInputOtpSlot]',
@@ -324,44 +324,45 @@ class NgpInputOtp {
324
324
  /**
325
325
  * The id of the input-otp.
326
326
  */
327
- this.id = input(uniqueId('ngp-input-otp'));
327
+ this.id = input(uniqueId('ngp-input-otp'), ...(ngDevMode ? [{ debugName: "id" }] : []));
328
328
  /**
329
329
  * The current value of the OTP.
330
330
  */
331
- this.value = input('', {
332
- alias: 'ngpInputOtpValue',
333
- });
331
+ this.value = input('', ...(ngDevMode ? [{ debugName: "value", alias: 'ngpInputOtpValue' }] : [{
332
+ alias: 'ngpInputOtpValue',
333
+ }]));
334
334
  /**
335
335
  * The regex pattern for allowed characters.
336
336
  */
337
- this.pattern = input('[0-9]', {
338
- alias: 'ngpInputOtpPattern',
339
- });
337
+ this.pattern = input('[0-9]', ...(ngDevMode ? [{ debugName: "pattern", alias: 'ngpInputOtpPattern' }] : [{
338
+ alias: 'ngpInputOtpPattern',
339
+ }]));
340
340
  /**
341
341
  * The input mode for the hidden input.
342
342
  */
343
- this.inputMode = input('text', {
344
- alias: 'ngpInputOtpInputMode',
345
- });
343
+ this.inputMode = input('text', ...(ngDevMode ? [{ debugName: "inputMode", alias: 'ngpInputOtpInputMode' }] : [{
344
+ alias: 'ngpInputOtpInputMode',
345
+ }]));
346
346
  /**
347
347
  * Function to transform pasted text.
348
348
  */
349
- this.pasteTransformer = input(undefined, {
350
- alias: 'ngpInputOtpPasteTransformer',
351
- });
349
+ this.pasteTransformer = input(undefined, ...(ngDevMode ? [{ debugName: "pasteTransformer", alias: 'ngpInputOtpPasteTransformer' }] : [{
350
+ alias: 'ngpInputOtpPasteTransformer',
351
+ }]));
352
352
  /**
353
353
  * Whether the input-otp is disabled.
354
354
  */
355
- this.disabled = input(false, {
356
- alias: 'ngpInputOtpDisabled',
357
- transform: booleanAttribute,
358
- });
355
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", alias: 'ngpInputOtpDisabled',
356
+ transform: booleanAttribute }] : [{
357
+ alias: 'ngpInputOtpDisabled',
358
+ transform: booleanAttribute,
359
+ }]));
359
360
  /**
360
361
  * The placeholder character to display when a slot is empty.
361
362
  */
362
- this.placeholder = input('', {
363
- alias: 'ngpInputOtpPlaceholder',
364
- });
363
+ this.placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder", alias: 'ngpInputOtpPlaceholder' }] : [{
364
+ alias: 'ngpInputOtpPlaceholder',
365
+ }]));
365
366
  /**
366
367
  * Event emitted when the value changes.
367
368
  */
@@ -378,31 +379,31 @@ class NgpInputOtp {
378
379
  * Store the input element reference.
379
380
  * @internal
380
381
  */
381
- this.inputElement = signal(undefined);
382
+ this.inputElement = signal(undefined, ...(ngDevMode ? [{ debugName: "inputElement" }] : []));
382
383
  /**
383
384
  * Store registered slots in order.
384
385
  * @internal
385
386
  */
386
- this.slots = signal([]);
387
+ this.slots = signal([], ...(ngDevMode ? [{ debugName: "slots" }] : []));
387
388
  /**
388
389
  * The number of characters in the OTP, derived from registered slots.
389
390
  */
390
- this.maxLength = computed(() => this.slots().length);
391
+ this.maxLength = computed(() => this.slots().length, ...(ngDevMode ? [{ debugName: "maxLength" }] : []));
391
392
  /**
392
393
  * The focus state of the input.
393
394
  * @internal
394
395
  */
395
- this.isFocused = signal(false);
396
+ this.isFocused = signal(false, ...(ngDevMode ? [{ debugName: "isFocused" }] : []));
396
397
  /**
397
398
  * The selection start position.
398
399
  * @internal
399
400
  */
400
- this.selectionStart = signal(0);
401
+ this.selectionStart = signal(0, ...(ngDevMode ? [{ debugName: "selectionStart" }] : []));
401
402
  /**
402
403
  * The selection end position.
403
404
  * @internal
404
405
  */
405
- this.selectionEnd = signal(0);
406
+ this.selectionEnd = signal(0, ...(ngDevMode ? [{ debugName: "selectionEnd" }] : []));
406
407
  /**
407
408
  * The state of the input-otp.
408
409
  */
@@ -494,17 +495,17 @@ class NgpInputOtp {
494
495
  input.focus();
495
496
  input.setSelectionRange(position, position);
496
497
  }
497
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpInputOtp, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
498
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpInputOtp, isStandalone: true, selector: "[ngpInputOtp]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpInputOtpValue", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "ngpInputOtpPattern", isSignal: true, isRequired: false, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "ngpInputOtpInputMode", isSignal: true, isRequired: false, transformFunction: null }, pasteTransformer: { classPropertyName: "pasteTransformer", publicName: "ngpInputOtpPasteTransformer", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpInputOtpDisabled", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "ngpInputOtpPlaceholder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpInputOtpValueChange", complete: "ngpInputOtpComplete" }, providers: [provideInputOtpState()], exportAs: ["ngpInputOtp"], ngImport: i0 }); }
498
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpInputOtp, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
499
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", type: NgpInputOtp, isStandalone: true, selector: "[ngpInputOtp]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpInputOtpValue", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "ngpInputOtpPattern", isSignal: true, isRequired: false, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "ngpInputOtpInputMode", isSignal: true, isRequired: false, transformFunction: null }, pasteTransformer: { classPropertyName: "pasteTransformer", publicName: "ngpInputOtpPasteTransformer", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpInputOtpDisabled", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "ngpInputOtpPlaceholder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpInputOtpValueChange", complete: "ngpInputOtpComplete" }, providers: [provideInputOtpState()], exportAs: ["ngpInputOtp"], ngImport: i0 }); }
499
500
  }
500
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpInputOtp, decorators: [{
501
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpInputOtp, decorators: [{
501
502
  type: Directive,
502
503
  args: [{
503
504
  selector: '[ngpInputOtp]',
504
505
  exportAs: 'ngpInputOtp',
505
506
  providers: [provideInputOtpState()],
506
507
  }]
507
- }], ctorParameters: () => [] });
508
+ }], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpInputOtpValue", required: false }] }], pattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpInputOtpPattern", required: false }] }], inputMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpInputOtpInputMode", required: false }] }], pasteTransformer: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpInputOtpPasteTransformer", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpInputOtpDisabled", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpInputOtpPlaceholder", required: false }] }], valueChange: [{ type: i0.Output, args: ["ngpInputOtpValueChange"] }], complete: [{ type: i0.Output, args: ["ngpInputOtpComplete"] }] } });
508
509
 
509
510
  /**
510
511
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-input-otp.mjs","sources":["../../../../packages/ng-primitives/input-otp/src/input-otp/input-otp-state.ts","../../../../packages/ng-primitives/input-otp/src/input-otp-input/input-otp-input.ts","../../../../packages/ng-primitives/input-otp/src/input-otp-slot/input-otp-slot.ts","../../../../packages/ng-primitives/input-otp/src/input-otp/input-otp.ts","../../../../packages/ng-primitives/input-otp/src/ng-primitives-input-otp.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpInputOtp } from './input-otp';\n\n/**\n * The state token for the InputOtp primitive.\n */\nexport const NgpInputOtpStateToken = createStateToken<NgpInputOtp>('InputOtp');\n\n/**\n * Provides the InputOtp state.\n */\nexport const provideInputOtpState = createStateProvider(NgpInputOtpStateToken);\n\n/**\n * Injects the InputOtp state.\n */\nexport const injectInputOtpState = createStateInjector<NgpInputOtp>(NgpInputOtpStateToken);\n\n/**\n * The InputOtp state registration function.\n */\nexport const inputOtpState = createState(NgpInputOtpStateToken);\n","import { AfterViewInit, Directive, HostListener } from '@angular/core';\nimport { NgpVisuallyHidden } from 'ng-primitives/a11y';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { injectInputOtpState } from '../input-otp/input-otp-state';\n\n@Directive({\n selector: 'input[ngpInputOtpInput]',\n exportAs: 'ngpInputOtpInput',\n hostDirectives: [NgpVisuallyHidden],\n host: {\n autocomplete: 'one-time-code',\n '[attr.inputmode]': 'state().inputMode()',\n '[attr.maxlength]': 'state().maxLength()',\n '[attr.pattern]': 'state().pattern() || null',\n '[attr.disabled]': 'state().disabled() ? \"\" : null',\n },\n})\nexport class NgpInputOtpInput implements AfterViewInit {\n /**\n * Access the element reference.\n */\n readonly elementRef = injectElementRef<HTMLInputElement>();\n\n /**\n * Access the input-otp state.\n */\n protected readonly state = injectInputOtpState();\n\n constructor() {\n // Register this input with the parent\n this.state().registerInput(this);\n }\n\n ngAfterViewInit(): void {\n // Set initial value\n this.elementRef.nativeElement.value = this.state().value();\n }\n\n /**\n * Focus the input.\n * @internal\n */\n focus(): void {\n this.elementRef.nativeElement.focus();\n }\n\n /**\n * Set selection range.\n * @param start Start position\n * @param end End position\n * @internal\n */\n setSelectionRange(start: number, end: number): void {\n this.elementRef.nativeElement.setSelectionRange(start, end);\n }\n\n /**\n * Handle input events (typing).\n */\n @HostListener('input', ['$event'])\n protected onInput(event: Event): void {\n if (this.state().disabled()) {\n return;\n }\n\n const input = event.target as HTMLInputElement;\n let newValue = input.value;\n\n // Validate against pattern if provided\n const pattern = this.state().pattern();\n if (pattern) {\n const patternRegex = new RegExp(pattern);\n const filteredValue = newValue\n .split('')\n .filter(char => patternRegex.test(char))\n .join('');\n\n if (filteredValue !== newValue) {\n newValue = filteredValue;\n input.value = newValue;\n }\n }\n\n // Clamp to maxLength\n const maxLength = this.state().maxLength();\n if (newValue.length > maxLength) {\n newValue = newValue.substring(0, maxLength);\n input.value = newValue;\n }\n\n this.state().updateValue(newValue);\n this.updateSelection();\n }\n\n /**\n * Handle paste events.\n */\n @HostListener('paste', ['$event'])\n protected onPaste(event: ClipboardEvent): void {\n if (this.state().disabled()) {\n return;\n }\n\n event.preventDefault();\n\n const clipboardData = event.clipboardData?.getData('text') || '';\n let pastedText = clipboardData.trim();\n\n // Apply paste transformer if provided\n const transformer = this.state().pasteTransformer();\n if (transformer) {\n pastedText = transformer(pastedText);\n }\n\n // Validate against pattern if provided\n const pattern = this.state().pattern();\n if (pattern) {\n const patternRegex = new RegExp(pattern);\n pastedText = pastedText\n .split('')\n .filter(char => patternRegex.test(char))\n .join('');\n }\n\n // Clamp to maxLength\n const maxLength = this.state().maxLength();\n if (pastedText.length > maxLength) {\n pastedText = pastedText.substring(0, maxLength);\n }\n\n // Update the input value and state\n this.elementRef.nativeElement.value = pastedText;\n this.state().updateValue(pastedText);\n\n // Set caret to the end\n const endPosition = pastedText.length;\n this.setSelectionRange(endPosition, endPosition);\n this.updateSelection();\n }\n\n /**\n * Handle focus events.\n */\n @HostListener('focus')\n protected onFocus(): void {\n this.state().updateFocus(true);\n this.updateSelection();\n }\n\n /**\n * Handle blur events.\n */\n @HostListener('blur')\n protected onBlur(): void {\n this.state().updateFocus(false);\n }\n\n /**\n * Handle keyup events to update selection.\n */\n @HostListener('keyup')\n protected onKeyup(): void {\n this.updateSelection();\n }\n\n /**\n * Handle selection change events.\n */\n @HostListener('select')\n protected onSelect(): void {\n this.updateSelection();\n }\n\n /**\n * Update the selection state.\n */\n private updateSelection(): void {\n const input = this.elementRef.nativeElement;\n const maxLength = this.state().maxLength();\n\n // If input is at max length, set selection to last character\n if (input.value.length === maxLength) {\n input.setSelectionRange(input.value.length - 1, input.value.length);\n }\n\n // if the input is not at max length, set selection at the end\n if (input.value.length < maxLength) {\n input.setSelectionRange(input.value.length, input.value.length);\n }\n\n const start = input.selectionStart || 0;\n const end = input.selectionEnd || 0;\n this.state().updateSelection(start, end);\n }\n}\n","import { computed, Directive, OnDestroy } from '@angular/core';\nimport { injectInputOtpState } from '../input-otp/input-otp-state';\n\n@Directive({\n selector: '[ngpInputOtpSlot]',\n exportAs: 'ngpInputOtpSlot',\n host: {\n role: 'presentation',\n '[attr.data-slot-index]': 'index()',\n '[attr.data-active]': 'focused() ? \"\" : null',\n '[attr.data-filled]': 'filled() ? \"\" : null',\n '[attr.data-caret]': 'caret() ? \"\" : null',\n '[attr.data-placeholder]': 'showPlaceholder() ? \"\" : null',\n '[textContent]': 'displayChar()',\n '(click)': 'onClick($event)',\n },\n})\nexport class NgpInputOtpSlot implements OnDestroy {\n /**\n * Access the input-otp state.\n */\n protected readonly state = injectInputOtpState();\n\n /**\n * The computed index of this slot based on registration order.\n */\n readonly index = computed(() => this.state().getSlotIndex(this));\n\n /**\n * The character for this slot from the value string.\n */\n private readonly char = computed(() => {\n const value = this.state().value();\n const currentIndex = this.index();\n return currentIndex >= 0 && currentIndex < value.length ? value[currentIndex] : null;\n });\n\n /**\n * Whether this slot is focused (active).\n */\n protected readonly focused = computed(() => {\n const currentIndex = this.index();\n const isFocused = this.state().isFocused();\n const selectionStart = this.state().selectionStart();\n const value = this.state().value();\n const maxLength = this.state().maxLength();\n\n return (\n isFocused &&\n (currentIndex === selectionStart ||\n (value.length === maxLength && currentIndex === maxLength - 1))\n );\n });\n\n /**\n * Whether this slot should show the caret.\n */\n protected readonly caret = computed(() => {\n const currentIndex = this.index();\n const isFocused = this.state().isFocused();\n const selectionStart = this.state().selectionStart();\n const selectionEnd = this.state().selectionEnd();\n const value = this.state().value();\n const maxLength = this.state().maxLength();\n\n return (\n isFocused &&\n currentIndex === selectionStart &&\n selectionStart === selectionEnd &&\n value.length < maxLength\n );\n });\n\n /**\n * Whether this slot is filled with a character.\n */\n protected readonly filled = computed(() => this.char() !== null);\n\n /**\n * Whether to show placeholder for this slot.\n */\n protected readonly showPlaceholder = computed(() => {\n const placeholder = this.state().placeholder();\n return !this.filled() && !!placeholder;\n });\n\n /**\n * The display character for this slot (character or placeholder).\n */\n protected readonly displayChar = computed(() => {\n const char = this.char();\n if (char) return char;\n if (this.showPlaceholder()) return this.state().placeholder();\n return '';\n });\n\n constructor() {\n this.state().registerSlot(this);\n }\n\n ngOnDestroy(): void {\n // Unregister this slot when destroyed\n this.state().unregisterSlot(this);\n }\n\n /**\n * Handle click events on the slot.\n * @internal\n */\n protected onClick(event: Event): void {\n if (this.state().disabled()) return;\n\n const currentValue = this.state().value();\n const maxLength = this.state().maxLength();\n\n // Focus the first empty slot, or the last slot if all are filled\n const targetPosition = currentValue.length < maxLength ? currentValue.length : maxLength - 1;\n this.state().focusAtPosition(targetPosition);\n event.preventDefault();\n event.stopPropagation();\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, output, signal } from '@angular/core';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport type { NgpInputOtpInput } from '../input-otp-input/input-otp-input';\nimport type { NgpInputOtpSlot } from '../input-otp-slot/input-otp-slot';\nimport { inputOtpState, provideInputOtpState } from './input-otp-state';\n\nexport type NgpInputOtpInputMode =\n | 'numeric'\n | 'text'\n | 'decimal'\n | 'tel'\n | 'search'\n | 'email'\n | 'url';\n\n@Directive({\n selector: '[ngpInputOtp]',\n exportAs: 'ngpInputOtp',\n providers: [provideInputOtpState()],\n})\nexport class NgpInputOtp {\n /**\n * Access the element reference.\n */\n readonly elementRef = injectElementRef<HTMLElement>();\n\n /**\n * The id of the input-otp.\n */\n readonly id = input(uniqueId('ngp-input-otp'));\n\n /**\n * The current value of the OTP.\n */\n readonly value = input<string>('', {\n alias: 'ngpInputOtpValue',\n });\n\n /**\n * The regex pattern for allowed characters.\n */\n readonly pattern = input<string>('[0-9]', {\n alias: 'ngpInputOtpPattern',\n });\n\n /**\n * The input mode for the hidden input.\n */\n readonly inputMode = input<NgpInputOtpInputMode>('text', {\n alias: 'ngpInputOtpInputMode',\n });\n\n /**\n * Function to transform pasted text.\n */\n readonly pasteTransformer = input<(text: string) => string>(undefined, {\n alias: 'ngpInputOtpPasteTransformer',\n });\n\n /**\n * Whether the input-otp is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpInputOtpDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The placeholder character to display when a slot is empty.\n */\n readonly placeholder = input<string>('', {\n alias: 'ngpInputOtpPlaceholder',\n });\n\n /**\n * Event emitted when the value changes.\n */\n readonly valueChange = output<string>({\n alias: 'ngpInputOtpValueChange',\n });\n\n /**\n * Event emitted when the OTP is complete (maxLength characters entered).\n */\n readonly complete = output<string>({\n alias: 'ngpInputOtpComplete',\n });\n\n /**\n * Store the input element reference.\n * @internal\n */\n private readonly inputElement = signal<NgpInputOtpInput | undefined>(undefined);\n\n /**\n * Store registered slots in order.\n * @internal\n */\n private readonly slots = signal<NgpInputOtpSlot[]>([]);\n\n /**\n * The number of characters in the OTP, derived from registered slots.\n */\n readonly maxLength = computed(() => this.slots().length);\n\n /**\n * The focus state of the input.\n * @internal\n */\n readonly isFocused = signal(false);\n\n /**\n * The selection start position.\n * @internal\n */\n readonly selectionStart = signal(0);\n\n /**\n * The selection end position.\n * @internal\n */\n readonly selectionEnd = signal(0);\n\n /**\n * The state of the input-otp.\n */\n protected readonly state = inputOtpState<NgpInputOtp>(this);\n\n constructor() {\n ngpInteractions({\n hover: true,\n press: true,\n focus: true,\n disabled: this.state.disabled,\n });\n }\n\n /**\n * Register an input element with the input-otp.\n * @param input The input element to register.\n * @internal\n */\n registerInput(input: NgpInputOtpInput): void {\n this.inputElement.set(input);\n }\n\n /**\n * Register a slot with the input-otp.\n * @param slot The slot to register.\n * @internal\n */\n registerSlot(slot: NgpInputOtpSlot): void {\n this.slots.update(currentSlots => [...currentSlots, slot]);\n }\n\n /**\n * Unregister a slot from the input-otp.\n * @param slot The slot to unregister.\n * @internal\n */\n unregisterSlot(slot: NgpInputOtpSlot): void {\n this.slots.update(currentSlots => currentSlots.filter(s => s !== slot));\n }\n\n /**\n * Get the index of a registered slot.\n * @param slot The slot to get the index for.\n * @returns The index of the slot, or -1 if not found.\n * @internal\n */\n getSlotIndex(slot: NgpInputOtpSlot): number {\n return this.slots().indexOf(slot);\n }\n\n /**\n * Update the value and emit change events.\n * @param newValue The new value.\n * @internal\n */\n updateValue(newValue: string): void {\n if (newValue === this.state.value()) {\n return;\n }\n\n this.state.value.set(newValue);\n this.valueChange.emit(newValue);\n\n // Emit complete event when the OTP is complete\n if (newValue.length === this.maxLength()) {\n this.complete.emit(newValue);\n }\n }\n\n /**\n * Update focus state.\n * @param focused Whether the input is focused.\n * @internal\n */\n updateFocus(focused: boolean): void {\n this.isFocused.set(focused);\n }\n\n /**\n * Update selection state.\n * @param start Selection start position.\n * @param end Selection end position.\n * @internal\n */\n updateSelection(start: number, end: number): void {\n this.selectionStart.set(start);\n this.selectionEnd.set(end);\n }\n\n /**\n * Focus the input and set caret to the specified position.\n * @param position The position to set the caret to.\n * @internal\n */\n focusAtPosition(position: number): void {\n const input = this.inputElement();\n if (!input) {\n return;\n }\n\n input.focus();\n input.setSelectionRange(position, position);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAQA;;AAEG;AACI,MAAM,qBAAqB,GAAG,gBAAgB,CAAc,UAAU,CAAC;AAE9E;;AAEG;MACU,oBAAoB,GAAG,mBAAmB,CAAC,qBAAqB;AAE7E;;AAEG;MACU,mBAAmB,GAAG,mBAAmB,CAAc,qBAAqB;AAEzF;;AAEG;AACI,MAAM,aAAa,GAAG,WAAW,CAAC,qBAAqB,CAAC;;MCTlD,gBAAgB,CAAA;AAW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AA,oBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,sBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,gBAAA,EAAA,EAAA,iBAAA,EAAA,kBAAA,EAAA,UAAA,EAAA,6BAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,qBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,WAAA,EAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,UAAA,EAAA,wBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,WAAA,EAAA,wBAAA,EAAA,QAAA,EAAA,qBAAA,EAAA,EAAA,SAAA,EAFX,CAAC,oBAAoB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,aAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAExB,WAAW,EAAA,UAAA,EAAA,CAAA;kBALvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,SAAS,EAAE,CAAC,oBAAoB,EAAE,CAAC;AACpC,iBAAA;;;ACtBD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-input-otp.mjs","sources":["../../../../packages/ng-primitives/input-otp/src/input-otp/input-otp-state.ts","../../../../packages/ng-primitives/input-otp/src/input-otp-input/input-otp-input.ts","../../../../packages/ng-primitives/input-otp/src/input-otp-slot/input-otp-slot.ts","../../../../packages/ng-primitives/input-otp/src/input-otp/input-otp.ts","../../../../packages/ng-primitives/input-otp/src/ng-primitives-input-otp.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpInputOtp } from './input-otp';\n\n/**\n * The state token for the InputOtp primitive.\n */\nexport const NgpInputOtpStateToken = createStateToken<NgpInputOtp>('InputOtp');\n\n/**\n * Provides the InputOtp state.\n */\nexport const provideInputOtpState = createStateProvider(NgpInputOtpStateToken);\n\n/**\n * Injects the InputOtp state.\n */\nexport const injectInputOtpState = createStateInjector<NgpInputOtp>(NgpInputOtpStateToken);\n\n/**\n * The InputOtp state registration function.\n */\nexport const inputOtpState = createState(NgpInputOtpStateToken);\n","import { AfterViewInit, Directive, HostListener } from '@angular/core';\nimport { NgpVisuallyHidden } from 'ng-primitives/a11y';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { injectInputOtpState } from '../input-otp/input-otp-state';\n\n@Directive({\n selector: 'input[ngpInputOtpInput]',\n exportAs: 'ngpInputOtpInput',\n hostDirectives: [NgpVisuallyHidden],\n host: {\n autocomplete: 'one-time-code',\n '[attr.inputmode]': 'state().inputMode()',\n '[attr.maxlength]': 'state().maxLength()',\n '[attr.pattern]': 'state().pattern() || null',\n '[attr.disabled]': 'state().disabled() ? \"\" : null',\n },\n})\nexport class NgpInputOtpInput implements AfterViewInit {\n /**\n * Access the element reference.\n */\n readonly elementRef = injectElementRef<HTMLInputElement>();\n\n /**\n * Access the input-otp state.\n */\n protected readonly state = injectInputOtpState();\n\n constructor() {\n // Register this input with the parent\n this.state().registerInput(this);\n }\n\n ngAfterViewInit(): void {\n // Set initial value\n this.elementRef.nativeElement.value = this.state().value();\n }\n\n /**\n * Focus the input.\n * @internal\n */\n focus(): void {\n this.elementRef.nativeElement.focus();\n }\n\n /**\n * Set selection range.\n * @param start Start position\n * @param end End position\n * @internal\n */\n setSelectionRange(start: number, end: number): void {\n this.elementRef.nativeElement.setSelectionRange(start, end);\n }\n\n /**\n * Handle input events (typing).\n */\n @HostListener('input', ['$event'])\n protected onInput(event: Event): void {\n if (this.state().disabled()) {\n return;\n }\n\n const input = event.target as HTMLInputElement;\n let newValue = input.value;\n\n // Validate against pattern if provided\n const pattern = this.state().pattern();\n if (pattern) {\n const patternRegex = new RegExp(pattern);\n const filteredValue = newValue\n .split('')\n .filter(char => patternRegex.test(char))\n .join('');\n\n if (filteredValue !== newValue) {\n newValue = filteredValue;\n input.value = newValue;\n }\n }\n\n // Clamp to maxLength\n const maxLength = this.state().maxLength();\n if (newValue.length > maxLength) {\n newValue = newValue.substring(0, maxLength);\n input.value = newValue;\n }\n\n this.state().updateValue(newValue);\n this.updateSelection();\n }\n\n /**\n * Handle paste events.\n */\n @HostListener('paste', ['$event'])\n protected onPaste(event: ClipboardEvent): void {\n if (this.state().disabled()) {\n return;\n }\n\n event.preventDefault();\n\n const clipboardData = event.clipboardData?.getData('text') || '';\n let pastedText = clipboardData.trim();\n\n // Apply paste transformer if provided\n const transformer = this.state().pasteTransformer();\n if (transformer) {\n pastedText = transformer(pastedText);\n }\n\n // Validate against pattern if provided\n const pattern = this.state().pattern();\n if (pattern) {\n const patternRegex = new RegExp(pattern);\n pastedText = pastedText\n .split('')\n .filter(char => patternRegex.test(char))\n .join('');\n }\n\n // Clamp to maxLength\n const maxLength = this.state().maxLength();\n if (pastedText.length > maxLength) {\n pastedText = pastedText.substring(0, maxLength);\n }\n\n // Update the input value and state\n this.elementRef.nativeElement.value = pastedText;\n this.state().updateValue(pastedText);\n\n // Set caret to the end\n const endPosition = pastedText.length;\n this.setSelectionRange(endPosition, endPosition);\n this.updateSelection();\n }\n\n /**\n * Handle focus events.\n */\n @HostListener('focus')\n protected onFocus(): void {\n this.state().updateFocus(true);\n this.updateSelection();\n }\n\n /**\n * Handle blur events.\n */\n @HostListener('blur')\n protected onBlur(): void {\n this.state().updateFocus(false);\n }\n\n /**\n * Handle keyup events to update selection.\n */\n @HostListener('keyup')\n protected onKeyup(): void {\n this.updateSelection();\n }\n\n /**\n * Handle selection change events.\n */\n @HostListener('select')\n protected onSelect(): void {\n this.updateSelection();\n }\n\n /**\n * Update the selection state.\n */\n private updateSelection(): void {\n const input = this.elementRef.nativeElement;\n const maxLength = this.state().maxLength();\n\n // If input is at max length, set selection to last character\n if (input.value.length === maxLength) {\n input.setSelectionRange(input.value.length - 1, input.value.length);\n }\n\n // if the input is not at max length, set selection at the end\n if (input.value.length < maxLength) {\n input.setSelectionRange(input.value.length, input.value.length);\n }\n\n const start = input.selectionStart || 0;\n const end = input.selectionEnd || 0;\n this.state().updateSelection(start, end);\n }\n}\n","import { computed, Directive, OnDestroy } from '@angular/core';\nimport { injectInputOtpState } from '../input-otp/input-otp-state';\n\n@Directive({\n selector: '[ngpInputOtpSlot]',\n exportAs: 'ngpInputOtpSlot',\n host: {\n role: 'presentation',\n '[attr.data-slot-index]': 'index()',\n '[attr.data-active]': 'focused() ? \"\" : null',\n '[attr.data-filled]': 'filled() ? \"\" : null',\n '[attr.data-caret]': 'caret() ? \"\" : null',\n '[attr.data-placeholder]': 'showPlaceholder() ? \"\" : null',\n '[textContent]': 'displayChar()',\n '(click)': 'onClick($event)',\n },\n})\nexport class NgpInputOtpSlot implements OnDestroy {\n /**\n * Access the input-otp state.\n */\n protected readonly state = injectInputOtpState();\n\n /**\n * The computed index of this slot based on registration order.\n */\n readonly index = computed(() => this.state().getSlotIndex(this));\n\n /**\n * The character for this slot from the value string.\n */\n private readonly char = computed(() => {\n const value = this.state().value();\n const currentIndex = this.index();\n return currentIndex >= 0 && currentIndex < value.length ? value[currentIndex] : null;\n });\n\n /**\n * Whether this slot is focused (active).\n */\n protected readonly focused = computed(() => {\n const currentIndex = this.index();\n const isFocused = this.state().isFocused();\n const selectionStart = this.state().selectionStart();\n const value = this.state().value();\n const maxLength = this.state().maxLength();\n\n return (\n isFocused &&\n (currentIndex === selectionStart ||\n (value.length === maxLength && currentIndex === maxLength - 1))\n );\n });\n\n /**\n * Whether this slot should show the caret.\n */\n protected readonly caret = computed(() => {\n const currentIndex = this.index();\n const isFocused = this.state().isFocused();\n const selectionStart = this.state().selectionStart();\n const selectionEnd = this.state().selectionEnd();\n const value = this.state().value();\n const maxLength = this.state().maxLength();\n\n return (\n isFocused &&\n currentIndex === selectionStart &&\n selectionStart === selectionEnd &&\n value.length < maxLength\n );\n });\n\n /**\n * Whether this slot is filled with a character.\n */\n protected readonly filled = computed(() => this.char() !== null);\n\n /**\n * Whether to show placeholder for this slot.\n */\n protected readonly showPlaceholder = computed(() => {\n const placeholder = this.state().placeholder();\n return !this.filled() && !!placeholder;\n });\n\n /**\n * The display character for this slot (character or placeholder).\n */\n protected readonly displayChar = computed(() => {\n const char = this.char();\n if (char) return char;\n if (this.showPlaceholder()) return this.state().placeholder();\n return '';\n });\n\n constructor() {\n this.state().registerSlot(this);\n }\n\n ngOnDestroy(): void {\n // Unregister this slot when destroyed\n this.state().unregisterSlot(this);\n }\n\n /**\n * Handle click events on the slot.\n * @internal\n */\n protected onClick(event: Event): void {\n if (this.state().disabled()) return;\n\n const currentValue = this.state().value();\n const maxLength = this.state().maxLength();\n\n // Focus the first empty slot, or the last slot if all are filled\n const targetPosition = currentValue.length < maxLength ? currentValue.length : maxLength - 1;\n this.state().focusAtPosition(targetPosition);\n event.preventDefault();\n event.stopPropagation();\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, output, signal } from '@angular/core';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { uniqueId } from 'ng-primitives/utils';\nimport type { NgpInputOtpInput } from '../input-otp-input/input-otp-input';\nimport type { NgpInputOtpSlot } from '../input-otp-slot/input-otp-slot';\nimport { inputOtpState, provideInputOtpState } from './input-otp-state';\n\nexport type NgpInputOtpInputMode =\n | 'numeric'\n | 'text'\n | 'decimal'\n | 'tel'\n | 'search'\n | 'email'\n | 'url';\n\n@Directive({\n selector: '[ngpInputOtp]',\n exportAs: 'ngpInputOtp',\n providers: [provideInputOtpState()],\n})\nexport class NgpInputOtp {\n /**\n * Access the element reference.\n */\n readonly elementRef = injectElementRef<HTMLElement>();\n\n /**\n * The id of the input-otp.\n */\n readonly id = input(uniqueId('ngp-input-otp'));\n\n /**\n * The current value of the OTP.\n */\n readonly value = input<string>('', {\n alias: 'ngpInputOtpValue',\n });\n\n /**\n * The regex pattern for allowed characters.\n */\n readonly pattern = input<string>('[0-9]', {\n alias: 'ngpInputOtpPattern',\n });\n\n /**\n * The input mode for the hidden input.\n */\n readonly inputMode = input<NgpInputOtpInputMode>('text', {\n alias: 'ngpInputOtpInputMode',\n });\n\n /**\n * Function to transform pasted text.\n */\n readonly pasteTransformer = input<(text: string) => string>(undefined, {\n alias: 'ngpInputOtpPasteTransformer',\n });\n\n /**\n * Whether the input-otp is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpInputOtpDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * The placeholder character to display when a slot is empty.\n */\n readonly placeholder = input<string>('', {\n alias: 'ngpInputOtpPlaceholder',\n });\n\n /**\n * Event emitted when the value changes.\n */\n readonly valueChange = output<string>({\n alias: 'ngpInputOtpValueChange',\n });\n\n /**\n * Event emitted when the OTP is complete (maxLength characters entered).\n */\n readonly complete = output<string>({\n alias: 'ngpInputOtpComplete',\n });\n\n /**\n * Store the input element reference.\n * @internal\n */\n private readonly inputElement = signal<NgpInputOtpInput | undefined>(undefined);\n\n /**\n * Store registered slots in order.\n * @internal\n */\n private readonly slots = signal<NgpInputOtpSlot[]>([]);\n\n /**\n * The number of characters in the OTP, derived from registered slots.\n */\n readonly maxLength = computed(() => this.slots().length);\n\n /**\n * The focus state of the input.\n * @internal\n */\n readonly isFocused = signal(false);\n\n /**\n * The selection start position.\n * @internal\n */\n readonly selectionStart = signal(0);\n\n /**\n * The selection end position.\n * @internal\n */\n readonly selectionEnd = signal(0);\n\n /**\n * The state of the input-otp.\n */\n protected readonly state = inputOtpState<NgpInputOtp>(this);\n\n constructor() {\n ngpInteractions({\n hover: true,\n press: true,\n focus: true,\n disabled: this.state.disabled,\n });\n }\n\n /**\n * Register an input element with the input-otp.\n * @param input The input element to register.\n * @internal\n */\n registerInput(input: NgpInputOtpInput): void {\n this.inputElement.set(input);\n }\n\n /**\n * Register a slot with the input-otp.\n * @param slot The slot to register.\n * @internal\n */\n registerSlot(slot: NgpInputOtpSlot): void {\n this.slots.update(currentSlots => [...currentSlots, slot]);\n }\n\n /**\n * Unregister a slot from the input-otp.\n * @param slot The slot to unregister.\n * @internal\n */\n unregisterSlot(slot: NgpInputOtpSlot): void {\n this.slots.update(currentSlots => currentSlots.filter(s => s !== slot));\n }\n\n /**\n * Get the index of a registered slot.\n * @param slot The slot to get the index for.\n * @returns The index of the slot, or -1 if not found.\n * @internal\n */\n getSlotIndex(slot: NgpInputOtpSlot): number {\n return this.slots().indexOf(slot);\n }\n\n /**\n * Update the value and emit change events.\n * @param newValue The new value.\n * @internal\n */\n updateValue(newValue: string): void {\n if (newValue === this.state.value()) {\n return;\n }\n\n this.state.value.set(newValue);\n this.valueChange.emit(newValue);\n\n // Emit complete event when the OTP is complete\n if (newValue.length === this.maxLength()) {\n this.complete.emit(newValue);\n }\n }\n\n /**\n * Update focus state.\n * @param focused Whether the input is focused.\n * @internal\n */\n updateFocus(focused: boolean): void {\n this.isFocused.set(focused);\n }\n\n /**\n * Update selection state.\n * @param start Selection start position.\n * @param end Selection end position.\n * @internal\n */\n updateSelection(start: number, end: number): void {\n this.selectionStart.set(start);\n this.selectionEnd.set(end);\n }\n\n /**\n * Focus the input and set caret to the specified position.\n * @param position The position to set the caret to.\n * @internal\n */\n focusAtPosition(position: number): void {\n const input = this.inputElement();\n if (!input) {\n return;\n }\n\n input.focus();\n input.setSelectionRange(position, position);\n }\n}\n","/**\n * Generated bund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IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,WAAA,EAAA,wBAAA,EAAA,QAAA,EAAA,qBAAA,EAAA,EAAA,SAAA,EAFX,CAAC,oBAAoB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,aAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAExB,WAAW,EAAA,UAAA,EAAA,CAAA;kBALvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,SAAS,EAAE,CAAC,oBAAoB,EAAE,CAAC;AACpC,iBAAA;;;ACtBD;;AAEG;;;;"}
@@ -1,85 +1,69 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, booleanAttribute, Directive } from '@angular/core';
3
- import * as i1 from 'ng-primitives/autofill';
4
- import { NgpAutofill } from 'ng-primitives/autofill';
5
- import { setupFormControl } from 'ng-primitives/form-field';
2
+ import { signal, computed, input, booleanAttribute, Directive } from '@angular/core';
3
+ import { uniqueId } from 'ng-primitives/utils';
4
+ import { ngpAutofill } from 'ng-primitives/autofill';
5
+ import { ngpFormControl } from 'ng-primitives/form-field';
6
6
  import { ngpInteractions } from 'ng-primitives/interactions';
7
7
  import { injectElementRef } from 'ng-primitives/internal';
8
8
  import { injectSearchState } from 'ng-primitives/search';
9
- import { uniqueId } from 'ng-primitives/utils';
10
- import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
9
+ import { createPrimitive, controlled, attrBinding } from 'ng-primitives/state';
11
10
 
12
- /**
13
- * The state token for the Input primitive.
14
- */
15
- const NgpInputStateToken = createStateToken('Input');
16
- /**
17
- * Provides the Input state.
18
- */
19
- const provideInputState = createStateProvider(NgpInputStateToken);
20
- /**
21
- * Injects the Input state.
22
- */
23
- const injectInputState = createStateInjector(NgpInputStateToken);
24
- /**
25
- * The Input state registration function.
26
- */
27
- const inputState = createState(NgpInputStateToken);
11
+ const [NgpInputStateToken, ngpInput, injectInputState, provideInputState] = createPrimitive('NgpInput', ({ id = signal(uniqueId('ngp-input')), disabled: _disabled = signal(false) }) => {
12
+ const element = injectElementRef();
13
+ const searchState = injectSearchState({ optional: true });
14
+ const disabled = controlled(_disabled);
15
+ // Setup autofill detection
16
+ ngpAutofill({});
17
+ // Setup interactions and form control bindings
18
+ const status = ngpFormControl({ id, disabled });
19
+ const isDisabled = computed(() => status().disabled ?? disabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : []));
20
+ ngpInteractions({ hover: true, press: true, focus: true, disabled: isDisabled });
21
+ // Host bindings
22
+ attrBinding(element, 'id', id);
23
+ attrBinding(element, 'disabled', () => (isDisabled() ? '' : null));
24
+ // Register the input with an enclosing search field if present
25
+ const search = searchState();
26
+ if (search) {
27
+ search.registerInput(element.nativeElement);
28
+ }
29
+ return { id, disabled, status };
30
+ });
28
31
 
29
32
  class NgpInput {
30
33
  constructor() {
31
34
  /**
32
35
  * The id of the input.
33
36
  */
34
- this.id = input(uniqueId('ngp-input'));
35
- /**
36
- * The input may be used within a search field, if so we need to register it.
37
- */
38
- this.searchState = injectSearchState({ optional: true });
39
- /**
40
- * Access the element reference.
41
- */
42
- this.elementRef = injectElementRef();
37
+ this.id = input(uniqueId('ngp-input'), ...(ngDevMode ? [{ debugName: "id" }] : []));
43
38
  /**
44
39
  * Whether the element is disabled.
45
40
  */
46
- this.disabled = input(false, {
47
- transform: booleanAttribute,
48
- });
41
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{
42
+ transform: booleanAttribute,
43
+ }]));
49
44
  /**
50
45
  * The input state.
51
46
  */
52
- this.state = inputState(this);
53
- ngpInteractions({
54
- hover: true,
55
- press: true,
56
- focus: true,
57
- disabled: this.state.disabled,
47
+ this.state = ngpInput({
48
+ id: this.id,
49
+ disabled: this.disabled,
58
50
  });
59
- // Set up the form control with the id and disabled state.
60
- this.status = setupFormControl({ id: this.state.id, disabled: this.state.disabled });
61
- this.searchState()?.registerInput(this.elementRef.nativeElement);
62
51
  }
63
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpInput, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
64
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.11", type: NgpInput, isStandalone: true, selector: "input[ngpInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "id()", "attr.disabled": "status().disabled ? \"\" : null" } }, providers: [provideInputState()], exportAs: ["ngpInput"], hostDirectives: [{ directive: i1.NgpAutofill }], ngImport: i0 }); }
52
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpInput, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
53
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", type: NgpInput, isStandalone: true, selector: "input[ngpInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, providers: [provideInputState({ inherit: false })], exportAs: ["ngpInput"], ngImport: i0 }); }
65
54
  }
66
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: NgpInput, decorators: [{
55
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: NgpInput, decorators: [{
67
56
  type: Directive,
68
57
  args: [{
69
58
  selector: 'input[ngpInput]',
70
59
  exportAs: 'ngpInput',
71
- providers: [provideInputState()],
72
- hostDirectives: [NgpAutofill],
73
- host: {
74
- '[attr.id]': 'id()',
75
- '[attr.disabled]': 'status().disabled ? "" : null',
76
- },
60
+ providers: [provideInputState({ inherit: false })],
77
61
  }]
78
- }], ctorParameters: () => [] });
62
+ }], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
79
63
 
80
64
  /**
81
65
  * Generated bundle index. Do not edit.
82
66
  */
83
67
 
84
- export { NgpInput, injectInputState, provideInputState };
68
+ export { NgpInput, injectInputState, ngpInput, provideInputState };
85
69
  //# sourceMappingURL=ng-primitives-input.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-input.mjs","sources":["../../../../packages/ng-primitives/input/src/input/input-state.ts","../../../../packages/ng-primitives/input/src/input/input.ts","../../../../packages/ng-primitives/input/src/ng-primitives-input.ts"],"sourcesContent":["import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpInput } from './input';\n\n/**\n * The state token for the Input primitive.\n */\nexport const NgpInputStateToken = createStateToken<NgpInput>('Input');\n\n/**\n * Provides the Input state.\n */\nexport const provideInputState = createStateProvider(NgpInputStateToken);\n\n/**\n * Injects the Input state.\n */\nexport const injectInputState = createStateInjector<NgpInput>(NgpInputStateToken);\n\n/**\n * The Input state registration function.\n */\nexport const inputState = createState(NgpInputStateToken);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input, Signal } from '@angular/core';\nimport { NgpAutofill } from 'ng-primitives/autofill';\nimport { setupFormControl } from 'ng-primitives/form-field';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { injectSearchState } from 'ng-primitives/search';\nimport { NgpControlStatus, uniqueId } from 'ng-primitives/utils';\nimport { inputState, provideInputState } from './input-state';\n\n@Directive({\n selector: 'input[ngpInput]',\n exportAs: 'ngpInput',\n providers: [provideInputState()],\n hostDirectives: [NgpAutofill],\n host: {\n '[attr.id]': 'id()',\n '[attr.disabled]': 'status().disabled ? \"\" : null',\n },\n})\nexport class NgpInput {\n /**\n * The id of the input.\n */\n readonly id = input(uniqueId('ngp-input'));\n\n /**\n * The input may be used within a search field, if so we need to register it.\n */\n private readonly searchState = injectSearchState({ optional: true });\n\n /**\n * Access the element reference.\n */\n private readonly elementRef = injectElementRef<HTMLInputElement>();\n\n /**\n * Whether the element is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute,\n });\n\n /**\n * The form control status.\n */\n protected readonly status: Signal<NgpControlStatus>;\n\n /**\n * The input state.\n */\n protected readonly state = inputState<NgpInput>(this);\n\n constructor() {\n ngpInteractions({\n hover: true,\n press: true,\n focus: true,\n disabled: this.state.disabled,\n });\n\n // Set up the form control with the id and disabled state.\n this.status = setupFormControl({ id: this.state.id, disabled: this.state.disabled });\n\n this.searchState()?.registerInput(this.elementRef.nativeElement);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAQA;;AAEG;AACI,MAAM,kBAAkB,GAAG,gBAAgB,CAAW,OAAO,CAAC;AAErE;;AAEG;MACU,iBAAiB,GAAG,mBAAmB,CAAC,kBAAkB;AAEvE;;AAEG;MACU,gBAAgB,GAAG,mBAAmB,CAAW,kBAAkB;AAEhF;;AAEG;AACI,MAAM,UAAU,GAAG,WAAW,CAAC,kBAAkB,CAAC;;MCN5C,QAAQ,CAAA;AAiCnB,IAAA,WAAA,GAAA;AAhCA;;AAEG;QACM,IAAA,CAAA,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAE1C;;AAEG;QACc,IAAA,CAAA,WAAW,GAAG,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAEpE;;AAEG;QACc,IAAA,CAAA,UAAU,GAAG,gBAAgB,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AAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,eAAA,EAAA,iCAAA,EAAA,EAAA,EAAA,SAAA,EAPR,CAAC,iBAAiB,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,WAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;4FAOrB,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAVpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,QAAQ,EAAE,UAAU;AACpB,oBAAA,SAAS,EAAE,CAAC,iBAAiB,EAAE,CAAC;oBAChC,cAAc,EAAE,CAAC,WAAW,CAAC;AAC7B,oBAAA,IAAI,EAAE;AACJ,wBAAA,WAAW,EAAE,MAAM;AACnB,wBAAA,iBAAiB,EAAE,+BAA+B;AACnD,qBAAA;AACF,iBAAA;;;ACnBD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-input.mjs","sources":["../../../../packages/ng-primitives/input/src/input/input-state.ts","../../../../packages/ng-primitives/input/src/input/input.ts","../../../../packages/ng-primitives/input/src/ng-primitives-input.ts"],"sourcesContent":["import { computed, Signal, signal, WritableSignal } from '@angular/core';\nimport { ngpAutofill } from 'ng-primitives/autofill';\nimport { ngpFormControl } from 'ng-primitives/form-field';\nimport { ngpInteractions } from 'ng-primitives/interactions';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { injectSearchState } from 'ng-primitives/search';\nimport { attrBinding, controlled, createPrimitive } from 'ng-primitives/state';\nimport { uniqueId } from 'ng-primitives/utils';\n\n/**\n * Public state surface for the Input primitive.\n */\nexport interface NgpInputState {\n /**\n * The id of the input.\n */\n readonly id: Signal<string>;\n /**\n * Whether the input is disabled.\n */\n readonly disabled: WritableSignal<boolean>;\n}\n\n/**\n * Inputs for configuring the Input primitive.\n */\nexport interface NgpInputProps {\n /**\n * The id of the input.\n */\n readonly id?: Signal<string>;\n /**\n * Whether the input is disabled.\n */\n readonly disabled?: Signal<boolean>;\n}\n\nexport const [NgpInputStateToken, ngpInput, injectInputState, provideInputState] = createPrimitive(\n 'NgpInput',\n ({ id = signal(uniqueId('ngp-input')), disabled: _disabled = signal(false) }: NgpInputProps) => {\n const element = injectElementRef<HTMLInputElement>();\n const searchState = injectSearchState({ optional: true });\n const disabled = controlled(_disabled);\n\n // Setup autofill detection\n ngpAutofill({});\n\n // Setup interactions and form control bindings\n const status = ngpFormControl({ id, disabled });\n const isDisabled = computed(() => status().disabled ?? disabled());\n\n ngpInteractions({ hover: true, press: true, focus: true, disabled: isDisabled });\n\n // Host bindings\n attrBinding(element, 'id', id);\n attrBinding(element, 'disabled', () => (isDisabled() ? '' : null));\n\n // Register the input with an enclosing search field if present\n const search = searchState();\n\n if (search) {\n search.registerInput(element.nativeElement);\n }\n\n return { id, disabled, status };\n },\n);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, Directive, input } from '@angular/core';\nimport { uniqueId } from 'ng-primitives/utils';\nimport { ngpInput, provideInputState } from './input-state';\n\n@Directive({\n selector: 'input[ngpInput]',\n exportAs: 'ngpInput',\n providers: [provideInputState({ inherit: false })],\n})\nexport class NgpInput {\n /**\n * The id of the input.\n */\n readonly id = input(uniqueId('ngp-input'));\n\n /**\n * Whether the element is disabled.\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute,\n });\n\n /**\n * The input state.\n */\n protected readonly state = ngpInput({\n id: this.id,\n disabled: this.disabled,\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAqCO,MAAM,CAAC,kBAAkB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,GAAG,eAAe,CAChG,UAAU,E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