@nanahoshi/mona-ui 0.27.2 → 0.29.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 (213) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/locales.md +8 -0
  3. package/docs/api/popup.md +1 -1
  4. package/docs/api/theme.md +2 -2
  5. package/docs/chart.md +14 -0
  6. package/docs/editor.md +2 -0
  7. package/docs/installation.md +147 -15
  8. package/docs/introduction.md +37 -15
  9. package/docs/theming-built-in-themes.md +67 -0
  10. package/docs/theming-custom-colors.md +274 -0
  11. package/docs/theming-custom-themes.md +168 -0
  12. package/docs/theming.md +164 -248
  13. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  14. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  15. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  16. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  17. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  18. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2071 -1573
  19. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  20. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  21. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  22. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  23. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  24. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  25. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  26. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  27. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  28. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  29. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  30. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  31. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  32. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  33. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  34. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  35. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  37. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  38. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  39. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  40. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  41. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  42. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  49. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  50. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  51. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  52. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  53. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  54. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  55. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  56. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  57. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  58. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  59. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  60. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  61. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  62. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  63. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  65. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  66. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  67. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  68. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  70. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +599 -0
  71. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  72. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  73. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  74. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  75. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  76. package/fesm2022/nanahoshi-mona-ui-locales.mjs +61 -77
  77. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  78. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  79. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  80. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  81. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  82. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  83. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  84. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  85. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  86. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  87. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  88. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  89. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  90. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  91. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  92. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  93. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  94. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  95. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  96. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  97. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  98. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  99. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  100. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  101. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  102. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  103. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  104. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  105. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  106. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  107. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  108. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  109. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  110. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  111. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  112. package/llms.txt +7 -3
  113. package/locales/pl-pl/package.json +4 -0
  114. package/locales/pl-pl/pl-pl.messages.json +536 -0
  115. package/package.json +66 -23
  116. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  117. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  118. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  119. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  120. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  121. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  122. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  123. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  124. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  125. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  126. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  127. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  128. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  129. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  130. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  131. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  132. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  133. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  134. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  135. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  136. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  137. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  138. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  139. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  140. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  141. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  142. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  143. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  144. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  145. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  146. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  147. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  148. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  149. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  150. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  151. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  152. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  153. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  154. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  155. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  156. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  157. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  158. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  159. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +540 -0
  168. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  169. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  170. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  171. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  172. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  173. package/types/nanahoshi-mona-ui-locales.d.ts +18 -19
  174. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  175. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  176. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  177. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  178. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  179. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  180. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  181. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  182. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  183. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  184. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  185. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  186. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  187. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  188. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  189. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  190. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  191. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  192. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  193. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  194. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  195. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  196. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  197. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  198. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  199. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  200. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  201. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  202. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  203. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  204. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  205. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  206. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  207. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  208. package/types/nanahoshi-mona-ui.d.ts +1 -2
  209. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  210. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  211. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  212. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  213. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,34 +1,49 @@
