@loomui-ng/ui 0.0.0-stage → 0.1.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 (270) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +46 -2
  3. package/accordion/README.md +38 -0
  4. package/alert/README.md +32 -0
  5. package/alert-dialog/README.md +37 -0
  6. package/aspect-ratio/README.md +24 -0
  7. package/attachment/README.md +40 -0
  8. package/avatar/README.md +34 -0
  9. package/badge/README.md +29 -0
  10. package/breadcrumb/README.md +33 -0
  11. package/bubble/README.md +32 -0
  12. package/button/README.md +31 -0
  13. package/button-group/README.md +30 -0
  14. package/calendar/README.md +35 -0
  15. package/card/README.md +41 -0
  16. package/carousel/README.md +41 -0
  17. package/chart/README.md +25 -0
  18. package/checkbox/README.md +31 -0
  19. package/collapsible/README.md +31 -0
  20. package/combobox/README.md +47 -0
  21. package/command/README.md +44 -0
  22. package/context-menu/README.md +36 -0
  23. package/data-table/README.md +39 -0
  24. package/date-picker/README.md +23 -0
  25. package/dialog/README.md +52 -0
  26. package/direction/README.md +19 -0
  27. package/drawer/README.md +37 -0
  28. package/dropdown-menu/README.md +46 -0
  29. package/empty/README.md +38 -0
  30. package/fesm2022/loomui-ng-ui-accordion.mjs +555 -0
  31. package/fesm2022/loomui-ng-ui-accordion.mjs.map +1 -0
  32. package/fesm2022/loomui-ng-ui-alert-dialog.mjs +652 -0
  33. package/fesm2022/loomui-ng-ui-alert-dialog.mjs.map +1 -0
  34. package/fesm2022/loomui-ng-ui-alert.mjs +286 -0
  35. package/fesm2022/loomui-ng-ui-alert.mjs.map +1 -0
  36. package/fesm2022/loomui-ng-ui-aspect-ratio.mjs +97 -0
  37. package/fesm2022/loomui-ng-ui-aspect-ratio.mjs.map +1 -0
  38. package/fesm2022/loomui-ng-ui-attachment.mjs +713 -0
  39. package/fesm2022/loomui-ng-ui-attachment.mjs.map +1 -0
  40. package/fesm2022/loomui-ng-ui-avatar.mjs +561 -0
  41. package/fesm2022/loomui-ng-ui-avatar.mjs.map +1 -0
  42. package/fesm2022/loomui-ng-ui-badge.mjs +102 -0
  43. package/fesm2022/loomui-ng-ui-badge.mjs.map +1 -0
  44. package/fesm2022/loomui-ng-ui-breadcrumb.mjs +520 -0
  45. package/fesm2022/loomui-ng-ui-breadcrumb.mjs.map +1 -0
  46. package/fesm2022/loomui-ng-ui-bubble.mjs +386 -0
  47. package/fesm2022/loomui-ng-ui-bubble.mjs.map +1 -0
  48. package/fesm2022/loomui-ng-ui-button-group.mjs +193 -0
  49. package/fesm2022/loomui-ng-ui-button-group.mjs.map +1 -0
  50. package/fesm2022/loomui-ng-ui-button.mjs +162 -0
  51. package/fesm2022/loomui-ng-ui-button.mjs.map +1 -0
  52. package/fesm2022/loomui-ng-ui-calendar.mjs +681 -0
  53. package/fesm2022/loomui-ng-ui-calendar.mjs.map +1 -0
  54. package/fesm2022/loomui-ng-ui-card.mjs +461 -0
  55. package/fesm2022/loomui-ng-ui-card.mjs.map +1 -0
  56. package/fesm2022/loomui-ng-ui-carousel.mjs +532 -0
  57. package/fesm2022/loomui-ng-ui-carousel.mjs.map +1 -0
  58. package/fesm2022/loomui-ng-ui-chart.mjs +373 -0
  59. package/fesm2022/loomui-ng-ui-chart.mjs.map +1 -0
  60. package/fesm2022/loomui-ng-ui-checkbox.mjs +265 -0
  61. package/fesm2022/loomui-ng-ui-checkbox.mjs.map +1 -0
  62. package/fesm2022/loomui-ng-ui-collapsible.mjs +274 -0
  63. package/fesm2022/loomui-ng-ui-collapsible.mjs.map +1 -0
  64. package/fesm2022/loomui-ng-ui-combobox.mjs +971 -0
  65. package/fesm2022/loomui-ng-ui-combobox.mjs.map +1 -0
  66. package/fesm2022/loomui-ng-ui-command.mjs +982 -0
  67. package/fesm2022/loomui-ng-ui-command.mjs.map +1 -0
  68. package/fesm2022/loomui-ng-ui-context-menu.mjs +1359 -0
  69. package/fesm2022/loomui-ng-ui-context-menu.mjs.map +1 -0
  70. package/fesm2022/loomui-ng-ui-data-table.mjs +535 -0
  71. package/fesm2022/loomui-ng-ui-data-table.mjs.map +1 -0
  72. package/fesm2022/loomui-ng-ui-date-picker.mjs +312 -0
  73. package/fesm2022/loomui-ng-ui-date-picker.mjs.map +1 -0
  74. package/fesm2022/loomui-ng-ui-dialog.mjs +508 -0
  75. package/fesm2022/loomui-ng-ui-dialog.mjs.map +1 -0
  76. package/fesm2022/loomui-ng-ui-direction.mjs +112 -0
  77. package/fesm2022/loomui-ng-ui-direction.mjs.map +1 -0
  78. package/fesm2022/loomui-ng-ui-drawer.mjs +590 -0
  79. package/fesm2022/loomui-ng-ui-drawer.mjs.map +1 -0
  80. package/fesm2022/loomui-ng-ui-dropdown-menu.mjs +1322 -0
  81. package/fesm2022/loomui-ng-ui-dropdown-menu.mjs.map +1 -0
  82. package/fesm2022/loomui-ng-ui-empty.mjs +408 -0
  83. package/fesm2022/loomui-ng-ui-empty.mjs.map +1 -0
  84. package/fesm2022/loomui-ng-ui-field.mjs +630 -0
  85. package/fesm2022/loomui-ng-ui-field.mjs.map +1 -0
  86. package/fesm2022/loomui-ng-ui-hover-card.mjs +230 -0
  87. package/fesm2022/loomui-ng-ui-hover-card.mjs.map +1 -0
  88. package/fesm2022/loomui-ng-ui-icon.mjs +498 -0
  89. package/fesm2022/loomui-ng-ui-icon.mjs.map +1 -0
  90. package/fesm2022/loomui-ng-ui-input-group.mjs +463 -0
  91. package/fesm2022/loomui-ng-ui-input-group.mjs.map +1 -0
  92. package/fesm2022/loomui-ng-ui-input-otp.mjs +586 -0
  93. package/fesm2022/loomui-ng-ui-input-otp.mjs.map +1 -0
  94. package/fesm2022/loomui-ng-ui-input.mjs +289 -0
  95. package/fesm2022/loomui-ng-ui-input.mjs.map +1 -0
  96. package/fesm2022/loomui-ng-ui-item.mjs +598 -0
  97. package/fesm2022/loomui-ng-ui-item.mjs.map +1 -0
  98. package/fesm2022/loomui-ng-ui-kbd.mjs +129 -0
  99. package/fesm2022/loomui-ng-ui-kbd.mjs.map +1 -0
  100. package/fesm2022/loomui-ng-ui-label.mjs +68 -0
  101. package/fesm2022/loomui-ng-ui-label.mjs.map +1 -0
  102. package/fesm2022/loomui-ng-ui-marker.mjs +234 -0
  103. package/fesm2022/loomui-ng-ui-marker.mjs.map +1 -0
  104. package/fesm2022/loomui-ng-ui-menubar.mjs +1523 -0
  105. package/fesm2022/loomui-ng-ui-menubar.mjs.map +1 -0
  106. package/fesm2022/loomui-ng-ui-message-scroller.mjs +519 -0
  107. package/fesm2022/loomui-ng-ui-message-scroller.mjs.map +1 -0
  108. package/fesm2022/loomui-ng-ui-message.mjs +408 -0
  109. package/fesm2022/loomui-ng-ui-message.mjs.map +1 -0
  110. package/fesm2022/loomui-ng-ui-native-select.mjs +389 -0
  111. package/fesm2022/loomui-ng-ui-native-select.mjs.map +1 -0
  112. package/fesm2022/loomui-ng-ui-navigation-menu.mjs +609 -0
  113. package/fesm2022/loomui-ng-ui-navigation-menu.mjs.map +1 -0
  114. package/fesm2022/loomui-ng-ui-pagination.mjs +611 -0
  115. package/fesm2022/loomui-ng-ui-pagination.mjs.map +1 -0
  116. package/fesm2022/loomui-ng-ui-popover.mjs +358 -0
  117. package/fesm2022/loomui-ng-ui-popover.mjs.map +1 -0
  118. package/fesm2022/loomui-ng-ui-progress.mjs +159 -0
  119. package/fesm2022/loomui-ng-ui-progress.mjs.map +1 -0
  120. package/fesm2022/loomui-ng-ui-questionnaire.mjs +1012 -0
  121. package/fesm2022/loomui-ng-ui-questionnaire.mjs.map +1 -0
  122. package/fesm2022/loomui-ng-ui-radio-group.mjs +399 -0
  123. package/fesm2022/loomui-ng-ui-radio-group.mjs.map +1 -0
  124. package/fesm2022/loomui-ng-ui-resizable.mjs +518 -0
  125. package/fesm2022/loomui-ng-ui-resizable.mjs.map +1 -0
  126. package/fesm2022/loomui-ng-ui-scroll-area.mjs +135 -0
  127. package/fesm2022/loomui-ng-ui-scroll-area.mjs.map +1 -0
  128. package/fesm2022/loomui-ng-ui-select.mjs +863 -0
  129. package/fesm2022/loomui-ng-ui-select.mjs.map +1 -0
  130. package/fesm2022/loomui-ng-ui-separator.mjs +114 -0
  131. package/fesm2022/loomui-ng-ui-separator.mjs.map +1 -0
  132. package/fesm2022/loomui-ng-ui-sheet.mjs +530 -0
  133. package/fesm2022/loomui-ng-ui-sheet.mjs.map +1 -0
  134. package/fesm2022/loomui-ng-ui-sidebar.mjs +1918 -0
  135. package/fesm2022/loomui-ng-ui-sidebar.mjs.map +1 -0
  136. package/fesm2022/loomui-ng-ui-skeleton.mjs +69 -0
  137. package/fesm2022/loomui-ng-ui-skeleton.mjs.map +1 -0
  138. package/fesm2022/loomui-ng-ui-slider.mjs +390 -0
  139. package/fesm2022/loomui-ng-ui-slider.mjs.map +1 -0
  140. package/fesm2022/loomui-ng-ui-spinner.mjs +85 -0
  141. package/fesm2022/loomui-ng-ui-spinner.mjs.map +1 -0
  142. package/fesm2022/loomui-ng-ui-switch.mjs +212 -0
  143. package/fesm2022/loomui-ng-ui-switch.mjs.map +1 -0
  144. package/fesm2022/loomui-ng-ui-table.mjs +559 -0
  145. package/fesm2022/loomui-ng-ui-table.mjs.map +1 -0
  146. package/fesm2022/loomui-ng-ui-tabs.mjs +544 -0
  147. package/fesm2022/loomui-ng-ui-tabs.mjs.map +1 -0
  148. package/fesm2022/loomui-ng-ui-textarea.mjs +206 -0
  149. package/fesm2022/loomui-ng-ui-textarea.mjs.map +1 -0
  150. package/fesm2022/loomui-ng-ui-toast.mjs +432 -0
  151. package/fesm2022/loomui-ng-ui-toast.mjs.map +1 -0
  152. package/fesm2022/loomui-ng-ui-toggle-group.mjs +477 -0
  153. package/fesm2022/loomui-ng-ui-toggle-group.mjs.map +1 -0
  154. package/fesm2022/loomui-ng-ui-toggle.mjs +219 -0
  155. package/fesm2022/loomui-ng-ui-toggle.mjs.map +1 -0
  156. package/fesm2022/loomui-ng-ui-tooltip.mjs +240 -0
  157. package/fesm2022/loomui-ng-ui-tooltip.mjs.map +1 -0
  158. package/fesm2022/loomui-ng-ui-typography.mjs +129 -0
  159. package/fesm2022/loomui-ng-ui-typography.mjs.map +1 -0
  160. package/fesm2022/loomui-ng-ui-utils.mjs +1533 -0
  161. package/fesm2022/loomui-ng-ui-utils.mjs.map +1 -0
  162. package/fesm2022/loomui-ng-ui.mjs +4 -0
  163. package/fesm2022/loomui-ng-ui.mjs.map +1 -0
  164. package/field/README.md +43 -0
  165. package/hover-card/README.md +31 -0
  166. package/icon/README.md +42 -0
  167. package/input/README.md +26 -0
  168. package/input-group/README.md +40 -0
  169. package/input-otp/README.md +35 -0
  170. package/item/README.md +33 -0
  171. package/kbd/README.md +21 -0
  172. package/label/README.md +24 -0
  173. package/marker/README.md +24 -0
  174. package/menubar/README.md +40 -0
  175. package/message/README.md +32 -0
  176. package/message-scroller/README.md +40 -0
  177. package/native-select/README.md +26 -0
  178. package/navigation-menu/README.md +39 -0
  179. package/package.json +325 -3
  180. package/pagination/README.md +37 -0
  181. package/popover/README.md +37 -0
  182. package/progress/README.md +25 -0
  183. package/questionnaire/README.md +52 -0
  184. package/radio-group/README.md +33 -0
  185. package/resizable/README.md +37 -0
  186. package/scroll-area/README.md +25 -0
  187. package/select/README.md +45 -0
  188. package/separator/README.md +28 -0
  189. package/sheet/README.md +38 -0
  190. package/sidebar/README.md +60 -0
  191. package/skeleton/README.md +21 -0
  192. package/slider/README.md +29 -0
  193. package/spinner/README.md +15 -0
  194. package/styles/loomui.css +330 -0
  195. package/switch/README.md +29 -0
  196. package/table/README.md +31 -0
  197. package/tabs/README.md +42 -0
  198. package/textarea/README.md +28 -0
  199. package/toast/README.md +27 -0
  200. package/toggle/README.md +27 -0
  201. package/toggle-group/README.md +37 -0
  202. package/tooltip/README.md +31 -0
  203. package/types/loomui-ng-ui-accordion.d.ts +141 -0
  204. package/types/loomui-ng-ui-alert-dialog.d.ts +175 -0
  205. package/types/loomui-ng-ui-alert.d.ts +77 -0
  206. package/types/loomui-ng-ui-aspect-ratio.d.ts +31 -0
  207. package/types/loomui-ng-ui-attachment.d.ts +192 -0
  208. package/types/loomui-ng-ui-avatar.d.ts +147 -0
  209. package/types/loomui-ng-ui-badge.d.ts +32 -0
  210. package/types/loomui-ng-ui-breadcrumb.d.ts +118 -0
  211. package/types/loomui-ng-ui-bubble.d.ts +100 -0
  212. package/types/loomui-ng-ui-button-group.d.ts +51 -0
  213. package/types/loomui-ng-ui-button.d.ts +57 -0
  214. package/types/loomui-ng-ui-calendar.d.ts +171 -0
  215. package/types/loomui-ng-ui-card.d.ts +123 -0
  216. package/types/loomui-ng-ui-carousel.d.ts +140 -0
  217. package/types/loomui-ng-ui-chart.d.ts +95 -0
  218. package/types/loomui-ng-ui-checkbox.d.ts +62 -0
  219. package/types/loomui-ng-ui-collapsible.d.ts +74 -0
  220. package/types/loomui-ng-ui-combobox.d.ts +229 -0
  221. package/types/loomui-ng-ui-command.d.ts +231 -0
  222. package/types/loomui-ng-ui-context-menu.d.ts +288 -0
  223. package/types/loomui-ng-ui-data-table.d.ts +111 -0
  224. package/types/loomui-ng-ui-date-picker.d.ts +63 -0
  225. package/types/loomui-ng-ui-dialog.d.ts +127 -0
  226. package/types/loomui-ng-ui-direction.d.ts +42 -0
  227. package/types/loomui-ng-ui-drawer.d.ts +149 -0
  228. package/types/loomui-ng-ui-dropdown-menu.d.ts +258 -0
  229. package/types/loomui-ng-ui-empty.d.ts +109 -0
  230. package/types/loomui-ng-ui-field.d.ts +169 -0
  231. package/types/loomui-ng-ui-hover-card.d.ts +62 -0
  232. package/types/loomui-ng-ui-icon.d.ts +156 -0
  233. package/types/loomui-ng-ui-input-group.d.ts +130 -0
  234. package/types/loomui-ng-ui-input-otp.d.ts +149 -0
  235. package/types/loomui-ng-ui-input.d.ts +89 -0
  236. package/types/loomui-ng-ui-item.d.ts +157 -0
  237. package/types/loomui-ng-ui-kbd.d.ts +36 -0
  238. package/types/loomui-ng-ui-label.d.ts +19 -0
  239. package/types/loomui-ng-ui-marker.d.ts +61 -0
  240. package/types/loomui-ng-ui-menubar.d.ts +321 -0
  241. package/types/loomui-ng-ui-message-scroller.d.ts +138 -0
  242. package/types/loomui-ng-ui-message.d.ts +109 -0
  243. package/types/loomui-ng-ui-native-select.d.ts +84 -0
  244. package/types/loomui-ng-ui-navigation-menu.d.ts +160 -0
  245. package/types/loomui-ng-ui-pagination.d.ts +130 -0
  246. package/types/loomui-ng-ui-popover.d.ts +90 -0
  247. package/types/loomui-ng-ui-progress.d.ts +39 -0
  248. package/types/loomui-ng-ui-questionnaire.d.ts +274 -0
  249. package/types/loomui-ng-ui-radio-group.d.ts +109 -0
  250. package/types/loomui-ng-ui-resizable.d.ts +121 -0
  251. package/types/loomui-ng-ui-scroll-area.d.ts +44 -0
  252. package/types/loomui-ng-ui-select.d.ts +204 -0
  253. package/types/loomui-ng-ui-separator.d.ts +35 -0
  254. package/types/loomui-ng-ui-sheet.d.ts +124 -0
  255. package/types/loomui-ng-ui-sidebar.d.ts +485 -0
  256. package/types/loomui-ng-ui-skeleton.d.ts +20 -0
  257. package/types/loomui-ng-ui-slider.d.ts +103 -0
  258. package/types/loomui-ng-ui-spinner.d.ts +19 -0
  259. package/types/loomui-ng-ui-switch.d.ts +56 -0
  260. package/types/loomui-ng-ui-table.d.ts +148 -0
  261. package/types/loomui-ng-ui-tabs.d.ts +148 -0
  262. package/types/loomui-ng-ui-textarea.d.ts +52 -0
  263. package/types/loomui-ng-ui-toast.d.ts +97 -0
  264. package/types/loomui-ng-ui-toggle-group.d.ts +138 -0
  265. package/types/loomui-ng-ui-toggle.d.ts +63 -0
  266. package/types/loomui-ng-ui-tooltip.d.ts +63 -0
  267. package/types/loomui-ng-ui-typography.d.ts +42 -0
  268. package/types/loomui-ng-ui-utils.d.ts +392 -0
  269. package/types/loomui-ng-ui.d.ts +5 -0
  270. package/typography/README.md +29 -0
