@star-ng/ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +148 -2
  3. package/fesm2022/star-ng-ui-accordion.mjs +376 -0
  4. package/fesm2022/star-ng-ui-accordion.mjs.map +1 -0
  5. package/fesm2022/star-ng-ui-autocomplete.mjs +782 -0
  6. package/fesm2022/star-ng-ui-autocomplete.mjs.map +1 -0
  7. package/fesm2022/star-ng-ui-avatar.mjs +154 -0
  8. package/fesm2022/star-ng-ui-avatar.mjs.map +1 -0
  9. package/fesm2022/star-ng-ui-badge.mjs +153 -0
  10. package/fesm2022/star-ng-ui-badge.mjs.map +1 -0
  11. package/fesm2022/star-ng-ui-breadcrumb.mjs +199 -0
  12. package/fesm2022/star-ng-ui-breadcrumb.mjs.map +1 -0
  13. package/fesm2022/star-ng-ui-button.mjs +282 -0
  14. package/fesm2022/star-ng-ui-button.mjs.map +1 -0
  15. package/fesm2022/star-ng-ui-card.mjs +112 -0
  16. package/fesm2022/star-ng-ui-card.mjs.map +1 -0
  17. package/fesm2022/star-ng-ui-chart.mjs +1904 -0
  18. package/fesm2022/star-ng-ui-chart.mjs.map +1 -0
  19. package/fesm2022/star-ng-ui-checkbox.mjs +345 -0
  20. package/fesm2022/star-ng-ui-checkbox.mjs.map +1 -0
  21. package/fesm2022/star-ng-ui-core.mjs +392 -0
  22. package/fesm2022/star-ng-ui-core.mjs.map +1 -0
  23. package/fesm2022/star-ng-ui-data-display.mjs +1556 -0
  24. package/fesm2022/star-ng-ui-data-display.mjs.map +1 -0
  25. package/fesm2022/star-ng-ui-date-picker.mjs +2786 -0
  26. package/fesm2022/star-ng-ui-date-picker.mjs.map +1 -0
  27. package/fesm2022/star-ng-ui-dialog.mjs +948 -0
  28. package/fesm2022/star-ng-ui-dialog.mjs.map +1 -0
  29. package/fesm2022/star-ng-ui-drawer.mjs +158 -0
  30. package/fesm2022/star-ng-ui-drawer.mjs.map +1 -0
  31. package/fesm2022/star-ng-ui-editor.mjs +416 -0
  32. package/fesm2022/star-ng-ui-editor.mjs.map +1 -0
  33. package/fesm2022/star-ng-ui-field.mjs +378 -0
  34. package/fesm2022/star-ng-ui-field.mjs.map +1 -0
  35. package/fesm2022/star-ng-ui-file-upload.mjs +762 -0
  36. package/fesm2022/star-ng-ui-file-upload.mjs.map +1 -0
  37. package/fesm2022/star-ng-ui-i18n-de.mjs +179 -0
  38. package/fesm2022/star-ng-ui-i18n-de.mjs.map +1 -0
  39. package/fesm2022/star-ng-ui-i18n-es.mjs +179 -0
  40. package/fesm2022/star-ng-ui-i18n-es.mjs.map +1 -0
  41. package/fesm2022/star-ng-ui-input-group.mjs +188 -0
  42. package/fesm2022/star-ng-ui-input-group.mjs.map +1 -0
  43. package/fesm2022/star-ng-ui-input-mask.mjs +434 -0
  44. package/fesm2022/star-ng-ui-input-mask.mjs.map +1 -0
  45. package/fesm2022/star-ng-ui-input-number.mjs +691 -0
  46. package/fesm2022/star-ng-ui-input-number.mjs.map +1 -0
  47. package/fesm2022/star-ng-ui-input-otp.mjs +343 -0
  48. package/fesm2022/star-ng-ui-input-otp.mjs.map +1 -0
  49. package/fesm2022/star-ng-ui-input-tags.mjs +616 -0
  50. package/fesm2022/star-ng-ui-input-tags.mjs.map +1 -0
  51. package/fesm2022/star-ng-ui-knob.mjs +514 -0
  52. package/fesm2022/star-ng-ui-knob.mjs.map +1 -0
  53. package/fesm2022/star-ng-ui-layout.mjs +608 -0
  54. package/fesm2022/star-ng-ui-layout.mjs.map +1 -0
  55. package/fesm2022/star-ng-ui-listbox.mjs +978 -0
  56. package/fesm2022/star-ng-ui-listbox.mjs.map +1 -0
  57. package/fesm2022/star-ng-ui-media.mjs +833 -0
  58. package/fesm2022/star-ng-ui-media.mjs.map +1 -0
  59. package/fesm2022/star-ng-ui-menu.mjs +1840 -0
  60. package/fesm2022/star-ng-ui-menu.mjs.map +1 -0
  61. package/fesm2022/star-ng-ui-message.mjs +191 -0
  62. package/fesm2022/star-ng-ui-message.mjs.map +1 -0
  63. package/fesm2022/star-ng-ui-paginator.mjs +387 -0
  64. package/fesm2022/star-ng-ui-paginator.mjs.map +1 -0
  65. package/fesm2022/star-ng-ui-panel.mjs +324 -0
  66. package/fesm2022/star-ng-ui-panel.mjs.map +1 -0
  67. package/fesm2022/star-ng-ui-password.mjs +517 -0
  68. package/fesm2022/star-ng-ui-password.mjs.map +1 -0
  69. package/fesm2022/star-ng-ui-popover.mjs +241 -0
  70. package/fesm2022/star-ng-ui-popover.mjs.map +1 -0
  71. package/fesm2022/star-ng-ui-progress-bar.mjs +183 -0
  72. package/fesm2022/star-ng-ui-progress-bar.mjs.map +1 -0
  73. package/fesm2022/star-ng-ui-radio.mjs +411 -0
  74. package/fesm2022/star-ng-ui-radio.mjs.map +1 -0
  75. package/fesm2022/star-ng-ui-rating.mjs +211 -0
  76. package/fesm2022/star-ng-ui-rating.mjs.map +1 -0
  77. package/fesm2022/star-ng-ui-select-button.mjs +613 -0
  78. package/fesm2022/star-ng-ui-select-button.mjs.map +1 -0
  79. package/fesm2022/star-ng-ui-select.mjs +2523 -0
  80. package/fesm2022/star-ng-ui-select.mjs.map +1 -0
  81. package/fesm2022/star-ng-ui-skeleton.mjs +160 -0
  82. package/fesm2022/star-ng-ui-skeleton.mjs.map +1 -0
  83. package/fesm2022/star-ng-ui-slider.mjs +552 -0
  84. package/fesm2022/star-ng-ui-slider.mjs.map +1 -0
  85. package/fesm2022/star-ng-ui-spinner.mjs +148 -0
  86. package/fesm2022/star-ng-ui-spinner.mjs.map +1 -0
  87. package/fesm2022/star-ng-ui-stepper.mjs +360 -0
  88. package/fesm2022/star-ng-ui-stepper.mjs.map +1 -0
  89. package/fesm2022/star-ng-ui-table.mjs +3477 -0
  90. package/fesm2022/star-ng-ui-table.mjs.map +1 -0
  91. package/fesm2022/star-ng-ui-tabs.mjs +464 -0
  92. package/fesm2022/star-ng-ui-tabs.mjs.map +1 -0
  93. package/fesm2022/star-ng-ui-tag.mjs +129 -0
  94. package/fesm2022/star-ng-ui-tag.mjs.map +1 -0
  95. package/fesm2022/star-ng-ui-theme-switch.mjs +105 -0
  96. package/fesm2022/star-ng-ui-theme-switch.mjs.map +1 -0
  97. package/fesm2022/star-ng-ui-theme.mjs +98 -0
  98. package/fesm2022/star-ng-ui-theme.mjs.map +1 -0
  99. package/fesm2022/star-ng-ui-toast.mjs +298 -0
  100. package/fesm2022/star-ng-ui-toast.mjs.map +1 -0
  101. package/fesm2022/star-ng-ui-toggle-switch.mjs +316 -0
  102. package/fesm2022/star-ng-ui-toggle-switch.mjs.map +1 -0
  103. package/fesm2022/star-ng-ui-tooltip.mjs +297 -0
  104. package/fesm2022/star-ng-ui-tooltip.mjs.map +1 -0
  105. package/fesm2022/star-ng-ui-transloco.mjs +40 -0
  106. package/fesm2022/star-ng-ui-transloco.mjs.map +1 -0
  107. package/fesm2022/star-ng-ui-tree.mjs +1446 -0
  108. package/fesm2022/star-ng-ui-tree.mjs.map +1 -0
  109. package/fesm2022/star-ng-ui-utility.mjs +2134 -0
  110. package/fesm2022/star-ng-ui-utility.mjs.map +1 -0
  111. package/fesm2022/star-ng-ui.mjs +51 -0
  112. package/package.json +281 -3
  113. package/styles/_base.scss +70 -0
  114. package/styles/_shared.scss +2 -0
  115. package/styles/_tokens.scss +190 -0
  116. package/styles/controls/_accordion.scss +75 -0
  117. package/styles/controls/_autocomplete.scss +44 -0
  118. package/styles/controls/_avatar.scss +39 -0
  119. package/styles/controls/_breadcrumb.scss +45 -0
  120. package/styles/controls/_button.scss +137 -0
  121. package/styles/controls/_card.scss +38 -0
  122. package/styles/controls/_chart.scss +214 -0
  123. package/styles/controls/_chip.scss +51 -0
  124. package/styles/controls/_choice.scss +153 -0
  125. package/styles/controls/_data-display.scss +118 -0
  126. package/styles/controls/_date-picker.scss +300 -0
  127. package/styles/controls/_dialog.scss +123 -0
  128. package/styles/controls/_drawer.scss +118 -0
  129. package/styles/controls/_editor.scss +74 -0
  130. package/styles/controls/_field.scss +92 -0
  131. package/styles/controls/_file-upload.scss +136 -0
  132. package/styles/controls/_input-group.scss +104 -0
  133. package/styles/controls/_input-mask.scss +46 -0
  134. package/styles/controls/_input-number.scss +125 -0
  135. package/styles/controls/_knob.scss +76 -0
  136. package/styles/controls/_layout.scss +182 -0
  137. package/styles/controls/_listbox.scss +38 -0
  138. package/styles/controls/_media.scss +222 -0
  139. package/styles/controls/_menu.scss +254 -0
  140. package/styles/controls/_message.scss +48 -0
  141. package/styles/controls/_org-chart.scss +128 -0
  142. package/styles/controls/_paginator.scss +59 -0
  143. package/styles/controls/_panel.scss +83 -0
  144. package/styles/controls/_popover.scss +40 -0
  145. package/styles/controls/_progress-bar.scss +74 -0
  146. package/styles/controls/_select-button.scss +61 -0
  147. package/styles/controls/_select.scss +216 -0
  148. package/styles/controls/_skeleton.scss +43 -0
  149. package/styles/controls/_slider.scss +163 -0
  150. package/styles/controls/_spinner.scss +34 -0
  151. package/styles/controls/_stepper.scss +109 -0
  152. package/styles/controls/_table.scss +523 -0
  153. package/styles/controls/_tabs.scss +93 -0
  154. package/styles/controls/_tag.scss +84 -0
  155. package/styles/controls/_toast.scss +141 -0
  156. package/styles/controls/_tooltip.scss +14 -0
  157. package/styles/controls/_tree.scss +113 -0
  158. package/styles/controls/_utility.scss +654 -0
  159. package/styles/star-ng.css +5803 -0
  160. package/styles/star-ng.min.css +1 -0
  161. package/styles/star-ng.scss +50 -0
  162. package/theme/star-theme-first-paint.js +1 -0
  163. package/types/star-ng-ui-accordion.d.ts +82 -0
  164. package/types/star-ng-ui-autocomplete.d.ts +171 -0
  165. package/types/star-ng-ui-avatar.d.ts +43 -0
  166. package/types/star-ng-ui-badge.d.ts +46 -0
  167. package/types/star-ng-ui-breadcrumb.d.ts +39 -0
  168. package/types/star-ng-ui-button.d.ts +79 -0
  169. package/types/star-ng-ui-card.d.ts +29 -0
  170. package/types/star-ng-ui-chart.d.ts +337 -0
  171. package/types/star-ng-ui-checkbox.d.ts +92 -0
  172. package/types/star-ng-ui-core.d.ts +310 -0
  173. package/types/star-ng-ui-data-display.d.ts +339 -0
  174. package/types/star-ng-ui-date-picker.d.ts +701 -0
  175. package/types/star-ng-ui-dialog.d.ts +254 -0
  176. package/types/star-ng-ui-drawer.d.ts +29 -0
  177. package/types/star-ng-ui-editor.d.ts +96 -0
  178. package/types/star-ng-ui-field.d.ts +146 -0
  179. package/types/star-ng-ui-file-upload.d.ts +192 -0
  180. package/types/star-ng-ui-i18n-de.d.ts +7 -0
  181. package/types/star-ng-ui-i18n-es.d.ts +7 -0
  182. package/types/star-ng-ui-input-group.d.ts +58 -0
  183. package/types/star-ng-ui-input-mask.d.ts +126 -0
  184. package/types/star-ng-ui-input-number.d.ts +193 -0
  185. package/types/star-ng-ui-input-otp.d.ts +86 -0
  186. package/types/star-ng-ui-input-tags.d.ts +159 -0
  187. package/types/star-ng-ui-knob.d.ts +121 -0
  188. package/types/star-ng-ui-layout.d.ts +154 -0
  189. package/types/star-ng-ui-listbox.d.ts +197 -0
  190. package/types/star-ng-ui-media.d.ts +161 -0
  191. package/types/star-ng-ui-menu.d.ts +332 -0
  192. package/types/star-ng-ui-message.d.ts +52 -0
  193. package/types/star-ng-ui-paginator.d.ts +85 -0
  194. package/types/star-ng-ui-panel.d.ts +65 -0
  195. package/types/star-ng-ui-password.d.ts +129 -0
  196. package/types/star-ng-ui-popover.d.ts +57 -0
  197. package/types/star-ng-ui-progress-bar.d.ts +49 -0
  198. package/types/star-ng-ui-radio.d.ts +116 -0
  199. package/types/star-ng-ui-rating.d.ts +52 -0
  200. package/types/star-ng-ui-select-button.d.ts +169 -0
  201. package/types/star-ng-ui-select.d.ts +540 -0
  202. package/types/star-ng-ui-skeleton.d.ts +47 -0
  203. package/types/star-ng-ui-slider.d.ts +145 -0
  204. package/types/star-ng-ui-spinner.d.ts +29 -0
  205. package/types/star-ng-ui-stepper.d.ts +89 -0
  206. package/types/star-ng-ui-table.d.ts +829 -0
  207. package/types/star-ng-ui-tabs.d.ts +109 -0
  208. package/types/star-ng-ui-tag.d.ts +35 -0
  209. package/types/star-ng-ui-theme-switch.d.ts +36 -0
  210. package/types/star-ng-ui-theme.d.ts +95 -0
  211. package/types/star-ng-ui-toast.d.ts +84 -0
  212. package/types/star-ng-ui-toggle-switch.d.ts +81 -0
  213. package/types/star-ng-ui-tooltip.d.ts +66 -0
  214. package/types/star-ng-ui-transloco.d.ts +14 -0
  215. package/types/star-ng-ui-tree.d.ts +310 -0
  216. package/types/star-ng-ui-utility.d.ts +533 -0
  217. package/types/star-ng-ui.d.ts +51 -0