1
- import { NgTemplateOutlet } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { inject, TemplateRef, Directive, signal, ElementRef, computed, viewChild, contentChild, input, output, booleanAttribute, numberAttribute, model, afterNextRender, effect, Component } from '@angular/core';
4
- import { themeControlSurfaceClasses, createElementControlId, injectLabelAssociation, injectEffectiveDisabled, AttributeBinderDirective } from '@nanahoshi/mona-ui/internal';
5
- import { twMerge } from 'tailwind-merge';
6
- import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
7
- import { cva } from 'class-variance-authority';
8
-
9
- class OtpInputSeparatorTemplateDirective {
10
- constructor() {
11
- this.templateRef = inject((TemplateRef));
12
- }
13
- static ngTemplateContextGuard(_directive, _context) {
14
- return true;
15
- }
16
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: OtpInputSeparatorTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
17
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: OtpInputSeparatorTemplateDirective, isStandalone: true, selector: "ng-template[monaOtpInputSeparatorTemplate]", ngImport: i0 }); }
18
- }
19
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: OtpInputSeparatorTemplateDirective, decorators: [{
20
- type: Directive,
21
- args: [{
22
- selector: "ng-template[monaOtpInputSeparatorTemplate]"
23
- }]
24
- }] });
25
-
26
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
27
- // Edit the JSON file and run `npm run generate:locale-catalogs`.
28
- const OTP_INPUT_DEFAULT_MESSAGES = {
29
- verificationCode: "Verification code"
1
+ import { NgTemplateOutlet } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { Component, Directive, ElementRef, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, inject, input, model, numberAttribute, output, signal, viewChild } from "@angular/core";
4
+ import { AttributeBinderDirective, createElementControlId, injectEffectiveDisabled, injectLabelAssociation, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
5
+ import { twMerge } from "tailwind-merge";
6
+ import { MonaI18nService } from "@nanahoshi/mona-ui/i18n";
7
+ import { cva } from "class-variance-authority";
8
+ var OtpInputSeparatorTemplateDirective = class OtpInputSeparatorTemplateDirective {
9
+ constructor() {
10
+ this.templateRef = inject(TemplateRef);
11
+ }
12
+ static ngTemplateContextGuard(_directive, _context) {
13
+ return true;
14
+ }
15
+ static {
16
+ this.ɵfac = i0.ɵɵngDeclareFactory({
17
+ minVersion: "12.0.0",
18
+ version: "22.2.6",
19
+ ngImport: i0,
20
+ type: OtpInputSeparatorTemplateDirective,
21
+ deps: [],
22
+ target: i0.ɵɵFactoryTarget.Directive
23
+ });
24
+ }
25
+ static {
26
+ this.ɵdir = i0.ɵɵngDeclareDirective({
27
+ minVersion: "14.0.0",
28
+ version: "22.2.6",
29
+ type: OtpInputSeparatorTemplateDirective,
30
+ isStandalone: true,
31
+ selector: "ng-template[monaOtpInputSeparatorTemplate]",
32
+ ngImport: i0
33
+ });
34
+ }
30
35
  };
31
-
36
+ i0.ɵɵngDeclareClassMetadata({
37
+ minVersion: "12.0.0",
38
+ version: "22.2.6",
39
+ ngImport: i0,
40
+ type: OtpInputSeparatorTemplateDirective,
41
+ decorators: [{
42
+ type: Directive,
43
+ args: [{ selector: "ng-template[monaOtpInputSeparatorTemplate]" }]
44
+ }]
45
+ });
46
+ const OTP_INPUT_DEFAULT_MESSAGES = { verificationCode: "Verification code" };
32
47
  const otpInputHostThemeVariants = cva(`
33
48
  relative inline-flex items-center gap-2
34
49
  outline-none focus-visible:outline-hidden
@@ -69,900 +84,1110 @@ const otpInputSlotThemeVariants = cva(`
69
84
  data-[invalid='true']:data-[active='true']:ring-2
70
85
  data-[invalid='true']:data-[active='true']:ring-error/35
71
86
  `, {
72
- variants: {
73
- rounded: {
74
- full: "rounded-full",
75
- large: "rounded-lg",
76
- medium: "rounded-md",
77
- none: "rounded-none",
78
- small: "rounded-sm"
79
- },
80
- size: {
81
- large: "h-10 w-10 min-w-10 text-base",
82
- medium: "h-9 w-9 min-w-9 text-sm",
83
- small: "h-8 w-8 min-w-8 text-xs"
84
- }
85
- },
86
- defaultVariants: {
87
- rounded: "medium",
88
- size: "medium"
89
- }
87
+ variants: {
88
+ rounded: {
89
+ full: "rounded-full",
90
+ large: "rounded-lg",
91
+ medium: "rounded-md",
92
+ none: "rounded-none",
93
+ small: "rounded-sm"
94
+ },
95
+ size: {
96
+ large: "h-10 w-10 min-w-10 text-base",
97
+ medium: "h-9 w-9 min-w-9 text-sm",
98
+ small: "h-8 w-8 min-w-8 text-xs"
99
+ }
100
+ },
101
+ defaultVariants: {
102
+ rounded: "medium",
103
+ size: "medium"
104
+ }
90
105
  });
91
-
92
- const RESERVED_INPUT_ATTRIBUTES = new Set([
93
- "aria-hidden",
94
- "aria-invalid",
95
- "aria-required",
96
- "class",
97
- "disabled",
98
- "maxlength",
99
- "readonly",
100
- "required",
101
- "role",
102
- "style",
103
- "type",
104
- "value"
106
+ const RESERVED_INPUT_ATTRIBUTES = /* @__PURE__ */ new Set([
107
+ "aria-hidden",
108
+ "aria-invalid",
109
+ "aria-required",
110
+ "class",
111
+ "disabled",
112
+ "maxlength",
113
+ "readonly",
114
+ "required",
115
+ "role",
116
+ "style",
117
+ "type",
118
+ "value"
105
119
  ]);
106
- const COMPONENT_MANAGED_ATTRIBUTES = new Set([
107
- "aria-label",
108
- "aria-labelledby",
109
- "autocomplete",
110
- "id",
111
- "inputmode",
112
- "name"
120
+ const COMPONENT_MANAGED_ATTRIBUTES = /* @__PURE__ */ new Set([
121
+ "aria-label",
122
+ "aria-labelledby",
123
+ "autocomplete",
124
+ "id",
125
+ "inputmode",
126
+ "name"
113
127
  ]);
114
- /** The zero of each decimal digit block a phone or IME commonly types: Arabic-Indic, Devanagari, Thai and so on. */
115
128
  const DECIMAL_DIGIT_ZEROES = [
116
- 0x0660, 0x06f0, 0x07c0, 0x0966, 0x09e6, 0x0a66, 0x0ae6, 0x0b66, 0x0be6, 0x0c66, 0x0ce6, 0x0d66, 0x0e50, 0x0ed0, 0x0f20,
117
- 0x1040, 0x17e0, 0x1810
129
+ 1632,
130
+ 1776,
131
+ 1984,
132
+ 2406,
133
+ 2534,
134
+ 2662,
135
+ 2790,
136
+ 2918,
137
+ 3046,
138
+ 3174,
139
+ 3302,
140
+ 3430,
141
+ 3664,
142
+ 3792,
143
+ 3872,
144
+ 4160,
145
+ 6112,
146
+ 6160
118
147
  ];
119
148
  function findAttribute(attrs, name) {
120
- const target = name.toLowerCase();
121
- for (const [key, value] of Object.entries(attrs)) {
122
- if (key.toLowerCase() === target) {
123
- return value;
124
- }
125
- }
126
- return undefined;
149
+ const target = name.toLowerCase();
150
+ for (const [key, value] of Object.entries(attrs)) if (key.toLowerCase() === target) return value;
127
151
  }
128
152
  function findUsableAttribute(attrs, name) {
129
- const value = findAttribute(attrs, name);
130
- if (value == null || value === false) {
131
- return undefined;
132
- }
133
- return value;
153
+ const value = findAttribute(attrs, name);
154
+ if (value == null || value === false) return;
155
+ return value;
134
156
  }
135
157
  function toNonEmptyString(value) {
136
- if (value == null || value === false) {
137
- return null;
138
- }
139
- const text = String(value).trim();
140
- return text.length > 0 ? text : null;
158
+ if (value == null || value === false) return null;
159
+ const text = String(value).trim();
160
+ return text.length > 0 ? text : null;
141
161
  }
142
162
  function normalizeLength(length) {
143
- if (typeof length !== "number" || isNaN(length) || !isFinite(length) || length < 1) {
144
- return 4;
145
- }
146
- return Math.floor(length);
163
+ if (typeof length !== "number" || isNaN(length) || !isFinite(length) || length < 1) return 4;
164
+ return Math.floor(length);
147
165
  }
148
166
  function isValidCharacter(char, type, characterPattern) {
149
- if (!char || char.length !== 1) {
150
- return false;
151
- }
152
- if (characterPattern != null) {
153
- const sanitized = new RegExp(characterPattern.source, characterPattern.flags.replace(/[gy]/g, ""));
154
- return sanitized.test(char);
155
- }
156
- if (type === "number") {
157
- return /^[0-9]$/.test(char);
158
- }
159
- return /^[a-zA-Z0-9]$/.test(char);
167
+ if (!char || char.length !== 1) return false;
168
+ if (characterPattern != null) return new RegExp(characterPattern.source, characterPattern.flags.replace(/[gy]/g, "")).test(char);
169
+ if (type === "number") return /^[0-9]$/.test(char);
170
+ return /^[a-zA-Z0-9]$/.test(char);
160
171
  }
161
- /**
162
- * Returns the character as the control would keep it, or null when it isn't allowed. A character the rules reject is
163
- * converted first, so fullwidth and Eastern Arabic digits count as the digits they are.
164
- */
165
172
  function acceptCharacter(char, type, characterPattern) {
166
- if (isValidCharacter(char, type, characterPattern)) {
167
- return char;
168
- }
169
- const converted = convertCharacter(char);
170
- return isValidCharacter(converted, type, characterPattern) ? converted : null;
173
+ if (isValidCharacter(char, type, characterPattern)) return char;
174
+ const converted = convertCharacter(char);
175
+ return isValidCharacter(converted, type, characterPattern) ? converted : null;
171
176
  }
172
177
  function convertCharacter(char) {
173
- const compatible = char.normalize("NFKC");
174
- const codePoint = compatible.codePointAt(0) ?? 0;
175
- const zero = DECIMAL_DIGIT_ZEROES.find(digitZero => codePoint >= digitZero && codePoint <= digitZero + 9);
176
- return zero === undefined ? compatible : String(codePoint - zero);
178
+ const compatible = char.normalize("NFKC");
179
+ const codePoint = compatible.codePointAt(0) ?? 0;
180
+ const zero = DECIMAL_DIGIT_ZEROES.find((digitZero) => codePoint >= digitZero && codePoint <= digitZero + 9);
181
+ return zero === void 0 ? compatible : String(codePoint - zero);
177
182
  }
178
183
  function filterCharacters(raw, type, characterPattern, maxLength) {
179
- if (!raw) {
180
- return "";
181
- }
182
- let result = "";
183
- for (const char of raw) {
184
- const accepted = acceptCharacter(char, type, characterPattern);
185
- if (accepted !== null) {
186
- result += accepted;
187
- if (result.length >= maxLength) {
188
- break;
189
- }
190
- }
191
- }
192
- return result;
184
+ if (!raw) return "";
185
+ let result = "";
186
+ for (const char of raw) {
187
+ const accepted = acceptCharacter(char, type, characterPattern);
188
+ if (accepted !== null) {
189
+ result += accepted;
190
+ if (result.length >= maxLength) break;
191
+ }
192
+ }
193
+ return result;
193
194
  }
194
195
  function normalizeGroupLengths(groupLength, totalLength) {
195
- if (totalLength <= 0) {
196
- return [];
197
- }
198
- if (groupLength == null) {
199
- return [totalLength];
200
- }
201
- if (typeof groupLength === "number") {
202
- if (!isFinite(groupLength) || isNaN(groupLength) || groupLength <= 0) {
203
- return [totalLength];
204
- }
205
- const size = Math.floor(groupLength);
206
- if (size <= 0) {
207
- return [totalLength];
208
- }
209
- const groups = [];
210
- let remaining = totalLength;
211
- while (remaining > 0) {
212
- const g = Math.min(size, remaining);
213
- groups.push(g);
214
- remaining -= g;
215
- }
216
- return groups;
217
- }
218
- if (Array.isArray(groupLength)) {
219
- const groups = [];
220
- let remaining = totalLength;
221
- for (const item of groupLength) {
222
- if (typeof item === "number" && isFinite(item) && !isNaN(item) && item > 0) {
223
- const size = Math.floor(item);
224
- if (size > 0) {
225
- const g = Math.min(size, remaining);
226
- groups.push(g);
227
- remaining -= g;
228
- if (remaining <= 0) {
229
- break;
230
- }
231
- }
232
- }
233
- }
234
- if (remaining > 0) {
235
- groups.push(remaining);
236
- }
237
- return groups.length > 0 ? groups : [totalLength];
238
- }
239
- return [totalLength];
196
+ if (totalLength <= 0) return [];
197
+ if (groupLength == null) return [totalLength];
198
+ if (typeof groupLength === "number") {
199
+ if (!isFinite(groupLength) || isNaN(groupLength) || groupLength <= 0) return [totalLength];
200
+ const size = Math.floor(groupLength);
201
+ if (size <= 0) return [totalLength];
202
+ const groups = [];
203
+ let remaining = totalLength;
204
+ while (remaining > 0) {
205
+ const g = Math.min(size, remaining);
206
+ groups.push(g);
207
+ remaining -= g;
208
+ }
209
+ return groups;
210
+ }
211
+ if (Array.isArray(groupLength)) {
212
+ const groups = [];
213
+ let remaining = totalLength;
214
+ for (const item of groupLength) if (typeof item === "number" && isFinite(item) && !isNaN(item) && item > 0) {
215
+ const size = Math.floor(item);
216
+ if (size > 0) {
217
+ const g = Math.min(size, remaining);
218
+ groups.push(g);
219
+ remaining -= g;
220
+ if (remaining <= 0) break;
221
+ }
222
+ }
223
+ if (remaining > 0) groups.push(remaining);
224
+ return groups.length > 0 ? groups : [totalLength];
225
+ }
226
+ return [totalLength];
240
227
  }
241
228
  function sanitizeInputAttributes(attrs) {
242
- const sanitized = {};
243
- for (const [key, val] of Object.entries(attrs)) {
244
- const normalizedKey = key.toLowerCase();
245
- if (!RESERVED_INPUT_ATTRIBUTES.has(normalizedKey) && !COMPONENT_MANAGED_ATTRIBUTES.has(normalizedKey)) {
246
- sanitized[key] = val;
247
- }
248
- }
249
- return sanitized;
229
+ const sanitized = {};
230
+ for (const [key, val] of Object.entries(attrs)) {
231
+ const normalizedKey = key.toLowerCase();
232
+ if (!RESERVED_INPUT_ATTRIBUTES.has(normalizedKey) && !COMPONENT_MANAGED_ATTRIBUTES.has(normalizedKey)) sanitized[key] = val;
233
+ }
234
+ return sanitized;
250
235
  }
251
236
  function getSlotRoundedClasses(rounded, firstSlot, lastSlot, groupSize) {
252
- if (groupSize <= 1) {
253
- return "";
254
- }
255
- if (firstSlot) {
256
- switch (rounded) {
257
- case "none":
258
- return "rounded-none";
259
- case "small":
260
- return "rounded-s-sm rounded-e-none";
261
- case "medium":
262
- return "rounded-s-md rounded-e-none";
263
- case "large":
264
- return "rounded-s-lg rounded-e-none";
265
- case "full":
266
- return "rounded-s-full rounded-e-none";
267
- default:
268
- return "rounded-s-md rounded-e-none";
269
- }
270
- }
271
- if (lastSlot) {
272
- switch (rounded) {
273
- case "none":
274
- return "rounded-none";
275
- case "small":
276
- return "rounded-e-sm rounded-s-none";
277
- case "medium":
278
- return "rounded-e-md rounded-s-none";
279
- case "large":
280
- return "rounded-e-lg rounded-s-none";
281
- case "full":
282
- return "rounded-e-full rounded-s-none";
283
- default:
284
- return "rounded-e-md rounded-s-none";
285
- }
286
- }
287
- return "rounded-none";
237
+ if (groupSize <= 1) return "";
238
+ if (firstSlot) switch (rounded) {
239
+ case "none": return "rounded-none";
240
+ case "small": return "rounded-s-sm rounded-e-none";
241
+ case "medium": return "rounded-s-md rounded-e-none";
242
+ case "large": return "rounded-s-lg rounded-e-none";
243
+ case "full": return "rounded-s-full rounded-e-none";
244
+ default: return "rounded-s-md rounded-e-none";
245
+ }
246
+ if (lastSlot) switch (rounded) {
247
+ case "none": return "rounded-none";
248
+ case "small": return "rounded-e-sm rounded-s-none";
249
+ case "medium": return "rounded-e-md rounded-s-none";
250
+ case "large": return "rounded-e-lg rounded-s-none";
251
+ case "full": return "rounded-e-full rounded-s-none";
252
+ default: return "rounded-e-md rounded-s-none";
253
+ }
254
+ return "rounded-none";
288
255
  }
289
256
  function computeSlotClasses(options) {
290
- const { firstSlot, groupSize, lastSlot, rounded, size, slotClass, spacing } = options;
291
- const baseClasses = otpInputSlotThemeVariants({
292
- rounded: spacing || groupSize === 1 ? rounded : "none",
293
- size
294
- });
295
- let extraRounding = "";
296
- if (!spacing) {
297
- extraRounding = getSlotRoundedClasses(rounded, firstSlot, lastSlot, groupSize);
298
- }
299
- return twMerge(baseClasses, extraRounding, slotClass);
300
- }
301
-
302
- class OtpInputComponent {
303
- #generatedId;
304
- #hasNativeLabel;
305
- #hostElementRef;
306
- #i18n;
307
- #label;
308
- #touchPress;
309
- constructor() {
310
- this.#generatedId = createElementControlId();
311
- this.#hasNativeLabel = signal(false, /* @ts-ignore */
312
- ...(ngDevMode ? [{ debugName: "#hasNativeLabel" }] : /* istanbul ignore next */ []));
313
- this.#hostElementRef = inject(ElementRef);
314
- this.#i18n = inject(MonaI18nService);
315
- this.#label = injectLabelAssociation({
316
- ariaLabel: () => this.ariaLabel(),
317
- ariaLabelledBy: () => this.ariaLabelledBy()
318
- });
319
- this.#touchPress = false;
320
- this.activeSlotIndex = computed(() => {
321
- if (!this.hasFocus()) {
322
- return -1;
323
- }
324
- const totalLen = this.normalizedLength();
325
- const start = this.logicalSelectionStart();
326
- const end = this.logicalSelectionEnd();
327
- if (start === end) {
328
- if (start < totalLen) {
329
- return start;
330
- }
331
- return Math.max(0, totalLen - 1);
332
- }
333
- return Math.min(start, totalLen - 1);
334
- }, /* @ts-ignore */
335
- ...(ngDevMode ? [{ debugName: "activeSlotIndex" }] : /* istanbul ignore next */ []));
336
- this.classes = computed(() => {
337
- const baseClasses = otpInputHostThemeVariants();
338
- return twMerge(baseClasses, this.userClass());
339
- }, /* @ts-ignore */
340
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
341
- this.computedAriaDescribedby = computed(() => {
342
- const raw = findUsableAttribute(this.inputAttributes(), "aria-describedby");
343
- return toNonEmptyString(raw) ?? toNonEmptyString(this.ariaDescribedBy());
344
- }, /* @ts-ignore */
345
- ...(ngDevMode ? [{ debugName: "computedAriaDescribedby" }] : /* istanbul ignore next */ []));
346
- this.computedAriaLabel = computed(() => {
347
- const labelledby = this.computedAriaLabelledby();
348
- if (labelledby != null) {
349
- return null;
350
- }
351
- const attrs = this.inputAttributes();
352
- const rawAttrLabel = findUsableAttribute(attrs, "aria-label");
353
- const customAttrLabel = toNonEmptyString(rawAttrLabel);
354
- if (customAttrLabel != null) {
355
- return customAttrLabel;
356
- }
357
- const explicit = toNonEmptyString(this.ariaLabel());
358
- if (explicit != null) {
359
- return explicit;
360
- }
361
- // A real <label> names the input, so the generic name would only hide it.
362
- return this.#hasNativeLabel() ? null : this.messages().verificationCode;
363
- }, /* @ts-ignore */
364
- ...(ngDevMode ? [{ debugName: "computedAriaLabel" }] : /* istanbul ignore next */ []));
365
- this.computedAriaLabelledby = computed(() => {
366
- const attrs = this.inputAttributes();
367
- const raw = findUsableAttribute(attrs, "aria-labelledby");
368
- return toNonEmptyString(raw) ?? this.#label.labelledBy();
369
- }, /* @ts-ignore */
370
- ...(ngDevMode ? [{ debugName: "computedAriaLabelledby" }] : /* istanbul ignore next */ []));
371
- this.derivedAutocomplete = computed(() => {
372
- const attrs = this.inputAttributes();
373
- const autocomplete = findUsableAttribute(attrs, "autocomplete");
374
- return autocomplete != null ? String(autocomplete) : "one-time-code";
375
- }, /* @ts-ignore */
376
- ...(ngDevMode ? [{ debugName: "derivedAutocomplete" }] : /* istanbul ignore next */ []));
377
- this.derivedInputMode = computed(() => {
378
- const attrs = this.inputAttributes();
379
- const inputMode = findUsableAttribute(attrs, "inputmode");
380
- if (inputMode != null) {
381
- return String(inputMode);
382
- }
383
- return this.type() === "number" ? "numeric" : "text";
384
- }, /* @ts-ignore */
385
- ...(ngDevMode ? [{ debugName: "derivedInputMode" }] : /* istanbul ignore next */ []));
386
- this.derivedName = computed(() => {
387
- const name = this.name();
388
- if (name) {
389
- return name;
390
- }
391
- const attribute = findUsableAttribute(this.inputAttributes(), "name");
392
- return attribute != null ? String(attribute) : null;
393
- }, /* @ts-ignore */
394
- ...(ngDevMode ? [{ debugName: "derivedName" }] : /* istanbul ignore next */ []));
395
- this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
396
- this.hasFocus = signal(false, /* @ts-ignore */
397
- ...(ngDevMode ? [{ debugName: "hasFocus" }] : /* istanbul ignore next */ []));
398
- this.inputClass = computed(() => otpInputFieldThemeVariants(), /* @ts-ignore */
399
- ...(ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []));
400
- this.inputRef = viewChild.required("input", /* @ts-ignore */
401
- ...(ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []));
402
- this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && this.value().length !== this.normalizedLength())), /* @ts-ignore */
403
- ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
404
- this.isComplete = computed(() => this.value().length === this.normalizedLength(), /* @ts-ignore */
405
- ...(ngDevMode ? [{ debugName: "isComplete" }] : /* istanbul ignore next */ []));
406
- this.isComposing = signal(false, /* @ts-ignore */
407
- ...(ngDevMode ? [{ debugName: "isComposing" }] : /* istanbul ignore next */ []));
408
- this.logicalSelectionEnd = computed(() => {
409
- const maxLogicalPosition = Math.min(this.value().length, this.normalizedLength());
410
- const start = this.logicalSelectionStart();
411
- const rawEnd = Math.max(0, Math.min(this.selectionEnd(), maxLogicalPosition));
412
- return Math.max(start, rawEnd);
413
- }, /* @ts-ignore */
414
- ...(ngDevMode ? [{ debugName: "logicalSelectionEnd" }] : /* istanbul ignore next */ []));
415
- this.logicalSelectionStart = computed(() => {
416
- const maxLogicalPosition = Math.min(this.value().length, this.normalizedLength());
417
- return Math.max(0, Math.min(this.selectionStart(), maxLogicalPosition));
418
- }, /* @ts-ignore */
419
- ...(ngDevMode ? [{ debugName: "logicalSelectionStart" }] : /* istanbul ignore next */ []));
420
- this.messages = this.#i18n.componentMessages("otpInput", OTP_INPUT_DEFAULT_MESSAGES);
421
- this.nativeInputType = computed(() => (this.type() === "password" ? "password" : "text"), /* @ts-ignore */
422
- ...(ngDevMode ? [{ debugName: "nativeInputType" }] : /* istanbul ignore next */ []));
423
- this.normalizedLength = computed(() => normalizeLength(this.length()), /* @ts-ignore */
424
- ...(ngDevMode ? [{ debugName: "normalizedLength" }] : /* istanbul ignore next */ []));
425
- /** The one thing that writes the id. `inputId` wins, and an id in `inputAttributes` stands in for a generated one. */
426
- this.resolvedId = computed(() => {
427
- const id = this.inputId();
428
- if (id !== this.#generatedId) {
429
- return id;
430
- }
431
- const attribute = findUsableAttribute(this.inputAttributes(), "id");
432
- return attribute != null ? String(attribute) : id;
433
- }, /* @ts-ignore */
434
- ...(ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []));
435
- this.sanitizedAttributes = computed(() => sanitizeInputAttributes(this.inputAttributes()), /* @ts-ignore */
436
- ...(ngDevMode ? [{ debugName: "sanitizedAttributes" }] : /* istanbul ignore next */ []));
437
- this.selectionEnd = signal(0, /* @ts-ignore */
438
- ...(ngDevMode ? [{ debugName: "selectionEnd" }] : /* istanbul ignore next */ []));
439
- this.selectionStart = signal(0, /* @ts-ignore */
440
- ...(ngDevMode ? [{ debugName: "selectionStart" }] : /* istanbul ignore next */ []));
441
- this.separatorTemplate = contentChild(OtpInputSeparatorTemplateDirective, { ...(ngDevMode ? { debugName: "separatorTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
442
- this.visualGroups = computed(() => {
443
- const totalLen = this.normalizedLength();
444
- const groupSizes = normalizeGroupLengths(this.groupLength(), totalLen);
445
- const val = this.value();
446
- const activeIndex = this.activeSlotIndex();
447
- const selStart = this.logicalSelectionStart();
448
- const selEnd = this.logicalSelectionEnd();
449
- const focused = this.hasFocus();
450
- const inputType = this.type();
451
- const placeholderStr = this.placeholder();
452
- const placeholderChar = placeholderStr.length > 0 ? placeholderStr.charAt(0) : "";
453
- const rounded = this.rounded();
454
- const size = this.size();
455
- const slotClass = this.slotClass();
456
- const spacing = this.spacing();
457
- const groups = [];
458
- let slotCounter = 0;
459
- for (let gIndex = 0; gIndex < groupSizes.length; gIndex++) {
460
- const groupSize = groupSizes[gIndex];
461
- const slots = [];
462
- for (let s = 0; s < groupSize; s++) {
463
- const slotIndex = slotCounter++;
464
- const filled = slotIndex < val.length;
465
- const character = filled ? val[slotIndex] : "";
466
- const isPlaceholder = !filled && placeholderChar.length > 0;
467
- let displayCharacter = "";
468
- if (filled) {
469
- displayCharacter = inputType === "password" ? "•" : character;
470
- }
471
- else if (isPlaceholder) {
472
- displayCharacter = placeholderChar;
473
- }
474
- const active = focused && slotIndex === activeIndex;
475
- const selected = focused && slotIndex >= selStart && slotIndex < selEnd;
476
- const isFirstSlot = s === 0;
477
- const isLastSlot = s === groupSize - 1;
478
- const classes = computeSlotClasses({
479
- firstSlot: isFirstSlot,
480
- groupSize,
481
- lastSlot: isLastSlot,
482
- rounded,
483
- size,
484
- slotClass,
485
- spacing
486
- });
487
- slots.push({
488
- active,
489
- classes,
490
- displayCharacter,
491
- filled,
492
- index: slotIndex,
493
- placeholder: isPlaceholder,
494
- selected
495
- });
496
- }
497
- groups.push({
498
- index: gIndex,
499
- slots
500
- });
501
- }
502
- return groups;
503
- }, /* @ts-ignore */
504
- ...(ngDevMode ? [{ debugName: "visualGroups" }] : /* istanbul ignore next */ []));
505
- /**
506
- * @description Id of an element that describes the inner `<input>`, such as an error message.
507
- * @default null
508
- */
509
- this.ariaDescribedBy = input(null, { ...(ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {}), alias: "aria-describedby" });
510
- /**
511
- * @description Accessible name for the inner `<input>` element. A `<label>` or `mona-label` names it too, and the
512
- * generic "Verification code" name only applies when there is neither.
513
- * @default null
514
- */
515
- this.ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
516
- /**
517
- * @description Id of the element that labels the inner `<input>`.
518
- * @default null
519
- */
520
- this.ariaLabelledBy = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
521
- /**
522
- * @description Regular expression used to determine whether each individual OTP character is allowed.
523
- * @default null
524
- */
525
- this.characterPattern = input(null, /* @ts-ignore */
526
- ...(ngDevMode ? [{ debugName: "characterPattern" }] : /* istanbul ignore next */ []));
527
- /**
528
- * @description Emitted when a user interaction completes the verification code. Pasting a different full code over
529
- * a complete one emits again, so auto-submit sees the new code. Correcting a complete code one character at a time
530
- * doesn't.
531
- */
532
- this.complete = output();
533
- /**
534
- * @description Renders the component with reduced visual emphasis and removes pointer interaction.
535
- * When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
536
- * @default false
537
- */
538
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
539
- /**
540
- * @description Configures slot grouping lengths. Accepts a uniform number or an array of group sizes.
541
- * @default null
542
- */
543
- this.groupLength = input(null, /* @ts-ignore */
544
- ...(ngDevMode ? [{ debugName: "groupLength" }] : /* istanbul ignore next */ []));
545
- /**
546
- * @description Additional HTML attributes applied directly to the inner `<input>` element.
547
- * @default {}
548
- */
549
- this.inputAttributes = input({}, /* @ts-ignore */
550
- ...(ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []));
551
- /**
552
- * @description Emitted when the inner input loses focus.
553
- */
554
- this.inputBlur = output();
555
- /**
556
- * @description Emitted when the inner input gains focus.
557
- */
558
- this.inputFocus = output();
559
- /**
560
- * @description Id of the inner `<input>` element. Point a `<label for>` or `<mona-label for>` at it to label the
561
- * control. A unique id is generated when it isn't set.
562
- * @default generated
563
- */
564
- this.inputId = input(this.#generatedId, /* @ts-ignore */
565
- ...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
566
- /**
567
- * @description Marks the OTP input as invalid. When bound to a signal form field via `[formField]`,
568
- * this is written by the `FormField` directive.
569
- * @default false
570
- */
571
- this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
572
- /**
573
- * @description Sets the total number of characters accepted by the OTP input and the number of visual slots.
574
- * @default 4
575
- */
576
- this.length = input(4, /* @ts-ignore */
577
- ...(ngDevMode ? [{ debugName: "length" }] : /* istanbul ignore next */ []));
578
- /**
579
- * @description Name of the native input, used in native form submission and by browsers for autofill. When bound to
580
- * a signal form field via `[formField]`, this is written by the `FormField` directive.
581
- * @default ""
582
- */
583
- this.name = input("", /* @ts-ignore */
584
- ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
585
- /**
586
- * @description Hint character displayed in empty visual slots.
587
- * @default ""
588
- */
589
- this.placeholder = input("", /* @ts-ignore */
590
- ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
591
- /**
592
- * @description Prevents value changes while preserving the component's focusability and visual state.
593
- * When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
594
- * @default false
595
- */
596
- this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
597
- /**
598
- * @description Marks the OTP input as required. Triggers invalid state when touched and incomplete.
599
- * When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
600
- * @default false
601
- */
602
- this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
603
- /**
604
- * @description Border-radius preset applied to the OTP slots.
605
- * @default "medium"
606
- */
607
- this.rounded = input("medium", /* @ts-ignore */
608
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
609
- /**
610
- * @description Text character or string displayed between visual slot groups.
611
- * @default ""
612
- */
613
- this.separator = input("", /* @ts-ignore */
614
- ...(ngDevMode ? [{ debugName: "separator" }] : /* istanbul ignore next */ []));
615
- /**
616
- * @description Additional CSS classes applied to separator elements.
617
- * @default ""
618
- */
619
- this.separatorClass = input("", /* @ts-ignore */
620
- ...(ngDevMode ? [{ debugName: "separatorClass" }] : /* istanbul ignore next */ []));
621
- /**
622
- * @description Size preset controlling the dimensions and font size of the OTP slots.
623
- * @default "medium"
624
- */
625
- this.size = input("medium", /* @ts-ignore */
626
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
627
- /**
628
- * @description Additional CSS classes applied to each visual slot element.
629
- * @default ""
630
- */
631
- this.slotClass = input("", /* @ts-ignore */
632
- ...(ngDevMode ? [{ debugName: "slotClass" }] : /* istanbul ignore next */ []));
633
- /**
634
- * @description Determines whether visual slots within a group have spacing between them or are joined together.
635
- * @default true
636
- */
637
- this.spacing = input(true, { ...(ngDevMode ? { debugName: "spacing" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
638
- /**
639
- * @description Tab index of the inner `<input>`.
640
- * @default 0
641
- */
642
- this.tabindex = input(0, { ...(ngDevMode ? { debugName: "tabindex" } : /* istanbul ignore next */ {}), transform: (value) => numberAttribute(value, 0) });
643
- /**
644
- * @description Emitted when the inner input loses focus. The `FormField` directive listens to this to mark the field
645
- * as touched.
646
- */
647
- this.touch = output();
648
- /**
649
- * @description Sets the touched state of the OTP input. When bound to a signal form field via `[formField]`,
650
- * this is written by the `FormField` directive.
651
- * @default false
652
- */
653
- this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
654
- /**
655
- * @description Sets the type of the OTP input ("text", "number", or "password").
656
- * @default "text"
657
- */
658
- this.type = input("text", /* @ts-ignore */
659
- ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
660
- /**
661
- * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
662
- * @default ""
663
- */
664
- this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
665
- /**
666
- * @description Two-way bindable current value of the OTP input.
667
- * @default ""
668
- */
669
- this.value = model("", /* @ts-ignore */
670
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
671
- afterNextRender(() => {
672
- this.#hasNativeLabel.set((this.inputRef().nativeElement.labels?.length ?? 0) > 0);
673
- });
674
- effect(() => {
675
- const val = this.value();
676
- const inputType = this.type();
677
- const characterPattern = this.characterPattern();
678
- const maxLen = this.normalizedLength();
679
- const filtered = filterCharacters(val, inputType, characterPattern, maxLen);
680
- if (filtered !== val) {
681
- this.value.set(filtered);
682
- }
683
- });
684
- }
685
- /** Removes focus from the input. */
686
- blur() {
687
- this.inputRef().nativeElement.blur();
688
- }
689
- /**
690
- * Focuses the input: at the given slot, with the given options, or at the next unfilled slot. Does nothing while
691
- * disabled.
692
- */
693
- focus(target) {
694
- if (this.effectiveDisabled()) {
695
- return;
696
- }
697
- const el = this.inputRef().nativeElement;
698
- if (typeof target === "object" && target !== null) {
699
- el.focus(target);
700
- this.syncSelection();
701
- return;
702
- }
703
- el.focus();
704
- const val = this.value();
705
- const maxLen = this.normalizedLength();
706
- if (typeof target === "number") {
707
- const clamped = Math.max(0, Math.min(target, maxLen));
708
- if (clamped < val.length) {
709
- el.setSelectionRange(clamped, clamped + 1);
710
- }
711
- else {
712
- const pos = Math.min(clamped, val.length);
713
- el.setSelectionRange(pos, pos);
714
- }
715
- }
716
- else {
717
- if (val.length < maxLen) {
718
- el.setSelectionRange(val.length, val.length);
719
- }
720
- else {
721
- el.setSelectionRange(maxLen, maxLen);
722
- }
723
- }
724
- this.syncSelection();
725
- }
726
- /**
727
- * @internal
728
- */
729
- setLabelledBy(id) {
730
- this.#label.setLabelledBy(id);
731
- }
732
- onBeforeInput(event) {
733
- if (this.effectiveDisabled() || this.readonly()) {
734
- event.preventDefault();
735
- return;
736
- }
737
- if (this.isComposing() || event.isComposing) {
738
- return;
739
- }
740
- const inputType = event.inputType;
741
- const inputEl = this.inputRef().nativeElement;
742
- const start = inputEl.selectionStart ?? 0;
743
- const end = inputEl.selectionEnd ?? 0;
744
- const val = this.value();
745
- const maxLen = this.normalizedLength();
746
- if (inputType === "insertText") {
747
- if (!event.data) {
748
- return;
749
- }
750
- if (event.data.length === 1) {
751
- const accepted = acceptCharacter(event.data, this.type(), this.characterPattern());
752
- if (accepted === null) {
753
- event.preventDefault();
754
- return;
755
- }
756
- if (start >= maxLen && start === end) {
757
- event.preventDefault();
758
- return;
759
- }
760
- const overwrites = start === end && start < val.length;
761
- if (accepted !== event.data) {
762
- event.preventDefault();
763
- this.applyUserInsertion(accepted, start, overwrites ? start + 1 : end);
764
- return;
765
- }
766
- if (overwrites) {
767
- inputEl.setSelectionRange(start, start + 1);
768
- }
769
- }
770
- else {
771
- event.preventDefault();
772
- this.applyUserInsertion(event.data, start, end);
773
- }
774
- }
775
- else if (inputType === "insertReplacementText" || inputType === "insertFromPaste") {
776
- if (event.data) {
777
- event.preventDefault();
778
- this.applyUserInsertion(event.data, start, end);
779
- }
780
- }
781
- }
782
- onBlur(event) {
783
- this.hasFocus.set(false);
784
- this.inputBlur.emit(event);
785
- this.touch.emit();
786
- }
787
- onCompositionEnd(event) {
788
- this.isComposing.set(false);
789
- this.onInput(event);
790
- }
791
- onCompositionStart() {
792
- this.isComposing.set(true);
793
- }
794
- onFocus(event) {
795
- this.hasFocus.set(true);
796
- this.syncSelection();
797
- this.inputFocus.emit(event);
798
- }
799
- onInput(_event) {
800
- if (this.effectiveDisabled() || this.readonly()) {
801
- const inputEl = this.inputRef().nativeElement;
802
- inputEl.value = this.value();
803
- return;
804
- }
805
- if (this.isComposing()) {
806
- return;
807
- }
808
- const inputEl = this.inputRef().nativeElement;
809
- const rawVal = inputEl.value;
810
- const prevVal = this.value();
811
- const nextVal = filterCharacters(rawVal, this.type(), this.characterPattern(), this.normalizedLength());
812
- inputEl.value = nextVal;
813
- const wasIncomplete = prevVal.length < this.normalizedLength();
814
- this.value.set(nextVal);
815
- if (wasIncomplete && nextVal.length === this.normalizedLength()) {
816
- this.complete.emit(nextVal);
817
- }
818
- this.syncSelection();
819
- }
820
- onInputClick(event) {
821
- // A touch leaves the press to the browser, for its paste menu, and places the caret once it's a tap.
822
- if (this.#touchPress && !this.effectiveDisabled()) {
823
- this.focus(this.#slotIndexAt(event.clientX));
824
- }
825
- }
826
- onInputMouseDown(event) {
827
- // The secondary button is left alone as well, so it opens the browser's menu with Paste.
828
- if (this.#touchPress || this.effectiveDisabled() || event.button !== 0 || event.ctrlKey) {
829
- return;
830
- }
831
- event.preventDefault();
832
- this.focus(this.#slotIndexAt(event.clientX));
833
- }
834
- onInputPointerDown(event) {
835
- this.#touchPress = event.pointerType === "touch" || event.pointerType === "pen";
836
- }
837
- onKeyDown(event) {
838
- if (this.effectiveDisabled() || this.readonly() || this.isComposing() || event.isComposing) {
839
- return;
840
- }
841
- if (event.ctrlKey || event.metaKey || event.altKey) {
842
- return;
843
- }
844
- if (event.key.length !== 1) {
845
- return;
846
- }
847
- const inputEl = this.inputRef().nativeElement;
848
- const start = inputEl.selectionStart ?? 0;
849
- const end = inputEl.selectionEnd ?? 0;
850
- const val = this.value();
851
- const maxLen = this.normalizedLength();
852
- if (acceptCharacter(event.key, this.type(), this.characterPattern()) === null) {
853
- event.preventDefault();
854
- return;
855
- }
856
- if (start >= maxLen && start === end) {
857
- event.preventDefault();
858
- return;
859
- }
860
- if (start === end && start < val.length) {
861
- inputEl.setSelectionRange(start, start + 1);
862
- }
863
- }
864
- onKeyUp() {
865
- this.syncSelection();
866
- }
867
- onPaste(event) {
868
- if (this.effectiveDisabled() || this.readonly()) {
869
- event.preventDefault();
870
- return;
871
- }
872
- const pastedText = event.clipboardData?.getData("text") ?? "";
873
- if (!pastedText) {
874
- return;
875
- }
876
- event.preventDefault();
877
- const inputEl = this.inputRef().nativeElement;
878
- const start = inputEl.selectionStart ?? 0;
879
- const end = inputEl.selectionEnd ?? 0;
880
- this.applyUserInsertion(pastedText, start, end);
881
- }
882
- onSelect() {
883
- this.syncSelection();
884
- }
885
- applyUserInsertion(text, selectionStart, selectionEnd) {
886
- if (this.effectiveDisabled() || this.readonly()) {
887
- return;
888
- }
889
- const inputEl = this.inputRef().nativeElement;
890
- const currentVal = this.value();
891
- const maxLen = this.normalizedLength();
892
- const filtered = filterCharacters(text, this.type(), this.characterPattern(), Number.MAX_SAFE_INTEGER);
893
- if (filtered.length === 0 && selectionStart === selectionEnd) {
894
- return;
895
- }
896
- // A full code replaces what's there, wherever the caret is, because merging would make up a code nobody entered.
897
- const replacesAll = filtered.length >= maxLen;
898
- const start = replacesAll ? 0 : Math.max(0, Math.min(selectionStart, currentVal.length));
899
- const end = replacesAll ? currentVal.length : Math.max(start, Math.min(selectionEnd, currentVal.length));
900
- const before = currentVal.substring(0, start);
901
- const after = currentVal.substring(end);
902
- let combined = before + filtered + after;
903
- if (combined.length > maxLen) {
904
- combined = combined.substring(0, maxLen);
905
- }
906
- const newCaretPos = Math.min(start + filtered.length, maxLen);
907
- inputEl.value = combined;
908
- this.value.set(combined);
909
- inputEl.setSelectionRange(newCaretPos, newCaretPos);
910
- this.selectionStart.set(newCaretPos);
911
- this.selectionEnd.set(newCaretPos);
912
- if (combined !== currentVal && combined.length === maxLen) {
913
- this.complete.emit(combined);
914
- }
915
- }
916
- #slotIndexAt(clientX) {
917
- const slots = this.#hostElementRef.nativeElement.querySelectorAll("[data-slot-index]");
918
- let closest = 0;
919
- let closestDistance = Number.POSITIVE_INFINITY;
920
- slots.forEach((slot, index) => {
921
- const { left, right } = slot.getBoundingClientRect();
922
- const distance = clientX < left ? left - clientX : Math.max(0, clientX - right);
923
- if (distance < closestDistance) {
924
- closest = index;
925
- closestDistance = distance;
926
- }
927
- });
928
- return closest;
929
- }
930
- syncSelection() {
931
- const el = this.inputRef().nativeElement;
932
- this.selectionStart.set(el.selectionStart ?? 0);
933
- this.selectionEnd.set(el.selectionEnd ?? 0);
934
- }
935
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: OtpInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
936
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: OtpInputComponent, isStandalone: true, selector: "mona-otp-input", inputs: { ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", 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 }, characterPattern: { classPropertyName: "characterPattern", publicName: "characterPattern", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, groupLength: { classPropertyName: "groupLength", publicName: "groupLength", isSignal: true, isRequired: false, transformFunction: null }, inputAttributes: { classPropertyName: "inputAttributes", publicName: "inputAttributes", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null }, separatorClass: { classPropertyName: "separatorClass", publicName: "separatorClass", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, slotClass: { classPropertyName: "slotClass", publicName: "slotClass", isSignal: true, isRequired: false, transformFunction: null }, spacing: { classPropertyName: "spacing", publicName: "spacing", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { complete: "complete", inputBlur: "inputBlur", inputFocus: "inputFocus", touch: "touch", value: "valueChange" }, host: { properties: { "attr.aria-describedby": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.tabindex": "null", "attr.dir": "'ltr'", "attr.data-disabled": "effectiveDisabled() || null", "attr.data-readonly": "readonly() || null", "attr.data-required": "required() || null", "attr.data-invalid": "invalidState() || null", "attr.data-complete": "isComplete() || null", "attr.data-focused": "hasFocus() || null", "class": "classes()" } }, queries: [{ propertyName: "separatorTemplate", first: true, predicate: OtpInputSeparatorTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "<input\n #input\n [class]=\"inputClass()\"\n [id]=\"resolvedId()\"\n [attr.tabindex]=\"tabindex()\"\n [value]=\"value()\"\n [disabled]=\"effectiveDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [type]=\"nativeInputType()\"\n [attr.inputmode]=\"derivedInputMode()\"\n [attr.autocomplete]=\"derivedAutocomplete()\"\n [attr.autocapitalize]=\"'off'\"\n [attr.spellcheck]=\"'false'\"\n [attr.aria-label]=\"computedAriaLabel()\"\n [attr.aria-labelledby]=\"computedAriaLabelledby()\"\n [attr.aria-describedby]=\"computedAriaDescribedby()\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.maxlength]=\"normalizedLength()\"\n [attr.name]=\"derivedName()\"\n [monaAttributeBinder]=\"sanitizedAttributes()\"\n (beforeinput)=\"onBeforeInput($event)\"\n (keydown)=\"onKeyDown($event)\"\n (input)=\"onInput($event)\"\n (paste)=\"onPaste($event)\"\n (click)=\"onInputClick($event)\"\n (mousedown)=\"onInputMouseDown($event)\"\n (pointerdown)=\"onInputPointerDown($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n (select)=\"onSelect()\"\n (selectionchange)=\"onSelect()\"\n (keyup)=\"onKeyUp()\"\n (compositionstart)=\"onCompositionStart()\"\n (compositionend)=\"onCompositionEnd($event)\" />\n\n@for (group of visualGroups(); track group.index; let lastGroup = $last) {\n <div\n class=\"inline-flex items-center\"\n [class.gap-1.5]=\"spacing()\"\n [class]=\"!spacing() ? '[&>*:not(:first-child)]:-ms-px' : ''\"\n [attr.data-group-index]=\"group.index\">\n @for (slot of group.slots; track slot.index) {\n <span\n class=\"otp-slot\"\n [class]=\"slot.classes\"\n [attr.data-slot-index]=\"slot.index\"\n [attr.data-active]=\"slot.active || null\"\n [attr.data-selected]=\"slot.selected || null\"\n [attr.data-filled]=\"slot.filled || null\"\n [attr.data-placeholder]=\"slot.placeholder || null\"\n [attr.data-disabled]=\"effectiveDisabled() || null\"\n [attr.data-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n aria-hidden=\"true\">\n {{ slot.displayCharacter }}\n @if (slot.active && !slot.filled && hasFocus() && !effectiveDisabled() && !readonly()) {\n <span\n class=\"pointer-events-none absolute inset-y-2 w-0.5 animate-pulse motion-reduce:animate-none bg-foreground\"\n aria-hidden=\"true\"></span>\n }\n </span>\n }\n </div>\n\n @if (!lastGroup && (separator() || separatorTemplate())) {\n <span\n class=\"inline-flex items-center justify-center text-muted-foreground select-none px-1\"\n [class]=\"separatorClass()\"\n aria-hidden=\"true\">\n @if (separatorTemplate(); as customTemplate) {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplate;\n context: { $implicit: group.index, groupIndex: group.index }\n \"></ng-container>\n } @else {\n {{ separator() }}\n }\n </span>\n }\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: AttributeBinderDirective, selector: "[monaAttributeBinder]", inputs: ["monaAttributeBinder"] }] }); }
257
+ const { firstSlot, groupSize, lastSlot, rounded, size, slotClass, spacing } = options;
258
+ const baseClasses = otpInputSlotThemeVariants({
259
+ rounded: spacing || groupSize === 1 ? rounded : "none",
260
+ size
261
+ });
262
+ let extraRounding = "";
263
+ if (!spacing) extraRounding = getSlotRoundedClasses(rounded, firstSlot, lastSlot, groupSize);
264
+ return twMerge(baseClasses, extraRounding, slotClass);
937
265
  }
938
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: OtpInputComponent, decorators: [{
939
- type: Component,
940
- args: [{ selector: "mona-otp-input", imports: [NgTemplateOutlet, AttributeBinderDirective], host: {
941
- // The ARIA inputs are applied to the inner input, so the host must not keep the static attributes.
942
- "[attr.aria-describedby]": "null",
943
- "[attr.aria-label]": "null",
944
- "[attr.aria-labelledby]": "null",
945
- "[attr.tabindex]": "null",
946
- "[attr.dir]": "'ltr'",
947
- "[attr.data-disabled]": "effectiveDisabled() || null",
948
- "[attr.data-readonly]": "readonly() || null",
949
- "[attr.data-required]": "required() || null",
950
- "[attr.data-invalid]": "invalidState() || null",
951
- "[attr.data-complete]": "isComplete() || null",
952
- "[attr.data-focused]": "hasFocus() || null",
953
- "[class]": "classes()"
954
- }, template: "<input\n #input\n [class]=\"inputClass()\"\n [id]=\"resolvedId()\"\n [attr.tabindex]=\"tabindex()\"\n [value]=\"value()\"\n [disabled]=\"effectiveDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [type]=\"nativeInputType()\"\n [attr.inputmode]=\"derivedInputMode()\"\n [attr.autocomplete]=\"derivedAutocomplete()\"\n [attr.autocapitalize]=\"'off'\"\n [attr.spellcheck]=\"'false'\"\n [attr.aria-label]=\"computedAriaLabel()\"\n [attr.aria-labelledby]=\"computedAriaLabelledby()\"\n [attr.aria-describedby]=\"computedAriaDescribedby()\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.maxlength]=\"normalizedLength()\"\n [attr.name]=\"derivedName()\"\n [monaAttributeBinder]=\"sanitizedAttributes()\"\n (beforeinput)=\"onBeforeInput($event)\"\n (keydown)=\"onKeyDown($event)\"\n (input)=\"onInput($event)\"\n (paste)=\"onPaste($event)\"\n (click)=\"onInputClick($event)\"\n (mousedown)=\"onInputMouseDown($event)\"\n (pointerdown)=\"onInputPointerDown($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n (select)=\"onSelect()\"\n (selectionchange)=\"onSelect()\"\n (keyup)=\"onKeyUp()\"\n (compositionstart)=\"onCompositionStart()\"\n (compositionend)=\"onCompositionEnd($event)\" />\n\n@for (group of visualGroups(); track group.index; let lastGroup = $last) {\n <div\n class=\"inline-flex items-center\"\n [class.gap-1.5]=\"spacing()\"\n [class]=\"!spacing() ? '[&>*:not(:first-child)]:-ms-px' : ''\"\n [attr.data-group-index]=\"group.index\">\n @for (slot of group.slots; track slot.index) {\n <span\n class=\"otp-slot\"\n [class]=\"slot.classes\"\n [attr.data-slot-index]=\"slot.index\"\n [attr.data-active]=\"slot.active || null\"\n [attr.data-selected]=\"slot.selected || null\"\n [attr.data-filled]=\"slot.filled || null\"\n [attr.data-placeholder]=\"slot.placeholder || null\"\n [attr.data-disabled]=\"effectiveDisabled() || null\"\n [attr.data-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n aria-hidden=\"true\">\n {{ slot.displayCharacter }}\n @if (slot.active && !slot.filled && hasFocus() && !effectiveDisabled() && !readonly()) {\n <span\n class=\"pointer-events-none absolute inset-y-2 w-0.5 animate-pulse motion-reduce:animate-none bg-foreground\"\n aria-hidden=\"true\"></span>\n }\n </span>\n }\n </div>\n\n @if (!lastGroup && (separator() || separatorTemplate())) {\n <span\n class=\"inline-flex items-center justify-center text-muted-foreground select-none px-1\"\n [class]=\"separatorClass()\"\n aria-hidden=\"true\">\n @if (separatorTemplate(); as customTemplate) {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplate;\n context: { $implicit: group.index, groupIndex: group.index }\n \"></ng-container>\n } @else {\n {{ separator() }}\n }\n </span>\n }\n}\n" }]
955
- }], ctorParameters: () => [], propDecorators: { inputRef: [{ type: i0.ViewChild, args: ["input", { isSignal: true }] }], separatorTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => OtpInputSeparatorTemplateDirective), { ...{
956
- read: TemplateRef
957
- }, isSignal: true }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", 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 }] }], characterPattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "characterPattern", required: false }] }], complete: [{ type: i0.Output, args: ["complete"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], groupLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupLength", required: false }] }], inputAttributes: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputAttributes", required: false }] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], length: [{ type: i0.Input, args: [{ isSignal: true, alias: "length", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], separator: [{ type: i0.Input, args: [{ isSignal: true, alias: "separator", required: false }] }], separatorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "separatorClass", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], slotClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "slotClass", required: false }] }], spacing: [{ type: i0.Input, args: [{ isSignal: true, alias: "spacing", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
958
-
959
- /*
960
- * Public API Surface of @nanahoshi/mona-ui/otp-input
961
- */
962
-
963
- /**
964
- * Generated bundle index. Do not edit.
965
- */
966
-
266
+ var OtpInputComponent = class OtpInputComponent {
267
+ #generatedId;
268
+ #hasNativeLabel;
269
+ #hostElementRef;
270
+ #i18n;
271
+ #label;
272
+ #touchPress;
273
+ constructor() {
274
+ this.#generatedId = createElementControlId();
275
+ this.#hasNativeLabel = signal(false, ...ngDevMode ? [{ debugName: "#hasNativeLabel" }] : /* istanbul ignore next */ []);
276
+ this.#hostElementRef = inject(ElementRef);
277
+ this.#i18n = inject(MonaI18nService);
278
+ this.#label = injectLabelAssociation({
279
+ ariaLabel: () => this.ariaLabel(),
280
+ ariaLabelledBy: () => this.ariaLabelledBy()
281
+ });
282
+ this.#touchPress = false;
283
+ this.activeSlotIndex = computed(() => {
284
+ if (!this.hasFocus()) return -1;
285
+ const totalLen = this.normalizedLength();
286
+ const start = this.logicalSelectionStart();
287
+ if (start === this.logicalSelectionEnd()) {
288
+ if (start < totalLen) return start;
289
+ return Math.max(0, totalLen - 1);
290
+ }
291
+ return Math.min(start, totalLen - 1);
292
+ }, ...ngDevMode ? [{ debugName: "activeSlotIndex" }] : /* istanbul ignore next */ []);
293
+ this.classes = computed(() => {
294
+ const baseClasses = otpInputHostThemeVariants();
295
+ return twMerge(baseClasses, this.userClass());
296
+ }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
297
+ this.computedAriaDescribedby = computed(() => {
298
+ return toNonEmptyString(findUsableAttribute(this.inputAttributes(), "aria-describedby")) ?? toNonEmptyString(this.ariaDescribedBy());
299
+ }, ...ngDevMode ? [{ debugName: "computedAriaDescribedby" }] : /* istanbul ignore next */ []);
300
+ this.computedAriaLabel = computed(() => {
301
+ if (this.computedAriaLabelledby() != null) return null;
302
+ const customAttrLabel = toNonEmptyString(findUsableAttribute(this.inputAttributes(), "aria-label"));
303
+ if (customAttrLabel != null) return customAttrLabel;
304
+ const explicit = toNonEmptyString(this.ariaLabel());
305
+ if (explicit != null) return explicit;
306
+ return this.#hasNativeLabel() ? null : this.messages().verificationCode;
307
+ }, ...ngDevMode ? [{ debugName: "computedAriaLabel" }] : /* istanbul ignore next */ []);
308
+ this.computedAriaLabelledby = computed(() => {
309
+ return toNonEmptyString(findUsableAttribute(this.inputAttributes(), "aria-labelledby")) ?? this.#label.labelledBy();
310
+ }, ...ngDevMode ? [{ debugName: "computedAriaLabelledby" }] : /* istanbul ignore next */ []);
311
+ this.derivedAutocomplete = computed(() => {
312
+ const autocomplete = findUsableAttribute(this.inputAttributes(), "autocomplete");
313
+ return autocomplete != null ? String(autocomplete) : "one-time-code";
314
+ }, ...ngDevMode ? [{ debugName: "derivedAutocomplete" }] : /* istanbul ignore next */ []);
315
+ this.derivedInputMode = computed(() => {
316
+ const inputMode = findUsableAttribute(this.inputAttributes(), "inputmode");
317
+ if (inputMode != null) return String(inputMode);
318
+ return this.type() === "number" ? "numeric" : "text";
319
+ }, ...ngDevMode ? [{ debugName: "derivedInputMode" }] : /* istanbul ignore next */ []);
320
+ this.derivedName = computed(() => {
321
+ const name = this.name();
322
+ if (name) return name;
323
+ const attribute = findUsableAttribute(this.inputAttributes(), "name");
324
+ return attribute != null ? String(attribute) : null;
325
+ }, ...ngDevMode ? [{ debugName: "derivedName" }] : /* istanbul ignore next */ []);
326
+ this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
327
+ this.hasFocus = signal(false, ...ngDevMode ? [{ debugName: "hasFocus" }] : /* istanbul ignore next */ []);
328
+ this.inputClass = computed(() => otpInputFieldThemeVariants(), ...ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []);
329
+ this.inputRef = viewChild.required("input", ...ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []);
330
+ this.invalidState = computed(() => this.touched() && (this.invalid() || this.required() && this.value().length !== this.normalizedLength()), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
331
+ this.isComplete = computed(() => this.value().length === this.normalizedLength(), ...ngDevMode ? [{ debugName: "isComplete" }] : /* istanbul ignore next */ []);
332
+ this.isComposing = signal(false, ...ngDevMode ? [{ debugName: "isComposing" }] : /* istanbul ignore next */ []);
333
+ this.logicalSelectionEnd = computed(() => {
334
+ const maxLogicalPosition = Math.min(this.value().length, this.normalizedLength());
335
+ const start = this.logicalSelectionStart();
336
+ const rawEnd = Math.max(0, Math.min(this.selectionEnd(), maxLogicalPosition));
337
+ return Math.max(start, rawEnd);
338
+ }, ...ngDevMode ? [{ debugName: "logicalSelectionEnd" }] : /* istanbul ignore next */ []);
339
+ this.logicalSelectionStart = computed(() => {
340
+ const maxLogicalPosition = Math.min(this.value().length, this.normalizedLength());
341
+ return Math.max(0, Math.min(this.selectionStart(), maxLogicalPosition));
342
+ }, ...ngDevMode ? [{ debugName: "logicalSelectionStart" }] : /* istanbul ignore next */ []);
343
+ this.messages = this.#i18n.componentMessages("otpInput", OTP_INPUT_DEFAULT_MESSAGES);
344
+ this.nativeInputType = computed(() => this.type() === "password" ? "password" : "text", ...ngDevMode ? [{ debugName: "nativeInputType" }] : /* istanbul ignore next */ []);
345
+ this.normalizedLength = computed(() => normalizeLength(this.length()), ...ngDevMode ? [{ debugName: "normalizedLength" }] : /* istanbul ignore next */ []);
346
+ this.resolvedId = computed(() => {
347
+ const id = this.inputId();
348
+ if (id !== this.#generatedId) return id;
349
+ const attribute = findUsableAttribute(this.inputAttributes(), "id");
350
+ return attribute != null ? String(attribute) : id;
351
+ }, ...ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []);
352
+ this.sanitizedAttributes = computed(() => sanitizeInputAttributes(this.inputAttributes()), ...ngDevMode ? [{ debugName: "sanitizedAttributes" }] : /* istanbul ignore next */ []);
353
+ this.selectionEnd = signal(0, ...ngDevMode ? [{ debugName: "selectionEnd" }] : /* istanbul ignore next */ []);
354
+ this.selectionStart = signal(0, ...ngDevMode ? [{ debugName: "selectionStart" }] : /* istanbul ignore next */ []);
355
+ this.separatorTemplate = contentChild(OtpInputSeparatorTemplateDirective, {
356
+ ...ngDevMode ? { debugName: "separatorTemplate" } : /* istanbul ignore next */ {},
357
+ read: TemplateRef
358
+ });
359
+ this.visualGroups = computed(() => {
360
+ const totalLen = this.normalizedLength();
361
+ const groupSizes = normalizeGroupLengths(this.groupLength(), totalLen);
362
+ const val = this.value();
363
+ const activeIndex = this.activeSlotIndex();
364
+ const selStart = this.logicalSelectionStart();
365
+ const selEnd = this.logicalSelectionEnd();
366
+ const focused = this.hasFocus();
367
+ const inputType = this.type();
368
+ const placeholderStr = this.placeholder();
369
+ const placeholderChar = placeholderStr.length > 0 ? placeholderStr.charAt(0) : "";
370
+ const rounded = this.rounded();
371
+ const size = this.size();
372
+ const slotClass = this.slotClass();
373
+ const spacing = this.spacing();
374
+ const groups = [];
375
+ let slotCounter = 0;
376
+ for (let gIndex = 0; gIndex < groupSizes.length; gIndex++) {
377
+ const groupSize = groupSizes[gIndex];
378
+ const slots = [];
379
+ for (let s = 0; s < groupSize; s++) {
380
+ const slotIndex = slotCounter++;
381
+ const filled = slotIndex < val.length;
382
+ const character = filled ? val[slotIndex] : "";
383
+ const isPlaceholder = !filled && placeholderChar.length > 0;
384
+ let displayCharacter = "";
385
+ if (filled) displayCharacter = inputType === "password" ? "•" : character;
386
+ else if (isPlaceholder) displayCharacter = placeholderChar;
387
+ const active = focused && slotIndex === activeIndex;
388
+ const selected = focused && slotIndex >= selStart && slotIndex < selEnd;
389
+ const classes = computeSlotClasses({
390
+ firstSlot: s === 0,
391
+ groupSize,
392
+ lastSlot: s === groupSize - 1,
393
+ rounded,
394
+ size,
395
+ slotClass,
396
+ spacing
397
+ });
398
+ slots.push({
399
+ active,
400
+ classes,
401
+ displayCharacter,
402
+ filled,
403
+ index: slotIndex,
404
+ placeholder: isPlaceholder,
405
+ selected
406
+ });
407
+ }
408
+ groups.push({
409
+ index: gIndex,
410
+ slots
411
+ });
412
+ }
413
+ return groups;
414
+ }, ...ngDevMode ? [{ debugName: "visualGroups" }] : /* istanbul ignore next */ []);
415
+ this.ariaDescribedBy = input(null, {
416
+ ...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
417
+ alias: "aria-describedby"
418
+ });
419
+ this.ariaLabel = input(null, {
420
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
421
+ alias: "aria-label"
422
+ });
423
+ this.ariaLabelledBy = input(null, {
424
+ ...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
425
+ alias: "aria-labelledby"
426
+ });
427
+ this.characterPattern = input(null, ...ngDevMode ? [{ debugName: "characterPattern" }] : /* istanbul ignore next */ []);
428
+ this.complete = output();
429
+ this.disabled = input(false, {
430
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
431
+ transform: booleanAttribute
432
+ });
433
+ this.groupLength = input(null, ...ngDevMode ? [{ debugName: "groupLength" }] : /* istanbul ignore next */ []);
434
+ this.inputAttributes = input({}, ...ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []);
435
+ this.inputBlur = output();
436
+ this.inputFocus = output();
437
+ this.inputId = input(this.#generatedId, ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
438
+ this.invalid = input(false, {
439
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
440
+ transform: booleanAttribute
441
+ });
442
+ this.length = input(4, ...ngDevMode ? [{ debugName: "length" }] : /* istanbul ignore next */ []);
443
+ this.name = input("", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
444
+ this.placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
445
+ this.readonly = input(false, {
446
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
447
+ transform: booleanAttribute
448
+ });
449
+ this.required = input(false, {
450
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
451
+ transform: booleanAttribute
452
+ });
453
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
454
+ this.separator = input("", ...ngDevMode ? [{ debugName: "separator" }] : /* istanbul ignore next */ []);
455
+ this.separatorClass = input("", ...ngDevMode ? [{ debugName: "separatorClass" }] : /* istanbul ignore next */ []);
456
+ this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
457
+ this.slotClass = input("", ...ngDevMode ? [{ debugName: "slotClass" }] : /* istanbul ignore next */ []);
458
+ this.spacing = input(true, {
459
+ ...ngDevMode ? { debugName: "spacing" } : /* istanbul ignore next */ {},
460
+ transform: booleanAttribute
461
+ });
462
+ this.tabindex = input(0, {
463
+ ...ngDevMode ? { debugName: "tabindex" } : /* istanbul ignore next */ {},
464
+ transform: (value) => numberAttribute(value, 0)
465
+ });
466
+ this.touch = output();
467
+ this.touched = input(false, {
468
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
469
+ transform: booleanAttribute
470
+ });
471
+ this.type = input("text", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
472
+ this.userClass = input("", {
473
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
474
+ alias: "class"
475
+ });
476
+ this.value = model("", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
477
+ afterNextRender(() => {
478
+ this.#hasNativeLabel.set((this.inputRef().nativeElement.labels?.length ?? 0) > 0);
479
+ });
480
+ effect(() => {
481
+ const val = this.value();
482
+ const filtered = filterCharacters(val, this.type(), this.characterPattern(), this.normalizedLength());
483
+ if (filtered !== val) this.value.set(filtered);
484
+ });
485
+ }
486
+ blur() {
487
+ this.inputRef().nativeElement.blur();
488
+ }
489
+ focus(target) {
490
+ if (this.effectiveDisabled()) return;
491
+ const el = this.inputRef().nativeElement;
492
+ if (typeof target === "object" && target !== null) {
493
+ el.focus(target);
494
+ this.syncSelection();
495
+ return;
496
+ }
497
+ el.focus();
498
+ const val = this.value();
499
+ const maxLen = this.normalizedLength();
500
+ if (typeof target === "number") {
501
+ const clamped = Math.max(0, Math.min(target, maxLen));
502
+ if (clamped < val.length) el.setSelectionRange(clamped, clamped + 1);
503
+ else {
504
+ const pos = Math.min(clamped, val.length);
505
+ el.setSelectionRange(pos, pos);
506
+ }
507
+ } else if (val.length < maxLen) el.setSelectionRange(val.length, val.length);
508
+ else el.setSelectionRange(maxLen, maxLen);
509
+ this.syncSelection();
510
+ }
511
+ setLabelledBy(id) {
512
+ this.#label.setLabelledBy(id);
513
+ }
514
+ onBeforeInput(event) {
515
+ if (this.effectiveDisabled() || this.readonly()) {
516
+ event.preventDefault();
517
+ return;
518
+ }
519
+ if (this.isComposing() || event.isComposing) return;
520
+ const inputType = event.inputType;
521
+ const inputEl = this.inputRef().nativeElement;
522
+ const start = inputEl.selectionStart ?? 0;
523
+ const end = inputEl.selectionEnd ?? 0;
524
+ const val = this.value();
525
+ const maxLen = this.normalizedLength();
526
+ if (inputType === "insertText") {
527
+ if (!event.data) return;
528
+ if (event.data.length === 1) {
529
+ const accepted = acceptCharacter(event.data, this.type(), this.characterPattern());
530
+ if (accepted === null) {
531
+ event.preventDefault();
532
+ return;
533
+ }
534
+ if (start >= maxLen && start === end) {
535
+ event.preventDefault();
536
+ return;
537
+ }
538
+ const overwrites = start === end && start < val.length;
539
+ if (accepted !== event.data) {
540
+ event.preventDefault();
541
+ this.applyUserInsertion(accepted, start, overwrites ? start + 1 : end);
542
+ return;
543
+ }
544
+ if (overwrites) inputEl.setSelectionRange(start, start + 1);
545
+ } else {
546
+ event.preventDefault();
547
+ this.applyUserInsertion(event.data, start, end);
548
+ }
549
+ } else if (inputType === "insertReplacementText" || inputType === "insertFromPaste") {
550
+ if (event.data) {
551
+ event.preventDefault();
552
+ this.applyUserInsertion(event.data, start, end);
553
+ }
554
+ }
555
+ }
556
+ onBlur(event) {
557
+ this.hasFocus.set(false);
558
+ this.inputBlur.emit(event);
559
+ this.touch.emit();
560
+ }
561
+ onCompositionEnd(event) {
562
+ this.isComposing.set(false);
563
+ this.onInput(event);
564
+ }
565
+ onCompositionStart() {
566
+ this.isComposing.set(true);
567
+ }
568
+ onFocus(event) {
569
+ this.hasFocus.set(true);
570
+ this.syncSelection();
571
+ this.inputFocus.emit(event);
572
+ }
573
+ onInput(_event) {
574
+ if (this.effectiveDisabled() || this.readonly()) {
575
+ const inputEl = this.inputRef().nativeElement;
576
+ inputEl.value = this.value();
577
+ return;
578
+ }
579
+ if (this.isComposing()) return;
580
+ const inputEl = this.inputRef().nativeElement;
581
+ const rawVal = inputEl.value;
582
+ const prevVal = this.value();
583
+ const nextVal = filterCharacters(rawVal, this.type(), this.characterPattern(), this.normalizedLength());
584
+ inputEl.value = nextVal;
585
+ const wasIncomplete = prevVal.length < this.normalizedLength();
586
+ this.value.set(nextVal);
587
+ if (wasIncomplete && nextVal.length === this.normalizedLength()) this.complete.emit(nextVal);
588
+ this.syncSelection();
589
+ }
590
+ onInputClick(event) {
591
+ if (this.#touchPress && !this.effectiveDisabled()) this.focus(this.#slotIndexAt(event.clientX));
592
+ }
593
+ onInputMouseDown(event) {
594
+ if (this.#touchPress || this.effectiveDisabled() || event.button !== 0 || event.ctrlKey) return;
595
+ event.preventDefault();
596
+ this.focus(this.#slotIndexAt(event.clientX));
597
+ }
598
+ onInputPointerDown(event) {
599
+ this.#touchPress = event.pointerType === "touch" || event.pointerType === "pen";
600
+ }
601
+ onKeyDown(event) {
602
+ if (this.effectiveDisabled() || this.readonly() || this.isComposing() || event.isComposing) return;
603
+ if (event.ctrlKey || event.metaKey || event.altKey) return;
604
+ if (event.key.length !== 1) return;
605
+ const inputEl = this.inputRef().nativeElement;
606
+ const start = inputEl.selectionStart ?? 0;
607
+ const end = inputEl.selectionEnd ?? 0;
608
+ const val = this.value();
609
+ const maxLen = this.normalizedLength();
610
+ if (acceptCharacter(event.key, this.type(), this.characterPattern()) === null) {
611
+ event.preventDefault();
612
+ return;
613
+ }
614
+ if (start >= maxLen && start === end) {
615
+ event.preventDefault();
616
+ return;
617
+ }
618
+ if (start === end && start < val.length) inputEl.setSelectionRange(start, start + 1);
619
+ }
620
+ onKeyUp() {
621
+ this.syncSelection();
622
+ }
623
+ onPaste(event) {
624
+ if (this.effectiveDisabled() || this.readonly()) {
625
+ event.preventDefault();
626
+ return;
627
+ }
628
+ const pastedText = event.clipboardData?.getData("text") ?? "";
629
+ if (!pastedText) return;
630
+ event.preventDefault();
631
+ const inputEl = this.inputRef().nativeElement;
632
+ const start = inputEl.selectionStart ?? 0;
633
+ const end = inputEl.selectionEnd ?? 0;
634
+ this.applyUserInsertion(pastedText, start, end);
635
+ }
636
+ onSelect() {
637
+ this.syncSelection();
638
+ }
639
+ applyUserInsertion(text, selectionStart, selectionEnd) {
640
+ if (this.effectiveDisabled() || this.readonly()) return;
641
+ const inputEl = this.inputRef().nativeElement;
642
+ const currentVal = this.value();
643
+ const maxLen = this.normalizedLength();
644
+ const filtered = filterCharacters(text, this.type(), this.characterPattern(), Number.MAX_SAFE_INTEGER);
645
+ if (filtered.length === 0 && selectionStart === selectionEnd) return;
646
+ const replacesAll = filtered.length >= maxLen;
647
+ const start = replacesAll ? 0 : Math.max(0, Math.min(selectionStart, currentVal.length));
648
+ const end = replacesAll ? currentVal.length : Math.max(start, Math.min(selectionEnd, currentVal.length));
649
+ const before = currentVal.substring(0, start);
650
+ const after = currentVal.substring(end);
651
+ let combined = before + filtered + after;
652
+ if (combined.length > maxLen) combined = combined.substring(0, maxLen);
653
+ const newCaretPos = Math.min(start + filtered.length, maxLen);
654
+ inputEl.value = combined;
655
+ this.value.set(combined);
656
+ inputEl.setSelectionRange(newCaretPos, newCaretPos);
657
+ this.selectionStart.set(newCaretPos);
658
+ this.selectionEnd.set(newCaretPos);
659
+ if (combined !== currentVal && combined.length === maxLen) this.complete.emit(combined);
660
+ }
661
+ #slotIndexAt(clientX) {
662
+ const slots = this.#hostElementRef.nativeElement.querySelectorAll("[data-slot-index]");
663
+ let closest = 0;
664
+ let closestDistance = Number.POSITIVE_INFINITY;
665
+ slots.forEach((slot, index) => {
666
+ const { left, right } = slot.getBoundingClientRect();
667
+ const distance = clientX < left ? left - clientX : Math.max(0, clientX - right);
668
+ if (distance < closestDistance) {
669
+ closest = index;
670
+ closestDistance = distance;
671
+ }
672
+ });
673
+ return closest;
674
+ }
675
+ syncSelection() {
676
+ const el = this.inputRef().nativeElement;
677
+ this.selectionStart.set(el.selectionStart ?? 0);
678
+ this.selectionEnd.set(el.selectionEnd ?? 0);
679
+ }
680
+ static {
681
+ this.ɵfac = i0.ɵɵngDeclareFactory({
682
+ minVersion: "12.0.0",
683
+ version: "22.2.6",
684
+ ngImport: i0,
685
+ type: OtpInputComponent,
686
+ deps: [],
687
+ target: i0.ɵɵFactoryTarget.Component
688
+ });
689
+ }
690
+ static {
691
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
692
+ minVersion: "17.0.0",
693
+ version: "22.2.6",
694
+ type: OtpInputComponent,
695
+ isStandalone: true,
696
+ selector: "mona-otp-input",
697
+ inputs: {
698
+ ariaDescribedBy: {
699
+ classPropertyName: "ariaDescribedBy",
700
+ publicName: "aria-describedby",
701
+ isSignal: true,
702
+ isRequired: false,
703
+ transformFunction: null
704
+ },
705
+ ariaLabel: {
706
+ classPropertyName: "ariaLabel",
707
+ publicName: "aria-label",
708
+ isSignal: true,
709
+ isRequired: false,
710
+ transformFunction: null
711
+ },
712
+ ariaLabelledBy: {
713
+ classPropertyName: "ariaLabelledBy",
714
+ publicName: "aria-labelledby",
715
+ isSignal: true,
716
+ isRequired: false,
717
+ transformFunction: null
718
+ },
719
+ characterPattern: {
720
+ classPropertyName: "characterPattern",
721
+ publicName: "characterPattern",
722
+ isSignal: true,
723
+ isRequired: false,
724
+ transformFunction: null
725
+ },
726
+ disabled: {
727
+ classPropertyName: "disabled",
728
+ publicName: "disabled",
729
+ isSignal: true,
730
+ isRequired: false,
731
+ transformFunction: null
732
+ },
733
+ groupLength: {
734
+ classPropertyName: "groupLength",
735
+ publicName: "groupLength",
736
+ isSignal: true,
737
+ isRequired: false,
738
+ transformFunction: null
739
+ },
740
+ inputAttributes: {
741
+ classPropertyName: "inputAttributes",
742
+ publicName: "inputAttributes",
743
+ isSignal: true,
744
+ isRequired: false,
745
+ transformFunction: null
746
+ },
747
+ inputId: {
748
+ classPropertyName: "inputId",
749
+ publicName: "inputId",
750
+ isSignal: true,
751
+ isRequired: false,
752
+ transformFunction: null
753
+ },
754
+ invalid: {
755
+ classPropertyName: "invalid",
756
+ publicName: "invalid",
757
+ isSignal: true,
758
+ isRequired: false,
759
+ transformFunction: null
760
+ },
761
+ length: {
762
+ classPropertyName: "length",
763
+ publicName: "length",
764
+ isSignal: true,
765
+ isRequired: false,
766
+ transformFunction: null
767
+ },
768
+ name: {
769
+ classPropertyName: "name",
770
+ publicName: "name",
771
+ isSignal: true,
772
+ isRequired: false,
773
+ transformFunction: null
774
+ },
775
+ placeholder: {
776
+ classPropertyName: "placeholder",
777
+ publicName: "placeholder",
778
+ isSignal: true,
779
+ isRequired: false,
780
+ transformFunction: null
781
+ },
782
+ readonly: {
783
+ classPropertyName: "readonly",
784
+ publicName: "readonly",
785
+ isSignal: true,
786
+ isRequired: false,
787
+ transformFunction: null
788
+ },
789
+ required: {
790
+ classPropertyName: "required",
791
+ publicName: "required",
792
+ isSignal: true,
793
+ isRequired: false,
794
+ transformFunction: null
795
+ },
796
+ rounded: {
797
+ classPropertyName: "rounded",
798
+ publicName: "rounded",
799
+ isSignal: true,
800
+ isRequired: false,
801
+ transformFunction: null
802
+ },
803
+ separator: {
804
+ classPropertyName: "separator",
805
+ publicName: "separator",
806
+ isSignal: true,
807
+ isRequired: false,
808
+ transformFunction: null
809
+ },
810
+ separatorClass: {
811
+ classPropertyName: "separatorClass",
812
+ publicName: "separatorClass",
813
+ isSignal: true,
814
+ isRequired: false,
815
+ transformFunction: null
816
+ },
817
+ size: {
818
+ classPropertyName: "size",
819
+ publicName: "size",
820
+ isSignal: true,
821
+ isRequired: false,
822
+ transformFunction: null
823
+ },
824
+ slotClass: {
825
+ classPropertyName: "slotClass",
826
+ publicName: "slotClass",
827
+ isSignal: true,
828
+ isRequired: false,
829
+ transformFunction: null
830
+ },
831
+ spacing: {
832
+ classPropertyName: "spacing",
833
+ publicName: "spacing",
834
+ isSignal: true,
835
+ isRequired: false,
836
+ transformFunction: null
837
+ },
838
+ tabindex: {
839
+ classPropertyName: "tabindex",
840
+ publicName: "tabindex",
841
+ isSignal: true,
842
+ isRequired: false,
843
+ transformFunction: null
844
+ },
845
+ touched: {
846
+ classPropertyName: "touched",
847
+ publicName: "touched",
848
+ isSignal: true,
849
+ isRequired: false,
850
+ transformFunction: null
851
+ },
852
+ type: {
853
+ classPropertyName: "type",
854
+ publicName: "type",
855
+ isSignal: true,
856
+ isRequired: false,
857
+ transformFunction: null
858
+ },
859
+ userClass: {
860
+ classPropertyName: "userClass",
861
+ publicName: "class",
862
+ isSignal: true,
863
+ isRequired: false,
864
+ transformFunction: null
865
+ },
866
+ value: {
867
+ classPropertyName: "value",
868
+ publicName: "value",
869
+ isSignal: true,
870
+ isRequired: false,
871
+ transformFunction: null
872
+ }
873
+ },
874
+ outputs: {
875
+ complete: "complete",
876
+ inputBlur: "inputBlur",
877
+ inputFocus: "inputFocus",
878
+ touch: "touch",
879
+ value: "valueChange"
880
+ },
881
+ host: { properties: {
882
+ "attr.aria-describedby": "null",
883
+ "attr.aria-label": "null",
884
+ "attr.aria-labelledby": "null",
885
+ "attr.tabindex": "null",
886
+ "attr.dir": "'ltr'",
887
+ "attr.data-disabled": "effectiveDisabled() || null",
888
+ "attr.data-readonly": "readonly() || null",
889
+ "attr.data-required": "required() || null",
890
+ "attr.data-invalid": "invalidState() || null",
891
+ "attr.data-complete": "isComplete() || null",
892
+ "attr.data-focused": "hasFocus() || null",
893
+ "class": "classes()"
894
+ } },
895
+ queries: [{
896
+ propertyName: "separatorTemplate",
897
+ first: true,
898
+ predicate: OtpInputSeparatorTemplateDirective,
899
+ descendants: true,
900
+ read: TemplateRef,
901
+ isSignal: true
902
+ }],
903
+ viewQueries: [{
904
+ propertyName: "inputRef",
905
+ first: true,
906
+ predicate: ["input"],
907
+ descendants: true,
908
+ isSignal: true
909
+ }],
910
+ ngImport: i0,
911
+ template: "<input\n #input\n [class]=\"inputClass()\"\n [id]=\"resolvedId()\"\n [attr.tabindex]=\"tabindex()\"\n [value]=\"value()\"\n [disabled]=\"effectiveDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [type]=\"nativeInputType()\"\n [attr.inputmode]=\"derivedInputMode()\"\n [attr.autocomplete]=\"derivedAutocomplete()\"\n [attr.autocapitalize]=\"'off'\"\n [attr.spellcheck]=\"'false'\"\n [attr.aria-label]=\"computedAriaLabel()\"\n [attr.aria-labelledby]=\"computedAriaLabelledby()\"\n [attr.aria-describedby]=\"computedAriaDescribedby()\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.maxlength]=\"normalizedLength()\"\n [attr.name]=\"derivedName()\"\n [monaAttributeBinder]=\"sanitizedAttributes()\"\n (beforeinput)=\"onBeforeInput($event)\"\n (keydown)=\"onKeyDown($event)\"\n (input)=\"onInput($event)\"\n (paste)=\"onPaste($event)\"\n (click)=\"onInputClick($event)\"\n (mousedown)=\"onInputMouseDown($event)\"\n (pointerdown)=\"onInputPointerDown($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n (select)=\"onSelect()\"\n (selectionchange)=\"onSelect()\"\n (keyup)=\"onKeyUp()\"\n (compositionstart)=\"onCompositionStart()\"\n (compositionend)=\"onCompositionEnd($event)\" />\n\n@for (group of visualGroups(); track group.index; let lastGroup = $last) {\n <div\n class=\"inline-flex items-center\"\n [class.gap-1.5]=\"spacing()\"\n [class]=\"!spacing() ? '[&>*:not(:first-child)]:-ms-px' : ''\"\n [attr.data-group-index]=\"group.index\">\n @for (slot of group.slots; track slot.index) {\n <span\n class=\"otp-slot\"\n [class]=\"slot.classes\"\n [attr.data-slot-index]=\"slot.index\"\n [attr.data-active]=\"slot.active || null\"\n [attr.data-selected]=\"slot.selected || null\"\n [attr.data-filled]=\"slot.filled || null\"\n [attr.data-placeholder]=\"slot.placeholder || null\"\n [attr.data-disabled]=\"effectiveDisabled() || null\"\n [attr.data-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n aria-hidden=\"true\">\n {{ slot.displayCharacter }}\n @if (slot.active && !slot.filled && hasFocus() && !effectiveDisabled() && !readonly()) {\n <span\n class=\"pointer-events-none absolute inset-y-2 w-0.5 animate-pulse motion-reduce:animate-none bg-foreground\"\n aria-hidden=\"true\"></span>\n }\n </span>\n }\n </div>\n\n @if (!lastGroup && (separator() || separatorTemplate())) {\n <span\n class=\"inline-flex items-center justify-center text-muted-foreground select-none px-1\"\n [class]=\"separatorClass()\"\n aria-hidden=\"true\">\n @if (separatorTemplate(); as customTemplate) {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplate;\n context: { $implicit: group.index, groupIndex: group.index }\n \"></ng-container>\n } @else {\n {{ separator() }}\n }\n </span>\n }\n}\n",
912
+ dependencies: [{
913
+ kind: "directive",
914
+ type: NgTemplateOutlet,
915
+ selector: "[ngTemplateOutlet]",
916
+ inputs: [
917
+ "ngTemplateOutletContext",
918
+ "ngTemplateOutlet",
919
+ "ngTemplateOutletInjector"
920
+ ]
921
+ }, {
922
+ kind: "directive",
923
+ type: AttributeBinderDirective,
924
+ selector: "[monaAttributeBinder]",
925
+ inputs: ["monaAttributeBinder"]
926
+ }]
927
+ });
928
+ }
929
+ };
930
+ i0.ɵɵngDeclareClassMetadata({
931
+ minVersion: "12.0.0",
932
+ version: "22.2.6",
933
+ ngImport: i0,
934
+ type: OtpInputComponent,
935
+ decorators: [{
936
+ type: Component,
937
+ args: [{
938
+ selector: "mona-otp-input",
939
+ imports: [NgTemplateOutlet, AttributeBinderDirective],
940
+ host: {
941
+ "[attr.aria-describedby]": "null",
942
+ "[attr.aria-label]": "null",
943
+ "[attr.aria-labelledby]": "null",
944
+ "[attr.tabindex]": "null",
945
+ "[attr.dir]": "'ltr'",
946
+ "[attr.data-disabled]": "effectiveDisabled() || null",
947
+ "[attr.data-readonly]": "readonly() || null",
948
+ "[attr.data-required]": "required() || null",
949
+ "[attr.data-invalid]": "invalidState() || null",
950
+ "[attr.data-complete]": "isComplete() || null",
951
+ "[attr.data-focused]": "hasFocus() || null",
952
+ "[class]": "classes()"
953
+ },
954
+ template: "<input\n #input\n [class]=\"inputClass()\"\n [id]=\"resolvedId()\"\n [attr.tabindex]=\"tabindex()\"\n [value]=\"value()\"\n [disabled]=\"effectiveDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [type]=\"nativeInputType()\"\n [attr.inputmode]=\"derivedInputMode()\"\n [attr.autocomplete]=\"derivedAutocomplete()\"\n [attr.autocapitalize]=\"'off'\"\n [attr.spellcheck]=\"'false'\"\n [attr.aria-label]=\"computedAriaLabel()\"\n [attr.aria-labelledby]=\"computedAriaLabelledby()\"\n [attr.aria-describedby]=\"computedAriaDescribedby()\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.maxlength]=\"normalizedLength()\"\n [attr.name]=\"derivedName()\"\n [monaAttributeBinder]=\"sanitizedAttributes()\"\n (beforeinput)=\"onBeforeInput($event)\"\n (keydown)=\"onKeyDown($event)\"\n (input)=\"onInput($event)\"\n (paste)=\"onPaste($event)\"\n (click)=\"onInputClick($event)\"\n (mousedown)=\"onInputMouseDown($event)\"\n (pointerdown)=\"onInputPointerDown($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n (select)=\"onSelect()\"\n (selectionchange)=\"onSelect()\"\n (keyup)=\"onKeyUp()\"\n (compositionstart)=\"onCompositionStart()\"\n (compositionend)=\"onCompositionEnd($event)\" />\n\n@for (group of visualGroups(); track group.index; let lastGroup = $last) {\n <div\n class=\"inline-flex items-center\"\n [class.gap-1.5]=\"spacing()\"\n [class]=\"!spacing() ? '[&>*:not(:first-child)]:-ms-px' : ''\"\n [attr.data-group-index]=\"group.index\">\n @for (slot of group.slots; track slot.index) {\n <span\n class=\"otp-slot\"\n [class]=\"slot.classes\"\n [attr.data-slot-index]=\"slot.index\"\n [attr.data-active]=\"slot.active || null\"\n [attr.data-selected]=\"slot.selected || null\"\n [attr.data-filled]=\"slot.filled || null\"\n [attr.data-placeholder]=\"slot.placeholder || null\"\n [attr.data-disabled]=\"effectiveDisabled() || null\"\n [attr.data-readonly]=\"readonly() || null\"\n [attr.data-invalid]=\"invalidState() || null\"\n aria-hidden=\"true\">\n {{ slot.displayCharacter }}\n @if (slot.active && !slot.filled && hasFocus() && !effectiveDisabled() && !readonly()) {\n <span\n class=\"pointer-events-none absolute inset-y-2 w-0.5 animate-pulse motion-reduce:animate-none bg-foreground\"\n aria-hidden=\"true\"></span>\n }\n </span>\n }\n </div>\n\n @if (!lastGroup && (separator() || separatorTemplate())) {\n <span\n class=\"inline-flex items-center justify-center text-muted-foreground select-none px-1\"\n [class]=\"separatorClass()\"\n aria-hidden=\"true\">\n @if (separatorTemplate(); as customTemplate) {\n <ng-container\n *ngTemplateOutlet=\"\n customTemplate;\n context: { $implicit: group.index, groupIndex: group.index }\n \"></ng-container>\n } @else {\n {{ separator() }}\n }\n </span>\n }\n}\n"
955
+ }]
956
+ }],
957
+ ctorParameters: () => [],
958
+ propDecorators: {
959
+ inputRef: [{
960
+ type: i0.ViewChild,
961
+ args: ["input", { isSignal: true }]
962
+ }],
963
+ separatorTemplate: [{
964
+ type: i0.ContentChild,
965
+ args: [i0.forwardRef(() => OtpInputSeparatorTemplateDirective), {
966
+ read: TemplateRef,
967
+ isSignal: true
968
+ }]
969
+ }],
970
+ ariaDescribedBy: [{
971
+ type: i0.Input,
972
+ args: [{
973
+ isSignal: true,
974
+ alias: "aria-describedby",
975
+ required: false
976
+ }]
977
+ }],
978
+ ariaLabel: [{
979
+ type: i0.Input,
980
+ args: [{
981
+ isSignal: true,
982
+ alias: "aria-label",
983
+ required: false
984
+ }]
985
+ }],
986
+ ariaLabelledBy: [{
987
+ type: i0.Input,
988
+ args: [{
989
+ isSignal: true,
990
+ alias: "aria-labelledby",
991
+ required: false
992
+ }]
993
+ }],
994
+ characterPattern: [{
995
+ type: i0.Input,
996
+ args: [{
997
+ isSignal: true,
998
+ alias: "characterPattern",
999
+ required: false
1000
+ }]
1001
+ }],
1002
+ complete: [{
1003
+ type: i0.Output,
1004
+ args: ["complete"]
1005
+ }],
1006
+ disabled: [{
1007
+ type: i0.Input,
1008
+ args: [{
1009
+ isSignal: true,
1010
+ alias: "disabled",
1011
+ required: false
1012
+ }]
1013
+ }],
1014
+ groupLength: [{
1015
+ type: i0.Input,
1016
+ args: [{
1017
+ isSignal: true,
1018
+ alias: "groupLength",
1019
+ required: false
1020
+ }]
1021
+ }],
1022
+ inputAttributes: [{
1023
+ type: i0.Input,
1024
+ args: [{
1025
+ isSignal: true,
1026
+ alias: "inputAttributes",
1027
+ required: false
1028
+ }]
1029
+ }],
1030
+ inputBlur: [{
1031
+ type: i0.Output,
1032
+ args: ["inputBlur"]
1033
+ }],
1034
+ inputFocus: [{
1035
+ type: i0.Output,
1036
+ args: ["inputFocus"]
1037
+ }],
1038
+ inputId: [{
1039
+ type: i0.Input,
1040
+ args: [{
1041
+ isSignal: true,
1042
+ alias: "inputId",
1043
+ required: false
1044
+ }]
1045
+ }],
1046
+ invalid: [{
1047
+ type: i0.Input,
1048
+ args: [{
1049
+ isSignal: true,
1050
+ alias: "invalid",
1051
+ required: false
1052
+ }]
1053
+ }],
1054
+ length: [{
1055
+ type: i0.Input,
1056
+ args: [{
1057
+ isSignal: true,
1058
+ alias: "length",
1059
+ required: false
1060
+ }]
1061
+ }],
1062
+ name: [{
1063
+ type: i0.Input,
1064
+ args: [{
1065
+ isSignal: true,
1066
+ alias: "name",
1067
+ required: false
1068
+ }]
1069
+ }],
1070
+ placeholder: [{
1071
+ type: i0.Input,
1072
+ args: [{
1073
+ isSignal: true,
1074
+ alias: "placeholder",
1075
+ required: false
1076
+ }]
1077
+ }],
1078
+ readonly: [{
1079
+ type: i0.Input,
1080
+ args: [{
1081
+ isSignal: true,
1082
+ alias: "readonly",
1083
+ required: false
1084
+ }]
1085
+ }],
1086
+ required: [{
1087
+ type: i0.Input,
1088
+ args: [{
1089
+ isSignal: true,
1090
+ alias: "required",
1091
+ required: false
1092
+ }]
1093
+ }],
1094
+ rounded: [{
1095
+ type: i0.Input,
1096
+ args: [{
1097
+ isSignal: true,
1098
+ alias: "rounded",
1099
+ required: false
1100
+ }]
1101
+ }],
1102
+ separator: [{
1103
+ type: i0.Input,
1104
+ args: [{
1105
+ isSignal: true,
1106
+ alias: "separator",
1107
+ required: false
1108
+ }]
1109
+ }],
1110
+ separatorClass: [{
1111
+ type: i0.Input,
1112
+ args: [{
1113
+ isSignal: true,
1114
+ alias: "separatorClass",
1115
+ required: false
1116
+ }]
1117
+ }],
1118
+ size: [{
1119
+ type: i0.Input,
1120
+ args: [{
1121
+ isSignal: true,
1122
+ alias: "size",
1123
+ required: false
1124
+ }]
1125
+ }],
1126
+ slotClass: [{
1127
+ type: i0.Input,
1128
+ args: [{
1129
+ isSignal: true,
1130
+ alias: "slotClass",
1131
+ required: false
1132
+ }]
1133
+ }],
1134
+ spacing: [{
1135
+ type: i0.Input,
1136
+ args: [{
1137
+ isSignal: true,
1138
+ alias: "spacing",
1139
+ required: false
1140
+ }]
1141
+ }],
1142
+ tabindex: [{
1143
+ type: i0.Input,
1144
+ args: [{
1145
+ isSignal: true,
1146
+ alias: "tabindex",
1147
+ required: false
1148
+ }]
1149
+ }],
1150
+ touch: [{
1151
+ type: i0.Output,
1152
+ args: ["touch"]
1153
+ }],
1154
+ touched: [{
1155
+ type: i0.Input,
1156
+ args: [{
1157
+ isSignal: true,
1158
+ alias: "touched",
1159
+ required: false
1160
+ }]
1161
+ }],
1162
+ type: [{
1163
+ type: i0.Input,
1164
+ args: [{
1165
+ isSignal: true,
1166
+ alias: "type",
1167
+ required: false
1168
+ }]
1169
+ }],
1170
+ userClass: [{
1171
+ type: i0.Input,
1172
+ args: [{
1173
+ isSignal: true,
1174
+ alias: "class",
1175
+ required: false
1176
+ }]
1177
+ }],
1178
+ value: [{
1179
+ type: i0.Input,
1180
+ args: [{
1181
+ isSignal: true,
1182
+ alias: "value",
1183
+ required: false
1184
+ }]
1185
+ }, {
1186
+ type: i0.Output,
1187
+ args: ["valueChange"]
1188
+ }]
1189
+ }
1190
+ });
967
1191
  export { OTP_INPUT_DEFAULT_MESSAGES, OtpInputComponent, OtpInputSeparatorTemplateDirective };
968
- //# sourceMappingURL=nanahoshi-mona-ui-otp-input.mjs.map
1192
+
1193
+ //# sourceMappingURL=nanahoshi-mona-ui-otp-input.mjs.map