@nanahoshi/mona-ui 0.27.2 → 0.28.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 (208) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/popup.md +1 -1
  3. package/docs/api/theme.md +2 -2
  4. package/docs/chart.md +14 -0
  5. package/docs/editor.md +2 -0
  6. package/docs/installation.md +147 -15
  7. package/docs/introduction.md +37 -15
  8. package/docs/theming-built-in-themes.md +67 -0
  9. package/docs/theming-custom-colors.md +274 -0
  10. package/docs/theming-custom-themes.md +168 -0
  11. package/docs/theming.md +164 -248
  12. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  13. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  14. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  15. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  16. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  17. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2070 -1573
  18. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  19. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  20. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  21. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  22. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  23. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  24. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  25. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  26. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  27. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  28. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  29. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  30. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  31. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  32. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  33. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  34. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  35. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  37. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  38. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  39. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  40. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  41. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  42. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  49. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  50. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  51. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  52. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  53. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  54. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  55. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  56. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  57. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  58. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  59. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  60. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  61. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  62. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  63. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  65. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  66. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  67. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  68. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  70. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  71. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  72. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  73. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  74. package/fesm2022/nanahoshi-mona-ui-locales.mjs +59 -77
  75. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  76. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  77. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  78. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  79. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  80. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  81. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  82. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  83. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  84. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  85. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  86. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  87. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  88. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  89. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  90. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  91. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  92. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  93. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  94. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  95. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  96. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  97. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  98. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  99. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  100. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  101. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  102. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  103. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  104. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  105. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  106. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  107. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  108. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  109. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  110. package/llms.txt +6 -2
  111. package/package.json +62 -23
  112. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  113. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  114. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  115. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  116. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  117. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  118. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  119. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  120. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  121. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  122. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  123. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  124. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  125. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  126. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  127. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  128. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  129. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  130. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  131. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  132. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  133. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  134. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  135. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  136. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  137. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  138. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  139. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  140. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  141. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  142. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  143. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  144. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  145. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  146. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  147. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  148. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  149. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  150. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  151. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  152. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  153. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  154. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  155. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  156. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  157. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  158. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  159. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  168. package/types/nanahoshi-mona-ui-locales.d.ts +17 -19
  169. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  170. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  171. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  172. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  173. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  174. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  175. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  176. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  177. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  178. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  179. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  180. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  181. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  182. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  183. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  184. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  185. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  186. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  187. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  188. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  189. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  190. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  191. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  192. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  193. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  194. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  195. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  196. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  197. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  198. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  199. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  200. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  201. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  202. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  203. package/types/nanahoshi-mona-ui.d.ts +1 -2
  204. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  205. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  206. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  207. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  208. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,25 +1,19 @@
