@ojiepermana/angular 22.1.14 → 22.2.1

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 (252) hide show
  1. package/README.md +8 -6
  2. package/SUPPORT.md +3 -3
  3. package/chart/README.md +1 -1
  4. package/component/README.md +2 -2
  5. package/component/calendar/README.md +3 -15
  6. package/component/drawer/README.md +1 -2
  7. package/fesm2022/ojiepermana-angular-chart-area.mjs +352 -137
  8. package/fesm2022/ojiepermana-angular-chart-bar.mjs +744 -524
  9. package/fesm2022/ojiepermana-angular-chart-core.mjs +1140 -1344
  10. package/fesm2022/ojiepermana-angular-chart-line.mjs +393 -147
  11. package/fesm2022/ojiepermana-angular-chart-pie.mjs +408 -179
  12. package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1262 -920
  13. package/fesm2022/ojiepermana-angular-chart-radar.mjs +473 -205
  14. package/fesm2022/ojiepermana-angular-chart-radial.mjs +425 -182
  15. package/fesm2022/ojiepermana-angular-chart-scatter.mjs +386 -210
  16. package/fesm2022/ojiepermana-angular-chart.mjs +3 -19
  17. package/fesm2022/ojiepermana-angular-component-accordion.mjs +485 -243
  18. package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +963 -325
  19. package/fesm2022/ojiepermana-angular-component-alert.mjs +266 -103
  20. package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +80 -35
  21. package/fesm2022/ojiepermana-angular-component-avatar.mjs +402 -135
  22. package/fesm2022/ojiepermana-angular-component-badge.mjs +109 -59
  23. package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +410 -142
  24. package/fesm2022/ojiepermana-angular-component-button-group.mjs +249 -96
  25. package/fesm2022/ojiepermana-angular-component-button.mjs +153 -75
  26. package/fesm2022/ojiepermana-angular-component-calendar.mjs +531 -418
  27. package/fesm2022/ojiepermana-angular-component-card.mjs +457 -171
  28. package/fesm2022/ojiepermana-angular-component-carousel.mjs +642 -272
  29. package/fesm2022/ojiepermana-angular-component-checkbox.mjs +312 -108
  30. package/fesm2022/ojiepermana-angular-component-collapsible.mjs +299 -115
  31. package/fesm2022/ojiepermana-angular-component-combobox.mjs +396 -183
  32. package/fesm2022/ojiepermana-angular-component-command.mjs +807 -347
  33. package/fesm2022/ojiepermana-angular-component-composer.mjs +807 -330
  34. package/fesm2022/ojiepermana-angular-component-context-menu.mjs +196 -161
  35. package/fesm2022/ojiepermana-angular-component-date-picker.mjs +650 -338
  36. package/fesm2022/ojiepermana-angular-component-dialog.mjs +710 -316
  37. package/fesm2022/ojiepermana-angular-component-drawer.mjs +1 -5
  38. package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +1212 -646
  39. package/fesm2022/ojiepermana-angular-component-editor.mjs +987 -502
  40. package/fesm2022/ojiepermana-angular-component-empty.mjs +350 -137
  41. package/fesm2022/ojiepermana-angular-component-form.mjs +813 -434
  42. package/fesm2022/ojiepermana-angular-component-hover-card.mjs +486 -277
  43. package/fesm2022/ojiepermana-angular-component-icon.mjs +241 -140
  44. package/fesm2022/ojiepermana-angular-component-input-group.mjs +449 -176
  45. package/fesm2022/ojiepermana-angular-component-input-otp.mjs +891 -488
  46. package/fesm2022/ojiepermana-angular-component-input.mjs +86 -55
  47. package/fesm2022/ojiepermana-angular-component-item.mjs +713 -261
  48. package/fesm2022/ojiepermana-angular-component-kanban.mjs +714 -216
  49. package/fesm2022/ojiepermana-angular-component-kbd.mjs +124 -52
  50. package/fesm2022/ojiepermana-angular-component-label.mjs +82 -31
  51. package/fesm2022/ojiepermana-angular-component-menubar.mjs +479 -329
  52. package/fesm2022/ojiepermana-angular-component-native-select.mjs +167 -65
  53. package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +683 -380
  54. package/fesm2022/ojiepermana-angular-component-pagination.mjs +277 -94
  55. package/fesm2022/ojiepermana-angular-component-pillbox.mjs +1283 -607
  56. package/fesm2022/ojiepermana-angular-component-popover.mjs +291 -204
  57. package/fesm2022/ojiepermana-angular-component-progress.mjs +176 -53
  58. package/fesm2022/ojiepermana-angular-component-radio.mjs +449 -142
  59. package/fesm2022/ojiepermana-angular-component-resizable.mjs +659 -453
  60. package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +117 -39
  61. package/fesm2022/ojiepermana-angular-component-segmented-control.mjs +351 -172
  62. package/fesm2022/ojiepermana-angular-component-select.mjs +475 -345
  63. package/fesm2022/ojiepermana-angular-component-separator.mjs +102 -35
  64. package/fesm2022/ojiepermana-angular-component-sheet.mjs +797 -347
  65. package/fesm2022/ojiepermana-angular-component-skeleton.mjs +62 -29
  66. package/fesm2022/ojiepermana-angular-component-slider.mjs +592 -376
  67. package/fesm2022/ojiepermana-angular-component-spinner.mjs +135 -38
  68. package/fesm2022/ojiepermana-angular-component-switch.mjs +315 -103
  69. package/fesm2022/ojiepermana-angular-component-table.mjs +440 -153
  70. package/fesm2022/ojiepermana-angular-component-tabs.mjs +590 -317
  71. package/fesm2022/ojiepermana-angular-component-textarea.mjs +85 -50
  72. package/fesm2022/ojiepermana-angular-component-timeline.mjs +609 -231
  73. package/fesm2022/ojiepermana-angular-component-toast.mjs +229 -243
  74. package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +573 -288
  75. package/fesm2022/ojiepermana-angular-component-toggle.mjs +187 -78
  76. package/fesm2022/ojiepermana-angular-component-tooltip.mjs +798 -517
  77. package/fesm2022/ojiepermana-angular-component-utils-core.mjs +159 -292
  78. package/fesm2022/ojiepermana-angular-component-utils-overlay.mjs +46 -58
  79. package/fesm2022/ojiepermana-angular-component-utils-scale.mjs +76 -38
  80. package/fesm2022/ojiepermana-angular-component-utils.mjs +2 -8
  81. package/fesm2022/ojiepermana-angular-component.mjs +0 -10
  82. package/fesm2022/ojiepermana-angular-navigation-core.mjs +13 -23
  83. package/fesm2022/ojiepermana-angular-navigation-icon.mjs +35 -24
  84. package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-DYuysKVf.mjs +129 -0
  85. package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-COiTaw34.mjs +812 -0
  86. package/fesm2022/{ojiepermana-angular-navigation-navigation-entry-grid.component-COQ-60DS.mjs → ojiepermana-angular-navigation-navigation-entry-grid.component-YIz0IsIb.mjs} +392 -207
  87. package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-D2vwEwBY.mjs +650 -0
  88. package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-B5D7yXfb.mjs +662 -0
  89. package/fesm2022/ojiepermana-angular-navigation-navigation-item.component-CUb68MZH.mjs +1219 -0
  90. package/fesm2022/ojiepermana-angular-navigation-navigation-list.component-CrK16trj.mjs +327 -0
  91. package/fesm2022/ojiepermana-angular-navigation-service.mjs +544 -724
  92. package/fesm2022/ojiepermana-angular-navigation-types.mjs +139 -56
  93. package/fesm2022/ojiepermana-angular-navigation.mjs +3256 -4
  94. package/fesm2022/ojiepermana-angular-sdk.mjs +91 -201
  95. package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +1125 -737
  96. package/fesm2022/ojiepermana-angular-theme-layout-services.mjs +245 -328
  97. package/fesm2022/ojiepermana-angular-theme-layout-types.mjs +35 -38
  98. package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +1928 -553
  99. package/fesm2022/ojiepermana-angular-theme-layout.mjs +847 -496
  100. package/fesm2022/ojiepermana-angular-theme-page-core.mjs +288 -358
  101. package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +362 -224
  102. package/fesm2022/ojiepermana-angular-theme-page-overview.mjs +88 -0
  103. package/fesm2022/ojiepermana-angular-theme-page-root.mjs +576 -254
  104. package/fesm2022/ojiepermana-angular-theme-page-side.mjs +317 -177
  105. package/fesm2022/ojiepermana-angular-theme-page-slots.mjs +256 -112
  106. package/fesm2022/ojiepermana-angular-theme-page.mjs +7 -12
  107. package/fesm2022/ojiepermana-angular-theme-shell-services.mjs +215 -326
  108. package/fesm2022/ojiepermana-angular-theme-shell-types.mjs +68 -129
  109. package/fesm2022/ojiepermana-angular-theme-shell.mjs +907 -378
  110. package/fesm2022/ojiepermana-angular-theme-styles.mjs +521 -720
  111. package/fesm2022/ojiepermana-angular-theme.mjs +0 -10
  112. package/fesm2022/ojiepermana-angular.mjs +5 -24
  113. package/navigation/README.md +69 -18
  114. package/package.json +16 -12
  115. package/sdk/README.md +1 -1
  116. package/sdk/src/writer/index.js +2 -2
  117. package/theme/README.md +1 -1
  118. package/theme/layout/README.md +2 -4
  119. package/theme/page/README.md +50 -0
  120. package/theme/styles/README.md +10 -10
  121. package/theme/styles/css/base/prefers-dark.css +1 -1
  122. package/theme/styles/css/base/status.css +1 -1
  123. package/theme/styles/css/color/amber.css +1 -1
  124. package/theme/styles/css/color/blue.css +1 -1
  125. package/theme/styles/css/color/cyan.css +1 -1
  126. package/theme/styles/css/color/emerald.css +1 -1
  127. package/theme/styles/css/color/fuchsia.css +1 -1
  128. package/theme/styles/css/color/green.css +1 -1
  129. package/theme/styles/css/color/indigo.css +1 -1
  130. package/theme/styles/css/color/lime.css +1 -1
  131. package/theme/styles/css/color/orange.css +1 -1
  132. package/theme/styles/css/color/pink.css +1 -1
  133. package/theme/styles/css/color/purple.css +1 -1
  134. package/theme/styles/css/color/red.css +1 -1
  135. package/theme/styles/css/color/rose.css +1 -1
  136. package/theme/styles/css/color/sky.css +1 -1
  137. package/theme/styles/css/color/teal.css +1 -1
  138. package/theme/styles/css/color/violet.css +1 -1
  139. package/theme/styles/css/color/yellow.css +1 -1
  140. package/theme/styles/css/neutral/gray.css +1 -1
  141. package/theme/styles/css/neutral/mauve.css +1 -1
  142. package/theme/styles/css/neutral/mist.css +1 -1
  143. package/theme/styles/css/neutral/neutral.css +1 -1
  144. package/theme/styles/css/neutral/olive.css +1 -1
  145. package/theme/styles/css/neutral/slate.css +1 -1
  146. package/theme/styles/css/neutral/stone.css +1 -1
  147. package/theme/styles/css/neutral/taupe.css +1 -1
  148. package/theme/styles/css/neutral/zinc.css +1 -1
  149. package/types/ojiepermana-angular-chart-area.d.ts +126 -63
  150. package/types/ojiepermana-angular-chart-bar.d.ts +244 -154
  151. package/types/ojiepermana-angular-chart-core.d.ts +409 -398
  152. package/types/ojiepermana-angular-chart-line.d.ts +141 -68
  153. package/types/ojiepermana-angular-chart-pie.d.ts +192 -121
  154. package/types/ojiepermana-angular-chart-primitives.d.ts +283 -214
  155. package/types/ojiepermana-angular-chart-radar.d.ts +189 -108
  156. package/types/ojiepermana-angular-chart-radial.d.ts +177 -106
  157. package/types/ojiepermana-angular-chart-scatter.d.ts +166 -110
  158. package/types/ojiepermana-angular-chart.d.ts +3 -2
  159. package/types/ojiepermana-angular-component-accordion.d.ts +135 -81
  160. package/types/ojiepermana-angular-component-alert-dialog.d.ts +271 -123
  161. package/types/ojiepermana-angular-component-alert.d.ts +69 -39
  162. package/types/ojiepermana-angular-component-aspect-ratio.d.ts +20 -12
  163. package/types/ojiepermana-angular-component-avatar.d.ts +103 -49
  164. package/types/ojiepermana-angular-component-badge.d.ts +36 -24
  165. package/types/ojiepermana-angular-component-breadcrumb.d.ts +79 -40
  166. package/types/ojiepermana-angular-component-button-group.d.ts +48 -24
  167. package/types/ojiepermana-angular-component-button.d.ts +44 -27
  168. package/types/ojiepermana-angular-component-calendar.d.ts +145 -107
  169. package/types/ojiepermana-angular-component-card.d.ts +112 -63
  170. package/types/ojiepermana-angular-component-carousel.d.ts +150 -81
  171. package/types/ojiepermana-angular-component-checkbox.d.ts +96 -38
  172. package/types/ojiepermana-angular-component-collapsible.d.ts +65 -39
  173. package/types/ojiepermana-angular-component-combobox.d.ts +100 -55
  174. package/types/ojiepermana-angular-component-command.d.ts +206 -121
  175. package/types/ojiepermana-angular-component-composer.d.ts +184 -84
  176. package/types/ojiepermana-angular-component-context-menu.d.ts +51 -41
  177. package/types/ojiepermana-angular-component-date-picker.d.ts +199 -109
  178. package/types/ojiepermana-angular-component-dialog.d.ts +200 -105
  179. package/types/ojiepermana-angular-component-drawer.d.ts +2 -1
  180. package/types/ojiepermana-angular-component-dropdown-menu.d.ts +324 -202
  181. package/types/ojiepermana-angular-component-editor.d.ts +215 -117
  182. package/types/ojiepermana-angular-component-empty.d.ts +80 -45
  183. package/types/ojiepermana-angular-component-form.d.ts +185 -121
  184. package/types/ojiepermana-angular-component-hover-card.d.ts +130 -72
  185. package/types/ojiepermana-angular-component-icon.d.ts +87 -57
  186. package/types/ojiepermana-angular-component-input-group.d.ts +93 -46
  187. package/types/ojiepermana-angular-component-input-otp.d.ts +243 -150
  188. package/types/ojiepermana-angular-component-input.d.ts +27 -17
  189. package/types/ojiepermana-angular-component-item.d.ts +160 -84
  190. package/types/ojiepermana-angular-component-kanban.d.ts +157 -62
  191. package/types/ojiepermana-angular-component-kbd.d.ts +24 -15
  192. package/types/ojiepermana-angular-component-label.d.ts +19 -11
  193. package/types/ojiepermana-angular-component-menubar.d.ts +120 -90
  194. package/types/ojiepermana-angular-component-native-select.d.ts +37 -24
  195. package/types/ojiepermana-angular-component-navigation-menu.d.ts +157 -98
  196. package/types/ojiepermana-angular-component-pagination.d.ts +78 -28
  197. package/types/ojiepermana-angular-component-pillbox.d.ts +361 -204
  198. package/types/ojiepermana-angular-component-popover.d.ts +94 -64
  199. package/types/ojiepermana-angular-component-progress.d.ts +45 -17
  200. package/types/ojiepermana-angular-component-radio.d.ts +129 -53
  201. package/types/ojiepermana-angular-component-resizable.d.ts +160 -112
  202. package/types/ojiepermana-angular-component-scroll-area.d.ts +33 -15
  203. package/types/ojiepermana-angular-component-segmented-control.d.ts +94 -50
  204. package/types/ojiepermana-angular-component-select.d.ts +94 -77
  205. package/types/ojiepermana-angular-component-separator.d.ts +26 -14
  206. package/types/ojiepermana-angular-component-sheet.d.ts +226 -116
  207. package/types/ojiepermana-angular-component-skeleton.d.ts +13 -10
  208. package/types/ojiepermana-angular-component-slider.d.ts +140 -75
  209. package/types/ojiepermana-angular-component-spinner.d.ts +31 -13
  210. package/types/ojiepermana-angular-component-switch.d.ts +97 -40
  211. package/types/ojiepermana-angular-component-table.d.ts +102 -50
  212. package/types/ojiepermana-angular-component-tabs.d.ts +174 -115
  213. package/types/ojiepermana-angular-component-textarea.d.ts +27 -17
  214. package/types/ojiepermana-angular-component-timeline.d.ts +141 -59
  215. package/types/ojiepermana-angular-component-toast.d.ts +51 -55
  216. package/types/ojiepermana-angular-component-toggle-group.d.ts +159 -88
  217. package/types/ojiepermana-angular-component-toggle.d.ts +47 -25
  218. package/types/ojiepermana-angular-component-tooltip.d.ts +222 -132
  219. package/types/ojiepermana-angular-component-utils-core.d.ts +81 -90
  220. package/types/ojiepermana-angular-component-utils-overlay.d.ts +7 -11
  221. package/types/ojiepermana-angular-component-utils-scale.d.ts +20 -12
  222. package/types/ojiepermana-angular-component-utils.d.ts +2 -2
  223. package/types/ojiepermana-angular-component.d.ts +1 -2
  224. package/types/ojiepermana-angular-navigation-core.d.ts +46 -50
  225. package/types/ojiepermana-angular-navigation-icon.d.ts +9 -12
  226. package/types/ojiepermana-angular-navigation-service.d.ts +112 -115
  227. package/types/ojiepermana-angular-navigation-types.d.ts +166 -125
  228. package/types/ojiepermana-angular-navigation.d.ts +708 -375
  229. package/types/ojiepermana-angular-sdk.d.ts +69 -71
  230. package/types/ojiepermana-angular-theme-component-settings.d.ts +120 -86
  231. package/types/ojiepermana-angular-theme-layout-services.d.ts +119 -124
  232. package/types/ojiepermana-angular-theme-layout-types.d.ts +27 -31
  233. package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +446 -187
  234. package/types/ojiepermana-angular-theme-layout.d.ts +201 -113
  235. package/types/ojiepermana-angular-theme-page-core.d.ts +136 -142
  236. package/types/ojiepermana-angular-theme-page-filter.d.ts +112 -62
  237. package/types/ojiepermana-angular-theme-page-overview.d.ts +28 -0
  238. package/types/ojiepermana-angular-theme-page-root.d.ts +172 -88
  239. package/types/ojiepermana-angular-theme-page-side.d.ts +89 -49
  240. package/types/ojiepermana-angular-theme-page-slots.d.ts +58 -37
  241. package/types/ojiepermana-angular-theme-page.d.ts +7 -5
  242. package/types/ojiepermana-angular-theme-shell-services.d.ts +119 -125
  243. package/types/ojiepermana-angular-theme-shell-types.d.ts +38 -41
  244. package/types/ojiepermana-angular-theme-shell.d.ts +139 -61
  245. package/types/ojiepermana-angular-theme-styles.d.ts +184 -196
  246. package/types/ojiepermana-angular-theme.d.ts +1 -2
  247. package/types/ojiepermana-angular.d.ts +5 -5
  248. package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-Be3IqzG4.mjs +0 -91
  249. package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-Bc7DWK3R.mjs +0 -522
  250. package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-DA8VPEn7.mjs +0 -404
  251. package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-U2TJTzlW.mjs +0 -466
  252. package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-CIUhmytH.mjs +0 -2668