@@ -0,0 +1,2523 @@
1
+ import { _IdGenerator } from "@angular/cdk/a11y";
2
+ import { CdkMenuTrigger } from "@angular/cdk/menu";
3
+ import * as i0 from "@angular/core";
4
+ import { ChangeDetectionStrategy, Component, DestroyRef, Directive, TemplateRef, booleanAttribute, computed, contentChild, inject, input, model, output, signal, viewChild } from "@angular/core";
5
+ import { STAR_UI_TEXT, StarDirectionService, matchesFilter, optionText, readOption } from "@star-ng/ui/core";
6
+ import { STAR_MENU_POSITIONS, StarMenu, StarMenuInDialog } from "@star-ng/ui/menu";
7
+ import { CdkConnectedOverlay, CdkOverlayOrigin } from "@angular/cdk/overlay";
8
+ import { NgTemplateOutlet } from "@angular/common";
9
+ var StarCascadeSelect = class StarCascadeSelect {
10
+ directionSync = inject(StarDirectionService);
11
+ text = inject(STAR_UI_TEXT);
12
+ positions = STAR_MENU_POSITIONS;
13
+ value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
14
+ options = input([], ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
15
+ optionLabel = input(null, ...ngDevMode ? [{ debugName: "optionLabel" }] : /* istanbul ignore next */ []);
16
+ optionValue = input(null, ...ngDevMode ? [{ debugName: "optionValue" }] : /* istanbul ignore next */ []);
17
+ optionChildren = input("children", ...ngDevMode ? [{ debugName: "optionChildren" }] : /* istanbul ignore next */ []);
18
+ optionDisabled = input(null, ...ngDevMode ? [{ debugName: "optionDisabled" }] : /* istanbul ignore next */ []);
19
+ compareWith = input(Object.is, ...ngDevMode ? [{ debugName: "compareWith" }] : /* istanbul ignore next */ []);
20
+ placeholder = input(null, ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
21
+ showPath = input(false, {
22
+ ...ngDevMode ? { debugName: "showPath" } : /* istanbul ignore next */ {},
23
+ transform: booleanAttribute
24
+ });
25
+ showClear = input(false, {
26
+ ...ngDevMode ? { debugName: "showClear" } : /* istanbul ignore next */ {},
27
+ transform: booleanAttribute
28
+ });
29
+ size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
30
+ ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
31
+ inputId = input(inject(_IdGenerator).getId("star-cascade-"), ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
32
+ disabled = input(false, {
33
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
34
+ transform: booleanAttribute
35
+ });
36
+ readonly = input(false, {
37
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
38
+ transform: booleanAttribute
39
+ });
40
+ required = input(false, {
41
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
42
+ transform: booleanAttribute
43
+ });
44
+ invalid = input(false, {
45
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
46
+ transform: booleanAttribute
47
+ });
48
+ touched = input(false, {
49
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
50
+ transform: booleanAttribute
51
+ });
52
+ touch = output();
53
+ optionSelect = output();
54
+ childrenOf(option) {
55
+ const children = readOption(option, this.optionChildren());
56
+ return Array.isArray(children) ? children : [];
57
+ }
58
+ labelOf(option) {
59
+ return optionText(option, this.optionLabel() ?? null);
60
+ }
61
+ leaves = computed(() => {
62
+ const out = [];
63
+ const walk = (options, path) => {
64
+ for (const option of options) {
65
+ const next = [...path, this.labelOf(option)];
66
+ const children = this.childrenOf(option);
67
+ if (children.length) walk(children, next);
68
+ else out.push({
69
+ option,
70
+ value: readOption(option, this.optionValue()),
71
+ path: next
72
+ });
73
+ }
74
+ };
75
+ walk(this.options(), []);
76
+ return out;
77
+ }, ...ngDevMode ? [{ debugName: "leaves" }] : /* istanbul ignore next */ []);
78
+ selected = computed(() => {
79
+ const value = this.value();
80
+ if (value === null || value === void 0) return null;
81
+ return this.leaves().find((leaf) => this.compareWith()(leaf.value, value)) ?? null;
82
+ }, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
83
+ menuItems = computed(() => {
84
+ const disabledKey = this.optionDisabled();
85
+ const selected = this.selected()?.option;
86
+ const build = (options) => options.map((option) => {
87
+ const children = this.childrenOf(option);
88
+ const disabled = disabledKey ? !!readOption(option, disabledKey) : false;
89
+ return children.length ? {
90
+ label: this.labelOf(option),
91
+ disabled,
92
+ items: build(children)
93
+ } : {
94
+ label: this.labelOf(option),
95
+ disabled,
96
+ icon: option === selected ? "ph-bold ph-check" : void 0,
97
+ command: () => this.choose(option)
98
+ };
99
+ });
100
+ return build(this.options());
101
+ }, ...ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []);
102
+ triggerName = computed(() => {
103
+ const label = this.ariaLabel();
104
+ if (!label) return null;
105
+ const leaf = this.selected();
106
+ return `${label}: ${leaf ? this.display(leaf) : this.placeholder() ?? this.text.selectPlaceholder}`;
107
+ }, ...ngDevMode ? [{ debugName: "triggerName" }] : /* istanbul ignore next */ []);
108
+ display(leaf) {
109
+ return this.showPath() ? leaf.path.join(" / ") : leaf.path.at(-1) ?? "";
110
+ }
111
+ choose(option) {
112
+ this.value.set(readOption(option, this.optionValue()));
113
+ this.optionSelect.emit(option);
114
+ }
115
+ clear() {
116
+ this.value.set(null);
117
+ }
118
+ static ɵfac = i0.ɵɵngDeclareFactory({
119
+ minVersion: "12.0.0",
120
+ version: "22.2.6",
121
+ ngImport: i0,
122
+ type: StarCascadeSelect,
123
+ deps: [],
124
+ target: i0.ɵɵFactoryTarget.Component
125
+ });
126
+ static ɵcmp = i0.ɵɵngDeclareComponent({
127
+ minVersion: "17.0.0",
128
+ version: "22.2.6",
129
+ type: StarCascadeSelect,
130
+ isStandalone: true,
131
+ selector: "star-cascade-select",
132
+ inputs: {
133
+ value: {
134
+ classPropertyName: "value",
135
+ publicName: "value",
136
+ isSignal: true,
137
+ isRequired: false,
138
+ transformFunction: null
139
+ },
140
+ options: {
141
+ classPropertyName: "options",
142
+ publicName: "options",
143
+ isSignal: true,
144
+ isRequired: false,
145
+ transformFunction: null
146
+ },
147
+ optionLabel: {
148
+ classPropertyName: "optionLabel",
149
+ publicName: "optionLabel",
150
+ isSignal: true,
151
+ isRequired: false,
152
+ transformFunction: null
153
+ },
154
+ optionValue: {
155
+ classPropertyName: "optionValue",
156
+ publicName: "optionValue",
157
+ isSignal: true,
158
+ isRequired: false,
159
+ transformFunction: null
160
+ },
161
+ optionChildren: {
162
+ classPropertyName: "optionChildren",
163
+ publicName: "optionChildren",
164
+ isSignal: true,
165
+ isRequired: false,
166
+ transformFunction: null
167
+ },
168
+ optionDisabled: {
169
+ classPropertyName: "optionDisabled",
170
+ publicName: "optionDisabled",
171
+ isSignal: true,
172
+ isRequired: false,
173
+ transformFunction: null
174
+ },
175
+ compareWith: {
176
+ classPropertyName: "compareWith",
177
+ publicName: "compareWith",
178
+ isSignal: true,
179
+ isRequired: false,
180
+ transformFunction: null
181
+ },
182
+ placeholder: {
183
+ classPropertyName: "placeholder",
184
+ publicName: "placeholder",
185
+ isSignal: true,
186
+ isRequired: false,
187
+ transformFunction: null
188
+ },
189
+ showPath: {
190
+ classPropertyName: "showPath",
191
+ publicName: "showPath",
192
+ isSignal: true,
193
+ isRequired: false,
194
+ transformFunction: null
195
+ },
196
+ showClear: {
197
+ classPropertyName: "showClear",
198
+ publicName: "showClear",
199
+ isSignal: true,
200
+ isRequired: false,
201
+ transformFunction: null
202
+ },
203
+ size: {
204
+ classPropertyName: "size",
205
+ publicName: "size",
206
+ isSignal: true,
207
+ isRequired: false,
208
+ transformFunction: null
209
+ },
210
+ ariaLabel: {
211
+ classPropertyName: "ariaLabel",
212
+ publicName: "ariaLabel",
213
+ isSignal: true,
214
+ isRequired: false,
215
+ transformFunction: null
216
+ },
217
+ inputId: {
218
+ classPropertyName: "inputId",
219
+ publicName: "inputId",
220
+ isSignal: true,
221
+ isRequired: false,
222
+ transformFunction: null
223
+ },
224
+ disabled: {
225
+ classPropertyName: "disabled",
226
+ publicName: "disabled",
227
+ isSignal: true,
228
+ isRequired: false,
229
+ transformFunction: null
230
+ },
231
+ readonly: {
232
+ classPropertyName: "readonly",
233
+ publicName: "readonly",
234
+ isSignal: true,
235
+ isRequired: false,
236
+ transformFunction: null
237
+ },
238
+ required: {
239
+ classPropertyName: "required",
240
+ publicName: "required",
241
+ isSignal: true,
242
+ isRequired: false,
243
+ transformFunction: null
244
+ },
245
+ invalid: {
246
+ classPropertyName: "invalid",
247
+ publicName: "invalid",
248
+ isSignal: true,
249
+ isRequired: false,
250
+ transformFunction: null
251
+ },
252
+ touched: {
253
+ classPropertyName: "touched",
254
+ publicName: "touched",
255
+ isSignal: true,
256
+ isRequired: false,
257
+ transformFunction: null
258
+ }
259
+ },
260
+ outputs: {
261
+ value: "valueChange",
262
+ touch: "touch",
263
+ optionSelect: "optionSelect"
264
+ },
265
+ host: {
266
+ properties: {
267
+ "class.star-select--disabled": "disabled()",
268
+ "class.star-select--invalid": "invalid() && touched()",
269
+ "class.star-select--sm": "size() === 'sm'"
270
+ },
271
+ classAttribute: "star-select star-cascade"
272
+ },
273
+ ngImport: i0,
274
+ template: `
275
+ <div class="star-select__control">
276
+ <button
277
+ #trigger="cdkMenuTriggerFor"
278
+ type="button"
279
+ class="star-select__trigger star-cascade__trigger"
280
+ [id]="inputId()"
281
+ [cdkMenuTriggerFor]="menu.template()"
282
+ [cdkMenuTriggerData]="{ $implicit: menuItems() }"
283
+ [cdkMenuPosition]="positions"
284
+ [disabled]="disabled() || readonly()"
285
+ [attr.aria-label]="triggerName()"
286
+ [attr.aria-invalid]="(invalid() && touched()) || null"
287
+ (cdkMenuClosed)="touch.emit()"
288
+ >
289
+ @if (selected(); as leaf) {
290
+ <span class="star-select__value">{{ display(leaf) }}</span>
291
+ } @else {
292
+ <span class="star-select__placeholder">{{
293
+ placeholder() ?? text.selectPlaceholder
294
+ }}</span>
295
+ }
296
+ </button>
297
+ @if (showClear() && selected() && !disabled() && !readonly()) {
298
+ <button
299
+ type="button"
300
+ class="star-select__icon-btn"
301
+ [attr.aria-label]="text.clear"
302
+ (click)="clear()"
303
+ >
304
+ <i class="ph-bold ph-x" aria-hidden="true"></i>
305
+ </button>
306
+ }
307
+ <i class="ph-bold ph-caret-down star-select__caret" aria-hidden="true"></i>
308
+ </div>
309
+ <star-menu #menu [ariaLabel]="ariaLabel()" />
310
+ `,
311
+ isInline: true,
312
+ dependencies: [
313
+ {
314
+ kind: "directive",
315
+ type: CdkMenuTrigger,
316
+ selector: "[cdkMenuTriggerFor]",
317
+ inputs: [
318
+ "cdkMenuTriggerFor",
319
+ "cdkMenuPosition",
320
+ "cdkMenuTriggerData",
321
+ "cdkMenuTriggerTransformOriginOn"
322
+ ],
323
+ outputs: ["cdkMenuOpened", "cdkMenuClosed"],
324
+ exportAs: ["cdkMenuTriggerFor"]
325
+ },
326
+ {
327
+ kind: "component",
328
+ type: StarMenu,
329
+ selector: "star-menu",
330
+ inputs: [
331
+ "items",
332
+ "inline",
333
+ "ariaLabel"
334
+ ],
335
+ outputs: ["itemClick"]
336
+ },
337
+ {
338
+ kind: "directive",
339
+ type: StarMenuInDialog,
340
+ selector: "[cdkMenuTriggerFor]"
341
+ }
342
+ ],
343
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
344
+ });
345
+ };
346
+ i0.ɵɵngDeclareClassMetadata({
347
+ minVersion: "12.0.0",
348
+ version: "22.2.6",
349
+ ngImport: i0,
350
+ type: StarCascadeSelect,
351
+ decorators: [{
352
+ type: Component,
353
+ args: [{
354
+ selector: "star-cascade-select",
355
+ imports: [
356
+ CdkMenuTrigger,
357
+ StarMenu,
358
+ StarMenuInDialog
359
+ ],
360
+ changeDetection: ChangeDetectionStrategy.OnPush,
361
+ host: {
362
+ class: "star-select star-cascade",
363
+ "[class.star-select--disabled]": "disabled()",
364
+ "[class.star-select--invalid]": "invalid() && touched()",
365
+ "[class.star-select--sm]": "size() === 'sm'"
366
+ },
367
+ template: `
368
+ <div class="star-select__control">
369
+ <button
370
+ #trigger="cdkMenuTriggerFor"
371
+ type="button"
372
+ class="star-select__trigger star-cascade__trigger"
373
+ [id]="inputId()"
374
+ [cdkMenuTriggerFor]="menu.template()"
375
+ [cdkMenuTriggerData]="{ $implicit: menuItems() }"
376
+ [cdkMenuPosition]="positions"
377
+ [disabled]="disabled() || readonly()"
378
+ [attr.aria-label]="triggerName()"
379
+ [attr.aria-invalid]="(invalid() && touched()) || null"
380
+ (cdkMenuClosed)="touch.emit()"
381
+ >
382
+ @if (selected(); as leaf) {
383
+ <span class="star-select__value">{{ display(leaf) }}</span>
384
+ } @else {
385
+ <span class="star-select__placeholder">{{
386
+ placeholder() ?? text.selectPlaceholder
387
+ }}</span>
388
+ }
389
+ </button>
390
+ @if (showClear() && selected() && !disabled() && !readonly()) {
391
+ <button
392
+ type="button"
393
+ class="star-select__icon-btn"
394
+ [attr.aria-label]="text.clear"
395
+ (click)="clear()"
396
+ >
397
+ <i class="ph-bold ph-x" aria-hidden="true"></i>
398
+ </button>
399
+ }
400
+ <i class="ph-bold ph-caret-down star-select__caret" aria-hidden="true"></i>
401
+ </div>
402
+ <star-menu #menu [ariaLabel]="ariaLabel()" />
403
+ `
404
+ }]
405
+ }],
406
+ propDecorators: {
407
+ value: [{
408
+ type: i0.Input,
409
+ args: [{
410
+ isSignal: true,
411
+ alias: "value",
412
+ required: false
413
+ }]
414
+ }, {
415
+ type: i0.Output,
416
+ args: ["valueChange"]
417
+ }],
418
+ options: [{
419
+ type: i0.Input,
420
+ args: [{
421
+ isSignal: true,
422
+ alias: "options",
423
+ required: false
424
+ }]
425
+ }],
426
+ optionLabel: [{
427
+ type: i0.Input,
428
+ args: [{
429
+ isSignal: true,
430
+ alias: "optionLabel",
431
+ required: false
432
+ }]
433
+ }],
434
+ optionValue: [{
435
+ type: i0.Input,
436
+ args: [{
437
+ isSignal: true,
438
+ alias: "optionValue",
439
+ required: false
440
+ }]
441
+ }],
442
+ optionChildren: [{
443
+ type: i0.Input,
444
+ args: [{
445
+ isSignal: true,
446
+ alias: "optionChildren",
447
+ required: false
448
+ }]
449
+ }],
450
+ optionDisabled: [{
451
+ type: i0.Input,
452
+ args: [{
453
+ isSignal: true,
454
+ alias: "optionDisabled",
455
+ required: false
456
+ }]
457
+ }],
458
+ compareWith: [{
459
+ type: i0.Input,
460
+ args: [{
461
+ isSignal: true,
462
+ alias: "compareWith",
463
+ required: false
464
+ }]
465
+ }],
466
+ placeholder: [{
467
+ type: i0.Input,
468
+ args: [{
469
+ isSignal: true,
470
+ alias: "placeholder",
471
+ required: false
472
+ }]
473
+ }],
474
+ showPath: [{
475
+ type: i0.Input,
476
+ args: [{
477
+ isSignal: true,
478
+ alias: "showPath",
479
+ required: false
480
+ }]
481
+ }],
482
+ showClear: [{
483
+ type: i0.Input,
484
+ args: [{
485
+ isSignal: true,
486
+ alias: "showClear",
487
+ required: false
488
+ }]
489
+ }],
490
+ size: [{
491
+ type: i0.Input,
492
+ args: [{
493
+ isSignal: true,
494
+ alias: "size",
495
+ required: false
496
+ }]
497
+ }],
498
+ ariaLabel: [{
499
+ type: i0.Input,
500
+ args: [{
501
+ isSignal: true,
502
+ alias: "ariaLabel",
503
+ required: false
504
+ }]
505
+ }],
506
+ inputId: [{
507
+ type: i0.Input,
508
+ args: [{
509
+ isSignal: true,
510
+ alias: "inputId",
511
+ required: false
512
+ }]
513
+ }],
514
+ disabled: [{
515
+ type: i0.Input,
516
+ args: [{
517
+ isSignal: true,
518
+ alias: "disabled",
519
+ required: false
520
+ }]
521
+ }],
522
+ readonly: [{
523
+ type: i0.Input,
524
+ args: [{
525
+ isSignal: true,
526
+ alias: "readonly",
527
+ required: false
528
+ }]
529
+ }],
530
+ required: [{
531
+ type: i0.Input,
532
+ args: [{
533
+ isSignal: true,
534
+ alias: "required",
535
+ required: false
536
+ }]
537
+ }],
538
+ invalid: [{
539
+ type: i0.Input,
540
+ args: [{
541
+ isSignal: true,
542
+ alias: "invalid",
543
+ required: false
544
+ }]
545
+ }],
546
+ touched: [{
547
+ type: i0.Input,
548
+ args: [{
549
+ isSignal: true,
550
+ alias: "touched",
551
+ required: false
552
+ }]
553
+ }],
554
+ touch: [{
555
+ type: i0.Output,
556
+ args: ["touch"]
557
+ }],
558
+ optionSelect: [{
559
+ type: i0.Output,
560
+ args: ["optionSelect"]
561
+ }]
562
+ }
563
+ });
564
+ var StarOptionTemplate = class StarOptionTemplate {
565
+ starOptionOf = input(null, ...ngDevMode ? [{ debugName: "starOptionOf" }] : /* istanbul ignore next */ []);
566
+ template = inject(TemplateRef);
567
+ static ngTemplateContextGuard(_dir, _ctx) {
568
+ return true;
569
+ }
570
+ static ɵfac = i0.ɵɵngDeclareFactory({
571
+ minVersion: "12.0.0",
572
+ version: "22.2.6",
573
+ ngImport: i0,
574
+ type: StarOptionTemplate,
575
+ deps: [],
576
+ target: i0.ɵɵFactoryTarget.Directive
577
+ });
578
+ static ɵdir = i0.ɵɵngDeclareDirective({
579
+ minVersion: "17.1.0",
580
+ version: "22.2.6",
581
+ type: StarOptionTemplate,
582
+ isStandalone: true,
583
+ selector: "ng-template[starOption]",
584
+ inputs: { starOptionOf: {
585
+ classPropertyName: "starOptionOf",
586
+ publicName: "starOptionOf",
587
+ isSignal: true,
588
+ isRequired: false,
589
+ transformFunction: null
590
+ } },
591
+ ngImport: i0
592
+ });
593
+ };
594
+ i0.ɵɵngDeclareClassMetadata({
595
+ minVersion: "12.0.0",
596
+ version: "22.2.6",
597
+ ngImport: i0,
598
+ type: StarOptionTemplate,
599
+ decorators: [{
600
+ type: Directive,
601
+ args: [{ selector: "ng-template[starOption]" }]
602
+ }],
603
+ propDecorators: { starOptionOf: [{
604
+ type: i0.Input,
605
+ args: [{
606
+ isSignal: true,
607
+ alias: "starOptionOf",
608
+ required: false
609
+ }]
610
+ }] }
611
+ });
612
+ const VIRTUAL_BUFFER = 6;
613
+ const VIRTUAL_FALLBACK_HEIGHT = 256;
614
+ const PANEL_POSITIONS = [{
615
+ originX: "start",
616
+ originY: "bottom",
617
+ overlayX: "start",
618
+ overlayY: "top",
619
+ offsetY: 6
620
+ }, {
621
+ originX: "start",
622
+ originY: "top",
623
+ overlayX: "start",
624
+ overlayY: "bottom",
625
+ offsetY: -6
626
+ }];
627
+ var StarOptionListBase = class StarOptionListBase {
628
+ directionSync = inject(StarDirectionService);
629
+ text = inject(STAR_UI_TEXT);
630
+ ids = inject(_IdGenerator);
631
+ options = input([], ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
632
+ optionLabel = input(null, ...ngDevMode ? [{ debugName: "optionLabel" }] : /* istanbul ignore next */ []);
633
+ optionValue = input(null, ...ngDevMode ? [{ debugName: "optionValue" }] : /* istanbul ignore next */ []);
634
+ optionDisabled = input(null, ...ngDevMode ? [{ debugName: "optionDisabled" }] : /* istanbul ignore next */ []);
635
+ compareWith = input(Object.is, ...ngDevMode ? [{ debugName: "compareWith" }] : /* istanbul ignore next */ []);
636
+ optionGroup = input(null, ...ngDevMode ? [{ debugName: "optionGroup" }] : /* istanbul ignore next */ []);
637
+ virtualScroll = input(false, {
638
+ ...ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {},
639
+ transform: booleanAttribute
640
+ });
641
+ virtualItemSize = input(40, ...ngDevMode ? [{ debugName: "virtualItemSize" }] : /* istanbul ignore next */ []);
642
+ placeholder = input(null, ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
643
+ filter = input(false, {
644
+ ...ngDevMode ? { debugName: "filter" } : /* istanbul ignore next */ {},
645
+ transform: booleanAttribute
646
+ });
647
+ filterPlaceholder = input(null, ...ngDevMode ? [{ debugName: "filterPlaceholder" }] : /* istanbul ignore next */ []);
648
+ showClear = input(false, {
649
+ ...ngDevMode ? { debugName: "showClear" } : /* istanbul ignore next */ {},
650
+ transform: booleanAttribute
651
+ });
652
+ loading = input(false, {
653
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
654
+ transform: booleanAttribute
655
+ });
656
+ emptyMessage = input(null, ...ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []);
657
+ scrollHeight = input("16rem", ...ngDevMode ? [{ debugName: "scrollHeight" }] : /* istanbul ignore next */ []);
658
+ size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
659
+ ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
660
+ ariaLabelledBy = input(null, ...ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []);
661
+ inputId = input(this.ids.getId("star-select-"), ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
662
+ disabled = input(false, {
663
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
664
+ transform: booleanAttribute
665
+ });
666
+ readonly = input(false, {
667
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
668
+ transform: booleanAttribute
669
+ });
670
+ required = input(false, {
671
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
672
+ transform: booleanAttribute
673
+ });
674
+ invalid = input(false, {
675
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
676
+ transform: booleanAttribute
677
+ });
678
+ touched = input(false, {
679
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
680
+ transform: booleanAttribute
681
+ });
682
+ name = input("", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
683
+ touch = output();
684
+ opened = output();
685
+ closed = output();
686
+ filterChange = output();
687
+ optionTemplate = contentChild(StarOptionTemplate, ...ngDevMode ? [{ debugName: "optionTemplate" }] : /* istanbul ignore next */ []);
688
+ trigger = viewChild.required("trigger", ...ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []);
689
+ filterInput = viewChild("filterInput", ...ngDevMode ? [{ debugName: "filterInput" }] : /* istanbul ignore next */ []);
690
+ positions = PANEL_POSITIONS;
691
+ listId = this.ids.getId("star-listbox-");
692
+ open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
693
+ filterValue = signal("", ...ngDevMode ? [{ debugName: "filterValue" }] : /* istanbul ignore next */ []);
694
+ activeIndex = signal(-1, ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
695
+ showInvalid = computed(() => this.invalid() && this.touched(), ...ngDevMode ? [{ debugName: "showInvalid" }] : /* istanbul ignore next */ []);
696
+ interactive = computed(() => !this.disabled() && !this.readonly(), ...ngDevMode ? [{ debugName: "interactive" }] : /* istanbul ignore next */ []);
697
+ visibleOptions = computed(() => {
698
+ const query = this.filterValue();
699
+ const all = this.options();
700
+ const options = !this.filter() || !query ? all : all.filter((option) => matchesFilter(this.labelOf(option), query));
701
+ return this.groupedOrder(options);
702
+ }, ...ngDevMode ? [{ debugName: "visibleOptions" }] : /* istanbul ignore next */ []);
703
+ groupedOrder(options) {
704
+ if (!this.optionGroup()) return options;
705
+ const order = /* @__PURE__ */ new Map();
706
+ for (const option of options) {
707
+ const group = this.groupOf(option);
708
+ if (!order.has(group)) order.set(group, order.size);
709
+ }
710
+ return options.map((option, index) => ({
711
+ option,
712
+ index,
713
+ rank: order.get(this.groupOf(option)) ?? 0
714
+ })).sort((a, b) => a.rank - b.rank || a.index - b.index).map(({ option }) => option);
715
+ }
716
+ rows = computed(() => {
717
+ const grouped = !!this.optionGroup();
718
+ const rows = [];
719
+ let current = null;
720
+ let groupId = null;
721
+ this.visibleOptions().forEach((option, index) => {
722
+ if (grouped) {
723
+ const label = this.groupOf(option);
724
+ if (label !== current) {
725
+ current = label;
726
+ groupId = `${this.listId}-group-${rows.length}`;
727
+ rows.push({
728
+ kind: "group",
729
+ key: `g:${label}`,
730
+ label,
731
+ id: groupId
732
+ });
733
+ }
734
+ }
735
+ rows.push({
736
+ kind: "option",
737
+ key: `o:${index}`,
738
+ option,
739
+ index,
740
+ groupId
741
+ });
742
+ });
743
+ return rows;
744
+ }, ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
745
+ listScrollTop = signal(0, ...ngDevMode ? [{ debugName: "listScrollTop" }] : /* istanbul ignore next */ []);
746
+ listHeight = signal(0, ...ngDevMode ? [{ debugName: "listHeight" }] : /* istanbul ignore next */ []);
747
+ virtualWindow = computed(() => {
748
+ const count = this.rows().length;
749
+ if (!this.virtualScroll()) return {
750
+ start: 0,
751
+ end: count,
752
+ before: 0,
753
+ after: 0
754
+ };
755
+ const size = Math.max(1, this.virtualItemSize());
756
+ const visible = Math.ceil((this.listHeight() || VIRTUAL_FALLBACK_HEIGHT) / size);
757
+ const first = Math.min(Math.floor(this.listScrollTop() / size), Math.max(0, count - visible));
758
+ const start = Math.max(0, first - VIRTUAL_BUFFER);
759
+ const end = Math.min(count, first + visible + VIRTUAL_BUFFER);
760
+ return {
761
+ start,
762
+ end,
763
+ before: start * size,
764
+ after: (count - end) * size
765
+ };
766
+ }, ...ngDevMode ? [{ debugName: "virtualWindow" }] : /* istanbul ignore next */ []);
767
+ renderedRows = computed(() => {
768
+ const rows = this.rows();
769
+ const { start, end } = this.virtualWindow();
770
+ return start === 0 && end === rows.length ? rows : rows.slice(start, end);
771
+ }, ...ngDevMode ? [{ debugName: "renderedRows" }] : /* istanbul ignore next */ []);
772
+ onListScroll(event) {
773
+ if (!this.virtualScroll()) return;
774
+ const list = event.target;
775
+ this.listScrollTop.set(list.scrollTop);
776
+ this.listHeight.set(list.clientHeight);
777
+ }
778
+ activeId = computed(() => this.open() && this.activeIndex() >= 0 ? this.optionId(this.activeIndex()) : null, ...ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []);
779
+ emptyText = computed(() => this.filterValue() ? this.text.emptyFilterMessage : this.emptyMessage() ?? this.text.emptyMessage, ...ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []);
780
+ typeahead = "";
781
+ typeaheadTimer;
782
+ constructor() {
783
+ inject(DestroyRef).onDestroy(() => clearTimeout(this.typeaheadTimer));
784
+ }
785
+ labelOf(option) {
786
+ return optionText(option, this.optionLabel() ?? null);
787
+ }
788
+ groupOf(option) {
789
+ const key = this.optionGroup();
790
+ const group = key ? readOption(option, key) : null;
791
+ return group === null || group === void 0 ? "" : String(group);
792
+ }
793
+ valueOf(option) {
794
+ return readOption(option, this.optionValue());
795
+ }
796
+ isDisabled(option) {
797
+ const key = this.optionDisabled();
798
+ return key ? !!readOption(option, key) : false;
799
+ }
800
+ equals(a, b) {
801
+ return this.compareWith()(a, b);
802
+ }
803
+ optionId(index) {
804
+ return `${this.listId}-${index}`;
805
+ }
806
+ optionContext(option, index) {
807
+ return {
808
+ $implicit: option,
809
+ selected: this.isSelected(option),
810
+ index
811
+ };
812
+ }
813
+ openPanel() {
814
+ if (!this.interactive() || this.open()) return;
815
+ this.open.set(true);
816
+ this.activeIndex.set(this.initialActiveIndex());
817
+ this.opened.emit();
818
+ }
819
+ closePanel(focusTrigger = true) {
820
+ if (!this.open()) return;
821
+ this.open.set(false);
822
+ this.activeIndex.set(-1);
823
+ this.listScrollTop.set(0);
824
+ if (this.filterValue()) {
825
+ this.filterValue.set("");
826
+ this.filterChange.emit("");
827
+ }
828
+ if (focusTrigger) this.trigger().nativeElement.focus();
829
+ this.closed.emit();
830
+ }
831
+ toggle() {
832
+ if (this.open()) this.closePanel();
833
+ else this.openPanel();
834
+ }
835
+ focus(options) {
836
+ this.trigger().nativeElement.focus(options);
837
+ }
838
+ onPanelAttached() {
839
+ this.filterInput()?.nativeElement.focus();
840
+ this.scrollActiveIntoView();
841
+ }
842
+ onOutsideClick(event) {
843
+ if (this.trigger().nativeElement.contains(event.target)) return;
844
+ this.closePanel(false);
845
+ this.touch.emit();
846
+ }
847
+ onPanelMousedown(event) {
848
+ if (!(event.target instanceof HTMLInputElement)) event.preventDefault();
849
+ }
850
+ onTriggerBlur() {
851
+ if (!this.open()) this.touch.emit();
852
+ }
853
+ onFilterInput(value) {
854
+ this.filterValue.set(value);
855
+ this.filterChange.emit(value);
856
+ this.listScrollTop.set(0);
857
+ this.activeIndex.set(this.firstEnabledFrom(0, 1));
858
+ }
859
+ onOptionClick(option, index) {
860
+ if (this.isDisabled(option)) return;
861
+ this.activeIndex.set(index);
862
+ this.choose(option);
863
+ if (this.closeOnChoose) this.closePanel();
864
+ }
865
+ onKeydown(event) {
866
+ if (!this.interactive()) return;
867
+ const open = this.open();
868
+ switch (event.key) {
869
+ case "ArrowDown":
870
+ case "ArrowUp": {
871
+ event.preventDefault();
872
+ if (!open) {
873
+ this.openPanel();
874
+ return;
875
+ }
876
+ const step = event.key === "ArrowDown" ? 1 : -1;
877
+ if (event.altKey && step === -1) {
878
+ this.chooseActive();
879
+ this.closePanel();
880
+ return;
881
+ }
882
+ this.moveActive(step);
883
+ return;
884
+ }
885
+ case "Home":
886
+ case "End":
887
+ if (!open) return;
888
+ event.preventDefault();
889
+ this.activeIndex.set(event.key === "Home" ? this.firstEnabledFrom(0, 1) : this.firstEnabledFrom(this.visibleOptions().length - 1, -1));
890
+ this.scrollActiveIntoView();
891
+ return;
892
+ case "Enter":
893
+ event.preventDefault();
894
+ if (!open) this.openPanel();
895
+ else this.chooseActive(this.closeOnChoose);
896
+ return;
897
+ case " ":
898
+ if (event.target instanceof HTMLInputElement) return;
899
+ event.preventDefault();
900
+ if (!open) this.openPanel();
901
+ else this.chooseActive(this.closeOnChoose);
902
+ return;
903
+ case "Escape":
904
+ if (open) {
905
+ event.preventDefault();
906
+ event.stopPropagation();
907
+ this.closePanel();
908
+ }
909
+ return;
910
+ case "Tab":
911
+ if (open) this.closePanel(false);
912
+ return;
913
+ default: if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey && !(event.target instanceof HTMLInputElement)) this.runTypeahead(event.key);
914
+ }
915
+ }
916
+ chooseActive(thenClose = false) {
917
+ const option = this.visibleOptions()[this.activeIndex()];
918
+ if (option === void 0 || this.isDisabled(option)) return;
919
+ this.choose(option);
920
+ if (thenClose) this.closePanel();
921
+ }
922
+ moveActive(step) {
923
+ const count = this.visibleOptions().length;
924
+ if (!count) return;
925
+ const start = this.activeIndex() < 0 ? step === 1 ? 0 : count - 1 : this.activeIndex() + step;
926
+ const next = this.firstEnabledFrom(Math.min(Math.max(start, 0), count - 1), step);
927
+ if (next >= 0) this.activeIndex.set(next);
928
+ this.scrollActiveIntoView();
929
+ }
930
+ firstEnabledFrom(start, step) {
931
+ const options = this.visibleOptions();
932
+ for (let i = start; i >= 0 && i < options.length; i += step) if (!this.isDisabled(options[i])) return i;
933
+ return -1;
934
+ }
935
+ runTypeahead(char) {
936
+ clearTimeout(this.typeaheadTimer);
937
+ this.typeahead += char.toLocaleLowerCase();
938
+ this.typeaheadTimer = setTimeout(() => this.typeahead = "", 500);
939
+ const options = this.visibleOptions();
940
+ const start = Math.max(this.activeIndex(), 0);
941
+ const match = [...options.keys()].map((i) => (start + (this.typeahead.length === 1 ? 1 : 0) + i) % options.length).find((i) => !this.isDisabled(options[i]) && this.labelOf(options[i]).toLocaleLowerCase().startsWith(this.typeahead));
942
+ if (match === void 0) return;
943
+ this.activeIndex.set(match);
944
+ if (!this.open() && this.closeOnChoose) this.choose(options[match]);
945
+ this.scrollActiveIntoView();
946
+ }
947
+ scrollActiveIntoView() {
948
+ const id = this.activeId();
949
+ if (!id) return;
950
+ if (this.virtualScroll()) {
951
+ const active = this.activeIndex();
952
+ const line = this.rows().findIndex((row) => row.kind === "option" && row.index === active);
953
+ const list = this.trigger().nativeElement.ownerDocument.getElementById(this.listId);
954
+ if (line < 0 || !list) return;
955
+ const size = Math.max(1, this.virtualItemSize());
956
+ const height = list.clientHeight || VIRTUAL_FALLBACK_HEIGHT;
957
+ const top = line * size;
958
+ let scrollTop = this.listScrollTop();
959
+ if (top < scrollTop) scrollTop = top;
960
+ else if (top + size > scrollTop + height) scrollTop = top + size - height;
961
+ this.listScrollTop.set(scrollTop);
962
+ this.listHeight.set(height);
963
+ queueMicrotask(() => list.scrollTop = scrollTop);
964
+ return;
965
+ }
966
+ queueMicrotask(() => this.trigger().nativeElement.ownerDocument.getElementById(id)?.scrollIntoView?.({ block: "nearest" }));
967
+ }
968
+ static ɵfac = i0.ɵɵngDeclareFactory({
969
+ minVersion: "12.0.0",
970
+ version: "22.2.6",
971
+ ngImport: i0,
972
+ type: StarOptionListBase,
973
+ deps: [],
974
+ target: i0.ɵɵFactoryTarget.Directive
975
+ });
976
+ static ɵdir = i0.ɵɵngDeclareDirective({
977
+ minVersion: "17.2.0",
978
+ version: "22.2.6",
979
+ type: StarOptionListBase,
980
+ isStandalone: true,
981
+ inputs: {
982
+ options: {
983
+ classPropertyName: "options",
984
+ publicName: "options",
985
+ isSignal: true,
986
+ isRequired: false,
987
+ transformFunction: null
988
+ },
989
+ optionLabel: {
990
+ classPropertyName: "optionLabel",
991
+ publicName: "optionLabel",
992
+ isSignal: true,
993
+ isRequired: false,
994
+ transformFunction: null
995
+ },
996
+ optionValue: {
997
+ classPropertyName: "optionValue",
998
+ publicName: "optionValue",
999
+ isSignal: true,
1000
+ isRequired: false,
1001
+ transformFunction: null
1002
+ },
1003
+ optionDisabled: {
1004
+ classPropertyName: "optionDisabled",
1005
+ publicName: "optionDisabled",
1006
+ isSignal: true,
1007
+ isRequired: false,
1008
+ transformFunction: null
1009
+ },
1010
+ compareWith: {
1011
+ classPropertyName: "compareWith",
1012
+ publicName: "compareWith",
1013
+ isSignal: true,
1014
+ isRequired: false,
1015
+ transformFunction: null
1016
+ },
1017
+ optionGroup: {
1018
+ classPropertyName: "optionGroup",
1019
+ publicName: "optionGroup",
1020
+ isSignal: true,
1021
+ isRequired: false,
1022
+ transformFunction: null
1023
+ },
1024
+ virtualScroll: {
1025
+ classPropertyName: "virtualScroll",
1026
+ publicName: "virtualScroll",
1027
+ isSignal: true,
1028
+ isRequired: false,
1029
+ transformFunction: null
1030
+ },
1031
+ virtualItemSize: {
1032
+ classPropertyName: "virtualItemSize",
1033
+ publicName: "virtualItemSize",
1034
+ isSignal: true,
1035
+ isRequired: false,
1036
+ transformFunction: null
1037
+ },
1038
+ placeholder: {
1039
+ classPropertyName: "placeholder",
1040
+ publicName: "placeholder",
1041
+ isSignal: true,
1042
+ isRequired: false,
1043
+ transformFunction: null
1044
+ },
1045
+ filter: {
1046
+ classPropertyName: "filter",
1047
+ publicName: "filter",
1048
+ isSignal: true,
1049
+ isRequired: false,
1050
+ transformFunction: null
1051
+ },
1052
+ filterPlaceholder: {
1053
+ classPropertyName: "filterPlaceholder",
1054
+ publicName: "filterPlaceholder",
1055
+ isSignal: true,
1056
+ isRequired: false,
1057
+ transformFunction: null
1058
+ },
1059
+ showClear: {
1060
+ classPropertyName: "showClear",
1061
+ publicName: "showClear",
1062
+ isSignal: true,
1063
+ isRequired: false,
1064
+ transformFunction: null
1065
+ },
1066
+ loading: {
1067
+ classPropertyName: "loading",
1068
+ publicName: "loading",
1069
+ isSignal: true,
1070
+ isRequired: false,
1071
+ transformFunction: null
1072
+ },
1073
+ emptyMessage: {
1074
+ classPropertyName: "emptyMessage",
1075
+ publicName: "emptyMessage",
1076
+ isSignal: true,
1077
+ isRequired: false,
1078
+ transformFunction: null
1079
+ },
1080
+ scrollHeight: {
1081
+ classPropertyName: "scrollHeight",
1082
+ publicName: "scrollHeight",
1083
+ isSignal: true,
1084
+ isRequired: false,
1085
+ transformFunction: null
1086
+ },
1087
+ size: {
1088
+ classPropertyName: "size",
1089
+ publicName: "size",
1090
+ isSignal: true,
1091
+ isRequired: false,
1092
+ transformFunction: null
1093
+ },
1094
+ ariaLabel: {
1095
+ classPropertyName: "ariaLabel",
1096
+ publicName: "ariaLabel",
1097
+ isSignal: true,
1098
+ isRequired: false,
1099
+ transformFunction: null
1100
+ },
1101
+ ariaLabelledBy: {
1102
+ classPropertyName: "ariaLabelledBy",
1103
+ publicName: "ariaLabelledBy",
1104
+ isSignal: true,
1105
+ isRequired: false,
1106
+ transformFunction: null
1107
+ },
1108
+ inputId: {
1109
+ classPropertyName: "inputId",
1110
+ publicName: "inputId",
1111
+ isSignal: true,
1112
+ isRequired: false,
1113
+ transformFunction: null
1114
+ },
1115
+ disabled: {
1116
+ classPropertyName: "disabled",
1117
+ publicName: "disabled",
1118
+ isSignal: true,
1119
+ isRequired: false,
1120
+ transformFunction: null
1121
+ },
1122
+ readonly: {
1123
+ classPropertyName: "readonly",
1124
+ publicName: "readonly",
1125
+ isSignal: true,
1126
+ isRequired: false,
1127
+ transformFunction: null
1128
+ },
1129
+ required: {
1130
+ classPropertyName: "required",
1131
+ publicName: "required",
1132
+ isSignal: true,
1133
+ isRequired: false,
1134
+ transformFunction: null
1135
+ },
1136
+ invalid: {
1137
+ classPropertyName: "invalid",
1138
+ publicName: "invalid",
1139
+ isSignal: true,
1140
+ isRequired: false,
1141
+ transformFunction: null
1142
+ },
1143
+ touched: {
1144
+ classPropertyName: "touched",
1145
+ publicName: "touched",
1146
+ isSignal: true,
1147
+ isRequired: false,
1148
+ transformFunction: null
1149
+ },
1150
+ name: {
1151
+ classPropertyName: "name",
1152
+ publicName: "name",
1153
+ isSignal: true,
1154
+ isRequired: false,
1155
+ transformFunction: null
1156
+ }
1157
+ },
1158
+ outputs: {
1159
+ touch: "touch",
1160
+ opened: "opened",
1161
+ closed: "closed",
1162
+ filterChange: "filterChange"
1163
+ },
1164
+ queries: [{
1165
+ propertyName: "optionTemplate",
1166
+ first: true,
1167
+ predicate: StarOptionTemplate,
1168
+ descendants: true,
1169
+ isSignal: true
1170
+ }],
1171
+ viewQueries: [{
1172
+ propertyName: "trigger",
1173
+ first: true,
1174
+ predicate: ["trigger"],
1175
+ descendants: true,
1176
+ isSignal: true
1177
+ }, {
1178
+ propertyName: "filterInput",
1179
+ first: true,
1180
+ predicate: ["filterInput"],
1181
+ descendants: true,
1182
+ isSignal: true
1183
+ }],
1184
+ ngImport: i0
1185
+ });
1186
+ };
1187
+ i0.ɵɵngDeclareClassMetadata({
1188
+ minVersion: "12.0.0",
1189
+ version: "22.2.6",
1190
+ ngImport: i0,
1191
+ type: StarOptionListBase,
1192
+ decorators: [{ type: Directive }],
1193
+ ctorParameters: () => [],
1194
+ propDecorators: {
1195
+ options: [{
1196
+ type: i0.Input,
1197
+ args: [{
1198
+ isSignal: true,
1199
+ alias: "options",
1200
+ required: false
1201
+ }]
1202
+ }],
1203
+ optionLabel: [{
1204
+ type: i0.Input,
1205
+ args: [{
1206
+ isSignal: true,
1207
+ alias: "optionLabel",
1208
+ required: false
1209
+ }]
1210
+ }],
1211
+ optionValue: [{
1212
+ type: i0.Input,
1213
+ args: [{
1214
+ isSignal: true,
1215
+ alias: "optionValue",
1216
+ required: false
1217
+ }]
1218
+ }],
1219
+ optionDisabled: [{
1220
+ type: i0.Input,
1221
+ args: [{
1222
+ isSignal: true,
1223
+ alias: "optionDisabled",
1224
+ required: false
1225
+ }]
1226
+ }],
1227
+ compareWith: [{
1228
+ type: i0.Input,
1229
+ args: [{
1230
+ isSignal: true,
1231
+ alias: "compareWith",
1232
+ required: false
1233
+ }]
1234
+ }],
1235
+ optionGroup: [{
1236
+ type: i0.Input,
1237
+ args: [{
1238
+ isSignal: true,
1239
+ alias: "optionGroup",
1240
+ required: false
1241
+ }]
1242
+ }],
1243
+ virtualScroll: [{
1244
+ type: i0.Input,
1245
+ args: [{
1246
+ isSignal: true,
1247
+ alias: "virtualScroll",
1248
+ required: false
1249
+ }]
1250
+ }],
1251
+ virtualItemSize: [{
1252
+ type: i0.Input,
1253
+ args: [{
1254
+ isSignal: true,
1255
+ alias: "virtualItemSize",
1256
+ required: false
1257
+ }]
1258
+ }],
1259
+ placeholder: [{
1260
+ type: i0.Input,
1261
+ args: [{
1262
+ isSignal: true,
1263
+ alias: "placeholder",
1264
+ required: false
1265
+ }]
1266
+ }],
1267
+ filter: [{
1268
+ type: i0.Input,
1269
+ args: [{
1270
+ isSignal: true,
1271
+ alias: "filter",
1272
+ required: false
1273
+ }]
1274
+ }],
1275
+ filterPlaceholder: [{
1276
+ type: i0.Input,
1277
+ args: [{
1278
+ isSignal: true,
1279
+ alias: "filterPlaceholder",
1280
+ required: false
1281
+ }]
1282
+ }],
1283
+ showClear: [{
1284
+ type: i0.Input,
1285
+ args: [{
1286
+ isSignal: true,
1287
+ alias: "showClear",
1288
+ required: false
1289
+ }]
1290
+ }],
1291
+ loading: [{
1292
+ type: i0.Input,
1293
+ args: [{
1294
+ isSignal: true,
1295
+ alias: "loading",
1296
+ required: false
1297
+ }]
1298
+ }],
1299
+ emptyMessage: [{
1300
+ type: i0.Input,
1301
+ args: [{
1302
+ isSignal: true,
1303
+ alias: "emptyMessage",
1304
+ required: false
1305
+ }]
1306
+ }],
1307
+ scrollHeight: [{
1308
+ type: i0.Input,
1309
+ args: [{
1310
+ isSignal: true,
1311
+ alias: "scrollHeight",
1312
+ required: false
1313
+ }]
1314
+ }],
1315
+ size: [{
1316
+ type: i0.Input,
1317
+ args: [{
1318
+ isSignal: true,
1319
+ alias: "size",
1320
+ required: false
1321
+ }]
1322
+ }],
1323
+ ariaLabel: [{
1324
+ type: i0.Input,
1325
+ args: [{
1326
+ isSignal: true,
1327
+ alias: "ariaLabel",
1328
+ required: false
1329
+ }]
1330
+ }],
1331
+ ariaLabelledBy: [{
1332
+ type: i0.Input,
1333
+ args: [{
1334
+ isSignal: true,
1335
+ alias: "ariaLabelledBy",
1336
+ required: false
1337
+ }]
1338
+ }],
1339
+ inputId: [{
1340
+ type: i0.Input,
1341
+ args: [{
1342
+ isSignal: true,
1343
+ alias: "inputId",
1344
+ required: false
1345
+ }]
1346
+ }],
1347
+ disabled: [{
1348
+ type: i0.Input,
1349
+ args: [{
1350
+ isSignal: true,
1351
+ alias: "disabled",
1352
+ required: false
1353
+ }]
1354
+ }],
1355
+ readonly: [{
1356
+ type: i0.Input,
1357
+ args: [{
1358
+ isSignal: true,
1359
+ alias: "readonly",
1360
+ required: false
1361
+ }]
1362
+ }],
1363
+ required: [{
1364
+ type: i0.Input,
1365
+ args: [{
1366
+ isSignal: true,
1367
+ alias: "required",
1368
+ required: false
1369
+ }]
1370
+ }],
1371
+ invalid: [{
1372
+ type: i0.Input,
1373
+ args: [{
1374
+ isSignal: true,
1375
+ alias: "invalid",
1376
+ required: false
1377
+ }]
1378
+ }],
1379
+ touched: [{
1380
+ type: i0.Input,
1381
+ args: [{
1382
+ isSignal: true,
1383
+ alias: "touched",
1384
+ required: false
1385
+ }]
1386
+ }],
1387
+ name: [{
1388
+ type: i0.Input,
1389
+ args: [{
1390
+ isSignal: true,
1391
+ alias: "name",
1392
+ required: false
1393
+ }]
1394
+ }],
1395
+ touch: [{
1396
+ type: i0.Output,
1397
+ args: ["touch"]
1398
+ }],
1399
+ opened: [{
1400
+ type: i0.Output,
1401
+ args: ["opened"]
1402
+ }],
1403
+ closed: [{
1404
+ type: i0.Output,
1405
+ args: ["closed"]
1406
+ }],
1407
+ filterChange: [{
1408
+ type: i0.Output,
1409
+ args: ["filterChange"]
1410
+ }],
1411
+ optionTemplate: [{
1412
+ type: i0.ContentChild,
1413
+ args: [i0.forwardRef(() => StarOptionTemplate), { isSignal: true }]
1414
+ }],
1415
+ trigger: [{
1416
+ type: i0.ViewChild,
1417
+ args: ["trigger", { isSignal: true }]
1418
+ }],
1419
+ filterInput: [{
1420
+ type: i0.ViewChild,
1421
+ args: ["filterInput", { isSignal: true }]
1422
+ }]
1423
+ }
1424
+ });
1425
+ var StarMultiSelect = class StarMultiSelect extends StarOptionListBase {
1426
+ value = model([], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
1427
+ display = input("comma", ...ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []);
1428
+ maxSelectedLabels = input(3, ...ngDevMode ? [{ debugName: "maxSelectedLabels" }] : /* istanbul ignore next */ []);
1429
+ selectionLimit = input(0, ...ngDevMode ? [{ debugName: "selectionLimit" }] : /* istanbul ignore next */ []);
1430
+ showToggleAll = input(true, ...ngDevMode ? [{ debugName: "showToggleAll" }] : /* istanbul ignore next */ []);
1431
+ closeOnChoose = false;
1432
+ selectedOptions = computed(() => this.options().filter((option) => this.isSelected(option)), ...ngDevMode ? [{ debugName: "selectedOptions" }] : /* istanbul ignore next */ []);
1433
+ collapsed = computed(() => this.selectedOptions().length > this.maxSelectedLabels(), ...ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []);
1434
+ selectedLabels = computed(() => this.selectedOptions().map((option) => this.labelOf(option)).join(", "), ...ngDevMode ? [{ debugName: "selectedLabels" }] : /* istanbul ignore next */ []);
1435
+ selectableVisible = computed(() => this.visibleOptions().filter((option) => !this.isDisabled(option)), ...ngDevMode ? [{ debugName: "selectableVisible" }] : /* istanbul ignore next */ []);
1436
+ allState = computed(() => {
1437
+ const options = this.selectableVisible();
1438
+ const selected = options.filter((option) => this.isSelected(option)).length;
1439
+ if (!options.length || selected === 0) return false;
1440
+ return selected === options.length ? true : "mixed";
1441
+ }, ...ngDevMode ? [{ debugName: "allState" }] : /* istanbul ignore next */ []);
1442
+ isSelected(option) {
1443
+ const optionValue = this.valueOf(option);
1444
+ return this.value().some((value) => this.equals(value, optionValue));
1445
+ }
1446
+ choose(option) {
1447
+ if (this.isSelected(option)) {
1448
+ this.remove(option);
1449
+ return;
1450
+ }
1451
+ const limit = this.selectionLimit();
1452
+ if (limit > 0 && this.value().length >= limit) return;
1453
+ this.value.update((values) => [...values, this.valueOf(option)]);
1454
+ }
1455
+ initialActiveIndex() {
1456
+ return this.firstEnabledFrom(0, 1);
1457
+ }
1458
+ remove(option) {
1459
+ const optionValue = this.valueOf(option);
1460
+ this.value.update((values) => values.filter((value) => !this.equals(value, optionValue)));
1461
+ }
1462
+ toggleAll() {
1463
+ const options = this.selectableVisible();
1464
+ if (this.allState() === true) {
1465
+ const visibleValues = options.map((option) => this.valueOf(option));
1466
+ this.value.update((values) => values.filter((value) => !visibleValues.some((visible) => this.equals(visible, value))));
1467
+ return;
1468
+ }
1469
+ const additions = options.filter((option) => !this.isSelected(option)).map((option) => this.valueOf(option));
1470
+ this.value.update((values) => [...values, ...additions]);
1471
+ }
1472
+ clear() {
1473
+ this.value.set([]);
1474
+ this.focus();
1475
+ }
1476
+ static ɵfac = i0.ɵɵngDeclareFactory({
1477
+ minVersion: "12.0.0",
1478
+ version: "22.2.6",
1479
+ ngImport: i0,
1480
+ type: StarMultiSelect,
1481
+ deps: null,
1482
+ target: i0.ɵɵFactoryTarget.Component
1483
+ });
1484
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1485
+ minVersion: "17.0.0",
1486
+ version: "22.2.6",
1487
+ type: StarMultiSelect,
1488
+ isStandalone: true,
1489
+ selector: "star-multi-select",
1490
+ inputs: {
1491
+ value: {
1492
+ classPropertyName: "value",
1493
+ publicName: "value",
1494
+ isSignal: true,
1495
+ isRequired: false,
1496
+ transformFunction: null
1497
+ },
1498
+ display: {
1499
+ classPropertyName: "display",
1500
+ publicName: "display",
1501
+ isSignal: true,
1502
+ isRequired: false,
1503
+ transformFunction: null
1504
+ },
1505
+ maxSelectedLabels: {
1506
+ classPropertyName: "maxSelectedLabels",
1507
+ publicName: "maxSelectedLabels",
1508
+ isSignal: true,
1509
+ isRequired: false,
1510
+ transformFunction: null
1511
+ },
1512
+ selectionLimit: {
1513
+ classPropertyName: "selectionLimit",
1514
+ publicName: "selectionLimit",
1515
+ isSignal: true,
1516
+ isRequired: false,
1517
+ transformFunction: null
1518
+ },
1519
+ showToggleAll: {
1520
+ classPropertyName: "showToggleAll",
1521
+ publicName: "showToggleAll",
1522
+ isSignal: true,
1523
+ isRequired: false,
1524
+ transformFunction: null
1525
+ }
1526
+ },
1527
+ outputs: { value: "valueChange" },
1528
+ host: {
1529
+ properties: {
1530
+ "class.star-select--open": "open()",
1531
+ "class.star-select--disabled": "disabled()",
1532
+ "class.star-select--invalid": "showInvalid()",
1533
+ "class.star-select--sm": "size() === 'sm'"
1534
+ },
1535
+ classAttribute: "star-select star-select--multi"
1536
+ },
1537
+ usesInheritance: true,
1538
+ ngImport: i0,
1539
+ template: `
1540
+ <div class="star-select__control" cdkOverlayOrigin #origin="cdkOverlayOrigin">
1541
+ <div
1542
+ #trigger
1543
+ class="star-select__trigger"
1544
+ role="combobox"
1545
+ aria-haspopup="listbox"
1546
+ [id]="inputId()"
1547
+ [attr.tabindex]="disabled() ? -1 : 0"
1548
+ [attr.aria-expanded]="open()"
1549
+ [attr.aria-controls]="open() ? listId : null"
1550
+ [attr.aria-activedescendant]="activeId()"
1551
+ [attr.aria-label]="ariaLabel()"
1552
+ [attr.aria-labelledby]="ariaLabelledBy()"
1553
+ [attr.aria-required]="required() || null"
1554
+ [attr.aria-invalid]="showInvalid() || null"
1555
+ [attr.aria-disabled]="disabled() || null"
1556
+ [attr.aria-readonly]="readonly() || null"
1557
+ (click)="toggle()"
1558
+ (keydown)="onKeydown($event)"
1559
+ (blur)="onTriggerBlur()"
1560
+ >
1561
+ @if (selectedOptions().length === 0) {
1562
+ <span class="star-select__placeholder">{{
1563
+ placeholder() ?? text.selectPlaceholder
1564
+ }}</span>
1565
+ } @else if (collapsed()) {
1566
+ <span class="star-select__value">{{ text.selectedItems(selectedOptions().length) }}</span>
1567
+ } @else if (display() === 'chip') {
1568
+ <span class="star-select__chips">
1569
+ @for (option of selectedOptions(); track $index) {
1570
+ <span class="star-chip star-chip--sm">
1571
+ {{ labelOf(option) }}
1572
+ @if (interactive()) {
1573
+ <button
1574
+ type="button"
1575
+ class="star-chip__remove"
1576
+ tabindex="-1"
1577
+ [attr.aria-label]="text.removeItem(labelOf(option))"
1578
+ (click)="$event.stopPropagation(); remove(option)"
1579
+ >
1580
+ <i class="ph-bold ph-x" aria-hidden="true"></i>
1581
+ </button>
1582
+ }
1583
+ </span>
1584
+ }
1585
+ </span>
1586
+ } @else {
1587
+ <span class="star-select__value">{{ selectedLabels() }}</span>
1588
+ }
1589
+ </div>
1590
+ @if (showClear() && selectedOptions().length && interactive()) {
1591
+ <button
1592
+ type="button"
1593
+ class="star-select__icon-btn"
1594
+ [attr.aria-label]="text.clear"
1595
+ (click)="clear()"
1596
+ >
1597
+ <i class="ph-bold ph-x" aria-hidden="true"></i>
1598
+ </button>
1599
+ }
1600
+ @if (loading()) {
1601
+ <i
1602
+ class="ph-bold ph-spinner-gap star-spin star-select__caret"
1603
+ role="img"
1604
+ [attr.aria-label]="text.loading"
1605
+ ></i>
1606
+ } @else {
1607
+ <i class="ph-bold ph-caret-down star-select__caret" aria-hidden="true"></i>
1608
+ }
1609
+ </div>
1610
+
1611
+ <ng-template
1612
+ cdkConnectedOverlay
1613
+ cdkConnectedOverlayUsePopover="inline"
1614
+ cdkConnectedOverlayMatchWidth
1615
+ [cdkConnectedOverlayOrigin]="origin"
1616
+ [cdkConnectedOverlayOpen]="open()"
1617
+ [cdkConnectedOverlayPositions]="positions"
1618
+ (attach)="onPanelAttached()"
1619
+ (detach)="closePanel(false)"
1620
+ (overlayOutsideClick)="onOutsideClick($event)"
1621
+ >
1622
+ <div class="star-panel" (mousedown)="onPanelMousedown($event)">
1623
+ @if (showToggleAll() || filter()) {
1624
+ <div class="star-panel__filter">
1625
+ @if (showToggleAll() && !selectionLimit()) {
1626
+ <button
1627
+ type="button"
1628
+ class="star-panel__toggle-all"
1629
+ role="checkbox"
1630
+ tabindex="-1"
1631
+ [attr.aria-checked]="allState()"
1632
+ [attr.aria-label]="text.selectAll"
1633
+ (click)="toggleAll()"
1634
+ >
1635
+ <span class="star-check__box" aria-hidden="true">
1636
+ @if (allState() === 'mixed') {
1637
+ <i class="ph-bold ph-minus"></i>
1638
+ } @else if (allState() === true) {
1639
+ <i class="ph-bold ph-check"></i>
1640
+ }
1641
+ </span>
1642
+ </button>
1643
+ }
1644
+ @if (filter()) {
1645
+ <i class="ph-bold ph-magnifying-glass" aria-hidden="true"></i>
1646
+ <input
1647
+ #filterInput
1648
+ type="text"
1649
+ class="star-input star-input--sm"
1650
+ role="searchbox"
1651
+ autocomplete="off"
1652
+ [value]="filterValue()"
1653
+ [attr.placeholder]="filterPlaceholder() ?? text.filterPlaceholder"
1654
+ [attr.aria-label]="filterPlaceholder() ?? text.filterPlaceholder"
1655
+ [attr.aria-controls]="listId"
1656
+ [attr.aria-activedescendant]="activeId()"
1657
+ (input)="onFilterInput(filterInput.value)"
1658
+ (keydown)="onKeydown($event)"
1659
+ />
1660
+ } @else {
1661
+ <span class="star-panel__toggle-label">{{ text.selectAll }}</span>
1662
+ }
1663
+ </div>
1664
+ }
1665
+ <ul
1666
+ class="star-listbox"
1667
+ role="listbox"
1668
+ aria-multiselectable="true"
1669
+ [id]="listId"
1670
+ [class.star-listbox--virtual]="virtualScroll()"
1671
+ [style.--star-item-size.px]="virtualScroll() ? virtualItemSize() : null"
1672
+ [style.max-height]="scrollHeight()"
1673
+ [attr.aria-label]="ariaLabel()"
1674
+ [attr.aria-labelledby]="ariaLabelledBy()"
1675
+ (scroll)="onListScroll($event)"
1676
+ >
1677
+ @if (virtualWindow().before) {
1678
+ <li
1679
+ class="star-listbox__spacer"
1680
+ role="presentation"
1681
+ [style.height.px]="virtualWindow().before"
1682
+ ></li>
1683
+ }
1684
+ @for (row of renderedRows(); track row.key) {
1685
+ @if (row.kind === 'group') {
1686
+ <li class="star-listbox__group" role="presentation" [id]="row.id">{{ row.label }}</li>
1687
+ } @else {
1688
+ @let option = row.option;
1689
+ @let i = row.index;
1690
+ <!-- Keyboard is handled on the combobox via aria-activedescendant (WAI-ARIA combobox pattern). -->
1691
+ <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->
1692
+ <li
1693
+ class="star-listbox__option"
1694
+ role="option"
1695
+ [id]="optionId(i)"
1696
+ [class.star-listbox__option--active]="activeIndex() === i"
1697
+ [class.star-listbox__option--selected]="isSelected(option)"
1698
+ [attr.aria-selected]="isSelected(option)"
1699
+ [attr.aria-disabled]="isDisabled(option) || null"
1700
+ [attr.aria-describedby]="row.groupId"
1701
+ [attr.aria-setsize]="virtualScroll() ? visibleOptions().length : null"
1702
+ [attr.aria-posinset]="virtualScroll() ? i + 1 : null"
1703
+ (click)="onOptionClick(option, i)"
1704
+ (mousemove)="isDisabled(option) || activeIndex.set(i)"
1705
+ >
1706
+ <span class="star-check__box" aria-hidden="true">
1707
+ @if (isSelected(option)) {
1708
+ <i class="ph-bold ph-check"></i>
1709
+ }
1710
+ </span>
1711
+ <span class="star-listbox__label">
1712
+ @if (optionTemplate(); as custom) {
1713
+ <ng-container
1714
+ *ngTemplateOutlet="custom.template; context: optionContext(option, i)"
1715
+ />
1716
+ } @else {
1717
+ {{ labelOf(option) }}
1718
+ }
1719
+ </span>
1720
+ </li>
1721
+ }
1722
+ } @empty {
1723
+ <li class="star-listbox__empty" role="presentation">{{ emptyText() }}</li>
1724
+ }
1725
+ @if (virtualWindow().after) {
1726
+ <li
1727
+ class="star-listbox__spacer"
1728
+ role="presentation"
1729
+ [style.height.px]="virtualWindow().after"
1730
+ ></li>
1731
+ }
1732
+ </ul>
1733
+ </div>
1734
+ </ng-template>
1735
+ `,
1736
+ isInline: true,
1737
+ dependencies: [
1738
+ {
1739
+ kind: "directive",
1740
+ type: CdkConnectedOverlay,
1741
+ selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
1742
+ inputs: [
1743
+ "cdkConnectedOverlayOrigin",
1744
+ "cdkConnectedOverlayPositions",
1745
+ "cdkConnectedOverlayPositionStrategy",
1746
+ "cdkConnectedOverlayOffsetX",
1747
+ "cdkConnectedOverlayOffsetY",
1748
+ "cdkConnectedOverlayWidth",
1749
+ "cdkConnectedOverlayHeight",
1750
+ "cdkConnectedOverlayMinWidth",
1751
+ "cdkConnectedOverlayMinHeight",
1752
+ "cdkConnectedOverlayBackdropClass",
1753
+ "cdkConnectedOverlayPanelClass",
1754
+ "cdkConnectedOverlayViewportMargin",
1755
+ "cdkConnectedOverlayScrollStrategy",
1756
+ "cdkConnectedOverlayOpen",
1757
+ "cdkConnectedOverlayDisableClose",
1758
+ "cdkConnectedOverlayTransformOriginOn",
1759
+ "cdkConnectedOverlayHasBackdrop",
1760
+ "cdkConnectedOverlayLockPosition",
1761
+ "cdkConnectedOverlayFlexibleDimensions",
1762
+ "cdkConnectedOverlayGrowAfterOpen",
1763
+ "cdkConnectedOverlayPush",
1764
+ "cdkConnectedOverlayDisposeOnNavigation",
1765
+ "cdkConnectedOverlayUsePopover",
1766
+ "cdkConnectedOverlayMatchWidth",
1767
+ "cdkConnectedOverlay"
1768
+ ],
1769
+ outputs: [
1770
+ "backdropClick",
1771
+ "positionChange",
1772
+ "attach",
1773
+ "detach",
1774
+ "overlayKeydown",
1775
+ "overlayOutsideClick"
1776
+ ],
1777
+ exportAs: ["cdkConnectedOverlay"]
1778
+ },
1779
+ {
1780
+ kind: "directive",
1781
+ type: CdkOverlayOrigin,
1782
+ selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
1783
+ exportAs: ["cdkOverlayOrigin"]
1784
+ },
1785
+ {
1786
+ kind: "directive",
1787
+ type: NgTemplateOutlet,
1788
+ selector: "[ngTemplateOutlet]",
1789
+ inputs: [
1790
+ "ngTemplateOutletContext",
1791
+ "ngTemplateOutlet",
1792
+ "ngTemplateOutletInjector"
1793
+ ]
1794
+ }
1795
+ ],
1796
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
1797
+ });
1798
+ };
1799
+ i0.ɵɵngDeclareClassMetadata({
1800
+ minVersion: "12.0.0",
1801
+ version: "22.2.6",
1802
+ ngImport: i0,
1803
+ type: StarMultiSelect,
1804
+ decorators: [{
1805
+ type: Component,
1806
+ args: [{
1807
+ selector: "star-multi-select",
1808
+ imports: [
1809
+ CdkConnectedOverlay,
1810
+ CdkOverlayOrigin,
1811
+ NgTemplateOutlet
1812
+ ],
1813
+ changeDetection: ChangeDetectionStrategy.OnPush,
1814
+ host: {
1815
+ class: "star-select star-select--multi",
1816
+ "[class.star-select--open]": "open()",
1817
+ "[class.star-select--disabled]": "disabled()",
1818
+ "[class.star-select--invalid]": "showInvalid()",
1819
+ "[class.star-select--sm]": "size() === 'sm'"
1820
+ },
1821
+ template: `
1822
+ <div class="star-select__control" cdkOverlayOrigin #origin="cdkOverlayOrigin">
1823
+ <div
1824
+ #trigger
1825
+ class="star-select__trigger"
1826
+ role="combobox"
1827
+ aria-haspopup="listbox"
1828
+ [id]="inputId()"
1829
+ [attr.tabindex]="disabled() ? -1 : 0"
1830
+ [attr.aria-expanded]="open()"
1831
+ [attr.aria-controls]="open() ? listId : null"
1832
+ [attr.aria-activedescendant]="activeId()"
1833
+ [attr.aria-label]="ariaLabel()"
1834
+ [attr.aria-labelledby]="ariaLabelledBy()"
1835
+ [attr.aria-required]="required() || null"
1836
+ [attr.aria-invalid]="showInvalid() || null"
1837
+ [attr.aria-disabled]="disabled() || null"
1838
+ [attr.aria-readonly]="readonly() || null"
1839
+ (click)="toggle()"
1840
+ (keydown)="onKeydown($event)"
1841
+ (blur)="onTriggerBlur()"
1842
+ >
1843
+ @if (selectedOptions().length === 0) {
1844
+ <span class="star-select__placeholder">{{
1845
+ placeholder() ?? text.selectPlaceholder
1846
+ }}</span>
1847
+ } @else if (collapsed()) {
1848
+ <span class="star-select__value">{{ text.selectedItems(selectedOptions().length) }}</span>
1849
+ } @else if (display() === 'chip') {
1850
+ <span class="star-select__chips">
1851
+ @for (option of selectedOptions(); track $index) {
1852
+ <span class="star-chip star-chip--sm">
1853
+ {{ labelOf(option) }}
1854
+ @if (interactive()) {
1855
+ <button
1856
+ type="button"
1857
+ class="star-chip__remove"
1858
+ tabindex="-1"
1859
+ [attr.aria-label]="text.removeItem(labelOf(option))"
1860
+ (click)="$event.stopPropagation(); remove(option)"
1861
+ >
1862
+ <i class="ph-bold ph-x" aria-hidden="true"></i>
1863
+ </button>
1864
+ }
1865
+ </span>
1866
+ }
1867
+ </span>
1868
+ } @else {
1869
+ <span class="star-select__value">{{ selectedLabels() }}</span>
1870
+ }
1871
+ </div>
1872
+ @if (showClear() && selectedOptions().length && interactive()) {
1873
+ <button
1874
+ type="button"
1875
+ class="star-select__icon-btn"
1876
+ [attr.aria-label]="text.clear"
1877
+ (click)="clear()"
1878
+ >
1879
+ <i class="ph-bold ph-x" aria-hidden="true"></i>
1880
+ </button>
1881
+ }
1882
+ @if (loading()) {
1883
+ <i
1884
+ class="ph-bold ph-spinner-gap star-spin star-select__caret"
1885
+ role="img"
1886
+ [attr.aria-label]="text.loading"
1887
+ ></i>
1888
+ } @else {
1889
+ <i class="ph-bold ph-caret-down star-select__caret" aria-hidden="true"></i>
1890
+ }
1891
+ </div>
1892
+
1893
+ <ng-template
1894
+ cdkConnectedOverlay
1895
+ cdkConnectedOverlayUsePopover="inline"
1896
+ cdkConnectedOverlayMatchWidth
1897
+ [cdkConnectedOverlayOrigin]="origin"
1898
+ [cdkConnectedOverlayOpen]="open()"
1899
+ [cdkConnectedOverlayPositions]="positions"
1900
+ (attach)="onPanelAttached()"
1901
+ (detach)="closePanel(false)"
1902
+ (overlayOutsideClick)="onOutsideClick($event)"
1903
+ >
1904
+ <div class="star-panel" (mousedown)="onPanelMousedown($event)">
1905
+ @if (showToggleAll() || filter()) {
1906
+ <div class="star-panel__filter">
1907
+ @if (showToggleAll() && !selectionLimit()) {
1908
+ <button
1909
+ type="button"
1910
+ class="star-panel__toggle-all"
1911
+ role="checkbox"
1912
+ tabindex="-1"
1913
+ [attr.aria-checked]="allState()"
1914
+ [attr.aria-label]="text.selectAll"
1915
+ (click)="toggleAll()"
1916
+ >
1917
+ <span class="star-check__box" aria-hidden="true">
1918
+ @if (allState() === 'mixed') {
1919
+ <i class="ph-bold ph-minus"></i>
1920
+ } @else if (allState() === true) {
1921
+ <i class="ph-bold ph-check"></i>
1922
+ }
1923
+ </span>
1924
+ </button>
1925
+ }
1926
+ @if (filter()) {
1927
+ <i class="ph-bold ph-magnifying-glass" aria-hidden="true"></i>
1928
+ <input
1929
+ #filterInput
1930
+ type="text"
1931
+ class="star-input star-input--sm"
1932
+ role="searchbox"
1933
+ autocomplete="off"
1934
+ [value]="filterValue()"
1935
+ [attr.placeholder]="filterPlaceholder() ?? text.filterPlaceholder"
1936
+ [attr.aria-label]="filterPlaceholder() ?? text.filterPlaceholder"
1937
+ [attr.aria-controls]="listId"
1938
+ [attr.aria-activedescendant]="activeId()"
1939
+ (input)="onFilterInput(filterInput.value)"
1940
+ (keydown)="onKeydown($event)"
1941
+ />
1942
+ } @else {
1943
+ <span class="star-panel__toggle-label">{{ text.selectAll }}</span>
1944
+ }
1945
+ </div>
1946
+ }
1947
+ <ul
1948
+ class="star-listbox"
1949
+ role="listbox"
1950
+ aria-multiselectable="true"
1951
+ [id]="listId"
1952
+ [class.star-listbox--virtual]="virtualScroll()"
1953
+ [style.--star-item-size.px]="virtualScroll() ? virtualItemSize() : null"
1954
+ [style.max-height]="scrollHeight()"
1955
+ [attr.aria-label]="ariaLabel()"
1956
+ [attr.aria-labelledby]="ariaLabelledBy()"
1957
+ (scroll)="onListScroll($event)"
1958
+ >
1959
+ @if (virtualWindow().before) {
1960
+ <li
1961
+ class="star-listbox__spacer"
1962
+ role="presentation"
1963
+ [style.height.px]="virtualWindow().before"
1964
+ ></li>
1965
+ }
1966
+ @for (row of renderedRows(); track row.key) {
1967
+ @if (row.kind === 'group') {
1968
+ <li class="star-listbox__group" role="presentation" [id]="row.id">{{ row.label }}</li>
1969
+ } @else {
1970
+ @let option = row.option;
1971
+ @let i = row.index;
1972
+ <!-- Keyboard is handled on the combobox via aria-activedescendant (WAI-ARIA combobox pattern). -->
1973
+ <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->
1974
+ <li
1975
+ class="star-listbox__option"
1976
+ role="option"
1977
+ [id]="optionId(i)"
1978
+ [class.star-listbox__option--active]="activeIndex() === i"
1979
+ [class.star-listbox__option--selected]="isSelected(option)"
1980
+ [attr.aria-selected]="isSelected(option)"
1981
+ [attr.aria-disabled]="isDisabled(option) || null"
1982
+ [attr.aria-describedby]="row.groupId"
1983
+ [attr.aria-setsize]="virtualScroll() ? visibleOptions().length : null"
1984
+ [attr.aria-posinset]="virtualScroll() ? i + 1 : null"
1985
+ (click)="onOptionClick(option, i)"
1986
+ (mousemove)="isDisabled(option) || activeIndex.set(i)"
1987
+ >
1988
+ <span class="star-check__box" aria-hidden="true">
1989
+ @if (isSelected(option)) {
1990
+ <i class="ph-bold ph-check"></i>
1991
+ }
1992
+ </span>
1993
+ <span class="star-listbox__label">
1994
+ @if (optionTemplate(); as custom) {
1995
+ <ng-container
1996
+ *ngTemplateOutlet="custom.template; context: optionContext(option, i)"
1997
+ />
1998
+ } @else {
1999
+ {{ labelOf(option) }}
2000
+ }
2001
+ </span>
2002
+ </li>
2003
+ }
2004
+ } @empty {
2005
+ <li class="star-listbox__empty" role="presentation">{{ emptyText() }}</li>
2006
+ }
2007
+ @if (virtualWindow().after) {
2008
+ <li
2009
+ class="star-listbox__spacer"
2010
+ role="presentation"
2011
+ [style.height.px]="virtualWindow().after"
2012
+ ></li>
2013
+ }
2014
+ </ul>
2015
+ </div>
2016
+ </ng-template>
2017
+ `
2018
+ }]
2019
+ }],
2020
+ propDecorators: {
2021
+ value: [{
2022
+ type: i0.Input,
2023
+ args: [{
2024
+ isSignal: true,
2025
+ alias: "value",
2026
+ required: false
2027
+ }]
2028
+ }, {
2029
+ type: i0.Output,
2030
+ args: ["valueChange"]
2031
+ }],
2032
+ display: [{
2033
+ type: i0.Input,
2034
+ args: [{
2035
+ isSignal: true,
2036
+ alias: "display",
2037
+ required: false
2038
+ }]
2039
+ }],
2040
+ maxSelectedLabels: [{
2041
+ type: i0.Input,
2042
+ args: [{
2043
+ isSignal: true,
2044
+ alias: "maxSelectedLabels",
2045
+ required: false
2046
+ }]
2047
+ }],
2048
+ selectionLimit: [{
2049
+ type: i0.Input,
2050
+ args: [{
2051
+ isSignal: true,
2052
+ alias: "selectionLimit",
2053
+ required: false
2054
+ }]
2055
+ }],
2056
+ showToggleAll: [{
2057
+ type: i0.Input,
2058
+ args: [{
2059
+ isSignal: true,
2060
+ alias: "showToggleAll",
2061
+ required: false
2062
+ }]
2063
+ }]
2064
+ }
2065
+ });
2066
+ var StarSelect = class StarSelect extends StarOptionListBase {
2067
+ value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
2068
+ closeOnChoose = true;
2069
+ selectedOption = computed(() => {
2070
+ const value = this.value();
2071
+ if (value === null) return void 0;
2072
+ return this.options().find((option) => this.equals(this.valueOf(option), value));
2073
+ }, ...ngDevMode ? [{ debugName: "selectedOption" }] : /* istanbul ignore next */ []);
2074
+ isSelected(option) {
2075
+ const value = this.value();
2076
+ return value !== null && this.equals(this.valueOf(option), value);
2077
+ }
2078
+ choose(option) {
2079
+ this.value.set(this.valueOf(option));
2080
+ }
2081
+ initialActiveIndex() {
2082
+ const index = this.visibleOptions().findIndex((option) => this.isSelected(option));
2083
+ return index >= 0 ? index : this.firstEnabledFrom(0, 1);
2084
+ }
2085
+ clear() {
2086
+ this.value.set(null);
2087
+ this.focus();
2088
+ }
2089
+ static ɵfac = i0.ɵɵngDeclareFactory({
2090
+ minVersion: "12.0.0",
2091
+ version: "22.2.6",
2092
+ ngImport: i0,
2093
+ type: StarSelect,
2094
+ deps: null,
2095
+ target: i0.ɵɵFactoryTarget.Component
2096
+ });
2097
+ static ɵcmp = i0.ɵɵngDeclareComponent({
2098
+ minVersion: "17.0.0",
2099
+ version: "22.2.6",
2100
+ type: StarSelect,
2101
+ isStandalone: true,
2102
+ selector: "star-select",
2103
+ inputs: { value: {
2104
+ classPropertyName: "value",
2105
+ publicName: "value",
2106
+ isSignal: true,
2107
+ isRequired: false,
2108
+ transformFunction: null
2109
+ } },
2110
+ outputs: { value: "valueChange" },
2111
+ host: {
2112
+ properties: {
2113
+ "class.star-select--open": "open()",
2114
+ "class.star-select--disabled": "disabled()",
2115
+ "class.star-select--invalid": "showInvalid()",
2116
+ "class.star-select--sm": "size() === 'sm'"
2117
+ },
2118
+ classAttribute: "star-select"
2119
+ },
2120
+ usesInheritance: true,
2121
+ ngImport: i0,
2122
+ template: `
2123
+ <div class="star-select__control" cdkOverlayOrigin #origin="cdkOverlayOrigin">
2124
+ <div
2125
+ #trigger
2126
+ class="star-select__trigger"
2127
+ role="combobox"
2128
+ aria-haspopup="listbox"
2129
+ [id]="inputId()"
2130
+ [attr.tabindex]="disabled() ? -1 : 0"
2131
+ [attr.aria-expanded]="open()"
2132
+ [attr.aria-controls]="open() ? listId : null"
2133
+ [attr.aria-activedescendant]="activeId()"
2134
+ [attr.aria-label]="ariaLabel()"
2135
+ [attr.aria-labelledby]="ariaLabelledBy()"
2136
+ [attr.aria-required]="required() || null"
2137
+ [attr.aria-invalid]="showInvalid() || null"
2138
+ [attr.aria-disabled]="disabled() || null"
2139
+ [attr.aria-readonly]="readonly() || null"
2140
+ (click)="toggle()"
2141
+ (keydown)="onKeydown($event)"
2142
+ (blur)="onTriggerBlur()"
2143
+ >
2144
+ @if (selectedOption(); as option) {
2145
+ <span class="star-select__value">{{ labelOf(option) }}</span>
2146
+ } @else {
2147
+ <span class="star-select__placeholder">{{
2148
+ placeholder() ?? text.selectPlaceholder
2149
+ }}</span>
2150
+ }
2151
+ </div>
2152
+ @if (showClear() && selectedOption() !== undefined && interactive()) {
2153
+ <button
2154
+ type="button"
2155
+ class="star-select__icon-btn"
2156
+ [attr.aria-label]="text.clear"
2157
+ (click)="clear()"
2158
+ >
2159
+ <i class="ph-bold ph-x" aria-hidden="true"></i>
2160
+ </button>
2161
+ }
2162
+ @if (loading()) {
2163
+ <i
2164
+ class="ph-bold ph-spinner-gap star-spin star-select__caret"
2165
+ role="img"
2166
+ [attr.aria-label]="text.loading"
2167
+ ></i>
2168
+ } @else {
2169
+ <i class="ph-bold ph-caret-down star-select__caret" aria-hidden="true"></i>
2170
+ }
2171
+ </div>
2172
+
2173
+ <ng-template
2174
+ cdkConnectedOverlay
2175
+ cdkConnectedOverlayUsePopover="inline"
2176
+ cdkConnectedOverlayMatchWidth
2177
+ [cdkConnectedOverlayOrigin]="origin"
2178
+ [cdkConnectedOverlayOpen]="open()"
2179
+ [cdkConnectedOverlayPositions]="positions"
2180
+ (attach)="onPanelAttached()"
2181
+ (detach)="closePanel(false)"
2182
+ (overlayOutsideClick)="onOutsideClick($event)"
2183
+ >
2184
+ <div class="star-panel" (mousedown)="onPanelMousedown($event)">
2185
+ @if (filter()) {
2186
+ <div class="star-panel__filter">
2187
+ <i class="ph-bold ph-magnifying-glass" aria-hidden="true"></i>
2188
+ <input
2189
+ #filterInput
2190
+ type="text"
2191
+ class="star-input star-input--sm"
2192
+ role="searchbox"
2193
+ autocomplete="off"
2194
+ [value]="filterValue()"
2195
+ [attr.placeholder]="filterPlaceholder() ?? text.filterPlaceholder"
2196
+ [attr.aria-label]="filterPlaceholder() ?? text.filterPlaceholder"
2197
+ [attr.aria-controls]="listId"
2198
+ [attr.aria-activedescendant]="activeId()"
2199
+ (input)="onFilterInput(filterInput.value)"
2200
+ (keydown)="onKeydown($event)"
2201
+ />
2202
+ </div>
2203
+ }
2204
+ <ul
2205
+ class="star-listbox"
2206
+ role="listbox"
2207
+ [id]="listId"
2208
+ [class.star-listbox--virtual]="virtualScroll()"
2209
+ [style.--star-item-size.px]="virtualScroll() ? virtualItemSize() : null"
2210
+ [style.max-height]="scrollHeight()"
2211
+ [attr.aria-label]="ariaLabel()"
2212
+ [attr.aria-labelledby]="ariaLabelledBy()"
2213
+ (scroll)="onListScroll($event)"
2214
+ >
2215
+ @if (virtualWindow().before) {
2216
+ <li
2217
+ class="star-listbox__spacer"
2218
+ role="presentation"
2219
+ [style.height.px]="virtualWindow().before"
2220
+ ></li>
2221
+ }
2222
+ @for (row of renderedRows(); track row.key) {
2223
+ @if (row.kind === 'group') {
2224
+ <li class="star-listbox__group" role="presentation" [id]="row.id">{{ row.label }}</li>
2225
+ } @else {
2226
+ @let option = row.option;
2227
+ @let i = row.index;
2228
+ <!-- Keyboard is handled on the combobox via aria-activedescendant (WAI-ARIA combobox pattern). -->
2229
+ <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->
2230
+ <li
2231
+ class="star-listbox__option"
2232
+ role="option"
2233
+ [id]="optionId(i)"
2234
+ [class.star-listbox__option--active]="activeIndex() === i"
2235
+ [class.star-listbox__option--selected]="isSelected(option)"
2236
+ [attr.aria-selected]="isSelected(option)"
2237
+ [attr.aria-disabled]="isDisabled(option) || null"
2238
+ [attr.aria-describedby]="row.groupId"
2239
+ [attr.aria-setsize]="virtualScroll() ? visibleOptions().length : null"
2240
+ [attr.aria-posinset]="virtualScroll() ? i + 1 : null"
2241
+ (click)="onOptionClick(option, i)"
2242
+ (mousemove)="isDisabled(option) || activeIndex.set(i)"
2243
+ >
2244
+ <span class="star-listbox__label">
2245
+ @if (optionTemplate(); as custom) {
2246
+ <ng-container
2247
+ *ngTemplateOutlet="custom.template; context: optionContext(option, i)"
2248
+ />
2249
+ } @else {
2250
+ {{ labelOf(option) }}
2251
+ }
2252
+ </span>
2253
+ @if (isSelected(option)) {
2254
+ <i class="ph-bold ph-check star-listbox__check" aria-hidden="true"></i>
2255
+ }
2256
+ </li>
2257
+ }
2258
+ } @empty {
2259
+ <li class="star-listbox__empty" role="presentation">{{ emptyText() }}</li>
2260
+ }
2261
+ @if (virtualWindow().after) {
2262
+ <li
2263
+ class="star-listbox__spacer"
2264
+ role="presentation"
2265
+ [style.height.px]="virtualWindow().after"
2266
+ ></li>
2267
+ }
2268
+ </ul>
2269
+ </div>
2270
+ </ng-template>
2271
+ `,
2272
+ isInline: true,
2273
+ dependencies: [
2274
+ {
2275
+ kind: "directive",
2276
+ type: CdkConnectedOverlay,
2277
+ selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
2278
+ inputs: [
2279
+ "cdkConnectedOverlayOrigin",
2280
+ "cdkConnectedOverlayPositions",
2281
+ "cdkConnectedOverlayPositionStrategy",
2282
+ "cdkConnectedOverlayOffsetX",
2283
+ "cdkConnectedOverlayOffsetY",
2284
+ "cdkConnectedOverlayWidth",
2285
+ "cdkConnectedOverlayHeight",
2286
+ "cdkConnectedOverlayMinWidth",
2287
+ "cdkConnectedOverlayMinHeight",
2288
+ "cdkConnectedOverlayBackdropClass",
2289
+ "cdkConnectedOverlayPanelClass",
2290
+ "cdkConnectedOverlayViewportMargin",
2291
+ "cdkConnectedOverlayScrollStrategy",
2292
+ "cdkConnectedOverlayOpen",
2293
+ "cdkConnectedOverlayDisableClose",
2294
+ "cdkConnectedOverlayTransformOriginOn",
2295
+ "cdkConnectedOverlayHasBackdrop",
2296
+ "cdkConnectedOverlayLockPosition",
2297
+ "cdkConnectedOverlayFlexibleDimensions",
2298
+ "cdkConnectedOverlayGrowAfterOpen",
2299
+ "cdkConnectedOverlayPush",
2300
+ "cdkConnectedOverlayDisposeOnNavigation",
2301
+ "cdkConnectedOverlayUsePopover",
2302
+ "cdkConnectedOverlayMatchWidth",
2303
+ "cdkConnectedOverlay"
2304
+ ],
2305
+ outputs: [
2306
+ "backdropClick",
2307
+ "positionChange",
2308
+ "attach",
2309
+ "detach",
2310
+ "overlayKeydown",
2311
+ "overlayOutsideClick"
2312
+ ],
2313
+ exportAs: ["cdkConnectedOverlay"]
2314
+ },
2315
+ {
2316
+ kind: "directive",
2317
+ type: CdkOverlayOrigin,
2318
+ selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
2319
+ exportAs: ["cdkOverlayOrigin"]
2320
+ },
2321
+ {
2322
+ kind: "directive",
2323
+ type: NgTemplateOutlet,
2324
+ selector: "[ngTemplateOutlet]",
2325
+ inputs: [
2326
+ "ngTemplateOutletContext",
2327
+ "ngTemplateOutlet",
2328
+ "ngTemplateOutletInjector"
2329
+ ]
2330
+ }
2331
+ ],
2332
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
2333
+ });
2334
+ };
2335
+ i0.ɵɵngDeclareClassMetadata({
2336
+ minVersion: "12.0.0",
2337
+ version: "22.2.6",
2338
+ ngImport: i0,
2339
+ type: StarSelect,
2340
+ decorators: [{
2341
+ type: Component,
2342
+ args: [{
2343
+ selector: "star-select",
2344
+ imports: [
2345
+ CdkConnectedOverlay,
2346
+ CdkOverlayOrigin,
2347
+ NgTemplateOutlet
2348
+ ],
2349
+ changeDetection: ChangeDetectionStrategy.OnPush,
2350
+ host: {
2351
+ class: "star-select",
2352
+ "[class.star-select--open]": "open()",
2353
+ "[class.star-select--disabled]": "disabled()",
2354
+ "[class.star-select--invalid]": "showInvalid()",
2355
+ "[class.star-select--sm]": "size() === 'sm'"
2356
+ },
2357
+ template: `
2358
+ <div class="star-select__control" cdkOverlayOrigin #origin="cdkOverlayOrigin">
2359
+ <div
2360
+ #trigger
2361
+ class="star-select__trigger"
2362
+ role="combobox"
2363
+ aria-haspopup="listbox"
2364
+ [id]="inputId()"
2365
+ [attr.tabindex]="disabled() ? -1 : 0"
2366
+ [attr.aria-expanded]="open()"
2367
+ [attr.aria-controls]="open() ? listId : null"
2368
+ [attr.aria-activedescendant]="activeId()"
2369
+ [attr.aria-label]="ariaLabel()"
2370
+ [attr.aria-labelledby]="ariaLabelledBy()"
2371
+ [attr.aria-required]="required() || null"
2372
+ [attr.aria-invalid]="showInvalid() || null"
2373
+ [attr.aria-disabled]="disabled() || null"
2374
+ [attr.aria-readonly]="readonly() || null"
2375
+ (click)="toggle()"
2376
+ (keydown)="onKeydown($event)"
2377
+ (blur)="onTriggerBlur()"
2378
+ >
2379
+ @if (selectedOption(); as option) {
2380
+ <span class="star-select__value">{{ labelOf(option) }}</span>
2381
+ } @else {
2382
+ <span class="star-select__placeholder">{{
2383
+ placeholder() ?? text.selectPlaceholder
2384
+ }}</span>
2385
+ }
2386
+ </div>
2387
+ @if (showClear() && selectedOption() !== undefined && interactive()) {
2388
+ <button
2389
+ type="button"
2390
+ class="star-select__icon-btn"
2391
+ [attr.aria-label]="text.clear"
2392
+ (click)="clear()"
2393
+ >
2394
+ <i class="ph-bold ph-x" aria-hidden="true"></i>
2395
+ </button>
2396
+ }
2397
+ @if (loading()) {
2398
+ <i
2399
+ class="ph-bold ph-spinner-gap star-spin star-select__caret"
2400
+ role="img"
2401
+ [attr.aria-label]="text.loading"
2402
+ ></i>
2403
+ } @else {
2404
+ <i class="ph-bold ph-caret-down star-select__caret" aria-hidden="true"></i>
2405
+ }
2406
+ </div>
2407
+
2408
+ <ng-template
2409
+ cdkConnectedOverlay
2410
+ cdkConnectedOverlayUsePopover="inline"
2411
+ cdkConnectedOverlayMatchWidth
2412
+ [cdkConnectedOverlayOrigin]="origin"
2413
+ [cdkConnectedOverlayOpen]="open()"
2414
+ [cdkConnectedOverlayPositions]="positions"
2415
+ (attach)="onPanelAttached()"
2416
+ (detach)="closePanel(false)"
2417
+ (overlayOutsideClick)="onOutsideClick($event)"
2418
+ >
2419
+ <div class="star-panel" (mousedown)="onPanelMousedown($event)">
2420
+ @if (filter()) {
2421
+ <div class="star-panel__filter">
2422
+ <i class="ph-bold ph-magnifying-glass" aria-hidden="true"></i>
2423
+ <input
2424
+ #filterInput
2425
+ type="text"
2426
+ class="star-input star-input--sm"
2427
+ role="searchbox"
2428
+ autocomplete="off"
2429
+ [value]="filterValue()"
2430
+ [attr.placeholder]="filterPlaceholder() ?? text.filterPlaceholder"
2431
+ [attr.aria-label]="filterPlaceholder() ?? text.filterPlaceholder"
2432
+ [attr.aria-controls]="listId"
2433
+ [attr.aria-activedescendant]="activeId()"
2434
+ (input)="onFilterInput(filterInput.value)"
2435
+ (keydown)="onKeydown($event)"
2436
+ />
2437
+ </div>
2438
+ }
2439
+ <ul
2440
+ class="star-listbox"
2441
+ role="listbox"
2442
+ [id]="listId"
2443
+ [class.star-listbox--virtual]="virtualScroll()"
2444
+ [style.--star-item-size.px]="virtualScroll() ? virtualItemSize() : null"
2445
+ [style.max-height]="scrollHeight()"
2446
+ [attr.aria-label]="ariaLabel()"
2447
+ [attr.aria-labelledby]="ariaLabelledBy()"
2448
+ (scroll)="onListScroll($event)"
2449
+ >
2450
+ @if (virtualWindow().before) {
2451
+ <li
2452
+ class="star-listbox__spacer"
2453
+ role="presentation"
2454
+ [style.height.px]="virtualWindow().before"
2455
+ ></li>
2456
+ }
2457
+ @for (row of renderedRows(); track row.key) {
2458
+ @if (row.kind === 'group') {
2459
+ <li class="star-listbox__group" role="presentation" [id]="row.id">{{ row.label }}</li>
2460
+ } @else {
2461
+ @let option = row.option;
2462
+ @let i = row.index;
2463
+ <!-- Keyboard is handled on the combobox via aria-activedescendant (WAI-ARIA combobox pattern). -->
2464
+ <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->
2465
+ <li
2466
+ class="star-listbox__option"
2467
+ role="option"
2468
+ [id]="optionId(i)"
2469
+ [class.star-listbox__option--active]="activeIndex() === i"
2470
+ [class.star-listbox__option--selected]="isSelected(option)"
2471
+ [attr.aria-selected]="isSelected(option)"
2472
+ [attr.aria-disabled]="isDisabled(option) || null"
2473
+ [attr.aria-describedby]="row.groupId"
2474
+ [attr.aria-setsize]="virtualScroll() ? visibleOptions().length : null"
2475
+ [attr.aria-posinset]="virtualScroll() ? i + 1 : null"
2476
+ (click)="onOptionClick(option, i)"
2477
+ (mousemove)="isDisabled(option) || activeIndex.set(i)"
2478
+ >
2479
+ <span class="star-listbox__label">
2480
+ @if (optionTemplate(); as custom) {
2481
+ <ng-container
2482
+ *ngTemplateOutlet="custom.template; context: optionContext(option, i)"
2483
+ />
2484
+ } @else {
2485
+ {{ labelOf(option) }}
2486
+ }
2487
+ </span>
2488
+ @if (isSelected(option)) {
2489
+ <i class="ph-bold ph-check star-listbox__check" aria-hidden="true"></i>
2490
+ }
2491
+ </li>
2492
+ }
2493
+ } @empty {
2494
+ <li class="star-listbox__empty" role="presentation">{{ emptyText() }}</li>
2495
+ }
2496
+ @if (virtualWindow().after) {
2497
+ <li
2498
+ class="star-listbox__spacer"
2499
+ role="presentation"
2500
+ [style.height.px]="virtualWindow().after"
2501
+ ></li>
2502
+ }
2503
+ </ul>
2504
+ </div>
2505
+ </ng-template>
2506
+ `
2507
+ }]
2508
+ }],
2509
+ propDecorators: { value: [{
2510
+ type: i0.Input,
2511
+ args: [{
2512
+ isSignal: true,
2513
+ alias: "value",
2514
+ required: false
2515
+ }]
2516
+ }, {
2517
+ type: i0.Output,
2518
+ args: ["valueChange"]
2519
+ }] }
2520
+ });
2521
+ export { StarCascadeSelect, StarMultiSelect, StarOptionListBase, StarOptionTemplate, StarSelect };
2522
+
2523
+ //# sourceMappingURL=star-ng-ui-select.mjs.map