1
- import { NgTemplateOutlet } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { inject, DestroyRef, ElementRef, signal, computed, contentChild, TemplateRef, viewChild, input, booleanAttribute, output, model, effect, untracked, afterNextRender, forwardRef, Component } from '@angular/core';
4
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
- import { FilterChangeEvent } from '@nanahoshi/mona-ui/common';
6
- import * as i1 from '@nanahoshi/mona-ui/dropdowns';
7
- import { DropdownListService, DropdownService, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, dropdownPopupThemeVariants, DropdownNoDataTemplateDirective, DropdownPrefixTemplateDirective, DROPDOWN_DATA_INPUT_TOKEN, DROPDOWN_POPUP_INPUT_TOKEN, DropdownDataHandlerDirective, DropdownListPopupHandlerDirective, DropdownLiveRegionDirective } from '@nanahoshi/mona-ui/dropdowns';
8
- import { themeControlSurfaceClasses, injectEffectiveDisabled, createElementControlId } from '@nanahoshi/mona-ui/internal';
9
- import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
10
- import { ListService, ListComponent, ListGroupHeaderTemplateDirective, ListFooterTemplateDirective, ListHeaderTemplateDirective, ListNoDataTemplateDirective, ListItemTemplateDirective } from '@nanahoshi/mona-ui/internal/list';
11
- import { TextBoxDirective } from '@nanahoshi/mona-ui/text-box';
12
- import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
13
- import { Subject, debounceTime, filter, take, tap } from 'rxjs';
14
- import { twMerge } from 'tailwind-merge';
15
- import { cva } from 'class-variance-authority';
16
-
17
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
18
- // Edit the JSON file and run `npm run generate:locale-catalogs`.
19
- const COMBO_BOX_DEFAULT_MESSAGES = {
20
- clear: "Clear"
21
- };
22
-
1
+ import { NgTemplateOutlet } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { Component, DestroyRef, ElementRef, TemplateRef, afterNextRender, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
4
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
5
+ import { FilterChangeEvent } from "@nanahoshi/mona-ui/common";
6
+ import * as i1 from "@nanahoshi/mona-ui/dropdowns";
7
+ import { DROPDOWN_DATA_INPUT_TOKEN, DROPDOWN_POPUP_INPUT_TOKEN, DropdownDataHandlerDirective, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, DropdownListPopupHandlerDirective, DropdownListService, DropdownLiveRegionDirective, DropdownNoDataTemplateDirective, DropdownPrefixTemplateDirective, DropdownService, dropdownPopupThemeVariants } from "@nanahoshi/mona-ui/dropdowns";
8
+ import { createElementControlId, injectEffectiveDisabled, themeControlSurfaceClasses } from "@nanahoshi/mona-ui/internal";
9
+ import { IndicatorIconComponent } from "@nanahoshi/mona-ui/internal/indicator-icon";
10
+ import { ListComponent, ListFooterTemplateDirective, ListGroupHeaderTemplateDirective, ListHeaderTemplateDirective, ListItemTemplateDirective, ListNoDataTemplateDirective, ListService } from "@nanahoshi/mona-ui/internal/list";
11
+ import { TextBoxDirective } from "@nanahoshi/mona-ui/text-box";
12
+ import { MonaI18nService } from "@nanahoshi/mona-ui/i18n";
13
+ import { Subject, debounceTime, filter, take, tap } from "rxjs";
14
+ import { twMerge } from "tailwind-merge";
15
+ import { cva } from "class-variance-authority";
16
+ const COMBO_BOX_DEFAULT_MESSAGES = { clear: "Clear" };
23
17
  const comboBoxBaseThemeVariants = cva(`
24
18
  flex items-center
25
19
  cursor-pointer
@@ -29,734 +23,1179 @@ const comboBoxBaseThemeVariants = cva(`
29
23
  data-[readonly='true']:cursor-default
30
24
  focus-within:border-focus-indicator focus-within:ring-2 focus-within:ring-focus-indicator/35
31
25
  `, {
32
- variants: {
33
- disabled: {
34
- true: `
26
+ variants: {
27
+ disabled: { true: `
35
28
  pointer-events-none cursor-not-allowed
36
29
  bg-disabled-background text-disabled-foreground
37
30
  border-disabled-border shadow-none
38
- `
39
- },
40
- focused: {
41
- true: "border-focus-indicator ring-2 ring-focus-indicator/35"
42
- },
43
- invalid: {
44
- true: "border-error ring-2 ring-error/35 focus-within:border-error focus-within:ring-error/35",
45
- false: ""
46
- },
47
- rounded: {
48
- none: "rounded-none",
49
- small: "rounded-sm",
50
- medium: "rounded-md",
51
- large: "rounded-lg",
52
- full: "rounded-full"
53
- },
54
- size: {
55
- small: "h-8 text-xs",
56
- medium: "h-9 text-sm",
57
- large: "h-10 text-base"
58
- }
59
- },
60
- compoundVariants: [
61
- {
62
- focused: true,
63
- invalid: true,
64
- class: "border-error ring-error/35"
65
- }
66
- ],
67
- defaultVariants: {
68
- disabled: false,
69
- focused: false,
70
- invalid: false,
71
- rounded: "medium",
72
- size: "medium"
73
- }
31
+ ` },
32
+ focused: { true: "border-focus-indicator ring-2 ring-focus-indicator/35" },
33
+ invalid: {
34
+ true: "border-error ring-2 ring-error/35 focus-within:border-error focus-within:ring-error/35",
35
+ false: ""
36
+ },
37
+ rounded: {
38
+ none: "rounded-none",
39
+ small: "rounded-sm",
40
+ medium: "rounded-md",
41
+ large: "rounded-lg",
42
+ full: "rounded-full"
43
+ },
44
+ size: {
45
+ small: "h-8 text-xs",
46
+ medium: "h-9 text-sm",
47
+ large: "h-10 text-base"
48
+ }
49
+ },
50
+ compoundVariants: [{
51
+ focused: true,
52
+ invalid: true,
53
+ class: "border-error ring-error/35"
54
+ }],
55
+ defaultVariants: {
56
+ disabled: false,
57
+ focused: false,
58
+ invalid: false,
59
+ rounded: "medium",
60
+ size: "medium"
61
+ }
74
62
  });
75
63
  const comboBoxTextInputThemeVariants = cva(`
76
64
  h-full w-full px-2 text-ellipsis
77
65
  bg-transparent border-none shadow-none outline-none focus-visible:outline-hidden
78
66
  focus-within:ring-0 focus-within:shadow-none
79
67
  focus-visible:ring-0 focus-visible:shadow-none
80
- `, {
81
- variants: {
82
- rounded: {
83
- none: "rounded-none",
84
- small: "rounded-sm",
85
- medium: "rounded-md",
86
- large: "rounded-lg",
87
- full: "rounded-full px-3"
88
- }
89
- }
90
- });
68
+ `, { variants: { rounded: {
69
+ none: "rounded-none",
70
+ small: "rounded-sm",
71
+ medium: "rounded-md",
72
+ large: "rounded-lg",
73
+ full: "rounded-full px-3"
74
+ } } });
91
75
  const comboBoxAffixContainerThemeVariants = cva(`flex h-full flex-none items-center justify-center`);
92
-
93
- class ComboBoxComponent {
94
- #destroyRef;
95
- #dropdownListService;
96
- #dropdownService;
97
- #hostElementRef;
98
- #i18n;
99
- #listService;
100
- #popupRef;
101
- #userNavigatedViaArrows;
102
- constructor() {
103
- this.#destroyRef = inject(DestroyRef);
104
- this.#dropdownListService = inject(DropdownListService);
105
- this.#dropdownService = inject(DropdownService);
106
- this.#hostElementRef = inject(ElementRef);
107
- this.#i18n = inject(MonaI18nService);
108
- this.#listService = inject(ListService);
109
- this.#popupRef = this.#dropdownService.popupRef;
110
- this.#userNavigatedViaArrows = signal(false, /* @ts-ignore */
111
- ...(ngDevMode ? [{ debugName: "#userNavigatedViaArrows" }] : /* istanbul ignore next */ []));
112
- this.activeDescendant = computed(() => {
113
- const highlightedItem = this.#listService.highlightedItem();
114
- return highlightedItem ? highlightedItem.uid : null;
115
- }, /* @ts-ignore */
116
- ...(ngDevMode ? [{ debugName: "activeDescendant" }] : /* istanbul ignore next */ []));
117
- this.affixClass = computed(() => {
118
- return comboBoxAffixContainerThemeVariants();
119
- }, /* @ts-ignore */
120
- ...(ngDevMode ? [{ debugName: "affixClass" }] : /* istanbul ignore next */ []));
121
- this.baseClass = computed(() => {
122
- const disabled = this.effectiveDisabled();
123
- const focused = this.#popupRef() != null;
124
- const invalid = this.invalidState();
125
- const rounded = this.rounded();
126
- const size = this.size();
127
- const variantClass = comboBoxBaseThemeVariants({ disabled, focused, invalid, rounded, size });
128
- const userClass = this.userClass();
129
- return twMerge(variantClass, userClass);
130
- }, /* @ts-ignore */
131
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
132
- this.clearButtonVisible = computed(() => this.showClearButton() &&
133
- this.selectedListItem() != null &&
134
- !this.loading() &&
135
- !this.effectiveDisabled() &&
136
- !this.readonly(), /* @ts-ignore */
137
- ...(ngDevMode ? [{ debugName: "clearButtonVisible" }] : /* istanbul ignore next */ []));
138
- this.comboBoxValue = signal("", /* @ts-ignore */
139
- ...(ngDevMode ? [{ debugName: "comboBoxValue" }] : /* istanbul ignore next */ []));
140
- this.comboBoxValue$ = new Subject();
141
- this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
142
- this.expanded = computed(() => this.#popupRef() !== null, /* @ts-ignore */
143
- ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
144
- this.footerTemplate = contentChild(DropdownFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
145
- this.groupHeaderTemplate = contentChild(DropdownGroupHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "groupHeaderTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
146
- this.headerTemplate = contentChild(DropdownHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "headerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
147
- this.inputClass = computed(() => {
148
- const rounded = this.rounded();
149
- return comboBoxTextInputThemeVariants({ rounded });
150
- }, /* @ts-ignore */
151
- ...(ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []));
152
- this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && this.value() == null)), /* @ts-ignore */
153
- ...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
154
- this.itemTemplate = contentChild(DropdownItemTemplateDirective, { ...(ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
155
- this.listId = createElementControlId();
156
- this.listPopupClass = computed(() => {
157
- const rounded = this.rounded();
158
- const size = this.size();
159
- const userClass = this.popupClass();
160
- const variantClass = dropdownPopupThemeVariants({ rounded, size });
161
- // With a popupHeight, the overlay sets the limit; the default max-h-64 would cut a taller popup short.
162
- const heightClass = this.popupHeight() ? "max-h-none" : "";
163
- return twMerge(variantClass, heightClass, userClass);
164
- }, /* @ts-ignore */
165
- ...(ngDevMode ? [{ debugName: "listPopupClass" }] : /* istanbul ignore next */ []));
166
- this.messages = this.#i18n.componentMessages("comboBox", COMBO_BOX_DEFAULT_MESSAGES);
167
- this.noDataTemplate = contentChild(DropdownNoDataTemplateDirective, { ...(ngDevMode ? { debugName: "noDataTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
168
- this.popupTemplate = viewChild.required("popupTemplate", /* @ts-ignore */
169
- ...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
170
- this.prefixTemplate = contentChild(DropdownPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
171
- this.selectableOptions = {
172
- enabled: true,
173
- mode: "single",
174
- toggleable: false
175
- };
176
- this.selectedListItem = computed(() => {
177
- return this.#listService.selectedListItems().firstOrDefault();
178
- }, /* @ts-ignore */
179
- ...(ngDevMode ? [{ debugName: "selectedListItem" }] : /* istanbul ignore next */ []));
180
- this.valueText = computed(() => {
181
- const listItem = this.selectedListItem();
182
- if (!listItem) {
183
- return "";
184
- }
185
- return this.#listService.getItemText(listItem);
186
- }, /* @ts-ignore */
187
- ...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
188
- /**
189
- * @description Allows a custom value to be committed when it doesn't match any item in {@link data}.
190
- * @default false
191
- */
192
- this.allowCustomValue = input(false, { ...(ngDevMode ? { debugName: "allowCustomValue" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
193
- /**
194
- * @description ID of an element that provides an extended description for the input.
195
- * @default ""
196
- */
197
- this.ariaDescribedBy = input("", { ...(ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {}), alias: "aria-describedby" });
198
- /**
199
- * @description Accessible name for the input. Describe what the combo box represents. Prefer a visible label,
200
- * linked through {@link inputId} or `aria-labelledby`; without any of them, browsers fall back to the
201
- * {@link placeholder}.
202
- * @default ""
203
- */
204
- this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
205
- /**
206
- * @description ID of an external element that provides the accessible name for the input.
207
- * @default ""
208
- */
209
- this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
210
- /**
211
- * @description Emitted when the popup is about to close. This event is preventable.
212
- */
213
- // eslint-disable-next-line @angular-eslint/no-output-native -- renaming the output would break existing (close) bindings
214
- this.close = output();
215
- /**
216
- * @description Emitted after the popup is closed.
217
- */
218
- this.closed = output();
219
- /**
220
- * @description Collection of items to render.
221
- * @default []
222
- */
223
- this.data = input([], /* @ts-ignore */
224
- ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
225
- /**
226
- * @description Renders the component with reduced visual emphasis and removes pointer interaction.
227
- * @default false
228
- */
229
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
230
- /**
231
- * @description Id of the inner `<input>` element. Point a `<label for>` or `<mona-label for>` at it to label the
232
- * combo box. A unique id is generated when it isn't set.
233
- * @default generated
234
- */
235
- this.inputId = input(createElementControlId(), /* @ts-ignore */
236
- ...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
237
- /**
238
- * @description Marks the combo box as invalid. When bound to a signal form field via `[formField]`,
239
- * this is written by the `FormField` directive.
240
- * @default false
241
- */
242
- this.invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
243
- /**
244
- * @description A predicate function or the name of the field that determines whether an item is disabled.
245
- * @default undefined
246
- */
247
- this.itemDisabled = input(/* @ts-ignore */
248
- ...(ngDevMode ? [undefined, { debugName: "itemDisabled" }] : /* istanbul ignore next */ []));
249
- /**
250
- * @description Shows a loading indicator, in place of the clear button, and marks the field busy. It doesn't
251
- * block interaction: the field stays usable while data loads.
252
- * @default false
253
- */
254
- this.loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
255
- /**
256
- * @description Emitted when the popup is about to open. This event is preventable.
257
- */
258
- this.open = output();
259
- /**
260
- * @description Emitted after the popup is opened.
261
- */
262
- this.opened = output();
263
- /**
264
- * @description Placeholder text shown when no value is selected or entered.
265
- * @default ""
266
- */
267
- this.placeholder = input("", /* @ts-ignore */
268
- ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
269
- /**
270
- * @description Sets the class of the popup element.
271
- * @default ""
272
- */
273
- this.popupClass = input("", /* @ts-ignore */
274
- ...(ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []));
275
- /**
276
- * @description Maximum height of the popup, in pixels or as a CSS length. Shorter lists shrink to fit. When
277
- * unset, the popup is at most 200 pixels tall.
278
- * @default null
279
- */
280
- this.popupHeight = input(null, /* @ts-ignore */
281
- ...(ngDevMode ? [{ debugName: "popupHeight" }] : /* istanbul ignore next */ []));
282
- /**
283
- * @description Sets the width of the popup element.
284
- * @default null
285
- */
286
- this.popupWidth = input(null, /* @ts-ignore */
287
- ...(ngDevMode ? [{ debugName: "popupWidth" }] : /* istanbul ignore next */ []));
288
- /**
289
- * @description Prevents value changes while preserving the component's visual state.
290
- * @default false
291
- */
292
- this.readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
293
- /**
294
- * @description Sets the required state of the combo box component.
295
- * @default false
296
- */
297
- this.required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
298
- /**
299
- * @description Border-radius preset applied to the component.
300
- * @default "medium"
301
- */
302
- this.rounded = input("medium", /* @ts-ignore */
303
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
304
- /**
305
- * @description Displays a button that resets the value to empty when an item is selected.
306
- * @default false
307
- */
308
- this.showClearButton = input(false, { ...(ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
309
- /**
310
- * @description Size preset controlling the component's dimensions.
311
- * @default "medium"
312
- */
313
- this.size = input("medium", /* @ts-ignore */
314
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
315
- /**
316
- * @description Property name or accessor used to derive the display text from a data item.
317
- * If not set, the item itself is used as the text representation.
318
- * @default undefined
319
- */
320
- this.textField = input(/* @ts-ignore */
321
- ...(ngDevMode ? [undefined, { debugName: "textField" }] : /* istanbul ignore next */ []));
322
- /**
323
- * @description Emitted when focus leaves the combo box. Moving between its input, clear button and popup doesn't
324
- * count. The `FormField` directive listens to this to mark the field as touched.
325
- */
326
- this.touch = output();
327
- /**
328
- * @description Sets the touched state of the combo box. When bound to a signal form field via `[formField]`,
329
- * this is written by the `FormField` directive.
330
- * @default false
331
- */
332
- this.touched = input(false, { ...(ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
333
- /**
334
- * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
335
- * @default ""
336
- */
337
- this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
338
- /**
339
- * @description Two-way bindable current selected value. Implements `FormValueControl<TValue | null>`,
340
- * enabling signal forms `[formField]` binding.
341
- * Object mode returns the selected data item; primitive mode (see {@link valuePrimitive}) returns the value
342
- * resolved through {@link valueField}. `null` represents no selection.
343
- * @default null
344
- */
345
- this.value = model(null, /* @ts-ignore */
346
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
347
- /**
348
- * @description Emitted with the entered text when the user presses Enter on text that matches no item, or leaves
349
- * the field with it. Only emitted when {@link allowCustomValue} is true.
350
- */
351
- this.valueAdd = output();
352
- /**
353
- * @description Property name or accessor used to derive the value from a data item.
354
- * It is used for stable item identity, matching externally supplied values, and primitive
355
- * value projection when {@link valuePrimitive} is enabled.
356
- * When omitted, the item itself is used as the value representation.
357
- * Should resolve to a stable, unique scalar.
358
- * @default undefined
359
- */
360
- this.valueField = input(/* @ts-ignore */
361
- ...(ngDevMode ? [undefined, { debugName: "valueField" }] : /* istanbul ignore next */ []));
362
- /**
363
- * @description Determines whether the bound value contains complete data items
364
- * or values extracted through {@link valueField}.
365
- *
366
- * When `false`, selecting an item writes the complete data item.
367
- * When `true`, selecting an item writes the value resolved through `valueField`.
368
- *
369
- * @default false
370
- */
371
- this.valuePrimitive = input(false, { ...(ngDevMode ? { debugName: "valuePrimitive" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
372
- effect(() => {
373
- const popupTemplate = this.popupTemplate();
374
- untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
375
- });
376
- effect(() => {
377
- const value = this.value();
378
- const valueField = this.valueField();
379
- this.valuePrimitive();
380
- this.selectedListItem();
381
- untracked(() => {
382
- this.#listService.setValueField(valueField ?? "");
383
- this.synchronizeSelection(value);
384
- this.comboBoxValue.set(this.valueText());
385
- });
386
- });
387
- afterNextRender({
388
- read: () => {
389
- this.initialize();
390
- this.setSubscriptions();
391
- }
392
- });
393
- }
394
- /**
395
- * @description Moves focus to the inner input. The caret goes to the end of the text.
396
- * @param options Passed to `HTMLElement.focus()`, for example `{ preventScroll: true }`.
397
- */
398
- focus(options) {
399
- const input = this.#hostElementRef.nativeElement.querySelector("input");
400
- if (input) {
401
- input.focus(options);
402
- input.setSelectionRange(input.value.length, input.value.length);
403
- }
404
- }
405
- onFocusOut(event) {
406
- // Removing a focused dropdown from the page fires focusout after it is destroyed.
407
- if (this.#destroyRef.destroyed) {
408
- return;
409
- }
410
- const nextTarget = event.relatedTarget;
411
- if (nextTarget instanceof Node) {
412
- const popupElement = this.#dropdownService.popupRef()?.overlayRef.overlayElement;
413
- if (this.#hostElementRef.nativeElement.contains(nextTarget) || popupElement?.contains(nextTarget)) {
414
- return;
415
- }
416
- }
417
- this.resolveText();
418
- this.touch.emit();
419
- }
420
- onHostPointerDown(event) {
421
- // A press on the padding, the affixes or the arrow focuses the input instead of the host. Controls of
422
- // their own (the input, the clear button, links or buttons in a prefix) keep the press.
423
- const host = this.#hostElementRef.nativeElement;
424
- const target = event.target;
425
- const control = target?.closest("a, button, input, select, textarea, [tabindex]");
426
- if (this.effectiveDisabled() || (control != null && control !== host)) {
427
- return;
428
- }
429
- event.preventDefault();
430
- host.querySelector("input")?.focus();
431
- }
432
- onInput(text) {
433
- // Keep the signal in step with the input on every keystroke, so that writing the same text back (a revert to
434
- // the selected item's text, say) still reaches the DOM through the [value] binding.
435
- this.comboBoxValue.set(text);
436
- this.comboBoxValue$.next(text);
437
- }
438
- onItemSelect(event) {
439
- if (this.#listService.filterableOptions().enabled &&
440
- event.source.via === "keyboard" &&
441
- event.source.key !== "Enter") {
442
- return;
443
- }
444
- this.updateValue(this.getControlValue(event.item.data));
445
- this.closePopup();
446
- }
447
- onPopupPointerDown(event) {
448
- const target = event.target;
449
- if (target?.tagName !== "INPUT") {
450
- event.preventDefault();
451
- }
452
- }
453
- onValueClear(event) {
454
- if (this.effectiveDisabled() ||
455
- this.readonly() ||
456
- (event instanceof KeyboardEvent && event.key !== "Enter" && event.key !== " ")) {
457
- return;
458
- }
459
- event.preventDefault();
460
- event.stopImmediatePropagation();
461
- this.updateValue(null);
462
- this.#listService.clearSelections();
463
- this.comboBoxValue.set("");
464
- this.focus();
465
- }
466
- clear() {
467
- this.updateValue(null);
468
- this.comboBoxValue.set("");
469
- this.#listService.clearSelections();
470
- this.#listService.clearFilter();
471
- }
472
- closePopup() {
473
- this.#popupRef()?.close();
474
- }
475
- getControlValue(dataItem) {
476
- const value = this.valuePrimitive() ? this.#listService.getDataItemValue(dataItem) : dataItem;
477
- return value;
478
- }
479
- handleEnterKey() {
480
- const comboBoxText = this.comboBoxValue();
481
- const highlightedItem = this.#listService.highlightedItem();
482
- if (this.#userNavigatedViaArrows() && highlightedItem) {
483
- this.selectItem(highlightedItem);
484
- return;
485
- }
486
- if (!this.allowCustomValue()) {
487
- if (highlightedItem) {
488
- const highlightedText = this.#listService.getItemText(highlightedItem);
489
- if (highlightedText.toLowerCase() === comboBoxText.toLowerCase()) {
490
- this.selectItem(highlightedItem);
491
- }
492
- else {
493
- const matchingItem = this.#listService.getMatchingFilteredItem(comboBoxText);
494
- if (matchingItem) {
495
- this.selectItem(matchingItem);
496
- }
497
- else {
498
- this.clear();
499
- }
500
- }
501
- }
502
- else {
503
- const matchingItem = this.#listService.getMatchingFilteredItem(comboBoxText);
504
- if (matchingItem) {
505
- this.selectItem(matchingItem);
506
- }
507
- else {
508
- this.clear();
509
- }
510
- }
511
- }
512
- else {
513
- if (highlightedItem) {
514
- const highlightedText = this.#listService.getItemText(highlightedItem);
515
- if (highlightedText.toLowerCase() === comboBoxText.toLowerCase()) {
516
- this.selectItem(highlightedItem);
517
- }
518
- else if (comboBoxText) {
519
- this.valueAdd.emit(comboBoxText);
520
- }
521
- }
522
- else if (comboBoxText) {
523
- this.valueAdd.emit(comboBoxText);
524
- }
525
- }
526
- }
527
- initialize() {
528
- this.#listService.setNavigableOptions({ enabled: true, mode: "highlight" });
529
- this.#listService.setSelectableOptions(this.selectableOptions);
530
- this.#listService.filterInputVisible.set(false);
531
- this.comboBoxValue.set(this.valueText());
532
- }
533
- notifyFilterChange(filter) {
534
- const event = new FilterChangeEvent(filter);
535
- this.#listService.filterChange$.next(event);
536
- return event;
537
- }
538
- /**
539
- * Settles typed text when focus leaves the combo box, so the field never shows text that isn't its value:
540
- * an item whose text matches is selected, empty text clears the value, other text is offered through
541
- * `valueAdd` when custom values are allowed, and otherwise the selected item's text comes back.
542
- */
543
- resolveText() {
544
- // Read the input itself: with a filter debounce, the last keystrokes may not have reached comboBoxValue yet.
545
- const input = this.#hostElementRef.nativeElement.querySelector("input");
546
- const text = input?.value ?? this.comboBoxValue();
547
- this.comboBoxValue.set(text);
548
- const selectedItem = this.selectedListItem();
549
- const selectedText = selectedItem ? this.#listService.getItemText(selectedItem) : "";
550
- if (text === selectedText) {
551
- return;
552
- }
553
- if (!text) {
554
- this.clear();
555
- return;
556
- }
557
- const matchingItem = this.#listService.getMatchingFilteredItem(text);
558
- if (matchingItem && this.#listService.getItemText(matchingItem).toLowerCase() === text.toLowerCase()) {
559
- this.selectItem(matchingItem);
560
- return;
561
- }
562
- if (this.allowCustomValue()) {
563
- this.valueAdd.emit(text);
564
- return;
565
- }
566
- this.comboBoxValue.set(selectedText);
567
- }
568
- selectItem(item) {
569
- this.#listService.selectItem(item);
570
- this.updateValue(this.getControlValue(item.data));
571
- }
572
- setArrowNavigationSubscription() {
573
- this.#dropdownListService.navigate$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(({ item }) => {
574
- if (!this.expanded()) {
575
- this.#listService.selectItem(item);
576
- this.updateValue(this.getControlValue(item.data));
577
- }
578
- else {
579
- this.#userNavigatedViaArrows.set(true);
580
- }
581
- });
582
- }
583
- setComboboxValueSubscription() {
584
- this.comboBoxValue$
585
- .pipe(takeUntilDestroyed(this.#destroyRef), debounceTime(this.#listService.getFilterDebounceDuration()), filter(value => value !== null))
586
- .subscribe(value => {
587
- this.#userNavigatedViaArrows.set(false);
588
- if (this.#listService.isFilteringEnabled()) {
589
- const event = this.notifyFilterChange(value);
590
- if (event.isDefaultPrevented()) {
591
- return;
592
- }
593
- if (value) {
594
- this.#listService.setFilter(value);
595
- }
596
- else {
597
- this.#listService.clearFilter();
598
- }
599
- }
600
- if (!this.#popupRef()) {
601
- this.#dropdownService.triggerPopupOpen$.next({});
602
- }
603
- this.comboBoxValue.set(value ?? "");
604
- const item = this.#listService.getMatchingFilteredItem(value);
605
- if (item) {
606
- this.#listService.highlightedItem.set(item);
607
- if (this.#popupRef()) {
608
- this.#listService.scrollToItem$.next({ item, focus: false });
609
- }
610
- else {
611
- this.#dropdownService.popupOpenComplete$.pipe(take(1)).subscribe(() => {
612
- this.#listService.scrollToItem$.next({ item, focus: false });
613
- });
614
- }
615
- }
616
- });
617
- }
618
- setEscapeKeySubscription() {
619
- this.#dropdownService.beforeKeydown$
620
- .pipe(takeUntilDestroyed(this.#destroyRef), filter(e => e.originalEvent?.key === "Escape"), tap(e => e.preventDefault()))
621
- .subscribe(event => {
622
- if (this.#popupRef()) {
623
- const selectedItem = this.selectedListItem();
624
- if (selectedItem) {
625
- this.comboBoxValue.set(this.#listService.getItemText(selectedItem));
626
- }
627
- else {
628
- this.clear();
629
- }
630
- this.closePopup();
631
- }
632
- else if (this.comboBoxValue() || this.value() != null) {
633
- // This Escape was used to clear the field; a dialog or window around it waits for the next.
634
- event.originalEvent?.stopPropagation();
635
- this.clear();
636
- this.focus();
637
- }
638
- });
639
- }
640
- setKeydownSubscription() {
641
- this.#dropdownService.keydown$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
642
- if (event.key === "Enter") {
643
- event.preventDefault();
644
- this.handleEnterKey();
645
- this.closePopup();
646
- }
647
- else if (event.key === "Tab") {
648
- this.closePopup();
649
- }
650
- });
651
- }
652
- setPopupCloseSubscriptions() {
653
- this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
654
- this.#userNavigatedViaArrows.set(false);
655
- if (this.#dropdownService.focusCanReturn()) {
656
- this.focus();
657
- }
658
- window.setTimeout(() => {
659
- this.comboBoxValue$.next(null);
660
- });
661
- });
662
- }
663
- setSpaceKeySubscription() {
664
- this.#dropdownService.beforeKeydown$
665
- .pipe(takeUntilDestroyed(this.#destroyRef), filter(e => e.originalEvent?.key === " "), tap(e => e.preventDefault()))
666
- .subscribe();
667
- }
668
- setSubscriptions() {
669
- this.setArrowNavigationSubscription();
670
- this.setComboboxValueSubscription();
671
- this.setEscapeKeySubscription();
672
- this.setKeydownSubscription();
673
- this.setPopupCloseSubscriptions();
674
- this.setSpaceKeySubscription();
675
- }
676
- synchronizeSelection(value) {
677
- if (value == null) {
678
- this.#listService.clearSelections();
679
- return;
680
- }
681
- if (this.valuePrimitive()) {
682
- this.#listService.setSelectedKeys([value]);
683
- }
684
- else {
685
- this.#listService.setSelectedDataItems([value]);
686
- }
687
- }
688
- updateValue(value) {
689
- if (this.value() !== value) {
690
- this.value.set(value);
691
- }
692
- this.comboBoxValue.set(this.valueText());
693
- }
694
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ComboBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
695
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ComboBoxComponent, isStandalone: true, selector: "mona-combo-box", inputs: { allowCustomValue: { classPropertyName: "allowCustomValue", publicName: "allowCustomValue", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, itemDisabled: { classPropertyName: "itemDisabled", publicName: "itemDisabled", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, popupClass: { classPropertyName: "popupClass", publicName: "popupClass", isSignal: true, isRequired: false, transformFunction: null }, popupHeight: { classPropertyName: "popupHeight", publicName: "popupHeight", isSignal: true, isRequired: false, transformFunction: null }, popupWidth: { classPropertyName: "popupWidth", publicName: "popupWidth", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null }, valuePrimitive: { classPropertyName: "valuePrimitive", publicName: "valuePrimitive", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed", open: "open", opened: "opened", touch: "touch", value: "valueChange", valueAdd: "valueAdd" }, host: { listeners: { "focusout": "onFocusOut($event)", "pointerdown": "onHostPointerDown($event)" }, properties: { "attr.aria-describedby": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.data-disabled": "effectiveDisabled() || null", "attr.data-invalid": "invalidState() || null", "attr.data-readonly": "readonly() || null", "attr.tabindex": "-1", "class": "baseClass()" } }, providers: [
696
- ListService,
697
- DropdownService,
698
- DropdownListService,
699
- {
700
- provide: DROPDOWN_DATA_INPUT_TOKEN,
701
- useExisting: forwardRef(() => ComboBoxComponent),
702
- multi: false
703
- },
704
- {
705
- provide: DROPDOWN_POPUP_INPUT_TOKEN,
706
- useExisting: forwardRef(() => ComboBoxComponent),
707
- multi: false
708
- }
709
- ], queries: [{ propertyName: "footerTemplate", first: true, predicate: DropdownFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupHeaderTemplate", first: true, predicate: DropdownGroupHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: DropdownHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: DropdownItemTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "noDataTemplate", first: true, predicate: DropdownNoDataTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "prefixTemplate", first: true, predicate: DropdownPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownDataHandlerDirective }, { directive: i1.DropdownListPopupHandlerDirective }, { directive: i1.DropdownLiveRegionDirective }], ngImport: i0, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"ariaDescribedBy() || undefined\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || undefined\"\n role=\"combobox\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().clear\"\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\n}\n\n@if (loading()) {\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\n}\n\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"size()\" [listId]=\"listId\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n </mona-list>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: TextBoxDirective, selector: "input[monaTextBox]", inputs: ["invalid", "rounded", "size", "touched", "class"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ListComponent, selector: "mona-list", inputs: ["ariaLabel", "ariaLabelledBy", "busy", "data", "focusOnMount", "height", "listClass", "listId", "listItemClass", "listItemStyle", "listRole", "listStyle", "maxHeight", "maxWidth", "size", "textField", "width"], outputs: ["itemActivate", "itemSelect"] }, { kind: "directive", type: ListGroupHeaderTemplateDirective, selector: "ng-template[monaListGroupHeaderTemplate]" }, { kind: "directive", type: ListFooterTemplateDirective, selector: "ng-template[monaListFooterTemplate]" }, { kind: "directive", type: ListHeaderTemplateDirective, selector: "ng-template[monaListHeaderTemplate]" }, { kind: "directive", type: ListNoDataTemplateDirective, selector: "ng-template[monaListNoDataTemplate]" }, { kind: "directive", type: ListItemTemplateDirective, selector: "ng-template[monaListItemTemplate]" }, { kind: "component", type: IndicatorIconComponent, selector: "mona-indicator-icon", inputs: ["icon", "interactive", "label", "preset", "size", "class"], outputs: ["activate"] }] }); }
710
- }
711
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ComboBoxComponent, decorators: [{
712
- type: Component,
713
- args: [{ selector: "mona-combo-box", providers: [
714
- ListService,
715
- DropdownService,
716
- DropdownListService,
717
- {
718
- provide: DROPDOWN_DATA_INPUT_TOKEN,
719
- useExisting: forwardRef(() => ComboBoxComponent),
720
- multi: false
721
- },
722
- {
723
- provide: DROPDOWN_POPUP_INPUT_TOKEN,
724
- useExisting: forwardRef(() => ComboBoxComponent),
725
- multi: false
726
- }
727
- ], imports: [
728
- TextBoxDirective,
729
- NgTemplateOutlet,
730
- ListComponent,
731
- ListGroupHeaderTemplateDirective,
732
- ListFooterTemplateDirective,
733
- ListHeaderTemplateDirective,
734
- ListNoDataTemplateDirective,
735
- ListItemTemplateDirective,
736
- IndicatorIconComponent
737
- ], hostDirectives: [DropdownDataHandlerDirective, DropdownListPopupHandlerDirective, DropdownLiveRegionDirective], host: {
738
- // The host has no role: the inner input is the combobox and carries the name, description and state. A static
739
- // aria-* attribute written on <mona-combo-box> would otherwise stay on the host as well.
740
- "[attr.aria-describedby]": "null",
741
- "[attr.aria-label]": "null",
742
- "[attr.aria-labelledby]": "null",
743
- "[attr.data-disabled]": "effectiveDisabled() || null",
744
- "[attr.data-invalid]": "invalidState() || null",
745
- "[attr.data-readonly]": "readonly() || null",
746
- "[attr.tabindex]": "-1",
747
- "[class]": "baseClass()",
748
- "(focusout)": "onFocusOut($event)",
749
- "(pointerdown)": "onHostPointerDown($event)"
750
- }, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"ariaDescribedBy() || undefined\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || undefined\"\n role=\"combobox\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().clear\"\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\n}\n\n@if (loading()) {\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\n}\n\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"size()\" [listId]=\"listId\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n </mona-list>\n </div>\n</ng-template>\n" }]
751
- }], ctorParameters: () => [], propDecorators: { footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupHeaderTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownGroupHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownItemTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], noDataTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownNoDataTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], popupTemplate: [{ type: i0.ViewChild, args: ["popupTemplate", { isSignal: true }] }], prefixTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DropdownPrefixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], allowCustomValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowCustomValue", required: false }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], closed: [{ type: i0.Output, args: ["closed"] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], itemDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemDisabled", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], open: [{ type: i0.Output, args: ["open"] }], opened: [{ type: i0.Output, args: ["opened"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], popupClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupClass", required: false }] }], popupHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupHeight", required: false }] }], popupWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupWidth", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], textField: [{ type: i0.Input, args: [{ isSignal: true, alias: "textField", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], valueAdd: [{ type: i0.Output, args: ["valueAdd"] }], valueField: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueField", required: false }] }], valuePrimitive: [{ type: i0.Input, args: [{ isSignal: true, alias: "valuePrimitive", required: false }] }] } });
752
-
753
- /*
754
- * Public API Surface of @nanahoshi/mona-ui/combo-box
755
- */
756
-
757
- /**
758
- * Generated bundle index. Do not edit.
759
- */
760
-
76
+ var ComboBoxComponent = class ComboBoxComponent {
77
+ #destroyRef;
78
+ #dropdownListService;
79
+ #dropdownService;
80
+ #hostElementRef;
81
+ #i18n;
82
+ #listService;
83
+ #popupRef;
84
+ #userNavigatedViaArrows;
85
+ constructor() {
86
+ this.#destroyRef = inject(DestroyRef);
87
+ this.#dropdownListService = inject(DropdownListService);
88
+ this.#dropdownService = inject(DropdownService);
89
+ this.#hostElementRef = inject(ElementRef);
90
+ this.#i18n = inject(MonaI18nService);
91
+ this.#listService = inject(ListService);
92
+ this.#popupRef = this.#dropdownService.popupRef;
93
+ this.#userNavigatedViaArrows = signal(false, ...ngDevMode ? [{ debugName: "#userNavigatedViaArrows" }] : /* istanbul ignore next */ []);
94
+ this.activeDescendant = computed(() => {
95
+ const highlightedItem = this.#listService.highlightedItem();
96
+ return highlightedItem ? highlightedItem.uid : null;
97
+ }, ...ngDevMode ? [{ debugName: "activeDescendant" }] : /* istanbul ignore next */ []);
98
+ this.affixClass = computed(() => {
99
+ return comboBoxAffixContainerThemeVariants();
100
+ }, ...ngDevMode ? [{ debugName: "affixClass" }] : /* istanbul ignore next */ []);
101
+ this.baseClass = computed(() => {
102
+ const disabled = this.effectiveDisabled();
103
+ const focused = this.#popupRef() != null;
104
+ const invalid = this.invalidState();
105
+ const rounded = this.rounded();
106
+ const size = this.size();
107
+ const variantClass = comboBoxBaseThemeVariants({
108
+ disabled,
109
+ focused,
110
+ invalid,
111
+ rounded,
112
+ size
113
+ });
114
+ const userClass = this.userClass();
115
+ return twMerge(variantClass, userClass);
116
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
117
+ this.clearButtonVisible = computed(() => this.showClearButton() && this.selectedListItem() != null && !this.loading() && !this.effectiveDisabled() && !this.readonly(), ...ngDevMode ? [{ debugName: "clearButtonVisible" }] : /* istanbul ignore next */ []);
118
+ this.comboBoxValue = signal("", ...ngDevMode ? [{ debugName: "comboBoxValue" }] : /* istanbul ignore next */ []);
119
+ this.comboBoxValue$ = new Subject();
120
+ this.effectiveDisabled = injectEffectiveDisabled(() => this.disabled());
121
+ this.expanded = computed(() => this.#popupRef() !== null, ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
122
+ this.footerTemplate = contentChild(DropdownFooterTemplateDirective, {
123
+ ...ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {},
124
+ read: TemplateRef
125
+ });
126
+ this.groupHeaderTemplate = contentChild(DropdownGroupHeaderTemplateDirective, {
127
+ ...ngDevMode ? { debugName: "groupHeaderTemplate" } : /* istanbul ignore next */ {},
128
+ read: TemplateRef
129
+ });
130
+ this.headerTemplate = contentChild(DropdownHeaderTemplateDirective, {
131
+ ...ngDevMode ? { debugName: "headerTemplate" } : /* istanbul ignore next */ {},
132
+ read: TemplateRef
133
+ });
134
+ this.inputClass = computed(() => {
135
+ const rounded = this.rounded();
136
+ return comboBoxTextInputThemeVariants({ rounded });
137
+ }, ...ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []);
138
+ this.invalidState = computed(() => this.touched() && (this.invalid() || this.required() && this.value() == null), ...ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []);
139
+ this.itemTemplate = contentChild(DropdownItemTemplateDirective, {
140
+ ...ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {},
141
+ read: TemplateRef
142
+ });
143
+ this.listId = createElementControlId();
144
+ this.listPopupClass = computed(() => {
145
+ const rounded = this.rounded();
146
+ const size = this.size();
147
+ const userClass = this.popupClass();
148
+ const variantClass = dropdownPopupThemeVariants({
149
+ rounded,
150
+ size
151
+ });
152
+ const heightClass = this.popupHeight() ? "max-h-none" : "";
153
+ return twMerge(variantClass, heightClass, userClass);
154
+ }, ...ngDevMode ? [{ debugName: "listPopupClass" }] : /* istanbul ignore next */ []);
155
+ this.messages = this.#i18n.componentMessages("comboBox", COMBO_BOX_DEFAULT_MESSAGES);
156
+ this.noDataTemplate = contentChild(DropdownNoDataTemplateDirective, {
157
+ ...ngDevMode ? { debugName: "noDataTemplate" } : /* istanbul ignore next */ {},
158
+ read: TemplateRef
159
+ });
160
+ this.popupTemplate = viewChild.required("popupTemplate", ...ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []);
161
+ this.prefixTemplate = contentChild(DropdownPrefixTemplateDirective, {
162
+ ...ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {},
163
+ read: TemplateRef
164
+ });
165
+ this.selectableOptions = {
166
+ enabled: true,
167
+ mode: "single",
168
+ toggleable: false
169
+ };
170
+ this.selectedListItem = computed(() => {
171
+ return this.#listService.selectedListItems().firstOrDefault();
172
+ }, ...ngDevMode ? [{ debugName: "selectedListItem" }] : /* istanbul ignore next */ []);
173
+ this.valueText = computed(() => {
174
+ const listItem = this.selectedListItem();
175
+ if (!listItem) return "";
176
+ return this.#listService.getItemText(listItem);
177
+ }, ...ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []);
178
+ this.allowCustomValue = input(false, {
179
+ ...ngDevMode ? { debugName: "allowCustomValue" } : /* istanbul ignore next */ {},
180
+ transform: booleanAttribute
181
+ });
182
+ this.ariaDescribedBy = input("", {
183
+ ...ngDevMode ? { debugName: "ariaDescribedBy" } : /* istanbul ignore next */ {},
184
+ alias: "aria-describedby"
185
+ });
186
+ this.ariaLabel = input("", {
187
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
188
+ alias: "aria-label"
189
+ });
190
+ this.ariaLabelledBy = input("", {
191
+ ...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
192
+ alias: "aria-labelledby"
193
+ });
194
+ this.close = output();
195
+ this.closed = output();
196
+ this.data = input([], ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
197
+ this.disabled = input(false, {
198
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
199
+ transform: booleanAttribute
200
+ });
201
+ this.inputId = input(createElementControlId(), ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
202
+ this.invalid = input(false, {
203
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
204
+ transform: booleanAttribute
205
+ });
206
+ this.itemDisabled = input(...ngDevMode ? [void 0, { debugName: "itemDisabled" }] : /* istanbul ignore next */ []);
207
+ this.loading = input(false, {
208
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
209
+ transform: booleanAttribute
210
+ });
211
+ this.open = output();
212
+ this.opened = output();
213
+ this.placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
214
+ this.popupClass = input("", ...ngDevMode ? [{ debugName: "popupClass" }] : /* istanbul ignore next */ []);
215
+ this.popupHeight = input(null, ...ngDevMode ? [{ debugName: "popupHeight" }] : /* istanbul ignore next */ []);
216
+ this.popupWidth = input(null, ...ngDevMode ? [{ debugName: "popupWidth" }] : /* istanbul ignore next */ []);
217
+ this.readonly = input(false, {
218
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
219
+ transform: booleanAttribute
220
+ });
221
+ this.required = input(false, {
222
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
223
+ transform: booleanAttribute
224
+ });
225
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
226
+ this.showClearButton = input(false, {
227
+ ...ngDevMode ? { debugName: "showClearButton" } : /* istanbul ignore next */ {},
228
+ transform: booleanAttribute
229
+ });
230
+ this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
231
+ this.textField = input(...ngDevMode ? [void 0, { debugName: "textField" }] : /* istanbul ignore next */ []);
232
+ this.touch = output();
233
+ this.touched = input(false, {
234
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
235
+ transform: booleanAttribute
236
+ });
237
+ this.userClass = input("", {
238
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
239
+ alias: "class"
240
+ });
241
+ this.value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
242
+ this.valueAdd = output();
243
+ this.valueField = input(...ngDevMode ? [void 0, { debugName: "valueField" }] : /* istanbul ignore next */ []);
244
+ this.valuePrimitive = input(false, {
245
+ ...ngDevMode ? { debugName: "valuePrimitive" } : /* istanbul ignore next */ {},
246
+ transform: booleanAttribute
247
+ });
248
+ effect(() => {
249
+ const popupTemplate = this.popupTemplate();
250
+ untracked(() => this.#dropdownService.popupTemplate.set(popupTemplate));
251
+ });
252
+ effect(() => {
253
+ const value = this.value();
254
+ const valueField = this.valueField();
255
+ this.valuePrimitive();
256
+ this.selectedListItem();
257
+ untracked(() => {
258
+ this.#listService.setValueField(valueField ?? "");
259
+ this.synchronizeSelection(value);
260
+ this.comboBoxValue.set(this.valueText());
261
+ });
262
+ });
263
+ afterNextRender({ read: () => {
264
+ this.initialize();
265
+ this.setSubscriptions();
266
+ } });
267
+ }
268
+ focus(options) {
269
+ const input = this.#hostElementRef.nativeElement.querySelector("input");
270
+ if (input) {
271
+ input.focus(options);
272
+ input.setSelectionRange(input.value.length, input.value.length);
273
+ }
274
+ }
275
+ onFocusOut(event) {
276
+ if (this.#destroyRef.destroyed) return;
277
+ const nextTarget = event.relatedTarget;
278
+ if (nextTarget instanceof Node) {
279
+ const popupElement = this.#dropdownService.popupRef()?.overlayRef.overlayElement;
280
+ if (this.#hostElementRef.nativeElement.contains(nextTarget) || popupElement?.contains(nextTarget)) return;
281
+ }
282
+ this.resolveText();
283
+ this.touch.emit();
284
+ }
285
+ onHostPointerDown(event) {
286
+ const host = this.#hostElementRef.nativeElement;
287
+ const control = event.target?.closest("a, button, input, select, textarea, [tabindex]");
288
+ if (this.effectiveDisabled() || control != null && control !== host) return;
289
+ event.preventDefault();
290
+ host.querySelector("input")?.focus();
291
+ }
292
+ onInput(text) {
293
+ this.comboBoxValue.set(text);
294
+ this.comboBoxValue$.next(text);
295
+ }
296
+ onItemSelect(event) {
297
+ if (this.#listService.filterableOptions().enabled && event.source.via === "keyboard" && event.source.key !== "Enter") return;
298
+ this.updateValue(this.getControlValue(event.item.data));
299
+ this.closePopup();
300
+ }
301
+ onPopupPointerDown(event) {
302
+ if (event.target?.tagName !== "INPUT") event.preventDefault();
303
+ }
304
+ onValueClear(event) {
305
+ if (this.effectiveDisabled() || this.readonly() || event instanceof KeyboardEvent && event.key !== "Enter" && event.key !== " ") return;
306
+ event.preventDefault();
307
+ event.stopImmediatePropagation();
308
+ this.updateValue(null);
309
+ this.#listService.clearSelections();
310
+ this.comboBoxValue.set("");
311
+ this.focus();
312
+ }
313
+ clear() {
314
+ this.updateValue(null);
315
+ this.comboBoxValue.set("");
316
+ this.#listService.clearSelections();
317
+ this.#listService.clearFilter();
318
+ }
319
+ closePopup() {
320
+ this.#popupRef()?.close();
321
+ }
322
+ getControlValue(dataItem) {
323
+ return this.valuePrimitive() ? this.#listService.getDataItemValue(dataItem) : dataItem;
324
+ }
325
+ handleEnterKey() {
326
+ const comboBoxText = this.comboBoxValue();
327
+ const highlightedItem = this.#listService.highlightedItem();
328
+ if (this.#userNavigatedViaArrows() && highlightedItem) {
329
+ this.selectItem(highlightedItem);
330
+ return;
331
+ }
332
+ if (!this.allowCustomValue()) {
333
+ if (highlightedItem) {
334
+ if (this.#listService.getItemText(highlightedItem).toLowerCase() === comboBoxText.toLowerCase()) this.selectItem(highlightedItem);
335
+ else {
336
+ const matchingItem = this.#listService.getMatchingFilteredItem(comboBoxText);
337
+ if (matchingItem) this.selectItem(matchingItem);
338
+ else this.clear();
339
+ }
340
+ } else {
341
+ const matchingItem = this.#listService.getMatchingFilteredItem(comboBoxText);
342
+ if (matchingItem) this.selectItem(matchingItem);
343
+ else this.clear();
344
+ }
345
+ } else if (highlightedItem) {
346
+ if (this.#listService.getItemText(highlightedItem).toLowerCase() === comboBoxText.toLowerCase()) this.selectItem(highlightedItem);
347
+ else if (comboBoxText) this.valueAdd.emit(comboBoxText);
348
+ } else if (comboBoxText) this.valueAdd.emit(comboBoxText);
349
+ }
350
+ initialize() {
351
+ this.#listService.setNavigableOptions({
352
+ enabled: true,
353
+ mode: "highlight"
354
+ });
355
+ this.#listService.setSelectableOptions(this.selectableOptions);
356
+ this.#listService.filterInputVisible.set(false);
357
+ this.comboBoxValue.set(this.valueText());
358
+ }
359
+ notifyFilterChange(filter) {
360
+ const event = new FilterChangeEvent(filter);
361
+ this.#listService.filterChange$.next(event);
362
+ return event;
363
+ }
364
+ resolveText() {
365
+ const text = this.#hostElementRef.nativeElement.querySelector("input")?.value ?? this.comboBoxValue();
366
+ this.comboBoxValue.set(text);
367
+ const selectedItem = this.selectedListItem();
368
+ const selectedText = selectedItem ? this.#listService.getItemText(selectedItem) : "";
369
+ if (text === selectedText) return;
370
+ if (!text) {
371
+ this.clear();
372
+ return;
373
+ }
374
+ const matchingItem = this.#listService.getMatchingFilteredItem(text);
375
+ if (matchingItem && this.#listService.getItemText(matchingItem).toLowerCase() === text.toLowerCase()) {
376
+ this.selectItem(matchingItem);
377
+ return;
378
+ }
379
+ if (this.allowCustomValue()) {
380
+ this.valueAdd.emit(text);
381
+ return;
382
+ }
383
+ this.comboBoxValue.set(selectedText);
384
+ }
385
+ selectItem(item) {
386
+ this.#listService.selectItem(item);
387
+ this.updateValue(this.getControlValue(item.data));
388
+ }
389
+ setArrowNavigationSubscription() {
390
+ this.#dropdownListService.navigate$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(({ item }) => {
391
+ if (!this.expanded()) {
392
+ this.#listService.selectItem(item);
393
+ this.updateValue(this.getControlValue(item.data));
394
+ } else this.#userNavigatedViaArrows.set(true);
395
+ });
396
+ }
397
+ setComboboxValueSubscription() {
398
+ this.comboBoxValue$.pipe(takeUntilDestroyed(this.#destroyRef), debounceTime(this.#listService.getFilterDebounceDuration()), filter((value) => value !== null)).subscribe((value) => {
399
+ this.#userNavigatedViaArrows.set(false);
400
+ if (this.#listService.isFilteringEnabled()) {
401
+ if (this.notifyFilterChange(value).isDefaultPrevented()) return;
402
+ if (value) this.#listService.setFilter(value);
403
+ else this.#listService.clearFilter();
404
+ }
405
+ if (!this.#popupRef()) this.#dropdownService.triggerPopupOpen$.next({});
406
+ this.comboBoxValue.set(value ?? "");
407
+ const item = this.#listService.getMatchingFilteredItem(value);
408
+ if (item) {
409
+ this.#listService.highlightedItem.set(item);
410
+ if (this.#popupRef()) this.#listService.scrollToItem$.next({
411
+ item,
412
+ focus: false
413
+ });
414
+ else this.#dropdownService.popupOpenComplete$.pipe(take(1)).subscribe(() => {
415
+ this.#listService.scrollToItem$.next({
416
+ item,
417
+ focus: false
418
+ });
419
+ });
420
+ }
421
+ });
422
+ }
423
+ setEscapeKeySubscription() {
424
+ this.#dropdownService.beforeKeydown$.pipe(takeUntilDestroyed(this.#destroyRef), filter((e) => e.originalEvent?.key === "Escape"), tap((e) => e.preventDefault())).subscribe((event) => {
425
+ if (this.#popupRef()) {
426
+ const selectedItem = this.selectedListItem();
427
+ if (selectedItem) this.comboBoxValue.set(this.#listService.getItemText(selectedItem));
428
+ else this.clear();
429
+ this.closePopup();
430
+ } else if (this.comboBoxValue() || this.value() != null) {
431
+ event.originalEvent?.stopPropagation();
432
+ this.clear();
433
+ this.focus();
434
+ }
435
+ });
436
+ }
437
+ setKeydownSubscription() {
438
+ this.#dropdownService.keydown$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((event) => {
439
+ if (event.key === "Enter") {
440
+ event.preventDefault();
441
+ this.handleEnterKey();
442
+ this.closePopup();
443
+ } else if (event.key === "Tab") this.closePopup();
444
+ });
445
+ }
446
+ setPopupCloseSubscriptions() {
447
+ this.#dropdownService.popupCloseComplete$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
448
+ this.#userNavigatedViaArrows.set(false);
449
+ if (this.#dropdownService.focusCanReturn()) this.focus();
450
+ window.setTimeout(() => {
451
+ this.comboBoxValue$.next(null);
452
+ });
453
+ });
454
+ }
455
+ setSpaceKeySubscription() {
456
+ this.#dropdownService.beforeKeydown$.pipe(takeUntilDestroyed(this.#destroyRef), filter((e) => e.originalEvent?.key === " "), tap((e) => e.preventDefault())).subscribe();
457
+ }
458
+ setSubscriptions() {
459
+ this.setArrowNavigationSubscription();
460
+ this.setComboboxValueSubscription();
461
+ this.setEscapeKeySubscription();
462
+ this.setKeydownSubscription();
463
+ this.setPopupCloseSubscriptions();
464
+ this.setSpaceKeySubscription();
465
+ }
466
+ synchronizeSelection(value) {
467
+ if (value == null) {
468
+ this.#listService.clearSelections();
469
+ return;
470
+ }
471
+ if (this.valuePrimitive()) this.#listService.setSelectedKeys([value]);
472
+ else this.#listService.setSelectedDataItems([value]);
473
+ }
474
+ updateValue(value) {
475
+ if (this.value() !== value) this.value.set(value);
476
+ this.comboBoxValue.set(this.valueText());
477
+ }
478
+ static {
479
+ this.ɵfac = i0.ɵɵngDeclareFactory({
480
+ minVersion: "12.0.0",
481
+ version: "22.2.6",
482
+ ngImport: i0,
483
+ type: ComboBoxComponent,
484
+ deps: [],
485
+ target: i0.ɵɵFactoryTarget.Component
486
+ });
487
+ }
488
+ static {
489
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
490
+ minVersion: "17.0.0",
491
+ version: "22.2.6",
492
+ type: ComboBoxComponent,
493
+ isStandalone: true,
494
+ selector: "mona-combo-box",
495
+ inputs: {
496
+ allowCustomValue: {
497
+ classPropertyName: "allowCustomValue",
498
+ publicName: "allowCustomValue",
499
+ isSignal: true,
500
+ isRequired: false,
501
+ transformFunction: null
502
+ },
503
+ ariaDescribedBy: {
504
+ classPropertyName: "ariaDescribedBy",
505
+ publicName: "aria-describedby",
506
+ isSignal: true,
507
+ isRequired: false,
508
+ transformFunction: null
509
+ },
510
+ ariaLabel: {
511
+ classPropertyName: "ariaLabel",
512
+ publicName: "aria-label",
513
+ isSignal: true,
514
+ isRequired: false,
515
+ transformFunction: null
516
+ },
517
+ ariaLabelledBy: {
518
+ classPropertyName: "ariaLabelledBy",
519
+ publicName: "aria-labelledby",
520
+ isSignal: true,
521
+ isRequired: false,
522
+ transformFunction: null
523
+ },
524
+ data: {
525
+ classPropertyName: "data",
526
+ publicName: "data",
527
+ isSignal: true,
528
+ isRequired: false,
529
+ transformFunction: null
530
+ },
531
+ disabled: {
532
+ classPropertyName: "disabled",
533
+ publicName: "disabled",
534
+ isSignal: true,
535
+ isRequired: false,
536
+ transformFunction: null
537
+ },
538
+ inputId: {
539
+ classPropertyName: "inputId",
540
+ publicName: "inputId",
541
+ isSignal: true,
542
+ isRequired: false,
543
+ transformFunction: null
544
+ },
545
+ invalid: {
546
+ classPropertyName: "invalid",
547
+ publicName: "invalid",
548
+ isSignal: true,
549
+ isRequired: false,
550
+ transformFunction: null
551
+ },
552
+ itemDisabled: {
553
+ classPropertyName: "itemDisabled",
554
+ publicName: "itemDisabled",
555
+ isSignal: true,
556
+ isRequired: false,
557
+ transformFunction: null
558
+ },
559
+ loading: {
560
+ classPropertyName: "loading",
561
+ publicName: "loading",
562
+ isSignal: true,
563
+ isRequired: false,
564
+ transformFunction: null
565
+ },
566
+ placeholder: {
567
+ classPropertyName: "placeholder",
568
+ publicName: "placeholder",
569
+ isSignal: true,
570
+ isRequired: false,
571
+ transformFunction: null
572
+ },
573
+ popupClass: {
574
+ classPropertyName: "popupClass",
575
+ publicName: "popupClass",
576
+ isSignal: true,
577
+ isRequired: false,
578
+ transformFunction: null
579
+ },
580
+ popupHeight: {
581
+ classPropertyName: "popupHeight",
582
+ publicName: "popupHeight",
583
+ isSignal: true,
584
+ isRequired: false,
585
+ transformFunction: null
586
+ },
587
+ popupWidth: {
588
+ classPropertyName: "popupWidth",
589
+ publicName: "popupWidth",
590
+ isSignal: true,
591
+ isRequired: false,
592
+ transformFunction: null
593
+ },
594
+ readonly: {
595
+ classPropertyName: "readonly",
596
+ publicName: "readonly",
597
+ isSignal: true,
598
+ isRequired: false,
599
+ transformFunction: null
600
+ },
601
+ required: {
602
+ classPropertyName: "required",
603
+ publicName: "required",
604
+ isSignal: true,
605
+ isRequired: false,
606
+ transformFunction: null
607
+ },
608
+ rounded: {
609
+ classPropertyName: "rounded",
610
+ publicName: "rounded",
611
+ isSignal: true,
612
+ isRequired: false,
613
+ transformFunction: null
614
+ },
615
+ showClearButton: {
616
+ classPropertyName: "showClearButton",
617
+ publicName: "showClearButton",
618
+ isSignal: true,
619
+ isRequired: false,
620
+ transformFunction: null
621
+ },
622
+ size: {
623
+ classPropertyName: "size",
624
+ publicName: "size",
625
+ isSignal: true,
626
+ isRequired: false,
627
+ transformFunction: null
628
+ },
629
+ textField: {
630
+ classPropertyName: "textField",
631
+ publicName: "textField",
632
+ isSignal: true,
633
+ isRequired: false,
634
+ transformFunction: null
635
+ },
636
+ touched: {
637
+ classPropertyName: "touched",
638
+ publicName: "touched",
639
+ isSignal: true,
640
+ isRequired: false,
641
+ transformFunction: null
642
+ },
643
+ userClass: {
644
+ classPropertyName: "userClass",
645
+ publicName: "class",
646
+ isSignal: true,
647
+ isRequired: false,
648
+ transformFunction: null
649
+ },
650
+ value: {
651
+ classPropertyName: "value",
652
+ publicName: "value",
653
+ isSignal: true,
654
+ isRequired: false,
655
+ transformFunction: null
656
+ },
657
+ valueField: {
658
+ classPropertyName: "valueField",
659
+ publicName: "valueField",
660
+ isSignal: true,
661
+ isRequired: false,
662
+ transformFunction: null
663
+ },
664
+ valuePrimitive: {
665
+ classPropertyName: "valuePrimitive",
666
+ publicName: "valuePrimitive",
667
+ isSignal: true,
668
+ isRequired: false,
669
+ transformFunction: null
670
+ }
671
+ },
672
+ outputs: {
673
+ close: "close",
674
+ closed: "closed",
675
+ open: "open",
676
+ opened: "opened",
677
+ touch: "touch",
678
+ value: "valueChange",
679
+ valueAdd: "valueAdd"
680
+ },
681
+ host: {
682
+ listeners: {
683
+ "focusout": "onFocusOut($event)",
684
+ "pointerdown": "onHostPointerDown($event)"
685
+ },
686
+ properties: {
687
+ "attr.aria-describedby": "null",
688
+ "attr.aria-label": "null",
689
+ "attr.aria-labelledby": "null",
690
+ "attr.data-disabled": "effectiveDisabled() || null",
691
+ "attr.data-invalid": "invalidState() || null",
692
+ "attr.data-readonly": "readonly() || null",
693
+ "attr.tabindex": "-1",
694
+ "class": "baseClass()"
695
+ }
696
+ },
697
+ providers: [
698
+ ListService,
699
+ DropdownService,
700
+ DropdownListService,
701
+ {
702
+ provide: DROPDOWN_DATA_INPUT_TOKEN,
703
+ useExisting: forwardRef(() => ComboBoxComponent),
704
+ multi: false
705
+ },
706
+ {
707
+ provide: DROPDOWN_POPUP_INPUT_TOKEN,
708
+ useExisting: forwardRef(() => ComboBoxComponent),
709
+ multi: false
710
+ }
711
+ ],
712
+ queries: [
713
+ {
714
+ propertyName: "footerTemplate",
715
+ first: true,
716
+ predicate: DropdownFooterTemplateDirective,
717
+ descendants: true,
718
+ read: TemplateRef,
719
+ isSignal: true
720
+ },
721
+ {
722
+ propertyName: "groupHeaderTemplate",
723
+ first: true,
724
+ predicate: DropdownGroupHeaderTemplateDirective,
725
+ descendants: true,
726
+ read: TemplateRef,
727
+ isSignal: true
728
+ },
729
+ {
730
+ propertyName: "headerTemplate",
731
+ first: true,
732
+ predicate: DropdownHeaderTemplateDirective,
733
+ descendants: true,
734
+ read: TemplateRef,
735
+ isSignal: true
736
+ },
737
+ {
738
+ propertyName: "itemTemplate",
739
+ first: true,
740
+ predicate: DropdownItemTemplateDirective,
741
+ descendants: true,
742
+ read: TemplateRef,
743
+ isSignal: true
744
+ },
745
+ {
746
+ propertyName: "noDataTemplate",
747
+ first: true,
748
+ predicate: DropdownNoDataTemplateDirective,
749
+ descendants: true,
750
+ read: TemplateRef,
751
+ isSignal: true
752
+ },
753
+ {
754
+ propertyName: "prefixTemplate",
755
+ first: true,
756
+ predicate: DropdownPrefixTemplateDirective,
757
+ descendants: true,
758
+ read: TemplateRef,
759
+ isSignal: true
760
+ }
761
+ ],
762
+ viewQueries: [{
763
+ propertyName: "popupTemplate",
764
+ first: true,
765
+ predicate: ["popupTemplate"],
766
+ descendants: true,
767
+ isSignal: true
768
+ }],
769
+ hostDirectives: [
770
+ { directive: i1.DropdownDataHandlerDirective },
771
+ { directive: i1.DropdownListPopupHandlerDirective },
772
+ { directive: i1.DropdownLiveRegionDirective }
773
+ ],
774
+ ngImport: i0,
775
+ template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"ariaDescribedBy() || undefined\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || undefined\"\n role=\"combobox\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().clear\"\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\n}\n\n@if (loading()) {\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\n}\n\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"size()\" [listId]=\"listId\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n </mona-list>\n </div>\n</ng-template>\n",
776
+ dependencies: [
777
+ {
778
+ kind: "directive",
779
+ type: TextBoxDirective,
780
+ selector: "input[monaTextBox]",
781
+ inputs: [
782
+ "invalid",
783
+ "rounded",
784
+ "size",
785
+ "touched",
786
+ "class"
787
+ ]
788
+ },
789
+ {
790
+ kind: "directive",
791
+ type: NgTemplateOutlet,
792
+ selector: "[ngTemplateOutlet]",
793
+ inputs: [
794
+ "ngTemplateOutletContext",
795
+ "ngTemplateOutlet",
796
+ "ngTemplateOutletInjector"
797
+ ]
798
+ },
799
+ {
800
+ kind: "component",
801
+ type: ListComponent,
802
+ selector: "mona-list",
803
+ inputs: [
804
+ "ariaLabel",
805
+ "ariaLabelledBy",
806
+ "busy",
807
+ "data",
808
+ "focusOnMount",
809
+ "height",
810
+ "listClass",
811
+ "listId",
812
+ "listItemClass",
813
+ "listItemStyle",
814
+ "listRole",
815
+ "listStyle",
816
+ "maxHeight",
817
+ "maxWidth",
818
+ "size",
819
+ "textField",
820
+ "width"
821
+ ],
822
+ outputs: ["itemActivate", "itemSelect"]
823
+ },
824
+ {
825
+ kind: "directive",
826
+ type: ListGroupHeaderTemplateDirective,
827
+ selector: "ng-template[monaListGroupHeaderTemplate]"
828
+ },
829
+ {
830
+ kind: "directive",
831
+ type: ListFooterTemplateDirective,
832
+ selector: "ng-template[monaListFooterTemplate]"
833
+ },
834
+ {
835
+ kind: "directive",
836
+ type: ListHeaderTemplateDirective,
837
+ selector: "ng-template[monaListHeaderTemplate]"
838
+ },
839
+ {
840
+ kind: "directive",
841
+ type: ListNoDataTemplateDirective,
842
+ selector: "ng-template[monaListNoDataTemplate]"
843
+ },
844
+ {
845
+ kind: "directive",
846
+ type: ListItemTemplateDirective,
847
+ selector: "ng-template[monaListItemTemplate]"
848
+ },
849
+ {
850
+ kind: "component",
851
+ type: IndicatorIconComponent,
852
+ selector: "mona-indicator-icon",
853
+ inputs: [
854
+ "icon",
855
+ "interactive",
856
+ "label",
857
+ "preset",
858
+ "size",
859
+ "class"
860
+ ],
861
+ outputs: ["activate"]
862
+ }
863
+ ]
864
+ });
865
+ }
866
+ };
867
+ i0.ɵɵngDeclareClassMetadata({
868
+ minVersion: "12.0.0",
869
+ version: "22.2.6",
870
+ ngImport: i0,
871
+ type: ComboBoxComponent,
872
+ decorators: [{
873
+ type: Component,
874
+ args: [{
875
+ selector: "mona-combo-box",
876
+ providers: [
877
+ ListService,
878
+ DropdownService,
879
+ DropdownListService,
880
+ {
881
+ provide: DROPDOWN_DATA_INPUT_TOKEN,
882
+ useExisting: forwardRef(() => ComboBoxComponent),
883
+ multi: false
884
+ },
885
+ {
886
+ provide: DROPDOWN_POPUP_INPUT_TOKEN,
887
+ useExisting: forwardRef(() => ComboBoxComponent),
888
+ multi: false
889
+ }
890
+ ],
891
+ imports: [
892
+ TextBoxDirective,
893
+ NgTemplateOutlet,
894
+ ListComponent,
895
+ ListGroupHeaderTemplateDirective,
896
+ ListFooterTemplateDirective,
897
+ ListHeaderTemplateDirective,
898
+ ListNoDataTemplateDirective,
899
+ ListItemTemplateDirective,
900
+ IndicatorIconComponent
901
+ ],
902
+ hostDirectives: [
903
+ DropdownDataHandlerDirective,
904
+ DropdownListPopupHandlerDirective,
905
+ DropdownLiveRegionDirective
906
+ ],
907
+ host: {
908
+ "[attr.aria-describedby]": "null",
909
+ "[attr.aria-label]": "null",
910
+ "[attr.aria-labelledby]": "null",
911
+ "[attr.data-disabled]": "effectiveDisabled() || null",
912
+ "[attr.data-invalid]": "invalidState() || null",
913
+ "[attr.data-readonly]": "readonly() || null",
914
+ "[attr.tabindex]": "-1",
915
+ "[class]": "baseClass()",
916
+ "(focusout)": "onFocusOut($event)",
917
+ "(pointerdown)": "onHostPointerDown($event)"
918
+ },
919
+ template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"effectiveDisabled()\"\n [id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [value]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"ariaDescribedBy() || undefined\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"ariaLabel() || undefined\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || undefined\"\n role=\"combobox\"\n (input)=\"onInput(textInput.value)\"\n #textInput />\n\n@if (clearButtonVisible()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n [label]=\"messages().clear\"\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\n}\n\n@if (loading()) {\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\n}\n\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\" (pointerdown)=\"onPopupPointerDown($event)\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"size()\" [listId]=\"listId\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n </mona-list>\n </div>\n</ng-template>\n"
920
+ }]
921
+ }],
922
+ ctorParameters: () => [],
923
+ propDecorators: {
924
+ footerTemplate: [{
925
+ type: i0.ContentChild,
926
+ args: [i0.forwardRef(() => DropdownFooterTemplateDirective), {
927
+ read: TemplateRef,
928
+ isSignal: true
929
+ }]
930
+ }],
931
+ groupHeaderTemplate: [{
932
+ type: i0.ContentChild,
933
+ args: [i0.forwardRef(() => DropdownGroupHeaderTemplateDirective), {
934
+ read: TemplateRef,
935
+ isSignal: true
936
+ }]
937
+ }],
938
+ headerTemplate: [{
939
+ type: i0.ContentChild,
940
+ args: [i0.forwardRef(() => DropdownHeaderTemplateDirective), {
941
+ read: TemplateRef,
942
+ isSignal: true
943
+ }]
944
+ }],
945
+ itemTemplate: [{
946
+ type: i0.ContentChild,
947
+ args: [i0.forwardRef(() => DropdownItemTemplateDirective), {
948
+ read: TemplateRef,
949
+ isSignal: true
950
+ }]
951
+ }],
952
+ noDataTemplate: [{
953
+ type: i0.ContentChild,
954
+ args: [i0.forwardRef(() => DropdownNoDataTemplateDirective), {
955
+ read: TemplateRef,
956
+ isSignal: true
957
+ }]
958
+ }],
959
+ popupTemplate: [{
960
+ type: i0.ViewChild,
961
+ args: ["popupTemplate", { isSignal: true }]
962
+ }],
963
+ prefixTemplate: [{
964
+ type: i0.ContentChild,
965
+ args: [i0.forwardRef(() => DropdownPrefixTemplateDirective), {
966
+ read: TemplateRef,
967
+ isSignal: true
968
+ }]
969
+ }],
970
+ allowCustomValue: [{
971
+ type: i0.Input,
972
+ args: [{
973
+ isSignal: true,
974
+ alias: "allowCustomValue",
975
+ required: false
976
+ }]
977
+ }],
978
+ ariaDescribedBy: [{
979
+ type: i0.Input,
980
+ args: [{
981
+ isSignal: true,
982
+ alias: "aria-describedby",
983
+ required: false
984
+ }]
985
+ }],
986
+ ariaLabel: [{
987
+ type: i0.Input,
988
+ args: [{
989
+ isSignal: true,
990
+ alias: "aria-label",
991
+ required: false
992
+ }]
993
+ }],
994
+ ariaLabelledBy: [{
995
+ type: i0.Input,
996
+ args: [{
997
+ isSignal: true,
998
+ alias: "aria-labelledby",
999
+ required: false
1000
+ }]
1001
+ }],
1002
+ close: [{
1003
+ type: i0.Output,
1004
+ args: ["close"]
1005
+ }],
1006
+ closed: [{
1007
+ type: i0.Output,
1008
+ args: ["closed"]
1009
+ }],
1010
+ data: [{
1011
+ type: i0.Input,
1012
+ args: [{
1013
+ isSignal: true,
1014
+ alias: "data",
1015
+ required: false
1016
+ }]
1017
+ }],
1018
+ disabled: [{
1019
+ type: i0.Input,
1020
+ args: [{
1021
+ isSignal: true,
1022
+ alias: "disabled",
1023
+ required: false
1024
+ }]
1025
+ }],
1026
+ inputId: [{
1027
+ type: i0.Input,
1028
+ args: [{
1029
+ isSignal: true,
1030
+ alias: "inputId",
1031
+ required: false
1032
+ }]
1033
+ }],
1034
+ invalid: [{
1035
+ type: i0.Input,
1036
+ args: [{
1037
+ isSignal: true,
1038
+ alias: "invalid",
1039
+ required: false
1040
+ }]
1041
+ }],
1042
+ itemDisabled: [{
1043
+ type: i0.Input,
1044
+ args: [{
1045
+ isSignal: true,
1046
+ alias: "itemDisabled",
1047
+ required: false
1048
+ }]
1049
+ }],
1050
+ loading: [{
1051
+ type: i0.Input,
1052
+ args: [{
1053
+ isSignal: true,
1054
+ alias: "loading",
1055
+ required: false
1056
+ }]
1057
+ }],
1058
+ open: [{
1059
+ type: i0.Output,
1060
+ args: ["open"]
1061
+ }],
1062
+ opened: [{
1063
+ type: i0.Output,
1064
+ args: ["opened"]
1065
+ }],
1066
+ placeholder: [{
1067
+ type: i0.Input,
1068
+ args: [{
1069
+ isSignal: true,
1070
+ alias: "placeholder",
1071
+ required: false
1072
+ }]
1073
+ }],
1074
+ popupClass: [{
1075
+ type: i0.Input,
1076
+ args: [{
1077
+ isSignal: true,
1078
+ alias: "popupClass",
1079
+ required: false
1080
+ }]
1081
+ }],
1082
+ popupHeight: [{
1083
+ type: i0.Input,
1084
+ args: [{
1085
+ isSignal: true,
1086
+ alias: "popupHeight",
1087
+ required: false
1088
+ }]
1089
+ }],
1090
+ popupWidth: [{
1091
+ type: i0.Input,
1092
+ args: [{
1093
+ isSignal: true,
1094
+ alias: "popupWidth",
1095
+ required: false
1096
+ }]
1097
+ }],
1098
+ readonly: [{
1099
+ type: i0.Input,
1100
+ args: [{
1101
+ isSignal: true,
1102
+ alias: "readonly",
1103
+ required: false
1104
+ }]
1105
+ }],
1106
+ required: [{
1107
+ type: i0.Input,
1108
+ args: [{
1109
+ isSignal: true,
1110
+ alias: "required",
1111
+ required: false
1112
+ }]
1113
+ }],
1114
+ rounded: [{
1115
+ type: i0.Input,
1116
+ args: [{
1117
+ isSignal: true,
1118
+ alias: "rounded",
1119
+ required: false
1120
+ }]
1121
+ }],
1122
+ showClearButton: [{
1123
+ type: i0.Input,
1124
+ args: [{
1125
+ isSignal: true,
1126
+ alias: "showClearButton",
1127
+ required: false
1128
+ }]
1129
+ }],
1130
+ size: [{
1131
+ type: i0.Input,
1132
+ args: [{
1133
+ isSignal: true,
1134
+ alias: "size",
1135
+ required: false
1136
+ }]
1137
+ }],
1138
+ textField: [{
1139
+ type: i0.Input,
1140
+ args: [{
1141
+ isSignal: true,
1142
+ alias: "textField",
1143
+ required: false
1144
+ }]
1145
+ }],
1146
+ touch: [{
1147
+ type: i0.Output,
1148
+ args: ["touch"]
1149
+ }],
1150
+ touched: [{
1151
+ type: i0.Input,
1152
+ args: [{
1153
+ isSignal: true,
1154
+ alias: "touched",
1155
+ required: false
1156
+ }]
1157
+ }],
1158
+ userClass: [{
1159
+ type: i0.Input,
1160
+ args: [{
1161
+ isSignal: true,
1162
+ alias: "class",
1163
+ required: false
1164
+ }]
1165
+ }],
1166
+ value: [{
1167
+ type: i0.Input,
1168
+ args: [{
1169
+ isSignal: true,
1170
+ alias: "value",
1171
+ required: false
1172
+ }]
1173
+ }, {
1174
+ type: i0.Output,
1175
+ args: ["valueChange"]
1176
+ }],
1177
+ valueAdd: [{
1178
+ type: i0.Output,
1179
+ args: ["valueAdd"]
1180
+ }],
1181
+ valueField: [{
1182
+ type: i0.Input,
1183
+ args: [{
1184
+ isSignal: true,
1185
+ alias: "valueField",
1186
+ required: false
1187
+ }]
1188
+ }],
1189
+ valuePrimitive: [{
1190
+ type: i0.Input,
1191
+ args: [{
1192
+ isSignal: true,
1193
+ alias: "valuePrimitive",
1194
+ required: false
1195
+ }]
1196
+ }]
1197
+ }
1198
+ });
761
1199
  export { COMBO_BOX_DEFAULT_MESSAGES, ComboBoxComponent };
762
- //# sourceMappingURL=nanahoshi-mona-ui-combo-box.mjs.map
1200
+
1201
+ //# sourceMappingURL=nanahoshi-mona-ui-combo-box.mjs.map