@@ -1,44 +1,125 @@
1
- import * as i0 from '@angular/core';
2
- import { Directive, input, computed, Component, inject, numberAttribute, booleanAttribute, viewChild, ElementRef, Injector, output, linkedSignal, signal, contentChildren, forwardRef } from '@angular/core';
3
- import { NgControl, NG_VALUE_ACCESSOR } from '@angular/forms';
4
- import { FormFieldContext } from '@ojiepermana/angular/component/form';
5
- import { cn, injectUniqueId } from '@ojiepermana/angular/component/utils/core';
6
-
1
+ import * as i0 from "@angular/core";
2
+ import { Component, Directive, ElementRef, Injector, booleanAttribute, computed, contentChildren, forwardRef, inject, input, linkedSignal, numberAttribute, output, signal, viewChild } from "@angular/core";
3
+ import { NG_VALUE_ACCESSOR, NgControl } from "@angular/forms";
4
+ import { FormFieldContext } from "@ojiepermana/angular/component/form";
5
+ import { cn, injectUniqueId } from "@ojiepermana/angular/component/utils/core";
7
6
  const REGEXP_ONLY_DIGITS = /^[0-9]$/;
8
7
  const REGEXP_ONLY_DIGITS_AND_CHARS = /^[A-Za-z0-9]$/;