@@ -0,0 +1,586 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, Directive, booleanAttribute, computed, forwardRef, inject, input, model, numberAttribute, output, signal, viewChild } from "@angular/core";
3
+ import { NG_VALUE_ACCESSOR } from "@angular/forms";
4
+ import * as i1 from "@loomui-ng/ui/utils";
5
+ import { UiElementHost, cn } from "@loomui-ng/ui/utils";
6
+ import { UiIconSvg } from "@loomui-ng/ui/icon";
7
+ const inputOtpGroupClass = "flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40";
8
+ const inputOtpSlotClass = "relative flex size-8 items-center justify-center border-y border-e border-input text-sm transition-all outline-none first:rounded-s-lg first:border-s last:rounded-e-lg aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-3 data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40";
9
+ const inputOtpSeparatorClass = "flex items-center [&_svg:not([class*='size-'])]:size-4";
10
+ const UI_INPUT_OTP_GENERATED = [];
11
+ var UiInputOtp = class UiInputOtp {
12
+ value = model("", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
13
+ maxLength = input(6, {
14
+ ...ngDevMode ? { debugName: "maxLength" } : /* istanbul ignore next */ {},
15
+ transform: numberAttribute
16
+ });
17
+ pattern = input("^\\d+$", ...ngDevMode ? [{ debugName: "pattern" }] : /* istanbul ignore next */ []);
18
+ disabled = input(false, {
19
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
20
+ transform: booleanAttribute
21
+ });
22
+ invalid = input(false, {
23
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
24
+ transform: booleanAttribute
25
+ });
26
+ required = input(false, {
27
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
28
+ transform: booleanAttribute
29
+ });
30
+ userClass = input("", {
31
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
32
+ alias: "class"
33
+ });
34
+ complete = output();
35
+ field = viewChild.required("field", ...ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []);
36
+ cvaDisabled = signal(false, ...ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []);
37
+ isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
38
+ focused = signal(false, ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
39
+ caret = signal(0, ...ngDevMode ? [{ debugName: "caret" }] : /* istanbul ignore next */ []);
40
+ inputMode = computed(() => this.pattern().includes("\\d") && !this.pattern().includes("a-z") ? "numeric" : "text", ...ngDevMode ? [{ debugName: "inputMode" }] : /* istanbul ignore next */ []);
41
+ classes = computed(() => cn("relative flex items-center gap-2 has-disabled:opacity-50", this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
42
+ onChange = () => {};
43
+ onTouched = () => {};
44
+ activeIndex = computed(() => Math.min(this.caret(), this.maxLength() - 1), ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
45
+ charAt(i) {
46
+ return this.value()[i] ?? "";
47
+ }
48
+ focus(index) {
49
+ const el = this.field().nativeElement;
50
+ el.focus();
51
+ if (index !== void 0) {
52
+ const i = Math.min(index, this.value().length);
53
+ el.setSelectionRange(i, Math.min(i + 1, this.value().length));
54
+ this.syncCaret();
55
+ }
56
+ }
57
+ onInput(e) {
58
+ const el = e.target;
59
+ const re = new RegExp(this.pattern());
60
+ const cleaned = el.value.slice(0, this.maxLength());
61
+ const ok = cleaned === "" || re.test(cleaned);
62
+ const next = ok ? cleaned : this.value();
63
+ if (!ok) el.value = next;
64
+ this.value.set(next);
65
+ this.onChange(next);
66
+ if (next.length === this.maxLength()) this.complete.emit(next);
67
+ this.syncCaret();
68
+ }
69
+ onFocus() {
70
+ this.focused.set(true);
71
+ this.syncCaret();
72
+ }
73
+ onBlur() {
74
+ this.focused.set(false);
75
+ this.onTouched();
76
+ }
77
+ syncCaret() {
78
+ this.caret.set(this.field().nativeElement.selectionStart ?? 0);
79
+ }
80
+ writeValue(v) {
81
+ this.value.set(v ?? "");
82
+ }
83
+ registerOnChange(fn) {
84
+ this.onChange = fn;
85
+ }
86
+ registerOnTouched(fn) {
87
+ this.onTouched = fn;
88
+ }
89
+ setDisabledState(d) {
90
+ this.cvaDisabled.set(d);
91
+ }
92
+ static ɵfac = i0.ɵɵngDeclareFactory({
93
+ minVersion: "12.0.0",
94
+ version: "22.2.2",
95
+ ngImport: i0,
96
+ type: UiInputOtp,
97
+ deps: [],
98
+ target: i0.ɵɵFactoryTarget.Component
99
+ });
100
+ static ɵcmp = i0.ɵɵngDeclareComponent({
101
+ minVersion: "17.2.0",
102
+ version: "22.2.2",
103
+ type: UiInputOtp,
104
+ isStandalone: true,
105
+ selector: "div[uiInputOtp], ui-input-otp",
106
+ inputs: {
107
+ value: {
108
+ classPropertyName: "value",
109
+ publicName: "value",
110
+ isSignal: true,
111
+ isRequired: false,
112
+ transformFunction: null
113
+ },
114
+ maxLength: {
115
+ classPropertyName: "maxLength",
116
+ publicName: "maxLength",
117
+ isSignal: true,
118
+ isRequired: false,
119
+ transformFunction: null
120
+ },
121
+ pattern: {
122
+ classPropertyName: "pattern",
123
+ publicName: "pattern",
124
+ isSignal: true,
125
+ isRequired: false,
126
+ transformFunction: null
127
+ },
128
+ disabled: {
129
+ classPropertyName: "disabled",
130
+ publicName: "disabled",
131
+ isSignal: true,
132
+ isRequired: false,
133
+ transformFunction: null
134
+ },
135
+ invalid: {
136
+ classPropertyName: "invalid",
137
+ publicName: "invalid",
138
+ isSignal: true,
139
+ isRequired: false,
140
+ transformFunction: null
141
+ },
142
+ required: {
143
+ classPropertyName: "required",
144
+ publicName: "required",
145
+ isSignal: true,
146
+ isRequired: false,
147
+ transformFunction: null
148
+ },
149
+ userClass: {
150
+ classPropertyName: "userClass",
151
+ publicName: "class",
152
+ isSignal: true,
153
+ isRequired: false,
154
+ transformFunction: null
155
+ }
156
+ },
157
+ outputs: {
158
+ value: "valueChange",
159
+ complete: "complete"
160
+ },
161
+ host: {
162
+ attributes: { "data-slot": "input-otp-container" },
163
+ properties: { "attr.class": "classes()" }
164
+ },
165
+ providers: [{
166
+ provide: NG_VALUE_ACCESSOR,
167
+ useExisting: forwardRef(() => UiInputOtp),
168
+ multi: true
169
+ }],
170
+ viewQueries: [{
171
+ propertyName: "field",
172
+ first: true,
173
+ predicate: ["field"],
174
+ descendants: true,
175
+ isSignal: true
176
+ }],
177
+ hostDirectives: [{ directive: i1.UiElementHost }],
178
+ ngImport: i0,
179
+ template: `
180
+ <ng-content />
181
+ <input
182
+ #field
183
+ data-slot="input-otp"
184
+ data-input-otp="true"
185
+ autocomplete="one-time-code"
186
+ spellcheck="false"
187
+ [attr.inputmode]="inputMode()"
188
+ [attr.maxlength]="maxLength()"
189
+ [attr.pattern]="pattern()"
190
+ [disabled]="isDisabled()"
191
+ [required]="required()"
192
+ [attr.aria-invalid]="invalid() ? 'true' : null"
193
+ [value]="value()"
194
+ class="absolute inset-0 size-full cursor-text opacity-0 disabled:cursor-not-allowed"
195
+ (input)="onInput($event)"
196
+ (focus)="onFocus()"
197
+ (blur)="onBlur()"
198
+ (keyup)="syncCaret()"
199
+ (click)="syncCaret()"
200
+ (select)="syncCaret()"
201
+ />
202
+ `,
203
+ isInline: true,
204
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
205
+ });
206
+ };
207
+ i0.ɵɵngDeclareClassMetadata({
208
+ minVersion: "12.0.0",
209
+ version: "22.2.2",
210
+ ngImport: i0,
211
+ type: UiInputOtp,
212
+ decorators: [{
213
+ type: Component,
214
+ args: [{
215
+ selector: "div[uiInputOtp], ui-input-otp",
216
+ hostDirectives: [UiElementHost],
217
+ changeDetection: ChangeDetectionStrategy.OnPush,
218
+ providers: [{
219
+ provide: NG_VALUE_ACCESSOR,
220
+ useExisting: forwardRef(() => UiInputOtp),
221
+ multi: true
222
+ }],
223
+ host: {
224
+ "data-slot": "input-otp-container",
225
+ "[attr.class]": "classes()"
226
+ },
227
+ template: `
228
+ <ng-content />
229
+ <input
230
+ #field
231
+ data-slot="input-otp"
232
+ data-input-otp="true"
233
+ autocomplete="one-time-code"
234
+ spellcheck="false"
235
+ [attr.inputmode]="inputMode()"
236
+ [attr.maxlength]="maxLength()"
237
+ [attr.pattern]="pattern()"
238
+ [disabled]="isDisabled()"
239
+ [required]="required()"
240
+ [attr.aria-invalid]="invalid() ? 'true' : null"
241
+ [value]="value()"
242
+ class="absolute inset-0 size-full cursor-text opacity-0 disabled:cursor-not-allowed"
243
+ (input)="onInput($event)"
244
+ (focus)="onFocus()"
245
+ (blur)="onBlur()"
246
+ (keyup)="syncCaret()"
247
+ (click)="syncCaret()"
248
+ (select)="syncCaret()"
249
+ />
250
+ `
251
+ }]
252
+ }],
253
+ propDecorators: {
254
+ value: [{
255
+ type: i0.Input,
256
+ args: [{
257
+ isSignal: true,
258
+ alias: "value",
259
+ required: false
260
+ }]
261
+ }, {
262
+ type: i0.Output,
263
+ args: ["valueChange"]
264
+ }],
265
+ maxLength: [{
266
+ type: i0.Input,
267
+ args: [{
268
+ isSignal: true,
269
+ alias: "maxLength",
270
+ required: false
271
+ }]
272
+ }],
273
+ pattern: [{
274
+ type: i0.Input,
275
+ args: [{
276
+ isSignal: true,
277
+ alias: "pattern",
278
+ required: false
279
+ }]
280
+ }],
281
+ disabled: [{
282
+ type: i0.Input,
283
+ args: [{
284
+ isSignal: true,
285
+ alias: "disabled",
286
+ required: false
287
+ }]
288
+ }],
289
+ invalid: [{
290
+ type: i0.Input,
291
+ args: [{
292
+ isSignal: true,
293
+ alias: "invalid",
294
+ required: false
295
+ }]
296
+ }],
297
+ required: [{
298
+ type: i0.Input,
299
+ args: [{
300
+ isSignal: true,
301
+ alias: "required",
302
+ required: false
303
+ }]
304
+ }],
305
+ userClass: [{
306
+ type: i0.Input,
307
+ args: [{
308
+ isSignal: true,
309
+ alias: "class",
310
+ required: false
311
+ }]
312
+ }],
313
+ complete: [{
314
+ type: i0.Output,
315
+ args: ["complete"]
316
+ }],
317
+ field: [{
318
+ type: i0.ViewChild,
319
+ args: ["field", { isSignal: true }]
320
+ }]
321
+ }
322
+ });
323
+ var UiInputOtpGroup = class UiInputOtpGroup {
324
+ userClass = input("", {
325
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
326
+ alias: "class"
327
+ });
328
+ classes = computed(() => cn(inputOtpGroupClass, this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
329
+ static ɵfac = i0.ɵɵngDeclareFactory({
330
+ minVersion: "12.0.0",
331
+ version: "22.2.2",
332
+ ngImport: i0,
333
+ type: UiInputOtpGroup,
334
+ deps: [],
335
+ target: i0.ɵɵFactoryTarget.Directive
336
+ });
337
+ static ɵdir = i0.ɵɵngDeclareDirective({
338
+ minVersion: "17.1.0",
339
+ version: "22.2.2",
340
+ type: UiInputOtpGroup,
341
+ isStandalone: true,
342
+ selector: "[uiInputOtpGroup], ui-input-otp-group",
343
+ inputs: { userClass: {
344
+ classPropertyName: "userClass",
345
+ publicName: "class",
346
+ isSignal: true,
347
+ isRequired: false,
348
+ transformFunction: null
349
+ } },
350
+ host: {
351
+ attributes: { "data-slot": "input-otp-group" },
352
+ properties: { "attr.class": "classes()" }
353
+ },
354
+ hostDirectives: [{ directive: i1.UiElementHost }],
355
+ ngImport: i0
356
+ });
357
+ };
358
+ i0.ɵɵngDeclareClassMetadata({
359
+ minVersion: "12.0.0",
360
+ version: "22.2.2",
361
+ ngImport: i0,
362
+ type: UiInputOtpGroup,
363
+ decorators: [{
364
+ type: Directive,
365
+ args: [{
366
+ selector: "[uiInputOtpGroup], ui-input-otp-group",
367
+ hostDirectives: [UiElementHost],
368
+ host: {
369
+ "data-slot": "input-otp-group",
370
+ "[attr.class]": "classes()"
371
+ }
372
+ }]
373
+ }],
374
+ propDecorators: { userClass: [{
375
+ type: i0.Input,
376
+ args: [{
377
+ isSignal: true,
378
+ alias: "class",
379
+ required: false
380
+ }]
381
+ }] }
382
+ });
383
+ var UiInputOtpSlot = class UiInputOtpSlot {
384
+ otp = inject(UiInputOtp);
385
+ index = input.required(...ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []);
386
+ userClass = input("", {
387
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
388
+ alias: "class"
389
+ });
390
+ char = computed(() => this.otp.charAt(this.index()), ...ngDevMode ? [{ debugName: "char" }] : /* istanbul ignore next */ []);
391
+ active = computed(() => this.otp.focused() && this.otp.activeIndex() === this.index(), ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
392
+ classes = computed(() => cn(inputOtpSlotClass, this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
393
+ static ɵfac = i0.ɵɵngDeclareFactory({
394
+ minVersion: "12.0.0",
395
+ version: "22.2.2",
396
+ ngImport: i0,
397
+ type: UiInputOtpSlot,
398
+ deps: [],
399
+ target: i0.ɵɵFactoryTarget.Component
400
+ });
401
+ static ɵcmp = i0.ɵɵngDeclareComponent({
402
+ minVersion: "17.0.0",
403
+ version: "22.2.2",
404
+ type: UiInputOtpSlot,
405
+ isStandalone: true,
406
+ selector: "[uiInputOtpSlot], ui-input-otp-slot",
407
+ inputs: {
408
+ index: {
409
+ classPropertyName: "index",
410
+ publicName: "index",
411
+ isSignal: true,
412
+ isRequired: true,
413
+ transformFunction: null
414
+ },
415
+ userClass: {
416
+ classPropertyName: "userClass",
417
+ publicName: "class",
418
+ isSignal: true,
419
+ isRequired: false,
420
+ transformFunction: null
421
+ }
422
+ },
423
+ host: {
424
+ attributes: { "data-slot": "input-otp-slot" },
425
+ listeners: { "pointerdown": "$event.preventDefault(); otp.focus(index())" },
426
+ properties: {
427
+ "attr.data-active": "active()",
428
+ "attr.aria-invalid": "otp.invalid() ? \"true\" : null",
429
+ "attr.class": "classes()"
430
+ }
431
+ },
432
+ hostDirectives: [{ directive: i1.UiElementHost }],
433
+ ngImport: i0,
434
+ template: `
435
+ {{ char() }}
436
+ @if (active() && !char()) {
437
+ <div class="pointer-events-none absolute inset-0 flex items-center justify-center">
438
+ <div class="h-4 w-px animate-caret-blink bg-foreground duration-1000"></div>
439
+ </div>
440
+ }
441
+ `,
442
+ isInline: true,
443
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
444
+ });
445
+ };
446
+ i0.ɵɵngDeclareClassMetadata({
447
+ minVersion: "12.0.0",
448
+ version: "22.2.2",
449
+ ngImport: i0,
450
+ type: UiInputOtpSlot,
451
+ decorators: [{
452
+ type: Component,
453
+ args: [{
454
+ selector: "[uiInputOtpSlot], ui-input-otp-slot",
455
+ hostDirectives: [UiElementHost],
456
+ changeDetection: ChangeDetectionStrategy.OnPush,
457
+ host: {
458
+ "data-slot": "input-otp-slot",
459
+ "[attr.data-active]": "active()",
460
+ "[attr.aria-invalid]": "otp.invalid() ? \"true\" : null",
461
+ "[attr.class]": "classes()",
462
+ "(pointerdown)": "$event.preventDefault(); otp.focus(index())"
463
+ },
464
+ template: `
465
+ {{ char() }}
466
+ @if (active() && !char()) {
467
+ <div class="pointer-events-none absolute inset-0 flex items-center justify-center">
468
+ <div class="h-4 w-px animate-caret-blink bg-foreground duration-1000"></div>
469
+ </div>
470
+ }
471
+ `
472
+ }]
473
+ }],
474
+ propDecorators: {
475
+ index: [{
476
+ type: i0.Input,
477
+ args: [{
478
+ isSignal: true,
479
+ alias: "index",
480
+ required: true
481
+ }]
482
+ }],
483
+ userClass: [{
484
+ type: i0.Input,
485
+ args: [{
486
+ isSignal: true,
487
+ alias: "class",
488
+ required: false
489
+ }]
490
+ }]
491
+ }
492
+ });
493
+ var UiInputOtpSeparator = class UiInputOtpSeparator {
494
+ userClass = input("", {
495
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
496
+ alias: "class"
497
+ });
498
+ classes = computed(() => cn(inputOtpSeparatorClass, this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
499
+ static ɵfac = i0.ɵɵngDeclareFactory({
500
+ minVersion: "12.0.0",
501
+ version: "22.2.2",
502
+ ngImport: i0,
503
+ type: UiInputOtpSeparator,
504
+ deps: [],
505
+ target: i0.ɵɵFactoryTarget.Component
506
+ });
507
+ static ɵcmp = i0.ɵɵngDeclareComponent({
508
+ minVersion: "17.1.0",
509
+ version: "22.2.2",
510
+ type: UiInputOtpSeparator,
511
+ isStandalone: true,
512
+ selector: "[uiInputOtpSeparator], ui-input-otp-separator",
513
+ inputs: { userClass: {
514
+ classPropertyName: "userClass",
515
+ publicName: "class",
516
+ isSignal: true,
517
+ isRequired: false,
518
+ transformFunction: null
519
+ } },
520
+ host: {
521
+ attributes: {
522
+ "role": "separator",
523
+ "data-slot": "input-otp-separator"
524
+ },
525
+ properties: { "attr.class": "classes()" }
526
+ },
527
+ hostDirectives: [{ directive: i1.UiElementHost }],
528
+ ngImport: i0,
529
+ template: `<svg uiIcon="minus"></svg>`,
530
+ isInline: true,
531
+ dependencies: [{
532
+ kind: "directive",
533
+ type: UiIconSvg,
534
+ selector: "svg[uiIcon]",
535
+ inputs: [
536
+ "uiIcon",
537
+ "icon",
538
+ "size",
539
+ "strokeWidth",
540
+ "absoluteStrokeWidth",
541
+ "color",
542
+ "label",
543
+ "class"
544
+ ]
545
+ }],
546
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
547
+ });
548
+ };
549
+ i0.ɵɵngDeclareClassMetadata({
550
+ minVersion: "12.0.0",
551
+ version: "22.2.2",
552
+ ngImport: i0,
553
+ type: UiInputOtpSeparator,
554
+ decorators: [{
555
+ type: Component,
556
+ args: [{
557
+ selector: "[uiInputOtpSeparator], ui-input-otp-separator",
558
+ hostDirectives: [UiElementHost],
559
+ imports: [UiIconSvg],
560
+ changeDetection: ChangeDetectionStrategy.OnPush,
561
+ host: {
562
+ role: "separator",
563
+ "data-slot": "input-otp-separator",
564
+ "[attr.class]": "classes()"
565
+ },
566
+ template: `<svg uiIcon="minus"></svg>`
567
+ }]
568
+ }],
569
+ propDecorators: { userClass: [{
570
+ type: i0.Input,
571
+ args: [{
572
+ isSignal: true,
573
+ alias: "class",
574
+ required: false
575
+ }]
576
+ }] }
577
+ });
578
+ const UI_INPUT_OTP = [
579
+ UiInputOtp,
580
+ UiInputOtpGroup,
581
+ UiInputOtpSlot,
582
+ UiInputOtpSeparator
583
+ ];
584
+ export { UI_INPUT_OTP, UI_INPUT_OTP_GENERATED, UiInputOtp, UiInputOtpGroup, UiInputOtpSeparator, UiInputOtpSlot, inputOtpGroupClass, inputOtpSeparatorClass, inputOtpSlotClass };
585
+
586
+ //# sourceMappingURL=loomui-ng-ui-input-otp.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loomui-ng-ui-input-otp.mjs","names":[],"sources":["../../../libs/ui/input-otp/input-otp.ts","../../../libs/ui/input-otp/input-otp.manual.ts"],"sourcesContent":["// GENERATED by tools/gen-ui.mjs from docs/evidence/slots/input-otp.json.\n// Change tools/ui-specs.mjs and regenerate; hand-written parts live in ./input-otp.manual.ts.\nimport { Directive, computed, input } from '@angular/core';\nimport { cn } from '@loomui-ng/ui/utils';\n\nexport const inputOtpGroupClass =\n 'flex items-center rounded-lg has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40';\n\nexport const inputOtpSlotClass =\n 'relative flex size-8 items-center justify-center border-y border-e border-input text-sm transition-all outline-none first:rounded-s-lg first:border-s last:rounded-e-lg aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-3 data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40';\n\nexport const inputOtpSeparatorClass =\n 'flex items-center [&_svg:not([class*=\\'size-\\'])]:size-4';\n\nexport const UI_INPUT_OTP_GENERATED = [] as const;\n","import {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n Directive,\n ElementRef,\n forwardRef,\n inject,\n input,\n model,\n numberAttribute,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { cn } from '@loomui-ng/ui/utils';\nimport { inputOtpGroupClass, inputOtpSeparatorClass, inputOtpSlotClass } from './input-otp';\nimport { UiIconSvg } from '@loomui-ng/ui/icon';\nimport { UiElementHost } from '@loomui-ng/ui/utils';\n\n/**\n * <div uiInputOtp [maxLength]=\"6\" [(value)]=\"code\">\n * <div uiInputOtpGroup><div uiInputOtpSlot [index]=\"0\"></div>…</div>\n * </div>\n * One real (transparent) <input> captures typing, paste and caret keys; slots only render characters (input-otp's approach).\n * Observed input attrs: autocomplete=\"one-time-code\", inputmode=\"numeric\", maxlength, pattern, spellcheck=false.\n */\n@Component({\n selector: 'div[uiInputOtp], ui-input-otp', hostDirectives: [UiElementHost],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiInputOtp), multi: true }],\n host: {\n 'data-slot': 'input-otp-container',\n '[attr.class]': 'classes()',\n },\n template: `\n <ng-content />\n <input\n #field\n data-slot=\"input-otp\"\n data-input-otp=\"true\"\n autocomplete=\"one-time-code\"\n spellcheck=\"false\"\n [attr.inputmode]=\"inputMode()\"\n [attr.maxlength]=\"maxLength()\"\n [attr.pattern]=\"pattern()\"\n [disabled]=\"isDisabled()\"\n [required]=\"required()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [value]=\"value()\"\n class=\"absolute inset-0 size-full cursor-text opacity-0 disabled:cursor-not-allowed\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (keyup)=\"syncCaret()\"\n (click)=\"syncCaret()\"\n (select)=\"syncCaret()\"\n />\n `,\n})\nexport class UiInputOtp implements ControlValueAccessor {\n readonly value = model('');\n readonly maxLength = input(6, { transform: numberAttribute });\n /** Allowed characters; default digits only (observed `^\\d+$`; alphanumeric uses `^[a-zA-Z0-9]+$`). */\n readonly pattern = input<string>('^\\\\d+$');\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly invalid = input(false, { transform: booleanAttribute });\n readonly required = input(false, { transform: booleanAttribute });\n readonly userClass = input<string>('', { alias: 'class' });\n readonly complete = output<string>();\n\n private readonly field = viewChild.required<ElementRef<HTMLInputElement>>('field');\n private readonly cvaDisabled = signal(false);\n readonly isDisabled = computed(() => this.disabled() || this.cvaDisabled());\n readonly focused = signal(false);\n private readonly caret = signal(0);\n protected readonly inputMode = computed(() => (this.pattern().includes('\\\\d') && !this.pattern().includes('a-z') ? 'numeric' : 'text'));\n protected readonly classes = computed(() => cn('relative flex items-center gap-2 has-disabled:opacity-50', this.userClass()));\n private onChange: (v: string) => void = () => {};\n private onTouched: () => void = () => {};\n\n /** Index of the slot that currently owns the caret. */\n readonly activeIndex = computed(() => Math.min(this.caret(), this.maxLength() - 1));\n\n charAt(i: number): string {\n return this.value()[i] ?? '';\n }\n\n focus(index?: number): void {\n const el = this.field().nativeElement;\n el.focus();\n if (index !== undefined) {\n const i = Math.min(index, this.value().length);\n el.setSelectionRange(i, Math.min(i + 1, this.value().length));\n this.syncCaret();\n }\n }\n\n protected onInput(e: Event): void {\n const el = e.target as HTMLInputElement;\n const re = new RegExp(this.pattern());\n const cleaned = el.value.slice(0, this.maxLength());\n const ok = cleaned === '' || re.test(cleaned);\n const next = ok ? cleaned : this.value();\n if (!ok) el.value = next;\n this.value.set(next);\n this.onChange(next);\n if (next.length === this.maxLength()) this.complete.emit(next);\n this.syncCaret();\n }\n\n protected onFocus(): void {\n this.focused.set(true);\n this.syncCaret();\n }\n protected onBlur(): void {\n this.focused.set(false);\n this.onTouched();\n }\n protected syncCaret(): void {\n this.caret.set(this.field().nativeElement.selectionStart ?? 0);\n }\n\n writeValue(v: string | null): void {\n this.value.set(v ?? '');\n }\n registerOnChange(fn: (v: string) => void): void {\n this.onChange = fn;\n }\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n setDisabledState(d: boolean): void {\n this.cvaDisabled.set(d);\n }\n}\n\n@Directive({\n selector: '[uiInputOtpGroup], ui-input-otp-group', hostDirectives: [UiElementHost],\n host: { 'data-slot': 'input-otp-group', '[attr.class]': 'classes()' },\n})\nexport class UiInputOtpGroup {\n readonly userClass = input<string>('', { alias: 'class' });\n protected readonly classes = computed(() => cn(inputOtpGroupClass, this.userClass()));\n}\n\n@Component({\n selector: '[uiInputOtpSlot], ui-input-otp-slot', hostDirectives: [UiElementHost],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n 'data-slot': 'input-otp-slot',\n '[attr.data-active]': 'active()',\n '[attr.aria-invalid]': 'otp.invalid() ? \"true\" : null',\n '[attr.class]': 'classes()',\n '(pointerdown)': '$event.preventDefault(); otp.focus(index())',\n },\n template: `\n {{ char() }}\n @if (active() && !char()) {\n <div class=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div class=\"h-4 w-px animate-caret-blink bg-foreground duration-1000\"></div>\n </div>\n }\n `,\n})\nexport class UiInputOtpSlot {\n protected readonly otp = inject(UiInputOtp);\n readonly index = input.required<number>();\n readonly userClass = input<string>('', { alias: 'class' });\n protected readonly char = computed(() => this.otp.charAt(this.index()));\n protected readonly active = computed(() => this.otp.focused() && this.otp.activeIndex() === this.index());\n protected readonly classes = computed(() => cn(inputOtpSlotClass, this.userClass()));\n}\n\n@Component({\n selector: '[uiInputOtpSeparator], ui-input-otp-separator', hostDirectives: [UiElementHost],\n imports: [UiIconSvg],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { role: 'separator', 'data-slot': 'input-otp-separator', '[attr.class]': 'classes()' },\n template: `<svg uiIcon=\"minus\"></svg>`,\n})\nexport class UiInputOtpSeparator {\n readonly userClass = input<string>('', { alias: 'class' });\n protected readonly classes = computed(() => cn(inputOtpSeparatorClass, this.userClass()));\n}\n\nexport const UI_INPUT_OTP = [UiInputOtp, UiInputOtpGroup, UiInputOtpSlot, UiInputOtpSeparator] as const;\n"],"mappings":";;;;;;AAKA,MAAa,qBACX;AAEF,MAAa,oBACX;AAEF,MAAa,yBACX;AAEF,MAAa,yBAAyB,CAAA;ACgDtC,IAAa,aAAb,MAAa,WAAU;CACZ,QAAQ,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACjB,YAAY,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,YAAA,+BAAA,CAAA;EAAI,WAAW;CAAe,CAAA;CAEjD,UAAU,MAAc,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACjC,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACrD,UAAU,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,UAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACpD,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACrD,YAAY,MAAc,IAAE;EAAA,GAAA,YAAA,EAAA,WAAA,YAAA,+BAAA,CAAA;EAAI,OAAO;CAAO,CAAA;CAC9C,WAAW,OAAM;CAET,QAAQ,UAAU,SAAuC,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACjE,cAAc,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACnC,aAAa,eAAe,KAAK,SAAQ,KAAM,KAAK,YAAW,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA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