@star-ng/ui 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +162 -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 +786 -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 +484 -0
  22. package/fesm2022/star-ng-ui-core.mjs.map +1 -0
  23. package/fesm2022/star-ng-ui-data-display.mjs +1870 -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 +886 -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 +2547 -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 +3531 -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 +285 -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 +124 -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 +5807 -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 +373 -0
  173. package/types/star-ng-ui-data-display.d.ts +438 -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 +170 -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 +563 -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 +885 -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 +343 -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,691 @@
1
+ import { _IdGenerator } from "@angular/cdk/a11y";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, booleanAttribute, computed, inject, input, linkedSignal, model, output, signal, untracked, viewChild } from "@angular/core";
4
+ import { STAR_UI_TEXT } from "@star-ng/ui/core";
5
+ import { StarField } from "@star-ng/ui/field";
6
+ var StarInputNumber = class StarInputNumber {
7
+ uiText = inject(STAR_UI_TEXT);
8
+ field = inject(StarField, { optional: true });
9
+ showInvalid = computed(() => this.invalid() && this.touched() || !!this.field?.errorText(), ...ngDevMode ? [{ debugName: "showInvalid" }] : /* istanbul ignore next */ []);
10
+ constructor() {
11
+ this.field?.linkControl(this.inputId);
12
+ }
13
+ value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
14
+ mode = input("decimal", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
15
+ currency = input("USD", ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
16
+ unit = input("", ...ngDevMode ? [{ debugName: "unit" }] : /* istanbul ignore next */ []);
17
+ prefix = input("", ...ngDevMode ? [{ debugName: "prefix" }] : /* istanbul ignore next */ []);
18
+ suffix = input("", ...ngDevMode ? [{ debugName: "suffix" }] : /* istanbul ignore next */ []);
19
+ locale = input(void 0, ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
20
+ minFractionDigits = input(void 0, ...ngDevMode ? [{ debugName: "minFractionDigits" }] : /* istanbul ignore next */ []);
21
+ maxFractionDigits = input(void 0, ...ngDevMode ? [{ debugName: "maxFractionDigits" }] : /* istanbul ignore next */ []);
22
+ useGrouping = input(true, {
23
+ ...ngDevMode ? { debugName: "useGrouping" } : /* istanbul ignore next */ {},
24
+ transform: booleanAttribute
25
+ });
26
+ step = input(1, ...ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []);
27
+ min = input(void 0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
28
+ max = input(void 0, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
29
+ showButtons = input(false, {
30
+ ...ngDevMode ? { debugName: "showButtons" } : /* istanbul ignore next */ {},
31
+ transform: booleanAttribute
32
+ });
33
+ placeholder = input(null, ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
34
+ ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
35
+ inputId = input(inject(_IdGenerator).getId("star-number-"), ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
36
+ disabled = input(false, {
37
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
38
+ transform: booleanAttribute
39
+ });
40
+ readonly = input(false, {
41
+ ...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
42
+ transform: booleanAttribute
43
+ });
44
+ required = input(false, {
45
+ ...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
46
+ transform: booleanAttribute
47
+ });
48
+ invalid = input(false, {
49
+ ...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
50
+ transform: booleanAttribute
51
+ });
52
+ touched = input(false, {
53
+ ...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
54
+ transform: booleanAttribute
55
+ });
56
+ name = input("", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
57
+ touch = output();
58
+ input = viewChild.required("input", ...ngDevMode ? [{ debugName: "input" }] : /* istanbul ignore next */ []);
59
+ focused = signal(false, ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
60
+ fallbackUnit = signal("", ...ngDevMode ? [{ debugName: "fallbackUnit" }] : /* istanbul ignore next */ []);
61
+ formatter = computed(() => {
62
+ const mode = this.mode();
63
+ const options = {
64
+ style: mode,
65
+ currency: mode === "currency" ? this.currency() : void 0,
66
+ unit: mode === "unit" ? this.unit() : void 0,
67
+ minimumFractionDigits: this.minFractionDigits(),
68
+ maximumFractionDigits: this.maxFractionDigits(),
69
+ useGrouping: this.useGrouping()
70
+ };
71
+ try {
72
+ const format = new Intl.NumberFormat(this.locale(), options);
73
+ untracked(() => this.fallbackUnit.set(""));
74
+ return format;
75
+ } catch (error) {
76
+ if (mode !== "unit") throw error;
77
+ untracked(() => this.fallbackUnit.set(this.unit() ? " " + this.unit() : ""));
78
+ return new Intl.NumberFormat(this.locale(), {
79
+ ...options,
80
+ style: "decimal",
81
+ unit: void 0
82
+ });
83
+ }
84
+ }, ...ngDevMode ? [{ debugName: "formatter" }] : /* istanbul ignore next */ []);
85
+ decimal = computed(() => new Intl.NumberFormat(this.locale()).formatToParts(1.1).find((part) => part.type === "decimal")?.value ?? ".", ...ngDevMode ? [{ debugName: "decimal" }] : /* istanbul ignore next */ []);
86
+ formatted = computed(() => {
87
+ const value = this.value();
88
+ if (value === null) return "";
89
+ const number = this.formatter().format(this.mode() === "percent" ? value / 100 : value);
90
+ return this.prefix() + number + this.fallbackUnit() + this.suffix();
91
+ }, ...ngDevMode ? [{ debugName: "formatted" }] : /* istanbul ignore next */ []);
92
+ text = linkedSignal(() => this.focused() ? this.plain(this.value()) : this.formatted(), ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
93
+ plain(value) {
94
+ if (value === null) return "";
95
+ return String(value).replace(".", this.decimal());
96
+ }
97
+ parse(text) {
98
+ const decimal = this.decimal();
99
+ const cleaned = text.replace(new RegExp(`[^0-9${decimal === "," ? "," : "."}-]`, "g"), "").replace(decimal, ".");
100
+ if (!cleaned || cleaned === "-") return null;
101
+ const number = Number(cleaned);
102
+ return Number.isFinite(number) ? number : void 0;
103
+ }
104
+ clamp(value) {
105
+ const min = this.min();
106
+ const max = this.max();
107
+ const digits = this.formatter().resolvedOptions().maximumFractionDigits ?? 2;
108
+ let result = Number(value.toFixed(this.mode() === "percent" ? Math.max(0, digits - 2) : digits));
109
+ if (min !== void 0) result = Math.max(min, result);
110
+ if (max !== void 0) result = Math.min(max, result);
111
+ return result;
112
+ }
113
+ onFocus() {
114
+ this.focused.set(true);
115
+ }
116
+ onBlur() {
117
+ this.commit();
118
+ this.focused.set(false);
119
+ this.input().nativeElement.value = this.formatted();
120
+ this.touch.emit();
121
+ }
122
+ commit() {
123
+ const parsed = this.parse(this.text());
124
+ if (parsed === void 0) return;
125
+ this.value.set(parsed === null ? null : this.clamp(parsed));
126
+ }
127
+ canStep(direction) {
128
+ if (this.disabled() || this.readonly()) return false;
129
+ const value = this.value();
130
+ if (value === null) return true;
131
+ const limit = direction === 1 ? this.max() : this.min();
132
+ return limit === void 0 || (direction === 1 ? value < limit : value > limit);
133
+ }
134
+ stepBy(direction) {
135
+ if (this.disabled() || this.readonly()) return;
136
+ if (this.focused()) this.commit();
137
+ const start = this.value() ?? this.min() ?? 0;
138
+ const next = this.clamp(start + direction * this.step());
139
+ this.value.set(next);
140
+ this.input().nativeElement.value = this.focused() ? this.plain(next) : this.formatted();
141
+ }
142
+ onKeydown(event) {
143
+ const steps = {
144
+ ArrowUp: 1,
145
+ ArrowDown: -1,
146
+ PageUp: 10,
147
+ PageDown: -10
148
+ };
149
+ if (event.key in steps) {
150
+ event.preventDefault();
151
+ this.stepBy(steps[event.key]);
152
+ } else if (event.key === "Home" && this.min() !== void 0) {
153
+ event.preventDefault();
154
+ this.value.set(this.min() ?? null);
155
+ } else if (event.key === "End" && this.max() !== void 0) {
156
+ event.preventDefault();
157
+ this.value.set(this.max() ?? null);
158
+ } else if (event.key === "Enter") this.commit();
159
+ }
160
+ focus(options) {
161
+ this.input().nativeElement.focus(options);
162
+ }
163
+ static ɵfac = i0.ɵɵngDeclareFactory({
164
+ minVersion: "12.0.0",
165
+ version: "22.2.6",
166
+ ngImport: i0,
167
+ type: StarInputNumber,
168
+ deps: [],
169
+ target: i0.ɵɵFactoryTarget.Component
170
+ });
171
+ static ɵcmp = i0.ɵɵngDeclareComponent({
172
+ minVersion: "17.0.0",
173
+ version: "22.2.6",
174
+ type: StarInputNumber,
175
+ isStandalone: true,
176
+ selector: "star-input-number",
177
+ inputs: {
178
+ value: {
179
+ classPropertyName: "value",
180
+ publicName: "value",
181
+ isSignal: true,
182
+ isRequired: false,
183
+ transformFunction: null
184
+ },
185
+ mode: {
186
+ classPropertyName: "mode",
187
+ publicName: "mode",
188
+ isSignal: true,
189
+ isRequired: false,
190
+ transformFunction: null
191
+ },
192
+ currency: {
193
+ classPropertyName: "currency",
194
+ publicName: "currency",
195
+ isSignal: true,
196
+ isRequired: false,
197
+ transformFunction: null
198
+ },
199
+ unit: {
200
+ classPropertyName: "unit",
201
+ publicName: "unit",
202
+ isSignal: true,
203
+ isRequired: false,
204
+ transformFunction: null
205
+ },
206
+ prefix: {
207
+ classPropertyName: "prefix",
208
+ publicName: "prefix",
209
+ isSignal: true,
210
+ isRequired: false,
211
+ transformFunction: null
212
+ },
213
+ suffix: {
214
+ classPropertyName: "suffix",
215
+ publicName: "suffix",
216
+ isSignal: true,
217
+ isRequired: false,
218
+ transformFunction: null
219
+ },
220
+ locale: {
221
+ classPropertyName: "locale",
222
+ publicName: "locale",
223
+ isSignal: true,
224
+ isRequired: false,
225
+ transformFunction: null
226
+ },
227
+ minFractionDigits: {
228
+ classPropertyName: "minFractionDigits",
229
+ publicName: "minFractionDigits",
230
+ isSignal: true,
231
+ isRequired: false,
232
+ transformFunction: null
233
+ },
234
+ maxFractionDigits: {
235
+ classPropertyName: "maxFractionDigits",
236
+ publicName: "maxFractionDigits",
237
+ isSignal: true,
238
+ isRequired: false,
239
+ transformFunction: null
240
+ },
241
+ useGrouping: {
242
+ classPropertyName: "useGrouping",
243
+ publicName: "useGrouping",
244
+ isSignal: true,
245
+ isRequired: false,
246
+ transformFunction: null
247
+ },
248
+ step: {
249
+ classPropertyName: "step",
250
+ publicName: "step",
251
+ isSignal: true,
252
+ isRequired: false,
253
+ transformFunction: null
254
+ },
255
+ min: {
256
+ classPropertyName: "min",
257
+ publicName: "min",
258
+ isSignal: true,
259
+ isRequired: false,
260
+ transformFunction: null
261
+ },
262
+ max: {
263
+ classPropertyName: "max",
264
+ publicName: "max",
265
+ isSignal: true,
266
+ isRequired: false,
267
+ transformFunction: null
268
+ },
269
+ showButtons: {
270
+ classPropertyName: "showButtons",
271
+ publicName: "showButtons",
272
+ isSignal: true,
273
+ isRequired: false,
274
+ transformFunction: null
275
+ },
276
+ placeholder: {
277
+ classPropertyName: "placeholder",
278
+ publicName: "placeholder",
279
+ isSignal: true,
280
+ isRequired: false,
281
+ transformFunction: null
282
+ },
283
+ ariaLabel: {
284
+ classPropertyName: "ariaLabel",
285
+ publicName: "ariaLabel",
286
+ isSignal: true,
287
+ isRequired: false,
288
+ transformFunction: null
289
+ },
290
+ inputId: {
291
+ classPropertyName: "inputId",
292
+ publicName: "inputId",
293
+ isSignal: true,
294
+ isRequired: false,
295
+ transformFunction: null
296
+ },
297
+ disabled: {
298
+ classPropertyName: "disabled",
299
+ publicName: "disabled",
300
+ isSignal: true,
301
+ isRequired: false,
302
+ transformFunction: null
303
+ },
304
+ readonly: {
305
+ classPropertyName: "readonly",
306
+ publicName: "readonly",
307
+ isSignal: true,
308
+ isRequired: false,
309
+ transformFunction: null
310
+ },
311
+ required: {
312
+ classPropertyName: "required",
313
+ publicName: "required",
314
+ isSignal: true,
315
+ isRequired: false,
316
+ transformFunction: null
317
+ },
318
+ invalid: {
319
+ classPropertyName: "invalid",
320
+ publicName: "invalid",
321
+ isSignal: true,
322
+ isRequired: false,
323
+ transformFunction: null
324
+ },
325
+ touched: {
326
+ classPropertyName: "touched",
327
+ publicName: "touched",
328
+ isSignal: true,
329
+ isRequired: false,
330
+ transformFunction: null
331
+ },
332
+ name: {
333
+ classPropertyName: "name",
334
+ publicName: "name",
335
+ isSignal: true,
336
+ isRequired: false,
337
+ transformFunction: null
338
+ }
339
+ },
340
+ outputs: {
341
+ value: "valueChange",
342
+ touch: "touch"
343
+ },
344
+ host: {
345
+ properties: {
346
+ "class.star-number--disabled": "disabled()",
347
+ "class.star-number--invalid": "showInvalid()",
348
+ "class.star-number--buttons": "showButtons()"
349
+ },
350
+ classAttribute: "star-number"
351
+ },
352
+ viewQueries: [{
353
+ propertyName: "input",
354
+ first: true,
355
+ predicate: ["input"],
356
+ descendants: true,
357
+ isSignal: true
358
+ }],
359
+ ngImport: i0,
360
+ template: `
361
+ <div class="star-number__control">
362
+ @if (showButtons()) {
363
+ <button
364
+ type="button"
365
+ class="star-number__btn"
366
+ tabindex="-1"
367
+ [attr.aria-label]="uiText.decrease"
368
+ [disabled]="!canStep(-1)"
369
+ (click)="stepBy(-1)"
370
+ >
371
+ <i class="ph-bold ph-minus" aria-hidden="true"></i>
372
+ </button>
373
+ }
374
+ <input
375
+ #input
376
+ type="text"
377
+ class="star-number__input"
378
+ role="spinbutton"
379
+ autocomplete="off"
380
+ [attr.inputmode]="maxFractionDigits() === 0 ? 'numeric' : 'decimal'"
381
+ [id]="inputId()"
382
+ [attr.name]="name() || null"
383
+ [value]="text()"
384
+ [attr.placeholder]="placeholder()"
385
+ [disabled]="disabled()"
386
+ [readOnly]="readonly()"
387
+ [required]="required()"
388
+ [attr.aria-label]="ariaLabel()"
389
+ [attr.aria-valuenow]="value()"
390
+ [attr.aria-valuetext]="formatted()"
391
+ [attr.aria-valuemin]="min()"
392
+ [attr.aria-valuemax]="max()"
393
+ [attr.aria-describedby]="field?.describedBy() ?? null"
394
+ [attr.aria-invalid]="showInvalid() || null"
395
+ (focus)="onFocus()"
396
+ (input)="text.set(input.value)"
397
+ (blur)="onBlur()"
398
+ (keydown)="onKeydown($event)"
399
+ />
400
+ @if (showButtons()) {
401
+ <button
402
+ type="button"
403
+ class="star-number__btn"
404
+ tabindex="-1"
405
+ [attr.aria-label]="uiText.increase"
406
+ [disabled]="!canStep(1)"
407
+ (click)="stepBy(1)"
408
+ >
409
+ <i class="ph-bold ph-plus" aria-hidden="true"></i>
410
+ </button>
411
+ }
412
+ </div>
413
+ `,
414
+ isInline: true,
415
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
416
+ });
417
+ };
418
+ i0.ɵɵngDeclareClassMetadata({
419
+ minVersion: "12.0.0",
420
+ version: "22.2.6",
421
+ ngImport: i0,
422
+ type: StarInputNumber,
423
+ decorators: [{
424
+ type: Component,
425
+ args: [{
426
+ selector: "star-input-number",
427
+ changeDetection: ChangeDetectionStrategy.OnPush,
428
+ host: {
429
+ class: "star-number",
430
+ "[class.star-number--disabled]": "disabled()",
431
+ "[class.star-number--invalid]": "showInvalid()",
432
+ "[class.star-number--buttons]": "showButtons()"
433
+ },
434
+ template: `
435
+ <div class="star-number__control">
436
+ @if (showButtons()) {
437
+ <button
438
+ type="button"
439
+ class="star-number__btn"
440
+ tabindex="-1"
441
+ [attr.aria-label]="uiText.decrease"
442
+ [disabled]="!canStep(-1)"
443
+ (click)="stepBy(-1)"
444
+ >
445
+ <i class="ph-bold ph-minus" aria-hidden="true"></i>
446
+ </button>
447
+ }
448
+ <input
449
+ #input
450
+ type="text"
451
+ class="star-number__input"
452
+ role="spinbutton"
453
+ autocomplete="off"
454
+ [attr.inputmode]="maxFractionDigits() === 0 ? 'numeric' : 'decimal'"
455
+ [id]="inputId()"
456
+ [attr.name]="name() || null"
457
+ [value]="text()"
458
+ [attr.placeholder]="placeholder()"
459
+ [disabled]="disabled()"
460
+ [readOnly]="readonly()"
461
+ [required]="required()"
462
+ [attr.aria-label]="ariaLabel()"
463
+ [attr.aria-valuenow]="value()"
464
+ [attr.aria-valuetext]="formatted()"
465
+ [attr.aria-valuemin]="min()"
466
+ [attr.aria-valuemax]="max()"
467
+ [attr.aria-describedby]="field?.describedBy() ?? null"
468
+ [attr.aria-invalid]="showInvalid() || null"
469
+ (focus)="onFocus()"
470
+ (input)="text.set(input.value)"
471
+ (blur)="onBlur()"
472
+ (keydown)="onKeydown($event)"
473
+ />
474
+ @if (showButtons()) {
475
+ <button
476
+ type="button"
477
+ class="star-number__btn"
478
+ tabindex="-1"
479
+ [attr.aria-label]="uiText.increase"
480
+ [disabled]="!canStep(1)"
481
+ (click)="stepBy(1)"
482
+ >
483
+ <i class="ph-bold ph-plus" aria-hidden="true"></i>
484
+ </button>
485
+ }
486
+ </div>
487
+ `
488
+ }]
489
+ }],
490
+ ctorParameters: () => [],
491
+ propDecorators: {
492
+ value: [{
493
+ type: i0.Input,
494
+ args: [{
495
+ isSignal: true,
496
+ alias: "value",
497
+ required: false
498
+ }]
499
+ }, {
500
+ type: i0.Output,
501
+ args: ["valueChange"]
502
+ }],
503
+ mode: [{
504
+ type: i0.Input,
505
+ args: [{
506
+ isSignal: true,
507
+ alias: "mode",
508
+ required: false
509
+ }]
510
+ }],
511
+ currency: [{
512
+ type: i0.Input,
513
+ args: [{
514
+ isSignal: true,
515
+ alias: "currency",
516
+ required: false
517
+ }]
518
+ }],
519
+ unit: [{
520
+ type: i0.Input,
521
+ args: [{
522
+ isSignal: true,
523
+ alias: "unit",
524
+ required: false
525
+ }]
526
+ }],
527
+ prefix: [{
528
+ type: i0.Input,
529
+ args: [{
530
+ isSignal: true,
531
+ alias: "prefix",
532
+ required: false
533
+ }]
534
+ }],
535
+ suffix: [{
536
+ type: i0.Input,
537
+ args: [{
538
+ isSignal: true,
539
+ alias: "suffix",
540
+ required: false
541
+ }]
542
+ }],
543
+ locale: [{
544
+ type: i0.Input,
545
+ args: [{
546
+ isSignal: true,
547
+ alias: "locale",
548
+ required: false
549
+ }]
550
+ }],
551
+ minFractionDigits: [{
552
+ type: i0.Input,
553
+ args: [{
554
+ isSignal: true,
555
+ alias: "minFractionDigits",
556
+ required: false
557
+ }]
558
+ }],
559
+ maxFractionDigits: [{
560
+ type: i0.Input,
561
+ args: [{
562
+ isSignal: true,
563
+ alias: "maxFractionDigits",
564
+ required: false
565
+ }]
566
+ }],
567
+ useGrouping: [{
568
+ type: i0.Input,
569
+ args: [{
570
+ isSignal: true,
571
+ alias: "useGrouping",
572
+ required: false
573
+ }]
574
+ }],
575
+ step: [{
576
+ type: i0.Input,
577
+ args: [{
578
+ isSignal: true,
579
+ alias: "step",
580
+ required: false
581
+ }]
582
+ }],
583
+ min: [{
584
+ type: i0.Input,
585
+ args: [{
586
+ isSignal: true,
587
+ alias: "min",
588
+ required: false
589
+ }]
590
+ }],
591
+ max: [{
592
+ type: i0.Input,
593
+ args: [{
594
+ isSignal: true,
595
+ alias: "max",
596
+ required: false
597
+ }]
598
+ }],
599
+ showButtons: [{
600
+ type: i0.Input,
601
+ args: [{
602
+ isSignal: true,
603
+ alias: "showButtons",
604
+ required: false
605
+ }]
606
+ }],
607
+ placeholder: [{
608
+ type: i0.Input,
609
+ args: [{
610
+ isSignal: true,
611
+ alias: "placeholder",
612
+ required: false
613
+ }]
614
+ }],
615
+ ariaLabel: [{
616
+ type: i0.Input,
617
+ args: [{
618
+ isSignal: true,
619
+ alias: "ariaLabel",
620
+ required: false
621
+ }]
622
+ }],
623
+ inputId: [{
624
+ type: i0.Input,
625
+ args: [{
626
+ isSignal: true,
627
+ alias: "inputId",
628
+ required: false
629
+ }]
630
+ }],
631
+ disabled: [{
632
+ type: i0.Input,
633
+ args: [{
634
+ isSignal: true,
635
+ alias: "disabled",
636
+ required: false
637
+ }]
638
+ }],
639
+ readonly: [{
640
+ type: i0.Input,
641
+ args: [{
642
+ isSignal: true,
643
+ alias: "readonly",
644
+ required: false
645
+ }]
646
+ }],
647
+ required: [{
648
+ type: i0.Input,
649
+ args: [{
650
+ isSignal: true,
651
+ alias: "required",
652
+ required: false
653
+ }]
654
+ }],
655
+ invalid: [{
656
+ type: i0.Input,
657
+ args: [{
658
+ isSignal: true,
659
+ alias: "invalid",
660
+ required: false
661
+ }]
662
+ }],
663
+ touched: [{
664
+ type: i0.Input,
665
+ args: [{
666
+ isSignal: true,
667
+ alias: "touched",
668
+ required: false
669
+ }]
670
+ }],
671
+ name: [{
672
+ type: i0.Input,
673
+ args: [{
674
+ isSignal: true,
675
+ alias: "name",
676
+ required: false
677
+ }]
678
+ }],
679
+ touch: [{
680
+ type: i0.Output,
681
+ args: ["touch"]
682
+ }],
683
+ input: [{
684
+ type: i0.ViewChild,
685
+ args: ["input", { isSignal: true }]
686
+ }]
687
+ }
688
+ });
689
+ export { StarInputNumber };
690
+
691
+ //# sourceMappingURL=star-ng-ui-input-number.mjs.map