9
- class InputOtpContextBase {
10
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: InputOtpContextBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
11
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.6", type: InputOtpContextBase, isStandalone: true, ngImport: i0 });
12
- }
13
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: InputOtpContextBase, decorators: [{
14
- type: Directive
15
- }] });
16
- class InputOtpGroupComponent {
17
- class = input('', /* @ts-ignore */
18
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
19
- classes = computed(() => cn('flex items-center overflow-hidden rounded-md border border-input bg-background shadow-sm', this.class()), /* @ts-ignore */
20
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
21
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: InputOtpGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
22
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: InputOtpGroupComponent, isStandalone: true, selector: "InputOtpGroup", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.data-slot": "\"input-otp-group\"" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
23
- }
24
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: InputOtpGroupComponent, decorators: [{
25
- type: Component,
26
- args: [{
27
- selector: 'InputOtpGroup',
28
- host: {
29
- '[class]': 'classes()',
30
- '[attr.data-slot]': '"input-otp-group"',
31
- },
32
- template: `<ng-content />`,
33
- }]
34
- }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
35
- class InputOtpSeparatorComponent {
36
- class = input('', /* @ts-ignore */
37
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
38
- classes = computed(() => cn('inline-flex h-control-10 w-6 items-center justify-center text-muted-foreground [&>svg]:h-4 [&>svg]:w-4', this.class()), /* @ts-ignore */
39
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
40
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: InputOtpSeparatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
41
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: InputOtpSeparatorComponent, isStandalone: true, selector: "InputOtpSeparator", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "class": "classes()", "attr.data-slot": "\"input-otp-separator\"" } }, ngImport: i0, template: `
8
+ var InputOtpContextBase = class InputOtpContextBase {
9
+ static ɵfac = i0.ɵɵngDeclareFactory({
10
+ minVersion: "12.0.0",
11
+ version: "22.2.2",
12
+ ngImport: i0,
13
+ type: InputOtpContextBase,
14
+ deps: [],
15
+ target: i0.ɵɵFactoryTarget.Directive
16
+ });
17
+ static ɵdir = i0.ɵɵngDeclareDirective({
18
+ minVersion: "14.0.0",
19
+ version: "22.2.2",
20
+ type: InputOtpContextBase,
21
+ isStandalone: true,
22
+ ngImport: i0
23
+ });
24
+ };
25
+ i0.ɵɵngDeclareClassMetadata({
26
+ minVersion: "12.0.0",
27
+ version: "22.2.2",
28
+ ngImport: i0,
29
+ type: InputOtpContextBase,
30
+ decorators: [{ type: Directive }]
31
+ });
32
+ var InputOtpGroupComponent = class InputOtpGroupComponent {
33
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
34
+ classes = computed(() => cn("flex items-center overflow-hidden rounded-md border border-input bg-background shadow-sm", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
35
+ static ɵfac = i0.ɵɵngDeclareFactory({
36
+ minVersion: "12.0.0",
37
+ version: "22.2.2",
38
+ ngImport: i0,
39
+ type: InputOtpGroupComponent,
40
+ deps: [],
41
+ target: i0.ɵɵFactoryTarget.Component
42
+ });
43
+ static ɵcmp = i0.ɵɵngDeclareComponent({
44
+ minVersion: "17.1.0",
45
+ version: "22.2.2",
46
+ type: InputOtpGroupComponent,
47
+ isStandalone: true,
48
+ selector: "InputOtpGroup",
49
+ inputs: { class: {
50
+ classPropertyName: "class",
51
+ publicName: "class",
52
+ isSignal: true,
53
+ isRequired: false,
54
+ transformFunction: null
55
+ } },
56
+ host: { properties: {
57
+ "class": "classes()",
58
+ "attr.data-slot": "\"input-otp-group\""
59
+ } },
60
+ ngImport: i0,
61
+ template: `<ng-content />`,
62
+ isInline: true
63
+ });
64
+ };
65
+ i0.ɵɵngDeclareClassMetadata({
66
+ minVersion: "12.0.0",
67
+ version: "22.2.2",
68
+ ngImport: i0,
69
+ type: InputOtpGroupComponent,
70
+ decorators: [{
71
+ type: Component,
72
+ args: [{
73
+ selector: "InputOtpGroup",
74
+ host: {
75
+ "[class]": "classes()",
76
+ "[attr.data-slot]": "\"input-otp-group\""
77
+ },
78
+ template: `<ng-content />`
79
+ }]
80
+ }],
81
+ propDecorators: { class: [{
82
+ type: i0.Input,
83
+ args: [{
84
+ isSignal: true,
85
+ alias: "class",
86
+ required: false
87
+ }]
88
+ }] }
89
+ });
90
+ var InputOtpSeparatorComponent = class InputOtpSeparatorComponent {
91
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
92
+ classes = computed(() => cn("inline-flex h-control-10 w-6 items-center justify-center text-muted-foreground [&>svg]:h-4 [&>svg]:w-4", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
93
+ static ɵfac = i0.ɵɵngDeclareFactory({
94
+ minVersion: "12.0.0",
95
+ version: "22.2.2",
96
+ ngImport: i0,
97
+ type: InputOtpSeparatorComponent,
98
+ deps: [],
99
+ target: i0.ɵɵFactoryTarget.Component
100
+ });
101
+ static ɵcmp = i0.ɵɵngDeclareComponent({
102
+ minVersion: "17.1.0",
103
+ version: "22.2.2",
104
+ type: InputOtpSeparatorComponent,
105
+ isStandalone: true,
106
+ selector: "InputOtpSeparator",
107
+ inputs: { class: {
108
+ classPropertyName: "class",
109
+ publicName: "class",
110
+ isSignal: true,
111
+ isRequired: false,
112
+ transformFunction: null
113
+ } },
114
+ host: {
115
+ attributes: { "aria-hidden": "true" },
116
+ properties: {
117
+ "class": "classes()",
118
+ "attr.data-slot": "\"input-otp-separator\""
119
+ }
120
+ },
121
+ ngImport: i0,
122
+ template: `
42
123
  <svg
43
124
  viewBox="0 0 24 24"
44
125
  fill="none"
@@ -49,18 +130,25 @@ class InputOtpSeparatorComponent {
49
130
  >
50
131
  <path d="M5 12h14" />
51
132
  </svg>
52
- `, isInline: true });
53
- }
54
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: InputOtpSeparatorComponent, decorators: [{
55
- type: Component,
56
- args: [{
57
- selector: 'InputOtpSeparator',
58
- host: {
59
- '[class]': 'classes()',
60
- '[attr.data-slot]': '"input-otp-separator"',
61
- 'aria-hidden': 'true',
62
- },
63
- template: `
133
+ `,
134
+ isInline: true
135
+ });
136
+ };
137
+ i0.ɵɵngDeclareClassMetadata({
138
+ minVersion: "12.0.0",
139
+ version: "22.2.2",
140
+ ngImport: i0,
141
+ type: InputOtpSeparatorComponent,
142
+ decorators: [{
143
+ type: Component,
144
+ args: [{
145
+ selector: "InputOtpSeparator",
146
+ host: {
147
+ "[class]": "classes()",
148
+ "[attr.data-slot]": "\"input-otp-separator\"",
149
+ "aria-hidden": "true"
150
+ },
151
+ template: `
64
152
  <svg
65
153
  viewBox="0 0 24 24"
66
154
  fill="none"
@@ -71,85 +159,123 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
71
159
  >
72
160
  <path d="M5 12h14" />
73
161
  </svg>
74
- `,
75
- }]
76
- }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
77
- class InputOtpSlotComponent {
78
- ctx = inject(InputOtpContextBase);
79
- index = input(0, { ...(ngDevMode ? { debugName: "index" } : /* istanbul ignore next */ {}), transform: numberAttribute });
80
- class = input('', /* @ts-ignore */
81
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
82
- invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), alias: 'aria-invalid', transform: booleanAttribute });
83
- inputRef = viewChild.required('inputRef', /* @ts-ignore */
84
- ...(ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []));
85
- maxLength = computed(() => this.ctx.maxLength(), /* @ts-ignore */
86
- ...(ngDevMode ? [{ debugName: "maxLength" }] : /* istanbul ignore next */ []));
87
- character = computed(() => this.ctx.slotValue(this.index()), /* @ts-ignore */
88
- ...(ngDevMode ? [{ debugName: "character" }] : /* istanbul ignore next */ []));
89
- active = computed(() => this.ctx.isActive(this.index()), /* @ts-ignore */
90
- ...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
91
- filled = computed(() => this.character() !== '', /* @ts-ignore */
92
- ...(ngDevMode ? [{ debugName: "filled" }] : /* istanbul ignore next */ []));
93
- disabled = computed(() => this.ctx.isDisabled(), /* @ts-ignore */
94
- ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
95
- required = computed(() => this.ctx.isRequired(), /* @ts-ignore */
96
- ...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
97
- inputId = computed(() => this.ctx.slotId(this.index()), /* @ts-ignore */
98
- ...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
99
- inputMode = computed(() => this.ctx.slotInputMode(), /* @ts-ignore */
100
- ...(ngDevMode ? [{ debugName: "inputMode" }] : /* istanbul ignore next */ []));
101
- autocomplete = computed(() => this.ctx.slotAutocomplete(this.index()), /* @ts-ignore */
102
- ...(ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []));
103
- ariaLabel = computed(() => this.ctx.slotAriaLabel(this.index()), /* @ts-ignore */
104
- ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
105
- ariaLabelledBy = computed(() => this.ctx.slotAriaLabelledBy(this.index()), /* @ts-ignore */
106
- ...(ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []));
107
- ariaDescribedBy = computed(() => this.ctx.slotAriaDescribedBy(), /* @ts-ignore */
108
- ...(ngDevMode ? [{ debugName: "ariaDescribedBy" }] : /* istanbul ignore next */ []));
109
- effectiveInvalid = computed(() => this.invalid() || this.ctx.isInvalid(), /* @ts-ignore */
110
- ...(ngDevMode ? [{ debugName: "effectiveInvalid" }] : /* istanbul ignore next */ []));
111
- classes = computed(() => cn('relative flex h-control-10 w-control-10 items-center justify-center border-r border-border text-sm font-medium transition-[background-color,box-shadow,opacity] last:border-r-0', this.active() && !this.effectiveInvalid() && 'z-10 ring-1 ring-inset ring-ring', this.effectiveInvalid() &&
112
- 'bg-destructive/5 text-destructive ring-1 ring-inset ring-destructive/50', this.disabled() && 'opacity-50', this.class()), /* @ts-ignore */
113
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
114
- focus(select = true) {
115
- const input = this.inputRef().nativeElement;
116
- input.focus();
117
- if (select) {
118
- input.select();
119
- }
120
- }
121
- handleFocus() {
122
- this.ctx.handleSlotFocus(this.index());
123
- this.inputRef().nativeElement.select();
124
- }
125
- handleInput(event) {
126
- const target = event.target;
127
- this.ctx.handleSlotInput(this.index(), target.value);
128
- this.syncElementValue(target);
129
- }
130
- /**
131
- * Push the model back onto the element the browser just wrote to.
132
- *
133
- * `[value]` only repaints when `character()` CHANGES, and a character the
134
- * pattern rejects leaves the model exactly as it was — so without this the
135
- * rejected character stays on screen until some later, unrelated value change.
136
- * It covers the paste of an entirely unacceptable string too: that one is not
137
- * prevented, so the browser drops it in and the `input` event lands here.
138
- */
139
- syncElementValue(target) {
140
- const character = this.character();
141
- if (target.value !== character) {
142
- target.value = character;
143
- }
144
- }
145
- handleKeydown(event) {
146
- this.ctx.handleSlotKeydown(this.index(), event);
147
- }
148
- handlePaste(event) {
149
- this.ctx.handleSlotPaste(this.index(), event);
150
- }
151
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: InputOtpSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
152
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.6", type: InputOtpSlotComponent, isStandalone: true, selector: "InputOtpSlot", inputs: { index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.data-slot": "\"input-otp-slot\"", "attr.data-active": "active() ? \"\" : null", "attr.data-filled": "filled() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-invalid": "effectiveInvalid() ? \"\" : null" } }, viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["inputRef"], descendants: true, isSignal: true }], ngImport: i0, template: `
162
+ `
163
+ }]
164
+ }],
165
+ propDecorators: { class: [{
166
+ type: i0.Input,
167
+ args: [{
168
+ isSignal: true,
169
+ alias: "class",
170
+ required: false
171
+ }]
172
+ }] }
173
+ });
174
+ var InputOtpSlotComponent = class InputOtpSlotComponent {
175
+ ctx = inject(InputOtpContextBase);
176
+ index = input(0, {
177
+ ...ngDevMode ? { debugName: "index" } : /* istanbul ignore next */ {},
178
+ transform: numberAttribute
179
+ });
180
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
181
+ invalid = input(false, {
182
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
183
+ alias: "aria-invalid",
184
+ transform: booleanAttribute
185
+ });
186
+ inputRef = viewChild.required("inputRef", ...ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []);
187
+ maxLength = computed(() => this.ctx.maxLength(), ...ngDevMode ? [{ debugName: "maxLength" }] : /* istanbul ignore next */ []);
188
+ character = computed(() => this.ctx.slotValue(this.index()), ...ngDevMode ? [{ debugName: "character" }] : /* istanbul ignore next */ []);
189
+ active = computed(() => this.ctx.isActive(this.index()), ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
190
+ filled = computed(() => this.character() !== "", ...ngDevMode ? [{ debugName: "filled" }] : /* istanbul ignore next */ []);
191
+ disabled = computed(() => this.ctx.isDisabled(), ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
192
+ required = computed(() => this.ctx.isRequired(), ...ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []);
193
+ inputId = computed(() => this.ctx.slotId(this.index()), ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
194
+ inputMode = computed(() => this.ctx.slotInputMode(), ...ngDevMode ? [{ debugName: "inputMode" }] : /* istanbul ignore next */ []);
195
+ autocomplete = computed(() => this.ctx.slotAutocomplete(this.index()), ...ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []);
196
+ ariaLabel = computed(() => this.ctx.slotAriaLabel(this.index()), ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
197
+ ariaLabelledBy = computed(() => this.ctx.slotAriaLabelledBy(this.index()), ...ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []);
198
+ ariaDescribedBy = computed(() => this.ctx.slotAriaDescribedBy(), ...ngDevMode ? [{ debugName: "ariaDescribedBy" }] : /* istanbul ignore next */ []);
199
+ effectiveInvalid = computed(() => this.invalid() || this.ctx.isInvalid(), ...ngDevMode ? [{ debugName: "effectiveInvalid" }] : /* istanbul ignore next */ []);
200
+ classes = computed(() => cn("relative flex h-control-10 w-control-10 items-center justify-center border-r border-border text-sm font-medium transition-[background-color,box-shadow,opacity] last:border-r-0", this.active() && !this.effectiveInvalid() && "z-10 ring-1 ring-inset ring-ring", this.effectiveInvalid() && "bg-destructive/5 text-destructive ring-1 ring-inset ring-destructive/50", this.disabled() && "opacity-50", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
201
+ focus(select = true) {
202
+ const input = this.inputRef().nativeElement;
203
+ input.focus();
204
+ if (select) input.select();
205
+ }
206
+ handleFocus() {
207
+ this.ctx.handleSlotFocus(this.index());
208
+ this.inputRef().nativeElement.select();
209
+ }
210
+ handleInput(event) {
211
+ const target = event.target;
212
+ this.ctx.handleSlotInput(this.index(), target.value);
213
+ this.syncElementValue(target);
214
+ }
215
+ syncElementValue(target) {
216
+ const character = this.character();
217
+ if (target.value !== character) target.value = character;
218
+ }
219
+ handleKeydown(event) {
220
+ this.ctx.handleSlotKeydown(this.index(), event);
221
+ }
222
+ handlePaste(event) {
223
+ this.ctx.handleSlotPaste(this.index(), event);
224
+ }
225
+ static ɵfac = i0.ɵɵngDeclareFactory({
226
+ minVersion: "12.0.0",
227
+ version: "22.2.2",
228
+ ngImport: i0,
229
+ type: InputOtpSlotComponent,
230
+ deps: [],
231
+ target: i0.ɵɵFactoryTarget.Component
232
+ });
233
+ static ɵcmp = i0.ɵɵngDeclareComponent({
234
+ minVersion: "17.2.0",
235
+ version: "22.2.2",
236
+ type: InputOtpSlotComponent,
237
+ isStandalone: true,
238
+ selector: "InputOtpSlot",
239
+ inputs: {
240
+ index: {
241
+ classPropertyName: "index",
242
+ publicName: "index",
243
+ isSignal: true,
244
+ isRequired: false,
245
+ transformFunction: null
246
+ },
247
+ class: {
248
+ classPropertyName: "class",
249
+ publicName: "class",
250
+ isSignal: true,
251
+ isRequired: false,
252
+ transformFunction: null
253
+ },
254
+ invalid: {
255
+ classPropertyName: "invalid",
256
+ publicName: "aria-invalid",
257
+ isSignal: true,
258
+ isRequired: false,
259
+ transformFunction: null
260
+ }
261
+ },
262
+ host: { properties: {
263
+ "class": "classes()",
264
+ "attr.data-slot": "\"input-otp-slot\"",
265
+ "attr.data-active": "active() ? \"\" : null",
266
+ "attr.data-filled": "filled() ? \"\" : null",
267
+ "attr.data-disabled": "disabled() ? \"\" : null",
268
+ "attr.data-invalid": "effectiveInvalid() ? \"\" : null"
269
+ } },
270
+ viewQueries: [{
271
+ propertyName: "inputRef",
272
+ first: true,
273
+ predicate: ["inputRef"],
274
+ descendants: true,
275
+ isSignal: true
276
+ }],
277
+ ngImport: i0,
278
+ template: `
153
279
  <input
154
280
  #inputRef
155
281
  class="h-full w-full border-0 bg-transparent px-0 text-center text-inherit font-inherit outline-none disabled:cursor-not-allowed"
@@ -172,21 +298,28 @@ class InputOtpSlotComponent {
172
298
  (keydown)="handleKeydown($event)"
173
299
  (paste)="handlePaste($event)"
174
300
  />
175
- `, isInline: true });
176
- }
177
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: InputOtpSlotComponent, decorators: [{
178
- type: Component,
179
- args: [{
180
- selector: 'InputOtpSlot',
181
- host: {
182
- '[class]': 'classes()',
183
- '[attr.data-slot]': '"input-otp-slot"',
184
- '[attr.data-active]': 'active() ? "" : null',
185
- '[attr.data-filled]': 'filled() ? "" : null',
186
- '[attr.data-disabled]': 'disabled() ? "" : null',
187
- '[attr.data-invalid]': 'effectiveInvalid() ? "" : null',
188
- },
189
- template: `
301
+ `,
302
+ isInline: true
303
+ });
304
+ };
305
+ i0.ɵɵngDeclareClassMetadata({
306
+ minVersion: "12.0.0",
307
+ version: "22.2.2",
308
+ ngImport: i0,
309
+ type: InputOtpSlotComponent,
310
+ decorators: [{
311
+ type: Component,
312
+ args: [{
313
+ selector: "InputOtpSlot",
314
+ host: {
315
+ "[class]": "classes()",
316
+ "[attr.data-slot]": "\"input-otp-slot\"",
317
+ "[attr.data-active]": "active() ? \"\" : null",
318
+ "[attr.data-filled]": "filled() ? \"\" : null",
319
+ "[attr.data-disabled]": "disabled() ? \"\" : null",
320
+ "[attr.data-invalid]": "effectiveInvalid() ? \"\" : null"
321
+ },
322
+ template: `
190
323
  <input
191
324
  #inputRef
192
325
  class="h-full w-full border-0 bg-transparent px-0 text-center text-inherit font-inherit outline-none disabled:cursor-not-allowed"
@@ -209,346 +342,616 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
209
342
  (keydown)="handleKeydown($event)"
210
343
  (paste)="handlePaste($event)"
211
344
  />
212
- `,
213
- }]
214
- }], propDecorators: { index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-invalid", required: false }] }], inputRef: [{ type: i0.ViewChild, args: ['inputRef', { isSignal: true }] }] } });
215
- class InputOtpComponent extends InputOtpContextBase {
216
- host = inject(ElementRef);
217
- injector = inject(Injector);
218
- formFieldContext = inject(FormFieldContext, { optional: true });
219
- maxLengthInput = input(6, { ...(ngDevMode ? { debugName: "maxLengthInput" } : /* istanbul ignore next */ {}), alias: 'maxLength', transform: numberAttribute });
220
- value = input(undefined, /* @ts-ignore */
221
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
222
- pattern = input(null, /* @ts-ignore */
223
- ...(ngDevMode ? [{ debugName: "pattern" }] : /* istanbul ignore next */ []));
224
- id = input(null, { ...(ngDevMode ? { debugName: "id" } : /* istanbul ignore next */ {}), alias: 'id' });
225
- ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
226
- ariaLabelledby = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
227
- ariaDescribedby = input(null, { ...(ngDevMode ? { debugName: "ariaDescribedby" } : /* istanbul ignore next */ {}), alias: 'aria-describedby' });
228
- inputMode = input('numeric', { ...(ngDevMode ? { debugName: "inputMode" } : /* istanbul ignore next */ {}), alias: 'inputmode' });
229
- autocomplete = input('one-time-code', { ...(ngDevMode ? { debugName: "autocomplete" } : /* istanbul ignore next */ {}), alias: 'autocomplete' });
230
- required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
231
- disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
232
- invalidInput = input(false, { ...(ngDevMode ? { debugName: "invalidInput" } : /* istanbul ignore next */ {}), alias: 'aria-invalid', transform: booleanAttribute });
233
- class = input('', /* @ts-ignore */
234
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
235
- valueChange = output();
236
- generatedId = injectUniqueId('InputOtp');
237
- /**
238
- * Single source of truth for the rendered value. Re-seeds from the `value`
239
- * binding when it changes, but writes from typing or the Forms API
240
- * (writeValue) win until the binding changes again — so `form.reset()` is
241
- * never shadowed by a stale `[value]` binding.
242
- */
243
- internalValue = linkedSignal(() => this.normalizeValue(this.value() ?? ''), {
244
- debugName: 'InputOtp.internalValue',
245
- set: (value, rawSet) => rawSet(this.normalizeValue(value)),
246
- });
247
- disabledState = signal(false, /* @ts-ignore */
248
- ...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
249
- activeIndex = signal(0, /* @ts-ignore */
250
- ...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
251
- slots = contentChildren(InputOtpSlotComponent, { ...(ngDevMode ? { debugName: "slots" } : /* istanbul ignore next */ {}), descendants: true });
252
- compiledPattern = computed(() => {
253
- const pattern = this.pattern();
254
- if (!pattern) {
255
- return [];
256
- }
257
- if (pattern instanceof RegExp) {
258
- return [pattern];
259
- }
260
- if (typeof pattern !== 'string') {
261
- return pattern;
262
- }
263
- try {
264
- return [new RegExp(pattern)];
265
- }
266
- catch {
267
- return [];
268
- }
269
- }, /* @ts-ignore */
270
- ...(ngDevMode ? [{ debugName: "compiledPattern" }] : /* istanbul ignore next */ []));
271
- classes = computed(() => cn('inline-flex flex-wrap items-center gap-2', this.class()), /* @ts-ignore */
272
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
273
- disabled = computed(() => this.disabledInput() || this.disabledState(), /* @ts-ignore */
274
- ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
275
- displayValue = computed(() => this.internalValue(), /* @ts-ignore */
276
- ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
277
- ngControl = null;
278
- onChange = () => { };
279
- onTouched = () => { };
280
- ngOnInit() {
281
- this.ngControl = this.injector.get(NgControl, null, { optional: true, self: true });
282
- this.publishControl();
283
- }
284
- ngAfterViewInit() {
285
- // `formControlName` assigns `.control` in FormControlName.ngOnChanges, which
286
- // Angular runs AFTER this component's ngOnInit — both are pre-order hooks,
287
- // and the component's are registered first. Reading it once at init would
288
- // park `null` in the FormField forever, so the field could never surface the
289
- // control's invalid state. By now the node is fully set up, whichever
290
- // directive owns the binding.
291
- this.publishControl();
292
- }
293
- maxLength() {
294
- return Math.max(1, this.maxLengthInput());
295
- }
296
- slotId(index) {
297
- const baseId = this.id() ?? this.formFieldContext?.controlId ?? this.generatedId;
298
- return index === 0 ? baseId : `${baseId}-${index + 1}`;
299
- }
300
- slotValue(index) {
301
- return this.toCharArray()[index] ?? '';
302
- }
303
- slotAriaLabel(index) {
304
- const baseLabel = this.ariaLabel() ?? 'One-time password';
305
- return `${baseLabel} character ${index + 1} of ${this.maxLength()}`;
306
- }
307
- slotAriaLabelledBy(index) {
308
- return index === 0 ? this.ariaLabelledby() : null;
309
- }
310
- slotAriaDescribedBy() {
311
- return this.describedBy();
312
- }
313
- slotInputMode() {
314
- return this.inputMode();
315
- }
316
- slotAutocomplete(index) {
317
- return index === 0 ? this.autocomplete() : 'off';
318
- }
319
- isDisabled() {
320
- return this.disabled();
321
- }
322
- isRequired() {
323
- return this.required();
324
- }
325
- isInvalid() {
326
- return this.invalidInput() || this.formFieldContext?.invalid() || false;
327
- }
328
- isActive(index) {
329
- return this.activeIndex() === index;
330
- }
331
- handleSlotFocus(index) {
332
- this.activeIndex.set(index);
333
- }
334
- handleSlotInput(index, value) {
335
- if (this.disabled()) {
336
- return;
337
- }
338
- const accepted = this.filterCharacters(value);
339
- if (accepted.length === 0) {
340
- return;
341
- }
342
- if (accepted.length > 1) {
343
- this.applyFragment(index, accepted);
344
- return;
345
- }
346
- const next = this.replaceAt(index, accepted[0]);
347
- this.commitValue(next);
348
- this.focusSlot(Math.min(index + 1, this.maxLength() - 1));
349
- }
350
- handleSlotKeydown(index, event) {
351
- if (this.disabled()) {
352
- return;
353
- }
354
- const isRtl = this.isRtl();
355
- switch (event.key) {
356
- case 'ArrowLeft':
357
- event.preventDefault();
358
- this.focusSlot(Math.max(0, index + (isRtl ? 1 : -1)));
359
- return;
360
- case 'ArrowRight':
361
- event.preventDefault();
362
- this.focusSlot(Math.min(this.maxLength() - 1, index + (isRtl ? -1 : 1)));
363
- return;
364
- case 'Home':
365
- event.preventDefault();
366
- this.focusSlot(0);
367
- return;
368
- case 'End':
369
- event.preventDefault();
370
- this.focusSlot(this.maxLength() - 1);
371
- return;
372
- case 'Backspace': {
373
- event.preventDefault();
374
- const current = this.slotValue(index);
375
- const deleteIndex = current === '' ? index - 1 : index;
376
- if (deleteIndex < 0) {
377
- return;
378
- }
379
- this.commitValue(this.removeAt(deleteIndex));
380
- this.focusSlot(Math.max(0, deleteIndex));
381
- return;
382
- }
383
- case 'Delete':
384
- event.preventDefault();
385
- this.commitValue(this.removeAt(index));
386
- this.focusSlot(index);
387
- return;
388
- default:
389
- return;
390
- }
391
- }
392
- handleSlotPaste(index, event) {
393
- if (this.disabled()) {
394
- return;
395
- }
396
- const pasted = event.clipboardData?.getData('text') ?? '';
397
- const accepted = this.filterCharacters(pasted);
398
- if (accepted.length === 0) {
399
- return;
400
- }
401
- event.preventDefault();
402
- this.applyFragment(index, accepted);
403
- }
404
- focus() {
405
- const index = Math.min(this.displayValue().length, this.maxLength() - 1);
406
- this.focusSlot(Math.max(index, 0));
407
- }
408
- writeValue(value) {
409
- this.internalValue.set(typeof value === 'string' ? value : '');
410
- }
411
- registerOnChange(fn) {
412
- this.onChange = fn;
413
- }
414
- registerOnTouched(fn) {
415
- this.onTouched = fn;
416
- }
417
- setDisabledState(disabled) {
418
- this.disabledState.set(disabled);
419
- }
420
- describedBy() {
421
- const rawIds = [this.ariaDescribedby(), this.formFieldContext?.describedBy() ?? null].filter((value) => !!value);
422
- const ids = [...new Set(rawIds.flatMap((value) => value.split(/\s+/)).filter(Boolean))];
423
- return ids.length > 0 ? ids.join(' ') : null;
424
- }
425
- handleFocusOut(event) {
426
- const nextTarget = event.relatedTarget;
427
- if (!(nextTarget instanceof Node) || !this.host.nativeElement.contains(nextTarget)) {
428
- this.onTouched();
429
- }
430
- }
431
- /** Hand the bound control to `<FormField>`, if this OTP is inside one. */
432
- publishControl() {
433
- const context = this.formFieldContext;
434
- if (!context) {
435
- return;
436
- }
437
- const control = this.ngControl?.control ?? null;
438
- if (control !== context.control()) {
439
- context.control.set(control);
440
- }
441
- }
442
- commitValue(value) {
443
- this.internalValue.set(value);
444
- const nextValue = this.internalValue();
445
- this.onChange(nextValue);
446
- this.valueChange.emit(nextValue);
447
- }
448
- replaceAt(index, character) {
449
- const chars = this.toCharArray();
450
- chars[index] = character;
451
- return this.serialize(chars);
452
- }
453
- removeAt(index) {
454
- const chars = this.toCharArray();
455
- if (index < 0 || index >= chars.length) {
456
- return this.displayValue();
457
- }
458
- chars.splice(index, 1);
459
- chars.push('');
460
- return this.serialize(chars);
461
- }
462
- applyFragment(index, characters) {
463
- const chars = this.toCharArray();
464
- let cursor = index;
465
- for (const character of characters) {
466
- if (cursor >= chars.length) {
467
- break;
468
- }
469
- chars[cursor] = character;
470
- cursor += 1;
471
- }
472
- this.commitValue(this.serialize(chars));
473
- this.focusSlot(Math.min(cursor, this.maxLength() - 1));
474
- }
475
- focusSlot(index) {
476
- const slot = this.slots().find((candidate) => candidate.index() === index);
477
- if (!slot) {
478
- return;
479
- }
480
- this.activeIndex.set(index);
481
- slot.focus();
482
- }
483
- toCharArray() {
484
- const chars = Array.from({ length: this.maxLength() }, () => '');
485
- for (const [index, character] of Array.from(this.displayValue()).entries()) {
486
- if (index >= chars.length) {
487
- break;
488
- }
489
- chars[index] = character;
490
- }
491
- return chars;
492
- }
493
- serialize(chars) {
494
- let lastFilledIndex = -1;
495
- for (let index = chars.length - 1; index >= 0; index -= 1) {
496
- if (chars[index] !== '') {
497
- lastFilledIndex = index;
498
- break;
499
- }
500
- }
501
- return lastFilledIndex === -1 ? '' : chars.slice(0, lastFilledIndex + 1).join('');
502
- }
503
- normalizeValue(value) {
504
- return this.filterCharacters(value).slice(0, this.maxLength()).join('');
505
- }
506
- filterCharacters(value) {
507
- return Array.from(value).filter((character) => this.acceptsCharacter(character));
508
- }
509
- acceptsCharacter(character) {
510
- return this.compiledPattern().every((pattern) => {
511
- pattern.lastIndex = 0;
512
- return pattern.test(character);
513
- });
514
- }
515
- isRtl() {
516
- return getComputedStyle(this.host.nativeElement).direction === 'rtl';
517
- }
518
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: InputOtpComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
519
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.6", type: InputOtpComponent, isStandalone: true, selector: "InputOtp", inputs: { maxLengthInput: { classPropertyName: "maxLengthInput", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "inputmode", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalidInput: { classPropertyName: "invalidInput", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "focusout": "handleFocusOut($event)" }, properties: { "class": "classes()", "attr.id": "null", "attr.role": "\"group\"", "attr.data-slot": "\"input-otp\"", "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-invalid": "isInvalid() ? \"\" : null", "attr.aria-label": "ariaLabel()", "attr.aria-labelledby": "ariaLabelledby()", "attr.aria-describedby": "describedBy()", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.aria-invalid": "isInvalid() ? \"true\" : null" } }, providers: [
520
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => InputOtpComponent), multi: true },
521
- { provide: InputOtpContextBase, useExisting: forwardRef(() => InputOtpComponent) },
522
- ], queries: [{ propertyName: "slots", predicate: InputOtpSlotComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `<ng-content />`, isInline: true });
523
- }
524
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: InputOtpComponent, decorators: [{
525
- type: Component,
526
- args: [{
527
- selector: 'InputOtp',
528
- providers: [
529
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => InputOtpComponent), multi: true },
530
- { provide: InputOtpContextBase, useExisting: forwardRef(() => InputOtpComponent) },
531
- ],
532
- host: {
533
- '[class]': 'classes()',
534
- '[attr.id]': 'null',
535
- '[attr.role]': '"group"',
536
- '[attr.data-slot]': '"input-otp"',
537
- '[attr.data-disabled]': 'disabled() ? "" : null',
538
- '[attr.data-invalid]': 'isInvalid() ? "" : null',
539
- '[attr.aria-label]': 'ariaLabel()',
540
- '[attr.aria-labelledby]': 'ariaLabelledby()',
541
- '[attr.aria-describedby]': 'describedBy()',
542
- '[attr.aria-disabled]': 'disabled() ? "true" : null',
543
- '[attr.aria-invalid]': 'isInvalid() ? "true" : null',
544
- '(focusout)': 'handleFocusOut($event)',
545
- },
546
- template: `<ng-content />`,
547
- }]
548
- }], propDecorators: { maxLengthInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLength", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], pattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "pattern", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], inputMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputmode", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalidInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-invalid", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], slots: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => InputOtpSlotComponent), { ...{ descendants: true }, isSignal: true }] }] } });
549
-
550
- /**
551
- * Generated bundle index. Do not edit.
552
- */
553
-
554
- export { InputOtpComponent, InputOtpGroupComponent, InputOtpSeparatorComponent, InputOtpSlotComponent, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS };
345
+ `
346
+ }]
347
+ }],
348
+ propDecorators: {
349
+ index: [{
350
+ type: i0.Input,
351
+ args: [{
352
+ isSignal: true,
353
+ alias: "index",
354
+ required: false
355
+ }]
356
+ }],
357
+ class: [{
358
+ type: i0.Input,
359
+ args: [{
360
+ isSignal: true,
361
+ alias: "class",
362
+ required: false
363
+ }]
364
+ }],
365
+ invalid: [{
366
+ type: i0.Input,
367
+ args: [{
368
+ isSignal: true,
369
+ alias: "aria-invalid",
370
+ required: false
371
+ }]
372
+ }],
373
+ inputRef: [{
374
+ type: i0.ViewChild,
375
+ args: ["inputRef", { isSignal: true }]
376
+ }]
377
+ }
378
+ });
379
+ var InputOtpComponent = class InputOtpComponent extends InputOtpContextBase {
380
+ host = inject(ElementRef);
381
+ injector = inject(Injector);
382
+ formFieldContext = inject(FormFieldContext, { optional: true });
383
+ maxLengthInput = input(6, {
384
+ ...ngDevMode ? { debugName: "maxLengthInput" } : /* istanbul ignore next */ {},
385
+ alias: "maxLength",
386
+ transform: numberAttribute
387
+ });
388
+ value = input(void 0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
389
+ pattern = input(null, ...ngDevMode ? [{ debugName: "pattern" }] : /* istanbul ignore next */ []);
390
+ id = input(null, {
391
+ ...ngDevMode ? { debugName: "id" } : /* istanbul ignore next */ {},
392
+ alias: "id"
393
+ });
394
+ ariaLabel = input(null, {
395
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
396
+ alias: "aria-label"
397
+ });
398
+ ariaLabelledby = input(null, {
399
+ ...ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {},
400
+ alias: "aria-labelledby"
401
+ });
402
+ ariaDescribedby = input(null, {
403
+ ...ngDevMode ? { debugName: "ariaDescribedby" } : /* istanbul ignore next */ {},
404
+ alias: "aria-describedby"
405
+ });
406
+ inputMode = input("numeric", {
407
+ ...ngDevMode ? { debugName: "inputMode" } : /* istanbul ignore next */ {},
408
+ alias: "inputmode"
409
+ });
410
+ autocomplete = input("one-time-code", {
411
+ ...ngDevMode ? { debugName: "autocomplete" } : /* istanbul ignore next */ {},
412
+ alias: "autocomplete"
413
+ });
414
+ required = input(false, {
415
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
416
+ transform: booleanAttribute
417
+ });
418
+ disabledInput = input(false, {
419
+ ...ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {},
420
+ alias: "disabled",
421
+ transform: booleanAttribute
422
+ });
423
+ invalidInput = input(false, {
424
+ ...ngDevMode ? { debugName: "invalidInput" } : /* istanbul ignore next */ {},
425
+ alias: "aria-invalid",
426
+ transform: booleanAttribute
427
+ });
428
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
429
+ valueChange = output();
430
+ generatedId = injectUniqueId("InputOtp");
431
+ internalValue = linkedSignal(() => this.normalizeValue(this.value() ?? ""), {
432
+ debugName: "InputOtp.internalValue",
433
+ set: (value, rawSet) => rawSet(this.normalizeValue(value))
434
+ });
435
+ disabledState = signal(false, ...ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []);
436
+ activeIndex = signal(0, ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
437
+ slots = contentChildren(InputOtpSlotComponent, {
438
+ ...ngDevMode ? { debugName: "slots" } : /* istanbul ignore next */ {},
439
+ descendants: true
440
+ });
441
+ compiledPattern = computed(() => {
442
+ const pattern = this.pattern();
443
+ if (!pattern) return [];
444
+ if (pattern instanceof RegExp) return [pattern];
445
+ if (typeof pattern !== "string") return pattern;
446
+ try {
447
+ return [new RegExp(pattern)];
448
+ } catch {
449
+ return [];
450
+ }
451
+ }, ...ngDevMode ? [{ debugName: "compiledPattern" }] : /* istanbul ignore next */ []);
452
+ classes = computed(() => cn("inline-flex flex-wrap items-center gap-2", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
453
+ disabled = computed(() => this.disabledInput() || this.disabledState(), ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
454
+ displayValue = computed(() => this.internalValue(), ...ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []);
455
+ ngControl = null;
456
+ onChange = () => {};
457
+ onTouched = () => {};
458
+ ngOnInit() {
459
+ this.ngControl = this.injector.get(NgControl, null, {
460
+ optional: true,
461
+ self: true
462
+ });
463
+ this.publishControl();
464
+ }
465
+ ngAfterViewInit() {
466
+ this.publishControl();
467
+ }
468
+ maxLength() {
469
+ return Math.max(1, this.maxLengthInput());
470
+ }
471
+ slotId(index) {
472
+ const baseId = this.id() ?? this.formFieldContext?.controlId ?? this.generatedId;
473
+ return index === 0 ? baseId : `${baseId}-${index + 1}`;
474
+ }
475
+ slotValue(index) {
476
+ return this.toCharArray()[index] ?? "";
477
+ }
478
+ slotAriaLabel(index) {
479
+ return `${this.ariaLabel() ?? "One-time password"} character ${index + 1} of ${this.maxLength()}`;
480
+ }
481
+ slotAriaLabelledBy(index) {
482
+ return index === 0 ? this.ariaLabelledby() : null;
483
+ }
484
+ slotAriaDescribedBy() {
485
+ return this.describedBy();
486
+ }
487
+ slotInputMode() {
488
+ return this.inputMode();
489
+ }
490
+ slotAutocomplete(index) {
491
+ return index === 0 ? this.autocomplete() : "off";
492
+ }
493
+ isDisabled() {
494
+ return this.disabled();
495
+ }
496
+ isRequired() {
497
+ return this.required();
498
+ }
499
+ isInvalid() {
500
+ return this.invalidInput() || this.formFieldContext?.invalid() || false;
501
+ }
502
+ isActive(index) {
503
+ return this.activeIndex() === index;
504
+ }
505
+ handleSlotFocus(index) {
506
+ this.activeIndex.set(index);
507
+ }
508
+ handleSlotInput(index, value) {
509
+ if (this.disabled()) return;
510
+ const accepted = this.filterCharacters(value);
511
+ if (accepted.length === 0) return;
512
+ if (accepted.length > 1) {
513
+ this.applyFragment(index, accepted);
514
+ return;
515
+ }
516
+ const next = this.replaceAt(index, accepted[0]);
517
+ this.commitValue(next);
518
+ this.focusSlot(Math.min(index + 1, this.maxLength() - 1));
519
+ }
520
+ handleSlotKeydown(index, event) {
521
+ if (this.disabled()) return;
522
+ const isRtl = this.isRtl();
523
+ switch (event.key) {
524
+ case "ArrowLeft":
525
+ event.preventDefault();
526
+ this.focusSlot(Math.max(0, index + (isRtl ? 1 : -1)));
527
+ return;
528
+ case "ArrowRight":
529
+ event.preventDefault();
530
+ this.focusSlot(Math.min(this.maxLength() - 1, index + (isRtl ? -1 : 1)));
531
+ return;
532
+ case "Home":
533
+ event.preventDefault();
534
+ this.focusSlot(0);
535
+ return;
536
+ case "End":
537
+ event.preventDefault();
538
+ this.focusSlot(this.maxLength() - 1);
539
+ return;
540
+ case "Backspace": {
541
+ event.preventDefault();
542
+ const deleteIndex = this.slotValue(index) === "" ? index - 1 : index;
543
+ if (deleteIndex < 0) return;
544
+ this.commitValue(this.removeAt(deleteIndex));
545
+ this.focusSlot(Math.max(0, deleteIndex));
546
+ return;
547
+ }
548
+ case "Delete":
549
+ event.preventDefault();
550
+ this.commitValue(this.removeAt(index));
551
+ this.focusSlot(index);
552
+ return;
553
+ default: return;
554
+ }
555
+ }
556
+ handleSlotPaste(index, event) {
557
+ if (this.disabled()) return;
558
+ const pasted = event.clipboardData?.getData("text") ?? "";
559
+ const accepted = this.filterCharacters(pasted);
560
+ if (accepted.length === 0) return;
561
+ event.preventDefault();
562
+ this.applyFragment(index, accepted);
563
+ }
564
+ focus() {
565
+ const index = Math.min(this.displayValue().length, this.maxLength() - 1);
566
+ this.focusSlot(Math.max(index, 0));
567
+ }
568
+ writeValue(value) {
569
+ this.internalValue.set(typeof value === "string" ? value : "");
570
+ }
571
+ registerOnChange(fn) {
572
+ this.onChange = fn;
573
+ }
574
+ registerOnTouched(fn) {
575
+ this.onTouched = fn;
576
+ }
577
+ setDisabledState(disabled) {
578
+ this.disabledState.set(disabled);
579
+ }
580
+ describedBy() {
581
+ const rawIds = [this.ariaDescribedby(), this.formFieldContext?.describedBy() ?? null].filter((value) => !!value);
582
+ const ids = [...new Set(rawIds.flatMap((value) => value.split(/\s+/)).filter(Boolean))];
583
+ return ids.length > 0 ? ids.join(" ") : null;
584
+ }
585
+ handleFocusOut(event) {
586
+ const nextTarget = event.relatedTarget;
587
+ if (!(nextTarget instanceof Node) || !this.host.nativeElement.contains(nextTarget)) this.onTouched();
588
+ }
589
+ publishControl() {
590
+ const context = this.formFieldContext;
591
+ if (!context) return;
592
+ const control = this.ngControl?.control ?? null;
593
+ if (control !== context.control()) context.control.set(control);
594
+ }
595
+ commitValue(value) {
596
+ this.internalValue.set(value);
597
+ const nextValue = this.internalValue();
598
+ this.onChange(nextValue);
599
+ this.valueChange.emit(nextValue);
600
+ }
601
+ replaceAt(index, character) {
602
+ const chars = this.toCharArray();
603
+ chars[index] = character;
604
+ return this.serialize(chars);
605
+ }
606
+ removeAt(index) {
607
+ const chars = this.toCharArray();
608
+ if (index < 0 || index >= chars.length) return this.displayValue();
609
+ chars.splice(index, 1);
610
+ chars.push("");
611
+ return this.serialize(chars);
612
+ }
613
+ applyFragment(index, characters) {
614
+ const chars = this.toCharArray();
615
+ let cursor = index;
616
+ for (const character of characters) {
617
+ if (cursor >= chars.length) break;
618
+ chars[cursor] = character;
619
+ cursor += 1;
620
+ }
621
+ this.commitValue(this.serialize(chars));
622
+ this.focusSlot(Math.min(cursor, this.maxLength() - 1));
623
+ }
624
+ focusSlot(index) {
625
+ const slot = this.slots().find((candidate) => candidate.index() === index);
626
+ if (!slot) return;
627
+ this.activeIndex.set(index);
628
+ slot.focus();
629
+ }
630
+ toCharArray() {
631
+ const chars = Array.from({ length: this.maxLength() }, () => "");
632
+ for (const [index, character] of Array.from(this.displayValue()).entries()) {
633
+ if (index >= chars.length) break;
634
+ chars[index] = character;
635
+ }
636
+ return chars;
637
+ }
638
+ serialize(chars) {
639
+ let lastFilledIndex = -1;
640
+ for (let index = chars.length - 1; index >= 0; index -= 1) if (chars[index] !== "") {
641
+ lastFilledIndex = index;
642
+ break;
643
+ }
644
+ return lastFilledIndex === -1 ? "" : chars.slice(0, lastFilledIndex + 1).join("");
645
+ }
646
+ normalizeValue(value) {
647
+ return this.filterCharacters(value).slice(0, this.maxLength()).join("");
648
+ }
649
+ filterCharacters(value) {
650
+ return Array.from(value).filter((character) => this.acceptsCharacter(character));
651
+ }
652
+ acceptsCharacter(character) {
653
+ return this.compiledPattern().every((pattern) => {
654
+ pattern.lastIndex = 0;
655
+ return pattern.test(character);
656
+ });
657
+ }
658
+ isRtl() {
659
+ return getComputedStyle(this.host.nativeElement).direction === "rtl";
660
+ }
661
+ static ɵfac = i0.ɵɵngDeclareFactory({
662
+ minVersion: "12.0.0",
663
+ version: "22.2.2",
664
+ ngImport: i0,
665
+ type: InputOtpComponent,
666
+ deps: null,
667
+ target: i0.ɵɵFactoryTarget.Component
668
+ });
669
+ static ɵcmp = i0.ɵɵngDeclareComponent({
670
+ minVersion: "17.2.0",
671
+ version: "22.2.2",
672
+ type: InputOtpComponent,
673
+ isStandalone: true,
674
+ selector: "InputOtp",
675
+ inputs: {
676
+ maxLengthInput: {
677
+ classPropertyName: "maxLengthInput",
678
+ publicName: "maxLength",
679
+ isSignal: true,
680
+ isRequired: false,
681
+ transformFunction: null
682
+ },
683
+ value: {
684
+ classPropertyName: "value",
685
+ publicName: "value",
686
+ isSignal: true,
687
+ isRequired: false,
688
+ transformFunction: null
689
+ },
690
+ pattern: {
691
+ classPropertyName: "pattern",
692
+ publicName: "pattern",
693
+ isSignal: true,
694
+ isRequired: false,
695
+ transformFunction: null
696
+ },
697
+ id: {
698
+ classPropertyName: "id",
699
+ publicName: "id",
700
+ isSignal: true,
701
+ isRequired: false,
702
+ transformFunction: null
703
+ },
704
+ ariaLabel: {
705
+ classPropertyName: "ariaLabel",
706
+ publicName: "aria-label",
707
+ isSignal: true,
708
+ isRequired: false,
709
+ transformFunction: null
710
+ },
711
+ ariaLabelledby: {
712
+ classPropertyName: "ariaLabelledby",
713
+ publicName: "aria-labelledby",
714
+ isSignal: true,
715
+ isRequired: false,
716
+ transformFunction: null
717
+ },
718
+ ariaDescribedby: {
719
+ classPropertyName: "ariaDescribedby",
720
+ publicName: "aria-describedby",
721
+ isSignal: true,
722
+ isRequired: false,
723
+ transformFunction: null
724
+ },
725
+ inputMode: {
726
+ classPropertyName: "inputMode",
727
+ publicName: "inputmode",
728
+ isSignal: true,
729
+ isRequired: false,
730
+ transformFunction: null
731
+ },
732
+ autocomplete: {
733
+ classPropertyName: "autocomplete",
734
+ publicName: "autocomplete",
735
+ isSignal: true,
736
+ isRequired: false,
737
+ transformFunction: null
738
+ },
739
+ required: {
740
+ classPropertyName: "required",
741
+ publicName: "required",
742
+ isSignal: true,
743
+ isRequired: false,
744
+ transformFunction: null
745
+ },
746
+ disabledInput: {
747
+ classPropertyName: "disabledInput",
748
+ publicName: "disabled",
749
+ isSignal: true,
750
+ isRequired: false,
751
+ transformFunction: null
752
+ },
753
+ invalidInput: {
754
+ classPropertyName: "invalidInput",
755
+ publicName: "aria-invalid",
756
+ isSignal: true,
757
+ isRequired: false,
758
+ transformFunction: null
759
+ },
760
+ class: {
761
+ classPropertyName: "class",
762
+ publicName: "class",
763
+ isSignal: true,
764
+ isRequired: false,
765
+ transformFunction: null
766
+ }
767
+ },
768
+ outputs: { valueChange: "valueChange" },
769
+ host: {
770
+ listeners: { "focusout": "handleFocusOut($event)" },
771
+ properties: {
772
+ "class": "classes()",
773
+ "attr.id": "null",
774
+ "attr.role": "\"group\"",
775
+ "attr.data-slot": "\"input-otp\"",
776
+ "attr.data-disabled": "disabled() ? \"\" : null",
777
+ "attr.data-invalid": "isInvalid() ? \"\" : null",
778
+ "attr.aria-label": "ariaLabel()",
779
+ "attr.aria-labelledby": "ariaLabelledby()",
780
+ "attr.aria-describedby": "describedBy()",
781
+ "attr.aria-disabled": "disabled() ? \"true\" : null",
782
+ "attr.aria-invalid": "isInvalid() ? \"true\" : null"
783
+ }
784
+ },
785
+ providers: [{
786
+ provide: NG_VALUE_ACCESSOR,
787
+ useExisting: forwardRef(() => InputOtpComponent),
788
+ multi: true
789
+ }, {
790
+ provide: InputOtpContextBase,
791
+ useExisting: forwardRef(() => InputOtpComponent)
792
+ }],
793
+ queries: [{
794
+ propertyName: "slots",
795
+ predicate: InputOtpSlotComponent,
796
+ descendants: true,
797
+ isSignal: true
798
+ }],
799
+ usesInheritance: true,
800
+ ngImport: i0,
801
+ template: `<ng-content />`,
802
+ isInline: true
803
+ });
804
+ };
805
+ i0.ɵɵngDeclareClassMetadata({
806
+ minVersion: "12.0.0",
807
+ version: "22.2.2",
808
+ ngImport: i0,
809
+ type: InputOtpComponent,
810
+ decorators: [{
811
+ type: Component,
812
+ args: [{
813
+ selector: "InputOtp",
814
+ providers: [{
815
+ provide: NG_VALUE_ACCESSOR,
816
+ useExisting: forwardRef(() => InputOtpComponent),
817
+ multi: true
818
+ }, {
819
+ provide: InputOtpContextBase,
820
+ useExisting: forwardRef(() => InputOtpComponent)
821
+ }],
822
+ host: {
823
+ "[class]": "classes()",
824
+ "[attr.id]": "null",
825
+ "[attr.role]": "\"group\"",
826
+ "[attr.data-slot]": "\"input-otp\"",
827
+ "[attr.data-disabled]": "disabled() ? \"\" : null",
828
+ "[attr.data-invalid]": "isInvalid() ? \"\" : null",
829
+ "[attr.aria-label]": "ariaLabel()",
830
+ "[attr.aria-labelledby]": "ariaLabelledby()",
831
+ "[attr.aria-describedby]": "describedBy()",
832
+ "[attr.aria-disabled]": "disabled() ? \"true\" : null",
833
+ "[attr.aria-invalid]": "isInvalid() ? \"true\" : null",
834
+ "(focusout)": "handleFocusOut($event)"
835
+ },
836
+ template: `<ng-content />`
837
+ }]
838
+ }],
839
+ propDecorators: {
840
+ maxLengthInput: [{
841
+ type: i0.Input,
842
+ args: [{
843
+ isSignal: true,
844
+ alias: "maxLength",
845
+ required: false
846
+ }]
847
+ }],
848
+ value: [{
849
+ type: i0.Input,
850
+ args: [{
851
+ isSignal: true,
852
+ alias: "value",
853
+ required: false
854
+ }]
855
+ }],
856
+ pattern: [{
857
+ type: i0.Input,
858
+ args: [{
859
+ isSignal: true,
860
+ alias: "pattern",
861
+ required: false
862
+ }]
863
+ }],
864
+ id: [{
865
+ type: i0.Input,
866
+ args: [{
867
+ isSignal: true,
868
+ alias: "id",
869
+ required: false
870
+ }]
871
+ }],
872
+ ariaLabel: [{
873
+ type: i0.Input,
874
+ args: [{
875
+ isSignal: true,
876
+ alias: "aria-label",
877
+ required: false
878
+ }]
879
+ }],
880
+ ariaLabelledby: [{
881
+ type: i0.Input,
882
+ args: [{
883
+ isSignal: true,
884
+ alias: "aria-labelledby",
885
+ required: false
886
+ }]
887
+ }],
888
+ ariaDescribedby: [{
889
+ type: i0.Input,
890
+ args: [{
891
+ isSignal: true,
892
+ alias: "aria-describedby",
893
+ required: false
894
+ }]
895
+ }],
896
+ inputMode: [{
897
+ type: i0.Input,
898
+ args: [{
899
+ isSignal: true,
900
+ alias: "inputmode",
901
+ required: false
902
+ }]
903
+ }],
904
+ autocomplete: [{
905
+ type: i0.Input,
906
+ args: [{
907
+ isSignal: true,
908
+ alias: "autocomplete",
909
+ required: false
910
+ }]
911
+ }],
912
+ required: [{
913
+ type: i0.Input,
914
+ args: [{
915
+ isSignal: true,
916
+ alias: "required",
917
+ required: false
918
+ }]
919
+ }],
920
+ disabledInput: [{
921
+ type: i0.Input,
922
+ args: [{
923
+ isSignal: true,
924
+ alias: "disabled",
925
+ required: false
926
+ }]
927
+ }],
928
+ invalidInput: [{
929
+ type: i0.Input,
930
+ args: [{
931
+ isSignal: true,
932
+ alias: "aria-invalid",
933
+ required: false
934
+ }]
935
+ }],
936
+ class: [{
937
+ type: i0.Input,
938
+ args: [{
939
+ isSignal: true,
940
+ alias: "class",
941
+ required: false
942
+ }]
943
+ }],
944
+ valueChange: [{
945
+ type: i0.Output,
946
+ args: ["valueChange"]
947
+ }],
948
+ slots: [{
949
+ type: i0.ContentChildren,
950
+ args: [i0.forwardRef(() => InputOtpSlotComponent), {
951
+ descendants: true,
952
+ isSignal: true
953
+ }]
954
+ }]
955
+ }
956
+ });
957
+ export { InputOtpComponent, InputOtpGroupComponent, InputOtpSeparatorComponent, InputOtpSlotComponent, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS };