@ojiepermana/angular 22.1.14 → 22.2.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 (252) hide show
  1. package/README.md +8 -6
  2. package/SUPPORT.md +3 -3
  3. package/chart/README.md +1 -1
  4. package/component/README.md +2 -2
  5. package/component/calendar/README.md +3 -15
  6. package/component/drawer/README.md +1 -2
  7. package/fesm2022/ojiepermana-angular-chart-area.mjs +352 -137
  8. package/fesm2022/ojiepermana-angular-chart-bar.mjs +744 -524
  9. package/fesm2022/ojiepermana-angular-chart-core.mjs +1140 -1344
  10. package/fesm2022/ojiepermana-angular-chart-line.mjs +393 -147
  11. package/fesm2022/ojiepermana-angular-chart-pie.mjs +408 -179
  12. package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1262 -920
  13. package/fesm2022/ojiepermana-angular-chart-radar.mjs +473 -205
  14. package/fesm2022/ojiepermana-angular-chart-radial.mjs +425 -182
  15. package/fesm2022/ojiepermana-angular-chart-scatter.mjs +386 -210
  16. package/fesm2022/ojiepermana-angular-chart.mjs +3 -19
  17. package/fesm2022/ojiepermana-angular-component-accordion.mjs +485 -243
  18. package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +963 -325
  19. package/fesm2022/ojiepermana-angular-component-alert.mjs +266 -103
  20. package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +80 -35
  21. package/fesm2022/ojiepermana-angular-component-avatar.mjs +402 -135
  22. package/fesm2022/ojiepermana-angular-component-badge.mjs +109 -59
  23. package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +410 -142
  24. package/fesm2022/ojiepermana-angular-component-button-group.mjs +249 -96
  25. package/fesm2022/ojiepermana-angular-component-button.mjs +153 -75
  26. package/fesm2022/ojiepermana-angular-component-calendar.mjs +531 -418
  27. package/fesm2022/ojiepermana-angular-component-card.mjs +457 -171
  28. package/fesm2022/ojiepermana-angular-component-carousel.mjs +642 -272
  29. package/fesm2022/ojiepermana-angular-component-checkbox.mjs +312 -108
  30. package/fesm2022/ojiepermana-angular-component-collapsible.mjs +299 -115
  31. package/fesm2022/ojiepermana-angular-component-combobox.mjs +396 -183
  32. package/fesm2022/ojiepermana-angular-component-command.mjs +807 -347
  33. package/fesm2022/ojiepermana-angular-component-composer.mjs +807 -330
  34. package/fesm2022/ojiepermana-angular-component-context-menu.mjs +196 -161
  35. package/fesm2022/ojiepermana-angular-component-date-picker.mjs +650 -338
  36. package/fesm2022/ojiepermana-angular-component-dialog.mjs +710 -316
  37. package/fesm2022/ojiepermana-angular-component-drawer.mjs +2 -5
  38. package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +1212 -646
  39. package/fesm2022/ojiepermana-angular-component-editor.mjs +987 -502
  40. package/fesm2022/ojiepermana-angular-component-empty.mjs +350 -137
  41. package/fesm2022/ojiepermana-angular-component-form.mjs +813 -434
  42. package/fesm2022/ojiepermana-angular-component-hover-card.mjs +486 -277
  43. package/fesm2022/ojiepermana-angular-component-icon.mjs +241 -140
  44. package/fesm2022/ojiepermana-angular-component-input-group.mjs +449 -176
  45. package/fesm2022/ojiepermana-angular-component-input-otp.mjs +891 -488
  46. package/fesm2022/ojiepermana-angular-component-input.mjs +86 -55
  47. package/fesm2022/ojiepermana-angular-component-item.mjs +713 -261
  48. package/fesm2022/ojiepermana-angular-component-kanban.mjs +714 -216
  49. package/fesm2022/ojiepermana-angular-component-kbd.mjs +124 -52
  50. package/fesm2022/ojiepermana-angular-component-label.mjs +82 -31
  51. package/fesm2022/ojiepermana-angular-component-menubar.mjs +479 -329
  52. package/fesm2022/ojiepermana-angular-component-native-select.mjs +167 -65
  53. package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +683 -380
  54. package/fesm2022/ojiepermana-angular-component-pagination.mjs +277 -94
  55. package/fesm2022/ojiepermana-angular-component-pillbox.mjs +1283 -607
  56. package/fesm2022/ojiepermana-angular-component-popover.mjs +291 -204
  57. package/fesm2022/ojiepermana-angular-component-progress.mjs +176 -53
  58. package/fesm2022/ojiepermana-angular-component-radio.mjs +449 -142
  59. package/fesm2022/ojiepermana-angular-component-resizable.mjs +659 -453
  60. package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +117 -39
  61. package/fesm2022/ojiepermana-angular-component-segmented-control.mjs +351 -172
  62. package/fesm2022/ojiepermana-angular-component-select.mjs +475 -345
  63. package/fesm2022/ojiepermana-angular-component-separator.mjs +102 -35
  64. package/fesm2022/ojiepermana-angular-component-sheet.mjs +797 -347
  65. package/fesm2022/ojiepermana-angular-component-skeleton.mjs +62 -29
  66. package/fesm2022/ojiepermana-angular-component-slider.mjs +592 -376
  67. package/fesm2022/ojiepermana-angular-component-spinner.mjs +135 -38
  68. package/fesm2022/ojiepermana-angular-component-switch.mjs +315 -103
  69. package/fesm2022/ojiepermana-angular-component-table.mjs +440 -153
  70. package/fesm2022/ojiepermana-angular-component-tabs.mjs +590 -317
  71. package/fesm2022/ojiepermana-angular-component-textarea.mjs +85 -50
  72. package/fesm2022/ojiepermana-angular-component-timeline.mjs +609 -231
  73. package/fesm2022/ojiepermana-angular-component-toast.mjs +229 -243
  74. package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +573 -288
  75. package/fesm2022/ojiepermana-angular-component-toggle.mjs +187 -78
  76. package/fesm2022/ojiepermana-angular-component-tooltip.mjs +798 -517
  77. package/fesm2022/ojiepermana-angular-component-utils-core.mjs +159 -292
  78. package/fesm2022/ojiepermana-angular-component-utils-overlay.mjs +46 -58
  79. package/fesm2022/ojiepermana-angular-component-utils-scale.mjs +76 -38
  80. package/fesm2022/ojiepermana-angular-component-utils.mjs +2 -8
  81. package/fesm2022/ojiepermana-angular-component.mjs +0 -10
  82. package/fesm2022/ojiepermana-angular-navigation-core.mjs +13 -23
  83. package/fesm2022/ojiepermana-angular-navigation-icon.mjs +35 -24
  84. package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-BKCeWzml.mjs +129 -0
  85. package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-DFEJK2jD.mjs +811 -0
  86. package/fesm2022/{ojiepermana-angular-navigation-navigation-entry-grid.component-COQ-60DS.mjs → ojiepermana-angular-navigation-navigation-entry-grid.component-mpK9Ar08.mjs} +387 -183
  87. package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-BPgH7FJk.mjs +650 -0
  88. package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-DMpYcD9t.mjs +662 -0
  89. package/fesm2022/ojiepermana-angular-navigation-navigation-item.component-Basp5SIk.mjs +1228 -0
  90. package/fesm2022/ojiepermana-angular-navigation-navigation-list.component-YUzHI9Pj.mjs +311 -0
  91. package/fesm2022/ojiepermana-angular-navigation-service.mjs +542 -724
  92. package/fesm2022/ojiepermana-angular-navigation-types.mjs +27 -56
  93. package/fesm2022/ojiepermana-angular-navigation.mjs +3052 -4
  94. package/fesm2022/ojiepermana-angular-sdk.mjs +91 -201
  95. package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +1115 -737
  96. package/fesm2022/ojiepermana-angular-theme-layout-services.mjs +245 -328
  97. package/fesm2022/ojiepermana-angular-theme-layout-types.mjs +35 -38
  98. package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +1719 -552
  99. package/fesm2022/ojiepermana-angular-theme-layout.mjs +847 -496
  100. package/fesm2022/ojiepermana-angular-theme-page-core.mjs +288 -358
  101. package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +362 -224
  102. package/fesm2022/ojiepermana-angular-theme-page-overview.mjs +88 -0
  103. package/fesm2022/ojiepermana-angular-theme-page-root.mjs +576 -254
  104. package/fesm2022/ojiepermana-angular-theme-page-side.mjs +317 -177
  105. package/fesm2022/ojiepermana-angular-theme-page-slots.mjs +256 -112
  106. package/fesm2022/ojiepermana-angular-theme-page.mjs +7 -12
  107. package/fesm2022/ojiepermana-angular-theme-shell-services.mjs +215 -326
  108. package/fesm2022/ojiepermana-angular-theme-shell-types.mjs +68 -129
  109. package/fesm2022/ojiepermana-angular-theme-shell.mjs +907 -378
  110. package/fesm2022/ojiepermana-angular-theme-styles.mjs +521 -720
  111. package/fesm2022/ojiepermana-angular-theme.mjs +0 -10
  112. package/fesm2022/ojiepermana-angular.mjs +5 -24
  113. package/navigation/README.md +1 -1
  114. package/package.json +16 -12
  115. package/sdk/README.md +1 -1
  116. package/sdk/src/writer/index.js +2 -2
  117. package/theme/README.md +1 -1
  118. package/theme/layout/README.md +2 -4
  119. package/theme/page/README.md +50 -0
  120. package/theme/styles/README.md +10 -10
  121. package/theme/styles/css/base/prefers-dark.css +1 -1
  122. package/theme/styles/css/base/status.css +1 -1
  123. package/theme/styles/css/color/amber.css +1 -1
  124. package/theme/styles/css/color/blue.css +1 -1
  125. package/theme/styles/css/color/cyan.css +1 -1
  126. package/theme/styles/css/color/emerald.css +1 -1
  127. package/theme/styles/css/color/fuchsia.css +1 -1
  128. package/theme/styles/css/color/green.css +1 -1
  129. package/theme/styles/css/color/indigo.css +1 -1
  130. package/theme/styles/css/color/lime.css +1 -1
  131. package/theme/styles/css/color/orange.css +1 -1
  132. package/theme/styles/css/color/pink.css +1 -1
  133. package/theme/styles/css/color/purple.css +1 -1
  134. package/theme/styles/css/color/red.css +1 -1
  135. package/theme/styles/css/color/rose.css +1 -1
  136. package/theme/styles/css/color/sky.css +1 -1
  137. package/theme/styles/css/color/teal.css +1 -1
  138. package/theme/styles/css/color/violet.css +1 -1
  139. package/theme/styles/css/color/yellow.css +1 -1
  140. package/theme/styles/css/neutral/gray.css +1 -1
  141. package/theme/styles/css/neutral/mauve.css +1 -1
  142. package/theme/styles/css/neutral/mist.css +1 -1
  143. package/theme/styles/css/neutral/neutral.css +1 -1
  144. package/theme/styles/css/neutral/olive.css +1 -1
  145. package/theme/styles/css/neutral/slate.css +1 -1
  146. package/theme/styles/css/neutral/stone.css +1 -1
  147. package/theme/styles/css/neutral/taupe.css +1 -1
  148. package/theme/styles/css/neutral/zinc.css +1 -1
  149. package/types/ojiepermana-angular-chart-area.d.ts +126 -63
  150. package/types/ojiepermana-angular-chart-bar.d.ts +244 -154
  151. package/types/ojiepermana-angular-chart-core.d.ts +409 -398
  152. package/types/ojiepermana-angular-chart-line.d.ts +141 -68
  153. package/types/ojiepermana-angular-chart-pie.d.ts +192 -121
  154. package/types/ojiepermana-angular-chart-primitives.d.ts +283 -214
  155. package/types/ojiepermana-angular-chart-radar.d.ts +189 -108
  156. package/types/ojiepermana-angular-chart-radial.d.ts +177 -106
  157. package/types/ojiepermana-angular-chart-scatter.d.ts +166 -110
  158. package/types/ojiepermana-angular-chart.d.ts +3 -2
  159. package/types/ojiepermana-angular-component-accordion.d.ts +135 -81
  160. package/types/ojiepermana-angular-component-alert-dialog.d.ts +271 -123
  161. package/types/ojiepermana-angular-component-alert.d.ts +69 -39
  162. package/types/ojiepermana-angular-component-aspect-ratio.d.ts +20 -12
  163. package/types/ojiepermana-angular-component-avatar.d.ts +103 -49
  164. package/types/ojiepermana-angular-component-badge.d.ts +36 -24
  165. package/types/ojiepermana-angular-component-breadcrumb.d.ts +79 -40
  166. package/types/ojiepermana-angular-component-button-group.d.ts +48 -24
  167. package/types/ojiepermana-angular-component-button.d.ts +44 -27
  168. package/types/ojiepermana-angular-component-calendar.d.ts +145 -107
  169. package/types/ojiepermana-angular-component-card.d.ts +112 -63
  170. package/types/ojiepermana-angular-component-carousel.d.ts +150 -81
  171. package/types/ojiepermana-angular-component-checkbox.d.ts +96 -38
  172. package/types/ojiepermana-angular-component-collapsible.d.ts +65 -39
  173. package/types/ojiepermana-angular-component-combobox.d.ts +100 -55
  174. package/types/ojiepermana-angular-component-command.d.ts +206 -121
  175. package/types/ojiepermana-angular-component-composer.d.ts +184 -84
  176. package/types/ojiepermana-angular-component-context-menu.d.ts +51 -41
  177. package/types/ojiepermana-angular-component-date-picker.d.ts +199 -109
  178. package/types/ojiepermana-angular-component-dialog.d.ts +200 -105
  179. package/types/ojiepermana-angular-component-drawer.d.ts +2 -1
  180. package/types/ojiepermana-angular-component-dropdown-menu.d.ts +324 -202
  181. package/types/ojiepermana-angular-component-editor.d.ts +215 -117
  182. package/types/ojiepermana-angular-component-empty.d.ts +80 -45
  183. package/types/ojiepermana-angular-component-form.d.ts +185 -121
  184. package/types/ojiepermana-angular-component-hover-card.d.ts +130 -72
  185. package/types/ojiepermana-angular-component-icon.d.ts +87 -57
  186. package/types/ojiepermana-angular-component-input-group.d.ts +93 -46
  187. package/types/ojiepermana-angular-component-input-otp.d.ts +243 -150
  188. package/types/ojiepermana-angular-component-input.d.ts +27 -17
  189. package/types/ojiepermana-angular-component-item.d.ts +160 -84
  190. package/types/ojiepermana-angular-component-kanban.d.ts +157 -62
  191. package/types/ojiepermana-angular-component-kbd.d.ts +24 -15
  192. package/types/ojiepermana-angular-component-label.d.ts +19 -11
  193. package/types/ojiepermana-angular-component-menubar.d.ts +120 -90
  194. package/types/ojiepermana-angular-component-native-select.d.ts +37 -24
  195. package/types/ojiepermana-angular-component-navigation-menu.d.ts +157 -98
  196. package/types/ojiepermana-angular-component-pagination.d.ts +78 -28
  197. package/types/ojiepermana-angular-component-pillbox.d.ts +361 -204
  198. package/types/ojiepermana-angular-component-popover.d.ts +94 -64
  199. package/types/ojiepermana-angular-component-progress.d.ts +45 -17
  200. package/types/ojiepermana-angular-component-radio.d.ts +129 -53
  201. package/types/ojiepermana-angular-component-resizable.d.ts +160 -112
  202. package/types/ojiepermana-angular-component-scroll-area.d.ts +33 -15
  203. package/types/ojiepermana-angular-component-segmented-control.d.ts +94 -50
  204. package/types/ojiepermana-angular-component-select.d.ts +94 -77
  205. package/types/ojiepermana-angular-component-separator.d.ts +26 -14
  206. package/types/ojiepermana-angular-component-sheet.d.ts +226 -116
  207. package/types/ojiepermana-angular-component-skeleton.d.ts +13 -10
  208. package/types/ojiepermana-angular-component-slider.d.ts +140 -75
  209. package/types/ojiepermana-angular-component-spinner.d.ts +31 -13
  210. package/types/ojiepermana-angular-component-switch.d.ts +97 -40
  211. package/types/ojiepermana-angular-component-table.d.ts +102 -50
  212. package/types/ojiepermana-angular-component-tabs.d.ts +174 -115
  213. package/types/ojiepermana-angular-component-textarea.d.ts +27 -17
  214. package/types/ojiepermana-angular-component-timeline.d.ts +141 -59
  215. package/types/ojiepermana-angular-component-toast.d.ts +51 -55
  216. package/types/ojiepermana-angular-component-toggle-group.d.ts +159 -88
  217. package/types/ojiepermana-angular-component-toggle.d.ts +47 -25
  218. package/types/ojiepermana-angular-component-tooltip.d.ts +222 -132
  219. package/types/ojiepermana-angular-component-utils-core.d.ts +81 -90
  220. package/types/ojiepermana-angular-component-utils-overlay.d.ts +7 -11
  221. package/types/ojiepermana-angular-component-utils-scale.d.ts +20 -12
  222. package/types/ojiepermana-angular-component-utils.d.ts +2 -2
  223. package/types/ojiepermana-angular-component.d.ts +1 -2
  224. package/types/ojiepermana-angular-navigation-core.d.ts +46 -50
  225. package/types/ojiepermana-angular-navigation-icon.d.ts +9 -12
  226. package/types/ojiepermana-angular-navigation-service.d.ts +112 -115
  227. package/types/ojiepermana-angular-navigation-types.d.ts +121 -125
  228. package/types/ojiepermana-angular-navigation.d.ts +663 -374
  229. package/types/ojiepermana-angular-sdk.d.ts +69 -71
  230. package/types/ojiepermana-angular-theme-component-settings.d.ts +115 -83
  231. package/types/ojiepermana-angular-theme-layout-services.d.ts +119 -124
  232. package/types/ojiepermana-angular-theme-layout-types.d.ts +27 -31
  233. package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +399 -187
  234. package/types/ojiepermana-angular-theme-layout.d.ts +201 -113
  235. package/types/ojiepermana-angular-theme-page-core.d.ts +136 -142
  236. package/types/ojiepermana-angular-theme-page-filter.d.ts +112 -62
  237. package/types/ojiepermana-angular-theme-page-overview.d.ts +28 -0
  238. package/types/ojiepermana-angular-theme-page-root.d.ts +172 -88
  239. package/types/ojiepermana-angular-theme-page-side.d.ts +89 -49
  240. package/types/ojiepermana-angular-theme-page-slots.d.ts +58 -37
  241. package/types/ojiepermana-angular-theme-page.d.ts +7 -5
  242. package/types/ojiepermana-angular-theme-shell-services.d.ts +119 -125
  243. package/types/ojiepermana-angular-theme-shell-types.d.ts +38 -41
  244. package/types/ojiepermana-angular-theme-shell.d.ts +139 -61
  245. package/types/ojiepermana-angular-theme-styles.d.ts +184 -196
  246. package/types/ojiepermana-angular-theme.d.ts +1 -2
  247. package/types/ojiepermana-angular.d.ts +5 -5
  248. package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-Be3IqzG4.mjs +0 -91
  249. package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-Bc7DWK3R.mjs +0 -522
  250. package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-DA8VPEn7.mjs +0 -404
  251. package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-U2TJTzlW.mjs +0 -466
  252. package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-CIUhmytH.mjs +0 -2668
@@ -1,442 +1,821 @@
1
- import * as i0 from '@angular/core';
2
- import { signal, computed, effect, Service, inject, input, booleanAttribute, Component, Directive } from '@angular/core';
3
- import { injectUniqueId, cn } from '@ojiepermana/angular/component/utils/core';
4
- import { NgControl } from '@angular/forms';
5
-
6
- /**
7
- * Backing store for a single `<FormField>`. Provided on the component
8
- * so descendant parts (label, description, message, control) can inject it.
9
- */
10
- class FormFieldContext {
11
- controlId = injectUniqueId('FormField');
12
- labelId = `${this.controlId}-label`;
13
- descriptionId = `${this.controlId}-description`;
14
- messageId = `${this.controlId}-message`;
15
- control = signal(null, /* @ts-ignore */
16
- ...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
17
- manualInvalid = signal(false, /* @ts-ignore */
18
- ...(ngDevMode ? [{ debugName: "manualInvalid" }] : /* istanbul ignore next */ []));
19
- hasLabel = signal(false, /* @ts-ignore */
20
- ...(ngDevMode ? [{ debugName: "hasLabel" }] : /* istanbul ignore next */ []));
21
- hasDescription = signal(false, /* @ts-ignore */
22
- ...(ngDevMode ? [{ debugName: "hasDescription" }] : /* istanbul ignore next */ []));
23
- hasMessage = signal(false, /* @ts-ignore */
24
- ...(ngDevMode ? [{ debugName: "hasMessage" }] : /* istanbul ignore next */ []));
25
- /**
26
- * `aria-labelledby` for the control. `<FormLabel>` renders as a custom element,
27
- * so the native `for`/`id` pairing does not associate it — point the control at
28
- * the label's id explicitly so it has an accessible name (axe `select-name`/`label`).
29
- */
30
- labelledBy = computed(() => (this.hasLabel() ? this.labelId : null), /* @ts-ignore */
31
- ...(ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []));
32
- statusTick = signal(0, /* @ts-ignore */
33
- ...(ngDevMode ? [{ debugName: "statusTick" }] : /* istanbul ignore next */ []));
34
- invalid = computed(() => {
35
- this.statusTick();
36
- const c = this.control();
37
- return this.manualInvalid() || (!!c && c.invalid && (c.touched || c.dirty));
38
- }, /* @ts-ignore */
39
- ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
40
- firstError = computed(() => {
41
- this.statusTick();
42
- const c = this.control();
43
- if (!c?.errors)
44
- return null;
45
- const keys = Object.keys(c.errors);
46
- return keys.length > 0 ? keys[0] : null;
47
- }, /* @ts-ignore */
48
- ...(ngDevMode ? [{ debugName: "firstError" }] : /* istanbul ignore next */ []));
49
- describedBy = computed(() => {
50
- const parts = [];
51
- if (this.hasDescription())
52
- parts.push(this.descriptionId);
53
- if (this.hasMessage() && this.invalid())
54
- parts.push(this.messageId);
55
- return parts.length > 0 ? parts.join(' ') : null;
56
- }, /* @ts-ignore */
57
- ...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
58
- constructor() {
59
- // Re-run computed() above whenever the control's status or interaction state changes.
60
- effect((onCleanup) => {
61
- const c = this.control();
62
- if (!c)
63
- return;
64
- // Signal Forms exposes an NgControl-compatible adapter whose state getters
65
- // read signals directly but which intentionally has no `events` stream.
66
- // The computed values above track those getters automatically; classic
67
- // AbstractControl instances still need the event bridge.
68
- const events = c.events;
69
- if (!events)
70
- return;
71
- const sub = events.subscribe(() => this.statusTick.update((n) => n + 1));
72
- onCleanup(() => sub.unsubscribe());
73
- });
74
- }
75
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormFieldContext, deps: [], target: i0.ɵɵFactoryTarget.Service });
76
- static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.6", ngImport: i0, type: FormFieldContext, autoProvided: false });
77
- }
78
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormFieldContext, decorators: [{
79
- type: Service,
80
- args: [{ autoProvided: false }]
81
- }], ctorParameters: () => [] });
82
-
83
- /**
84
- * Groups a label, control, description, and validation message.
85
- * Provides ids + invalid state to descendants via {@link FormFieldContext}.
86
- */
87
- class FormFieldComponent {
88
- ctx = inject(FormFieldContext);
89
- class = input('', /* @ts-ignore */
90
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
91
- orientation = input('vertical', /* @ts-ignore */
92
- ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
93
- invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
94
- classes = computed(() => {
95
- const orientation = this.orientation();
96
- return cn('block min-w-0', orientation === 'vertical' && 'flex flex-col gap-2', orientation === 'horizontal' && 'flex items-start gap-3', orientation === 'responsive' &&
97
- 'flex flex-col gap-3 sm:grid sm:grid-cols-[minmax(0,12rem)_minmax(0,1fr)] sm:items-start', this.class());
98
- }, /* @ts-ignore */
99
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
100
- constructor() {
101
- effect(() => this.ctx.manualInvalid.set(this.invalid()));
102
- }
103
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
104
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: FormFieldComponent, isStandalone: true, selector: "FormField", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.data-orientation": "orientation()", "attr.data-invalid": "ctx.invalid() ? \"\" : null", "attr.role": "\"group\"" } }, providers: [FormFieldContext], ngImport: i0, template: `<ng-content />`, isInline: true });
105
- }
106
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormFieldComponent, decorators: [{
107
- type: Component,
108
- args: [{
109
- selector: 'FormField',
110
- providers: [FormFieldContext],
111
- host: {
112
- '[class]': 'classes()',
113
- '[attr.data-orientation]': 'orientation()',
114
- '[attr.data-invalid]': 'ctx.invalid() ? "" : null',
115
- '[attr.role]': '"group"',
116
- },
117
- template: `<ng-content />`,
118
- }]
119
- }], ctorParameters: () => [], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }] } });
120
-
121
- class FormFieldsetComponent {
122
- class = input('', /* @ts-ignore */
123
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
124
- classes = computed(() => cn('block min-w-0 border-0 p-0 m-0', 'grid gap-4', this.class()), /* @ts-ignore */
125
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
126
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormFieldsetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
127
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: FormFieldsetComponent, isStandalone: true, selector: "FormFieldset, fieldset[FormFieldset]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
128
- }
129
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormFieldsetComponent, decorators: [{
130
- type: Component,
131
- args: [{
132
- selector: 'FormFieldset, fieldset[FormFieldset]',
133
- host: {
134
- '[class]': 'classes()',
135
- },
136
- template: `<ng-content />`,
137
- }]
138
- }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
139
-
140
- class FormLegendComponent {
141
- class = input('', /* @ts-ignore */
142
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
143
- variant = input('legend', /* @ts-ignore */
144
- ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
145
- classes = computed(() => cn('block min-w-0 text-foreground', this.variant() === 'label'
146
- ? 'text-sm font-medium leading-none'
147
- : 'text-sm font-semibold leading-none', this.class()), /* @ts-ignore */
148
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
149
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormLegendComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
150
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: FormLegendComponent, isStandalone: true, selector: "FormLegend, legend[FormLegend]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
151
- }
152
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormLegendComponent, decorators: [{
153
- type: Component,
154
- args: [{
155
- selector: 'FormLegend, legend[FormLegend]',
156
- host: {
157
- '[class]': 'classes()',
158
- },
159
- template: `<ng-content />`,
160
- }]
161
- }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }] } });
162
-
163
- class FormGroupComponent {
164
- class = input('', /* @ts-ignore */
165
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
166
- classes = computed(() => cn('block min-w-0', 'grid gap-6', this.class()), /* @ts-ignore */
167
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
168
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
169
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: FormGroupComponent, isStandalone: true, selector: "FormGroup", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
170
- }
171
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormGroupComponent, decorators: [{
172
- type: Component,
173
- args: [{
174
- selector: 'FormGroup',
175
- host: {
176
- '[class]': 'classes()',
177
- },
178
- template: `<ng-content />`,
179
- }]
180
- }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
181
-
182
- class FormSeparatorComponent {
183
- class = input('', /* @ts-ignore */
184
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
185
- classes = computed(() => cn('block min-w-0', 'flex items-center gap-3 text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground', 'before:h-px before:flex-1 before:bg-border after:h-px after:flex-1 after:bg-border', this.class()), /* @ts-ignore */
186
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
187
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormSeparatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
188
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: FormSeparatorComponent, isStandalone: true, selector: "FormSeparator", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<span class="shrink-0"><ng-content /></span>`, isInline: true });
189
- }
190
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormSeparatorComponent, decorators: [{
191
- type: Component,
192
- args: [{
193
- selector: 'FormSeparator',
194
- host: {
195
- '[class]': 'classes()',
196
- },
197
- template: `<span class="shrink-0"><ng-content /></span>`,
198
- }]
199
- }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
200
-
201
- class FormContentComponent {
202
- class = input('', /* @ts-ignore */
203
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
204
- classes = computed(() => cn('block min-w-0 flex-1', 'grid gap-1.5', this.class()), /* @ts-ignore */
205
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
206
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
207
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: FormContentComponent, isStandalone: true, selector: "FormContent", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
208
- }
209
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormContentComponent, decorators: [{
210
- type: Component,
211
- args: [{
212
- selector: 'FormContent',
213
- host: {
214
- '[class]': 'classes()',
215
- },
216
- template: `<ng-content />`,
217
- }]
218
- }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
219
-
220
- class FormTitleComponent {
221
- class = input('', /* @ts-ignore */
222
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
223
- classes = computed(() => cn('block text-sm font-medium leading-none text-foreground', this.class()), /* @ts-ignore */
224
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
225
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
226
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: FormTitleComponent, isStandalone: true, selector: "FormTitle", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
227
- }
228
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormTitleComponent, decorators: [{
229
- type: Component,
230
- args: [{
231
- selector: 'FormTitle',
232
- host: {
233
- '[class]': 'classes()',
234
- },
235
- template: `<ng-content />`,
236
- }]
237
- }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
238
-
239
- class FormLabelComponent {
240
- ctx = inject(FormFieldContext);
241
- class = input('', /* @ts-ignore */
242
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
243
- classes = computed(() => cn('text-sm font-medium leading-none', this.ctx.invalid() ? 'text-destructive' : 'text-foreground', 'peer-disabled:cursor-not-allowed peer-disabled:opacity-70', this.class()), /* @ts-ignore */
244
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
245
- ngOnInit() {
246
- // Let the control reference this label via aria-labelledby.
247
- this.ctx.hasLabel.set(true);
248
- }
249
- ngOnDestroy() {
250
- // Clear the flag on the way out, the way the description and message parts
251
- // do. A conditionally rendered label that is removed but leaves the flag set
252
- // points the control's aria-labelledby at an id no longer in the document,
253
- // which strips its accessible name instead of restoring it.
254
- this.ctx.hasLabel.set(false);
255
- }
256
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
257
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: FormLabelComponent, isStandalone: true, selector: "FormLabel, label[FormLabel]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.id": "ctx.labelId", "attr.for": "ctx.controlId" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
258
- }
259
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormLabelComponent, decorators: [{
260
- type: Component,
261
- args: [{
262
- selector: 'FormLabel, label[FormLabel]',
263
- host: {
264
- '[class]': 'classes()',
265
- '[attr.id]': 'ctx.labelId',
266
- '[attr.for]': 'ctx.controlId',
267
- },
268
- template: `<ng-content />`,
269
- }]
270
- }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
271
-
272
- class FormDescriptionComponent {
273
- ctx = inject(FormFieldContext, { optional: true });
274
- class = input('', /* @ts-ignore */
275
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
276
- classes = computed(() => cn('text-sm text-muted-foreground', this.class()), /* @ts-ignore */
277
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
278
- descriptionId = computed(() => this.ctx?.descriptionId ?? null, /* @ts-ignore */
279
- ...(ngDevMode ? [{ debugName: "descriptionId" }] : /* istanbul ignore next */ []));
280
- ngOnInit() {
281
- this.ctx?.hasDescription.set(true);
282
- }
283
- ngOnDestroy() {
284
- this.ctx?.hasDescription.set(false);
285
- }
286
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormDescriptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
287
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.6", type: FormDescriptionComponent, isStandalone: true, selector: "FormDescription, p[FormDescription]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.id": "descriptionId()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
288
- }
289
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormDescriptionComponent, decorators: [{
290
- type: Component,
291
- args: [{
292
- selector: 'FormDescription, p[FormDescription]',
293
- host: {
294
- '[class]': 'classes()',
295
- '[attr.id]': 'descriptionId()',
296
- },
297
- template: `<ng-content />`,
298
- }]
299
- }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
300
-
301
- const numericConstraint = (value, key) => value && typeof value === 'object' && key in value
302
- ? value[key]
303
- : undefined;
304
- /** Default human-readable messages for Angular's built-in validators. */
1
+ import * as i0 from "@angular/core";
2
+ import { Component, Directive, Service, booleanAttribute, computed, effect, inject, input, signal } from "@angular/core";
3
+ import { cn, injectUniqueId } from "@ojiepermana/angular/component/utils/core";
4
+ import { NgControl } from "@angular/forms";
5
+ var FormFieldContext = class FormFieldContext {
6
+ controlId = injectUniqueId("FormField");
7
+ labelId = `${this.controlId}-label`;
8
+ descriptionId = `${this.controlId}-description`;
9
+ messageId = `${this.controlId}-message`;
10
+ control = signal(null, ...ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []);
11
+ manualInvalid = signal(false, ...ngDevMode ? [{ debugName: "manualInvalid" }] : /* istanbul ignore next */ []);
12
+ hasLabel = signal(false, ...ngDevMode ? [{ debugName: "hasLabel" }] : /* istanbul ignore next */ []);
13
+ hasDescription = signal(false, ...ngDevMode ? [{ debugName: "hasDescription" }] : /* istanbul ignore next */ []);
14
+ hasMessage = signal(false, ...ngDevMode ? [{ debugName: "hasMessage" }] : /* istanbul ignore next */ []);
15
+ labelledBy = computed(() => this.hasLabel() ? this.labelId : null, ...ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []);
16
+ statusTick = signal(0, ...ngDevMode ? [{ debugName: "statusTick" }] : /* istanbul ignore next */ []);
17
+ invalid = computed(() => {
18
+ this.statusTick();
19
+ const c = this.control();
20
+ return this.manualInvalid() || !!c && c.invalid && (c.touched || c.dirty);
21
+ }, ...ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []);
22
+ firstError = computed(() => {
23
+ this.statusTick();
24
+ const c = this.control();
25
+ if (!c?.errors) return null;
26
+ const keys = Object.keys(c.errors);
27
+ return keys.length > 0 ? keys[0] : null;
28
+ }, ...ngDevMode ? [{ debugName: "firstError" }] : /* istanbul ignore next */ []);
29
+ describedBy = computed(() => {
30
+ const parts = [];
31
+ if (this.hasDescription()) parts.push(this.descriptionId);
32
+ if (this.hasMessage() && this.invalid()) parts.push(this.messageId);
33
+ return parts.length > 0 ? parts.join(" ") : null;
34
+ }, ...ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []);
35
+ constructor() {
36
+ effect((onCleanup) => {
37
+ const c = this.control();
38
+ if (!c) return;
39
+ const events = c.events;
40
+ if (!events) return;
41
+ const sub = events.subscribe(() => this.statusTick.update((n) => n + 1));
42
+ onCleanup(() => sub.unsubscribe());
43
+ });
44
+ }
45
+ static ɵfac = i0.ɵɵngDeclareFactory({
46
+ minVersion: "12.0.0",
47
+ version: "22.2.0",
48
+ ngImport: i0,
49
+ type: FormFieldContext,
50
+ deps: [],
51
+ target: i0.ɵɵFactoryTarget.Service
52
+ });
53
+ static ɵprov = i0.ɵɵngDeclareService({
54
+ minVersion: "22.0.0",
55
+ version: "22.2.0",
56
+ ngImport: i0,
57
+ type: FormFieldContext,
58
+ autoProvided: false
59
+ });
60
+ };
61
+ i0.ɵɵngDeclareClassMetadata({
62
+ minVersion: "12.0.0",
63
+ version: "22.2.0",
64
+ ngImport: i0,
65
+ type: FormFieldContext,
66
+ decorators: [{
67
+ type: Service,
68
+ args: [{ autoProvided: false }]
69
+ }],
70
+ ctorParameters: () => []
71
+ });
72
+ var FormFieldComponent = class FormFieldComponent {
73
+ ctx = inject(FormFieldContext);
74
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
75
+ orientation = input("vertical", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
76
+ invalid = input(false, {
77
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
78
+ transform: booleanAttribute
79
+ });
80
+ classes = computed(() => {
81
+ const orientation = this.orientation();
82
+ return cn("block min-w-0", orientation === "vertical" && "flex flex-col gap-2", orientation === "horizontal" && "flex items-start gap-3", orientation === "responsive" && "flex flex-col gap-3 sm:grid sm:grid-cols-[minmax(0,12rem)_minmax(0,1fr)] sm:items-start", this.class());
83
+ }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
84
+ constructor() {
85
+ effect(() => this.ctx.manualInvalid.set(this.invalid()));
86
+ }
87
+ static ɵfac = i0.ɵɵngDeclareFactory({
88
+ minVersion: "12.0.0",
89
+ version: "22.2.0",
90
+ ngImport: i0,
91
+ type: FormFieldComponent,
92
+ deps: [],
93
+ target: i0.ɵɵFactoryTarget.Component
94
+ });
95
+ static ɵcmp = i0.ɵɵngDeclareComponent({
96
+ minVersion: "17.1.0",
97
+ version: "22.2.0",
98
+ type: FormFieldComponent,
99
+ isStandalone: true,
100
+ selector: "FormField",
101
+ inputs: {
102
+ class: {
103
+ classPropertyName: "class",
104
+ publicName: "class",
105
+ isSignal: true,
106
+ isRequired: false,
107
+ transformFunction: null
108
+ },
109
+ orientation: {
110
+ classPropertyName: "orientation",
111
+ publicName: "orientation",
112
+ isSignal: true,
113
+ isRequired: false,
114
+ transformFunction: null
115
+ },
116
+ invalid: {
117
+ classPropertyName: "invalid",
118
+ publicName: "invalid",
119
+ isSignal: true,
120
+ isRequired: false,
121
+ transformFunction: null
122
+ }
123
+ },
124
+ host: { properties: {
125
+ "class": "classes()",
126
+ "attr.data-orientation": "orientation()",
127
+ "attr.data-invalid": "ctx.invalid() ? \"\" : null",
128
+ "attr.role": "\"group\""
129
+ } },
130
+ providers: [FormFieldContext],
131
+ ngImport: i0,
132
+ template: `<ng-content />`,
133
+ isInline: true
134
+ });
135
+ };
136
+ i0.ɵɵngDeclareClassMetadata({
137
+ minVersion: "12.0.0",
138
+ version: "22.2.0",
139
+ ngImport: i0,
140
+ type: FormFieldComponent,
141
+ decorators: [{
142
+ type: Component,
143
+ args: [{
144
+ selector: "FormField",
145
+ providers: [FormFieldContext],
146
+ host: {
147
+ "[class]": "classes()",
148
+ "[attr.data-orientation]": "orientation()",
149
+ "[attr.data-invalid]": "ctx.invalid() ? \"\" : null",
150
+ "[attr.role]": "\"group\""
151
+ },
152
+ template: `<ng-content />`
153
+ }]
154
+ }],
155
+ ctorParameters: () => [],
156
+ propDecorators: {
157
+ class: [{
158
+ type: i0.Input,
159
+ args: [{
160
+ isSignal: true,
161
+ alias: "class",
162
+ required: false
163
+ }]
164
+ }],
165
+ orientation: [{
166
+ type: i0.Input,
167
+ args: [{
168
+ isSignal: true,
169
+ alias: "orientation",
170
+ required: false
171
+ }]
172
+ }],
173
+ invalid: [{
174
+ type: i0.Input,
175
+ args: [{
176
+ isSignal: true,
177
+ alias: "invalid",
178
+ required: false
179
+ }]
180
+ }]
181
+ }
182
+ });
183
+ var FormFieldsetComponent = class FormFieldsetComponent {
184
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
185
+ classes = computed(() => cn("block min-w-0 border-0 p-0 m-0", "grid gap-4", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
186
+ static ɵfac = i0.ɵɵngDeclareFactory({
187
+ minVersion: "12.0.0",
188
+ version: "22.2.0",
189
+ ngImport: i0,
190
+ type: FormFieldsetComponent,
191
+ deps: [],
192
+ target: i0.ɵɵFactoryTarget.Component
193
+ });
194
+ static ɵcmp = i0.ɵɵngDeclareComponent({
195
+ minVersion: "17.1.0",
196
+ version: "22.2.0",
197
+ type: FormFieldsetComponent,
198
+ isStandalone: true,
199
+ selector: "FormFieldset, fieldset[FormFieldset]",
200
+ inputs: { class: {
201
+ classPropertyName: "class",
202
+ publicName: "class",
203
+ isSignal: true,
204
+ isRequired: false,
205
+ transformFunction: null
206
+ } },
207
+ host: { properties: { "class": "classes()" } },
208
+ ngImport: i0,
209
+ template: `<ng-content />`,
210
+ isInline: true
211
+ });
212
+ };
213
+ i0.ɵɵngDeclareClassMetadata({
214
+ minVersion: "12.0.0",
215
+ version: "22.2.0",
216
+ ngImport: i0,
217
+ type: FormFieldsetComponent,
218
+ decorators: [{
219
+ type: Component,
220
+ args: [{
221
+ selector: "FormFieldset, fieldset[FormFieldset]",
222
+ host: { "[class]": "classes()" },
223
+ template: `<ng-content />`
224
+ }]
225
+ }],
226
+ propDecorators: { class: [{
227
+ type: i0.Input,
228
+ args: [{
229
+ isSignal: true,
230
+ alias: "class",
231
+ required: false
232
+ }]
233
+ }] }
234
+ });
235
+ var FormLegendComponent = class FormLegendComponent {
236
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
237
+ variant = input("legend", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
238
+ classes = computed(() => cn("block min-w-0 text-foreground", this.variant() === "label" ? "text-sm font-medium leading-none" : "text-sm font-semibold leading-none", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
239
+ static ɵfac = i0.ɵɵngDeclareFactory({
240
+ minVersion: "12.0.0",
241
+ version: "22.2.0",
242
+ ngImport: i0,
243
+ type: FormLegendComponent,
244
+ deps: [],
245
+ target: i0.ɵɵFactoryTarget.Component
246
+ });
247
+ static ɵcmp = i0.ɵɵngDeclareComponent({
248
+ minVersion: "17.1.0",
249
+ version: "22.2.0",
250
+ type: FormLegendComponent,
251
+ isStandalone: true,
252
+ selector: "FormLegend, legend[FormLegend]",
253
+ inputs: {
254
+ class: {
255
+ classPropertyName: "class",
256
+ publicName: "class",
257
+ isSignal: true,
258
+ isRequired: false,
259
+ transformFunction: null
260
+ },
261
+ variant: {
262
+ classPropertyName: "variant",
263
+ publicName: "variant",
264
+ isSignal: true,
265
+ isRequired: false,
266
+ transformFunction: null
267
+ }
268
+ },
269
+ host: { properties: { "class": "classes()" } },
270
+ ngImport: i0,
271
+ template: `<ng-content />`,
272
+ isInline: true
273
+ });
274
+ };
275
+ i0.ɵɵngDeclareClassMetadata({
276
+ minVersion: "12.0.0",
277
+ version: "22.2.0",
278
+ ngImport: i0,
279
+ type: FormLegendComponent,
280
+ decorators: [{
281
+ type: Component,
282
+ args: [{
283
+ selector: "FormLegend, legend[FormLegend]",
284
+ host: { "[class]": "classes()" },
285
+ template: `<ng-content />`
286
+ }]
287
+ }],
288
+ propDecorators: {
289
+ class: [{
290
+ type: i0.Input,
291
+ args: [{
292
+ isSignal: true,
293
+ alias: "class",
294
+ required: false
295
+ }]
296
+ }],
297
+ variant: [{
298
+ type: i0.Input,
299
+ args: [{
300
+ isSignal: true,
301
+ alias: "variant",
302
+ required: false
303
+ }]
304
+ }]
305
+ }
306
+ });
307
+ var FormGroupComponent = class FormGroupComponent {
308
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
309
+ classes = computed(() => cn("block min-w-0", "grid gap-6", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
310
+ static ɵfac = i0.ɵɵngDeclareFactory({
311
+ minVersion: "12.0.0",
312
+ version: "22.2.0",
313
+ ngImport: i0,
314
+ type: FormGroupComponent,
315
+ deps: [],
316
+ target: i0.ɵɵFactoryTarget.Component
317
+ });
318
+ static ɵcmp = i0.ɵɵngDeclareComponent({
319
+ minVersion: "17.1.0",
320
+ version: "22.2.0",
321
+ type: FormGroupComponent,
322
+ isStandalone: true,
323
+ selector: "FormGroup",
324
+ inputs: { class: {
325
+ classPropertyName: "class",
326
+ publicName: "class",
327
+ isSignal: true,
328
+ isRequired: false,
329
+ transformFunction: null
330
+ } },
331
+ host: { properties: { "class": "classes()" } },
332
+ ngImport: i0,
333
+ template: `<ng-content />`,
334
+ isInline: true
335
+ });
336
+ };
337
+ i0.ɵɵngDeclareClassMetadata({
338
+ minVersion: "12.0.0",
339
+ version: "22.2.0",
340
+ ngImport: i0,
341
+ type: FormGroupComponent,
342
+ decorators: [{
343
+ type: Component,
344
+ args: [{
345
+ selector: "FormGroup",
346
+ host: { "[class]": "classes()" },
347
+ template: `<ng-content />`
348
+ }]
349
+ }],
350
+ propDecorators: { class: [{
351
+ type: i0.Input,
352
+ args: [{
353
+ isSignal: true,
354
+ alias: "class",
355
+ required: false
356
+ }]
357
+ }] }
358
+ });
359
+ var FormSeparatorComponent = class FormSeparatorComponent {
360
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
361
+ classes = computed(() => cn("block min-w-0", "flex items-center gap-3 text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground", "before:h-px before:flex-1 before:bg-border after:h-px after:flex-1 after:bg-border", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
362
+ static ɵfac = i0.ɵɵngDeclareFactory({
363
+ minVersion: "12.0.0",
364
+ version: "22.2.0",
365
+ ngImport: i0,
366
+ type: FormSeparatorComponent,
367
+ deps: [],
368
+ target: i0.ɵɵFactoryTarget.Component
369
+ });
370
+ static ɵcmp = i0.ɵɵngDeclareComponent({
371
+ minVersion: "17.1.0",
372
+ version: "22.2.0",
373
+ type: FormSeparatorComponent,
374
+ isStandalone: true,
375
+ selector: "FormSeparator",
376
+ inputs: { class: {
377
+ classPropertyName: "class",
378
+ publicName: "class",
379
+ isSignal: true,
380
+ isRequired: false,
381
+ transformFunction: null
382
+ } },
383
+ host: { properties: { "class": "classes()" } },
384
+ ngImport: i0,
385
+ template: `<span class="shrink-0"><ng-content /></span>`,
386
+ isInline: true
387
+ });
388
+ };
389
+ i0.ɵɵngDeclareClassMetadata({
390
+ minVersion: "12.0.0",
391
+ version: "22.2.0",
392
+ ngImport: i0,
393
+ type: FormSeparatorComponent,
394
+ decorators: [{
395
+ type: Component,
396
+ args: [{
397
+ selector: "FormSeparator",
398
+ host: { "[class]": "classes()" },
399
+ template: `<span class="shrink-0"><ng-content /></span>`
400
+ }]
401
+ }],
402
+ propDecorators: { class: [{
403
+ type: i0.Input,
404
+ args: [{
405
+ isSignal: true,
406
+ alias: "class",
407
+ required: false
408
+ }]
409
+ }] }
410
+ });
411
+ var FormContentComponent = class FormContentComponent {
412
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
413
+ classes = computed(() => cn("block min-w-0 flex-1", "grid gap-1.5", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
414
+ static ɵfac = i0.ɵɵngDeclareFactory({
415
+ minVersion: "12.0.0",
416
+ version: "22.2.0",
417
+ ngImport: i0,
418
+ type: FormContentComponent,
419
+ deps: [],
420
+ target: i0.ɵɵFactoryTarget.Component
421
+ });
422
+ static ɵcmp = i0.ɵɵngDeclareComponent({
423
+ minVersion: "17.1.0",
424
+ version: "22.2.0",
425
+ type: FormContentComponent,
426
+ isStandalone: true,
427
+ selector: "FormContent",
428
+ inputs: { class: {
429
+ classPropertyName: "class",
430
+ publicName: "class",
431
+ isSignal: true,
432
+ isRequired: false,
433
+ transformFunction: null
434
+ } },
435
+ host: { properties: { "class": "classes()" } },
436
+ ngImport: i0,
437
+ template: `<ng-content />`,
438
+ isInline: true
439
+ });
440
+ };
441
+ i0.ɵɵngDeclareClassMetadata({
442
+ minVersion: "12.0.0",
443
+ version: "22.2.0",
444
+ ngImport: i0,
445
+ type: FormContentComponent,
446
+ decorators: [{
447
+ type: Component,
448
+ args: [{
449
+ selector: "FormContent",
450
+ host: { "[class]": "classes()" },
451
+ template: `<ng-content />`
452
+ }]
453
+ }],
454
+ propDecorators: { class: [{
455
+ type: i0.Input,
456
+ args: [{
457
+ isSignal: true,
458
+ alias: "class",
459
+ required: false
460
+ }]
461
+ }] }
462
+ });
463
+ var FormTitleComponent = class FormTitleComponent {
464
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
465
+ classes = computed(() => cn("block text-sm font-medium leading-none text-foreground", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
466
+ static ɵfac = i0.ɵɵngDeclareFactory({
467
+ minVersion: "12.0.0",
468
+ version: "22.2.0",
469
+ ngImport: i0,
470
+ type: FormTitleComponent,
471
+ deps: [],
472
+ target: i0.ɵɵFactoryTarget.Component
473
+ });
474
+ static ɵcmp = i0.ɵɵngDeclareComponent({
475
+ minVersion: "17.1.0",
476
+ version: "22.2.0",
477
+ type: FormTitleComponent,
478
+ isStandalone: true,
479
+ selector: "FormTitle",
480
+ inputs: { class: {
481
+ classPropertyName: "class",
482
+ publicName: "class",
483
+ isSignal: true,
484
+ isRequired: false,
485
+ transformFunction: null
486
+ } },
487
+ host: { properties: { "class": "classes()" } },
488
+ ngImport: i0,
489
+ template: `<ng-content />`,
490
+ isInline: true
491
+ });
492
+ };
493
+ i0.ɵɵngDeclareClassMetadata({
494
+ minVersion: "12.0.0",
495
+ version: "22.2.0",
496
+ ngImport: i0,
497
+ type: FormTitleComponent,
498
+ decorators: [{
499
+ type: Component,
500
+ args: [{
501
+ selector: "FormTitle",
502
+ host: { "[class]": "classes()" },
503
+ template: `<ng-content />`
504
+ }]
505
+ }],
506
+ propDecorators: { class: [{
507
+ type: i0.Input,
508
+ args: [{
509
+ isSignal: true,
510
+ alias: "class",
511
+ required: false
512
+ }]
513
+ }] }
514
+ });
515
+ var FormLabelComponent = class FormLabelComponent {
516
+ ctx = inject(FormFieldContext);
517
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
518
+ classes = computed(() => cn("text-sm font-medium leading-none", this.ctx.invalid() ? "text-destructive" : "text-foreground", "peer-disabled:cursor-not-allowed peer-disabled:opacity-70", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
519
+ ngOnInit() {
520
+ this.ctx.hasLabel.set(true);
521
+ }
522
+ ngOnDestroy() {
523
+ this.ctx.hasLabel.set(false);
524
+ }
525
+ static ɵfac = i0.ɵɵngDeclareFactory({
526
+ minVersion: "12.0.0",
527
+ version: "22.2.0",
528
+ ngImport: i0,
529
+ type: FormLabelComponent,
530
+ deps: [],
531
+ target: i0.ɵɵFactoryTarget.Component
532
+ });
533
+ static ɵcmp = i0.ɵɵngDeclareComponent({
534
+ minVersion: "17.1.0",
535
+ version: "22.2.0",
536
+ type: FormLabelComponent,
537
+ isStandalone: true,
538
+ selector: "FormLabel, label[FormLabel]",
539
+ inputs: { class: {
540
+ classPropertyName: "class",
541
+ publicName: "class",
542
+ isSignal: true,
543
+ isRequired: false,
544
+ transformFunction: null
545
+ } },
546
+ host: { properties: {
547
+ "class": "classes()",
548
+ "attr.id": "ctx.labelId",
549
+ "attr.for": "ctx.controlId"
550
+ } },
551
+ ngImport: i0,
552
+ template: `<ng-content />`,
553
+ isInline: true
554
+ });
555
+ };
556
+ i0.ɵɵngDeclareClassMetadata({
557
+ minVersion: "12.0.0",
558
+ version: "22.2.0",
559
+ ngImport: i0,
560
+ type: FormLabelComponent,
561
+ decorators: [{
562
+ type: Component,
563
+ args: [{
564
+ selector: "FormLabel, label[FormLabel]",
565
+ host: {
566
+ "[class]": "classes()",
567
+ "[attr.id]": "ctx.labelId",
568
+ "[attr.for]": "ctx.controlId"
569
+ },
570
+ template: `<ng-content />`
571
+ }]
572
+ }],
573
+ propDecorators: { class: [{
574
+ type: i0.Input,
575
+ args: [{
576
+ isSignal: true,
577
+ alias: "class",
578
+ required: false
579
+ }]
580
+ }] }
581
+ });
582
+ var FormDescriptionComponent = class FormDescriptionComponent {
583
+ ctx = inject(FormFieldContext, { optional: true });
584
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
585
+ classes = computed(() => cn("text-sm text-muted-foreground", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
586
+ descriptionId = computed(() => this.ctx?.descriptionId ?? null, ...ngDevMode ? [{ debugName: "descriptionId" }] : /* istanbul ignore next */ []);
587
+ ngOnInit() {
588
+ this.ctx?.hasDescription.set(true);
589
+ }
590
+ ngOnDestroy() {
591
+ this.ctx?.hasDescription.set(false);
592
+ }
593
+ static ɵfac = i0.ɵɵngDeclareFactory({
594
+ minVersion: "12.0.0",
595
+ version: "22.2.0",
596
+ ngImport: i0,
597
+ type: FormDescriptionComponent,
598
+ deps: [],
599
+ target: i0.ɵɵFactoryTarget.Component
600
+ });
601
+ static ɵcmp = i0.ɵɵngDeclareComponent({
602
+ minVersion: "17.1.0",
603
+ version: "22.2.0",
604
+ type: FormDescriptionComponent,
605
+ isStandalone: true,
606
+ selector: "FormDescription, p[FormDescription]",
607
+ inputs: { class: {
608
+ classPropertyName: "class",
609
+ publicName: "class",
610
+ isSignal: true,
611
+ isRequired: false,
612
+ transformFunction: null
613
+ } },
614
+ host: { properties: {
615
+ "class": "classes()",
616
+ "attr.id": "descriptionId()"
617
+ } },
618
+ ngImport: i0,
619
+ template: `<ng-content />`,
620
+ isInline: true
621
+ });
622
+ };
623
+ i0.ɵɵngDeclareClassMetadata({
624
+ minVersion: "12.0.0",
625
+ version: "22.2.0",
626
+ ngImport: i0,
627
+ type: FormDescriptionComponent,
628
+ decorators: [{
629
+ type: Component,
630
+ args: [{
631
+ selector: "FormDescription, p[FormDescription]",
632
+ host: {
633
+ "[class]": "classes()",
634
+ "[attr.id]": "descriptionId()"
635
+ },
636
+ template: `<ng-content />`
637
+ }]
638
+ }],
639
+ propDecorators: { class: [{
640
+ type: i0.Input,
641
+ args: [{
642
+ isSignal: true,
643
+ alias: "class",
644
+ required: false
645
+ }]
646
+ }] }
647
+ });
648
+ const numericConstraint = (value, key) => value && typeof value === "object" && key in value ? value[key] : void 0;
305
649
  const defaultFormErrorMessageResolver = (errorKey, errorValue) => {
306
- switch (errorKey) {
307
- case 'required':
308
- return 'This field is required.';
309
- case 'requiredTrue':
310
- return 'This option must be selected.';
311
- case 'email':
312
- return 'Enter a valid email address.';
313
- case 'minlength':
314
- return `Enter at least ${numericConstraint(errorValue, 'requiredLength')} characters.`;
315
- case 'maxlength':
316
- return `Enter no more than ${numericConstraint(errorValue, 'requiredLength')} characters.`;
317
- case 'min':
318
- return `Enter a value greater than or equal to ${numericConstraint(errorValue, 'min')}.`;
319
- case 'max':
320
- return `Enter a value less than or equal to ${numericConstraint(errorValue, 'max')}.`;
321
- case 'pattern':
322
- return 'Enter a value in the required format.';
323
- default:
324
- return 'Enter a valid value.';
325
- }
650
+ switch (errorKey) {
651
+ case "required": return "This field is required.";
652
+ case "requiredTrue": return "This option must be selected.";
653
+ case "email": return "Enter a valid email address.";
654
+ case "minlength": return `Enter at least ${numericConstraint(errorValue, "requiredLength")} characters.`;
655
+ case "maxlength": return `Enter no more than ${numericConstraint(errorValue, "requiredLength")} characters.`;
656
+ case "min": return `Enter a value greater than or equal to ${numericConstraint(errorValue, "min")}.`;
657
+ case "max": return `Enter a value less than or equal to ${numericConstraint(errorValue, "max")}.`;
658
+ case "pattern": return "Enter a value in the required format.";
659
+ default: return "Enter a valid value.";
660
+ }
326
661
  };
327
-
328
- /**
329
- * Renders validation errors for the field's control.
330
- * By default, surfaces the first error key. Provide custom content to override.
331
- */
332
- class FormMessageComponent {
333
- ctx = inject(FormFieldContext);
334
- class = input('', /* @ts-ignore */
335
- ...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
336
- errorMessageResolver = input(defaultFormErrorMessageResolver, /* @ts-ignore */
337
- ...(ngDevMode ? [{ debugName: "errorMessageResolver" }] : /* istanbul ignore next */ []));
338
- show = computed(() => this.ctx.invalid(), /* @ts-ignore */
339
- ...(ngDevMode ? [{ debugName: "show" }] : /* istanbul ignore next */ []));
340
- message = computed(() => {
341
- const errorKey = this.ctx.firstError();
342
- const control = this.ctx.control();
343
- if (!errorKey) {
344
- return '';
345
- }
346
- return this.errorMessageResolver()(errorKey, control?.errors?.[errorKey], control);
347
- }, /* @ts-ignore */
348
- ...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
349
- classes = computed(() => cn('text-sm font-medium text-destructive', this.class()), /* @ts-ignore */
350
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
351
- ngOnInit() {
352
- this.ctx.hasMessage.set(true);
353
- }
354
- ngOnDestroy() {
355
- this.ctx.hasMessage.set(false);
356
- }
357
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
358
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.6", type: FormMessageComponent, isStandalone: true, selector: "FormMessage, p[FormMessage]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, errorMessageResolver: { classPropertyName: "errorMessageResolver", publicName: "errorMessageResolver", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.id": "ctx.messageId", "attr.role": "\"status\"" } }, ngImport: i0, template: `
662
+ var FormMessageComponent = class FormMessageComponent {
663
+ ctx = inject(FormFieldContext);
664
+ class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
665
+ errorMessageResolver = input(defaultFormErrorMessageResolver, ...ngDevMode ? [{ debugName: "errorMessageResolver" }] : /* istanbul ignore next */ []);
666
+ show = computed(() => this.ctx.invalid(), ...ngDevMode ? [{ debugName: "show" }] : /* istanbul ignore next */ []);
667
+ message = computed(() => {
668
+ const errorKey = this.ctx.firstError();
669
+ const control = this.ctx.control();
670
+ if (!errorKey) return "";
671
+ return this.errorMessageResolver()(errorKey, control?.errors?.[errorKey], control);
672
+ }, ...ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []);
673
+ classes = computed(() => cn("text-sm font-medium text-destructive", this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
674
+ ngOnInit() {
675
+ this.ctx.hasMessage.set(true);
676
+ }
677
+ ngOnDestroy() {
678
+ this.ctx.hasMessage.set(false);
679
+ }
680
+ static ɵfac = i0.ɵɵngDeclareFactory({
681
+ minVersion: "12.0.0",
682
+ version: "22.2.0",
683
+ ngImport: i0,
684
+ type: FormMessageComponent,
685
+ deps: [],
686
+ target: i0.ɵɵFactoryTarget.Component
687
+ });
688
+ static ɵcmp = i0.ɵɵngDeclareComponent({
689
+ minVersion: "17.0.0",
690
+ version: "22.2.0",
691
+ type: FormMessageComponent,
692
+ isStandalone: true,
693
+ selector: "FormMessage, p[FormMessage]",
694
+ inputs: {
695
+ class: {
696
+ classPropertyName: "class",
697
+ publicName: "class",
698
+ isSignal: true,
699
+ isRequired: false,
700
+ transformFunction: null
701
+ },
702
+ errorMessageResolver: {
703
+ classPropertyName: "errorMessageResolver",
704
+ publicName: "errorMessageResolver",
705
+ isSignal: true,
706
+ isRequired: false,
707
+ transformFunction: null
708
+ }
709
+ },
710
+ host: { properties: {
711
+ "class": "classes()",
712
+ "attr.id": "ctx.messageId",
713
+ "attr.role": "\"status\""
714
+ } },
715
+ ngImport: i0,
716
+ template: `
359
717
  @if (show()) {
360
718
  <ng-content>{{ message() }}</ng-content>
361
719
  }
362
- `, isInline: true });
363
- }
364
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormMessageComponent, decorators: [{
365
- type: Component,
366
- args: [{
367
- selector: 'FormMessage, p[FormMessage]',
368
- host: {
369
- '[class]': 'classes()',
370
- '[attr.id]': 'ctx.messageId',
371
- // One semantic, not two. `role="alert"` carries an implicit assertive live
372
- // region, so pairing it with aria-live="polite" asked screen readers to be
373
- // both interruptive and polite about the same message. A field error is
374
- // status about the field the user is working in, so it announces politely.
375
- '[attr.role]': '"status"',
376
- },
377
- template: `
720
+ `,
721
+ isInline: true
722
+ });
723
+ };
724
+ i0.ɵɵngDeclareClassMetadata({
725
+ minVersion: "12.0.0",
726
+ version: "22.2.0",
727
+ ngImport: i0,
728
+ type: FormMessageComponent,
729
+ decorators: [{
730
+ type: Component,
731
+ args: [{
732
+ selector: "FormMessage, p[FormMessage]",
733
+ host: {
734
+ "[class]": "classes()",
735
+ "[attr.id]": "ctx.messageId",
736
+ "[attr.role]": "\"status\""
737
+ },
738
+ template: `
378
739
  @if (show()) {
379
740
  <ng-content>{{ message() }}</ng-content>
380
741
  }
381
- `,
382
- }]
383
- }], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], errorMessageResolver: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessageResolver", required: false }] }] } });
384
-
385
- /**
386
- * Attach to the native form control inside a `<FormField>` to auto-wire:
387
- * - `id` ↔ `<FormLabel for>`
388
- * - `aria-describedby` ↔ description + error message
389
- * - `aria-invalid` ↔ control validity (after touch/dirty)
390
- *
391
- * @example
392
- * <FormField>
393
- * <FormLabel>Email</FormLabel>
394
- * <input Input FormControl [formControl]="email" />
395
- * <FormDescription>We'll never share it.</FormDescription>
396
- * <FormMessage />
397
- * </FormField>
398
- */
399
- class FormControlDirective {
400
- ctx = inject(FormFieldContext);
401
- ngControl = inject(NgControl, { optional: true, self: true });
402
- ngOnInit() {
403
- this.publishControl();
404
- }
405
- ngAfterViewInit() {
406
- // `formControlName` only assigns `.control` in FormControlName.ngOnChanges.
407
- // Whether that lands before this ngOnInit depends on directive *creation*
408
- // order: injecting NgControl in a field initializer (as above) instantiates
409
- // FormControlName early, which registers its hooks first and happens to make
410
- // the init read work today. Anything that moves that injection later — a lazy
411
- // `injector.get`, for instance — parks `null` in the FormField forever, and
412
- // the field can then never surface the control's invalid state. Re-resolving
413
- // here removes the dependence on that ordering accident.
414
- this.publishControl();
415
- }
416
- publishControl() {
417
- const control = this.ngControl?.control ?? null;
418
- if (control !== this.ctx.control()) {
419
- this.ctx.control.set(control);
420
- }
421
- }
422
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormControlDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
423
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.6", type: FormControlDirective, isStandalone: true, selector: "[FormControl]", host: { properties: { "attr.id": "ctx.controlId", "attr.aria-labelledby": "ctx.labelledBy()", "attr.aria-describedby": "ctx.describedBy()", "attr.aria-invalid": "ctx.invalid() ? \"true\" : null" } }, ngImport: i0 });
424
- }
425
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: FormControlDirective, decorators: [{
426
- type: Directive,
427
- args: [{
428
- selector: '[FormControl]',
429
- host: {
430
- '[attr.id]': 'ctx.controlId',
431
- '[attr.aria-labelledby]': 'ctx.labelledBy()',
432
- '[attr.aria-describedby]': 'ctx.describedBy()',
433
- '[attr.aria-invalid]': 'ctx.invalid() ? "true" : null',
434
- },
435
- }]
436
- }] });
437
-
438
- /**
439
- * Generated bundle index. Do not edit.
440
- */
441
-
442
- export { FormContentComponent, FormControlDirective, FormDescriptionComponent, FormFieldComponent, FormFieldContext, FormFieldsetComponent, FormGroupComponent, FormLabelComponent, FormLegendComponent, FormMessageComponent, FormSeparatorComponent, FormTitleComponent, defaultFormErrorMessageResolver };
742
+ `
743
+ }]
744
+ }],
745
+ propDecorators: {
746
+ class: [{
747
+ type: i0.Input,
748
+ args: [{
749
+ isSignal: true,
750
+ alias: "class",
751
+ required: false
752
+ }]
753
+ }],
754
+ errorMessageResolver: [{
755
+ type: i0.Input,
756
+ args: [{
757
+ isSignal: true,
758
+ alias: "errorMessageResolver",
759
+ required: false
760
+ }]
761
+ }]
762
+ }
763
+ });
764
+ var FormControlDirective = class FormControlDirective {
765
+ ctx = inject(FormFieldContext);
766
+ ngControl = inject(NgControl, {
767
+ optional: true,
768
+ self: true
769
+ });
770
+ ngOnInit() {
771
+ this.publishControl();
772
+ }
773
+ ngAfterViewInit() {
774
+ this.publishControl();
775
+ }
776
+ publishControl() {
777
+ const control = this.ngControl?.control ?? null;
778
+ if (control !== this.ctx.control()) this.ctx.control.set(control);
779
+ }
780
+ static ɵfac = i0.ɵɵngDeclareFactory({
781
+ minVersion: "12.0.0",
782
+ version: "22.2.0",
783
+ ngImport: i0,
784
+ type: FormControlDirective,
785
+ deps: [],
786
+ target: i0.ɵɵFactoryTarget.Directive
787
+ });
788
+ static ɵdir = i0.ɵɵngDeclareDirective({
789
+ minVersion: "14.0.0",
790
+ version: "22.2.0",
791
+ type: FormControlDirective,
792
+ isStandalone: true,
793
+ selector: "[FormControl]",
794
+ host: { properties: {
795
+ "attr.id": "ctx.controlId",
796
+ "attr.aria-labelledby": "ctx.labelledBy()",
797
+ "attr.aria-describedby": "ctx.describedBy()",
798
+ "attr.aria-invalid": "ctx.invalid() ? \"true\" : null"
799
+ } },
800
+ ngImport: i0
801
+ });
802
+ };
803
+ i0.ɵɵngDeclareClassMetadata({
804
+ minVersion: "12.0.0",
805
+ version: "22.2.0",
806
+ ngImport: i0,
807
+ type: FormControlDirective,
808
+ decorators: [{
809
+ type: Directive,
810
+ args: [{
811
+ selector: "[FormControl]",
812
+ host: {
813
+ "[attr.id]": "ctx.controlId",
814
+ "[attr.aria-labelledby]": "ctx.labelledBy()",
815
+ "[attr.aria-describedby]": "ctx.describedBy()",
816
+ "[attr.aria-invalid]": "ctx.invalid() ? \"true\" : null"
817
+ }
818
+ }]
819
+ }]
820
+ });
821
+ export { FormContentComponent, FormControlDirective, FormDescriptionComponent, FormFieldComponent, FormFieldContext, FormFieldsetComponent, FormGroupComponent, FormLabelComponent, FormLegendComponent, FormMessageComponent, FormSeparatorComponent, FormTitleComponent, defaultFormErrorMessageResolver };