@radix-ng/primitives 0.35.0 → 0.37.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 (50) hide show
  1. package/avatar/index.d.ts +1 -1
  2. package/avatar/src/avatar-context.token.d.ts +7 -0
  3. package/avatar/src/avatar-fallback.directive.d.ts +3 -9
  4. package/avatar/src/avatar-image.directive.d.ts +11 -11
  5. package/avatar/src/avatar-root.directive.d.ts +3 -6
  6. package/avatar/src/types.d.ts +2 -0
  7. package/checkbox/index.d.ts +1 -1
  8. package/checkbox/src/checkbox-button.directive.d.ts +1 -1
  9. package/checkbox/src/checkbox-indicator.directive.d.ts +1 -1
  10. package/checkbox/src/checkbox-input.directive.d.ts +1 -1
  11. package/checkbox/src/checkbox.directive.d.ts +3 -3
  12. package/checkbox/src/checkbox.token.d.ts +3 -3
  13. package/core/index.d.ts +2 -0
  14. package/core/src/clamp.d.ts +38 -0
  15. package/cropper/README.md +1 -0
  16. package/cropper/index.d.ts +15 -0
  17. package/cropper/src/cropper-context.token.d.ts +12 -0
  18. package/cropper/src/cropper-crop-area.directive.d.ts +6 -0
  19. package/cropper/src/cropper-description.directive.d.ts +6 -0
  20. package/cropper/src/cropper-image.component.d.ts +10 -0
  21. package/cropper/src/cropper-root.directive.d.ts +91 -0
  22. package/date-field/index.d.ts +9 -0
  23. package/fesm2022/radix-ng-primitives-avatar.mjs +82 -86
  24. package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
  25. package/fesm2022/radix-ng-primitives-checkbox.mjs +13 -16
  26. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  27. package/fesm2022/radix-ng-primitives-core.mjs +84 -1
  28. package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
  29. package/fesm2022/radix-ng-primitives-cropper.mjs +680 -0
  30. package/fesm2022/radix-ng-primitives-cropper.mjs.map +1 -0
  31. package/fesm2022/radix-ng-primitives-date-field.mjs +16 -2
  32. package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
  33. package/fesm2022/radix-ng-primitives-number-field.mjs +502 -0
  34. package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -0
  35. package/fesm2022/radix-ng-primitives-stepper.mjs +1 -14
  36. package/fesm2022/radix-ng-primitives-stepper.mjs.map +1 -1
  37. package/hover-card/src/hover-card-root.directive.d.ts +4 -4
  38. package/number-field/README.md +1 -0
  39. package/number-field/index.d.ts +17 -0
  40. package/number-field/src/number-field-context.token.d.ts +24 -0
  41. package/number-field/src/number-field-decrement.directive.d.ts +23 -0
  42. package/number-field/src/number-field-increment.directive.d.ts +23 -0
  43. package/number-field/src/number-field-input.directive.d.ts +22 -0
  44. package/number-field/src/number-field-root.directive.d.ts +86 -0
  45. package/number-field/src/types.d.ts +1 -0
  46. package/number-field/src/utils.d.ts +18 -0
  47. package/package.json +9 -1
  48. package/popover/src/popover-root.directive.d.ts +4 -4
  49. package/tooltip/src/tooltip-root.directive.d.ts +4 -4
  50. /package/{stepper/src/utils → core/src}/getActiveElement.d.ts +0 -0
@@ -0,0 +1,502 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, DestroyRef, signal, effect, Injectable, computed, ElementRef, input, booleanAttribute, Directive, model, numberAttribute, NgModule } from '@angular/core';
3
+ import { NumberFormatter, NumberParser } from '@internationalized/number';
4
+ import { Subject, fromEvent } from 'rxjs';
5
+ import { takeUntil } from 'rxjs/operators';
6
+ import { getActiveElement, clamp, snapValueToStep, provideToken } from '@radix-ng/primitives/core';
7
+
8
+ const NUMBER_FIELD_ROOT_CONTEXT = new InjectionToken('NUMBER_FIELD_ROOT_CONTEXT');
9
+ function injectNumberFieldRootContext() {
10
+ return inject(NUMBER_FIELD_ROOT_CONTEXT);
11
+ }
12
+
13
+ class PressedHoldService {
14
+ constructor() {
15
+ this.destroyRef = inject(DestroyRef);
16
+ }
17
+ create(options) {
18
+ const timeout = signal(undefined);
19
+ const triggerHook = new Subject();
20
+ const isPressed = signal(false);
21
+ const resetTimeout = () => {
22
+ const timer = timeout();
23
+ if (timer !== undefined) {
24
+ window.clearTimeout(timer);
25
+ timeout.set(undefined);
26
+ }
27
+ };
28
+ const onIncrementPressStart = (delay) => {
29
+ resetTimeout();
30
+ if (options.disabled())
31
+ return;
32
+ triggerHook.next();
33
+ timeout.set(window.setTimeout(() => {
34
+ onIncrementPressStart(60);
35
+ }, delay));
36
+ };
37
+ const onPressStart = (event) => {
38
+ if (event.button !== 0 || isPressed())
39
+ return;
40
+ event.preventDefault();
41
+ isPressed.set(true);
42
+ onIncrementPressStart(400);
43
+ };
44
+ const onPressRelease = () => {
45
+ isPressed.set(false);
46
+ resetTimeout();
47
+ };
48
+ effect(() => {
49
+ // Skip SSR environments
50
+ if (typeof window === 'undefined')
51
+ return;
52
+ const targetElement = options.target?.() || window;
53
+ const destroy$ = new Subject();
54
+ const pointerDownSub = fromEvent(targetElement, 'pointerdown')
55
+ .pipe(takeUntil(destroy$))
56
+ .subscribe((e) => onPressStart(e));
57
+ const pointerUpSub = fromEvent(window, 'pointerup').pipe(takeUntil(destroy$)).subscribe(onPressRelease);
58
+ const pointerCancelSub = fromEvent(window, 'pointercancel')
59
+ .pipe(takeUntil(destroy$))
60
+ .subscribe(onPressRelease);
61
+ this.destroyRef.onDestroy(() => {
62
+ destroy$.next();
63
+ destroy$.complete();
64
+ pointerDownSub.unsubscribe();
65
+ pointerUpSub.unsubscribe();
66
+ pointerCancelSub.unsubscribe();
67
+ });
68
+ });
69
+ return {
70
+ isPressed: isPressed.asReadonly(),
71
+ onTrigger: (fn) => {
72
+ const sub = triggerHook.subscribe(fn);
73
+ this.destroyRef.onDestroy(() => sub.unsubscribe());
74
+ }
75
+ };
76
+ }
77
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PressedHoldService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
78
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PressedHoldService }); }
79
+ }
80
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PressedHoldService, decorators: [{
81
+ type: Injectable
82
+ }] });
83
+ function useNumberFormatter(locale, options = signal({})) {
84
+ return computed(() => new NumberFormatter(locale(), options()));
85
+ }
86
+ function useNumberParser(locale, options = signal({})) {
87
+ return computed(() => new NumberParser(locale(), options()));
88
+ }
89
+ function handleDecimalOperation(operator, value1, value2) {
90
+ let result = operator === '+' ? value1 + value2 : value1 - value2;
91
+ // Check if we have decimals
92
+ if (value1 % 1 !== 0 || value2 % 1 !== 0) {
93
+ const value1Decimal = value1.toString().split('.');
94
+ const value2Decimal = value2.toString().split('.');
95
+ const value1DecimalLength = (value1Decimal[1] && value1Decimal[1].length) || 0;
96
+ const value2DecimalLength = (value2Decimal[1] && value2Decimal[1].length) || 0;
97
+ const multiplier = 10 ** Math.max(value1DecimalLength, value2DecimalLength);
98
+ // Transform the decimals to integers based on the precision
99
+ value1 = Math.round(value1 * multiplier);
100
+ value2 = Math.round(value2 * multiplier);
101
+ // Perform the operation on integers values to make sure we don't get a fancy decimal value
102
+ result = operator === '+' ? value1 + value2 : value1 - value2;
103
+ // Transform the integer result back to decimal
104
+ result /= multiplier;
105
+ }
106
+ return result;
107
+ }
108
+
109
+ class RdxNumberFieldDecrementDirective {
110
+ constructor() {
111
+ this.elementRef = inject((ElementRef));
112
+ this.pressedHold = inject(PressedHoldService);
113
+ this.rootContext = injectNumberFieldRootContext();
114
+ this.disabled = input(false, { transform: booleanAttribute });
115
+ /**
116
+ * @ignore
117
+ */
118
+ this.isDisabled = computed(() => this.rootContext.disabled() || this.disabled() || this.rootContext.isDecreaseDisabled());
119
+ /**
120
+ * @ignore
121
+ */
122
+ this.useHold = this.pressedHold.create({
123
+ target: signal(this.elementRef.nativeElement),
124
+ disabled: this.disabled
125
+ });
126
+ }
127
+ ngOnInit() {
128
+ this.useHold.onTrigger(() => this.rootContext.handleDecrease());
129
+ }
130
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldDecrementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
131
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxNumberFieldDecrementDirective, isStandalone: true, selector: "button[rdxNumberFieldDecrement]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "tabindex": "-1", "type": "\"button\"" }, listeners: { "contextmenu": "$event.preventDefault()" }, properties: { "attr.aria-label": "\"Decrease\"", "attr.disabled": "isDisabled() ? \"\" : undefined", "attr.data-disabled": "isDisabled() ? \"\" : undefined", "attr.data-pressed": "useHold.isPressed() ? \"true\" : undefined", "style.user-select": "useHold.isPressed() ? \"none\" : null" } }, providers: [PressedHoldService], ngImport: i0 }); }
132
+ }
133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldDecrementDirective, decorators: [{
134
+ type: Directive,
135
+ args: [{
136
+ selector: 'button[rdxNumberFieldDecrement]',
137
+ providers: [PressedHoldService],
138
+ host: {
139
+ tabindex: '-1',
140
+ type: '"button"',
141
+ '[attr.aria-label]': '"Decrease"',
142
+ '[attr.disabled]': 'isDisabled() ? "" : undefined',
143
+ '[attr.data-disabled]': 'isDisabled() ? "" : undefined',
144
+ '[attr.data-pressed]': 'useHold.isPressed() ? "true" : undefined',
145
+ '[style.user-select]': 'useHold.isPressed() ? "none" : null',
146
+ '(contextmenu)': '$event.preventDefault()'
147
+ }
148
+ }]
149
+ }] });
150
+
151
+ class RdxNumberFieldIncrementDirective {
152
+ constructor() {
153
+ this.elementRef = inject((ElementRef));
154
+ this.pressedHold = inject(PressedHoldService);
155
+ this.rootContext = injectNumberFieldRootContext();
156
+ this.disabled = input(false, { transform: booleanAttribute });
157
+ /**
158
+ * @ignore
159
+ */
160
+ this.isDisabled = computed(() => this.rootContext.disabled() || this.disabled() || this.rootContext.isIncreaseDisabled());
161
+ /**
162
+ * @ignore
163
+ */
164
+ this.useHold = this.pressedHold.create({
165
+ target: signal(this.elementRef.nativeElement),
166
+ disabled: this.disabled
167
+ });
168
+ }
169
+ ngOnInit() {
170
+ this.useHold.onTrigger(() => this.rootContext.handleIncrease());
171
+ }
172
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldIncrementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
173
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxNumberFieldIncrementDirective, isStandalone: true, selector: "button[rdxNumberFieldIncrement]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "tabindex": "-1", "type": "\"button\"" }, listeners: { "contextmenu": "$event.preventDefault()" }, properties: { "attr.aria-label": "\"Increase\"", "attr.disabled": "isDisabled() ? \"\" : undefined", "attr.data-disabled": "isDisabled() ? \"\" : undefined", "attr.data-pressed": "useHold.isPressed() ? \"true\" : undefined", "style.user-select": "useHold.isPressed() ? \"none\" : null" } }, providers: [PressedHoldService], ngImport: i0 }); }
174
+ }
175
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldIncrementDirective, decorators: [{
176
+ type: Directive,
177
+ args: [{
178
+ selector: 'button[rdxNumberFieldIncrement]',
179
+ providers: [PressedHoldService],
180
+ host: {
181
+ tabindex: '-1',
182
+ type: '"button"',
183
+ '[attr.aria-label]': '"Increase"',
184
+ '[attr.disabled]': 'isDisabled() ? "" : undefined',
185
+ '[attr.data-disabled]': 'isDisabled() ? "" : undefined',
186
+ '[attr.data-pressed]': 'useHold.isPressed() ? "true" : undefined',
187
+ '[style.user-select]': 'useHold.isPressed() ? "none" : null',
188
+ '(contextmenu)': '$event.preventDefault()'
189
+ }
190
+ }]
191
+ }] });
192
+
193
+ class RdxNumberFieldInputDirective {
194
+ constructor() {
195
+ this.elementRef = inject((ElementRef));
196
+ this.rootContext = injectNumberFieldRootContext();
197
+ this.inputValue = signal(this.rootContext.textValue());
198
+ effect(() => {
199
+ this.inputValue.set(this.rootContext.textValue());
200
+ this.rootContext.setInputValue(this.inputValue());
201
+ });
202
+ }
203
+ ngOnInit() {
204
+ this.rootContext.onInputElement(this.elementRef.nativeElement);
205
+ }
206
+ onBeforeInput(event) {
207
+ const target = event.target;
208
+ const nextValue = target.value.slice(0, target.selectionStart ?? undefined) +
209
+ (event.data ?? '') +
210
+ target.value.slice(target.selectionEnd ?? undefined);
211
+ if (!this.rootContext.validate(nextValue)) {
212
+ event.preventDefault();
213
+ }
214
+ }
215
+ onWheelEvent(event) {
216
+ if (this.rootContext.disableWheelChange()) {
217
+ return;
218
+ }
219
+ // only handle when in focus
220
+ if (event.target !== getActiveElement())
221
+ return;
222
+ // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change
223
+ // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec
224
+ // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication
225
+ // especially if the user is scrolling near 45deg
226
+ if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) {
227
+ return;
228
+ }
229
+ event.preventDefault();
230
+ if (event.deltaY > 0) {
231
+ this.rootContext.handleIncrease();
232
+ }
233
+ else if (event.deltaY < 0) {
234
+ this.rootContext.handleDecrease();
235
+ }
236
+ }
237
+ onKeydownPageUp(event) {
238
+ event.preventDefault();
239
+ this.rootContext.handleIncrease(10);
240
+ }
241
+ onKeydownPageDown(event) {
242
+ event.preventDefault();
243
+ this.rootContext.handleDecrease(10);
244
+ }
245
+ onKeydownHome(event) {
246
+ event.preventDefault();
247
+ this.rootContext.handleMinMaxValue('min');
248
+ }
249
+ onKeydownEnd(event) {
250
+ event.preventDefault();
251
+ this.rootContext.handleMinMaxValue('max');
252
+ }
253
+ onInput(event) {
254
+ const target = event.target;
255
+ this.rootContext.applyInputValue(target.value);
256
+ }
257
+ onChange() {
258
+ this.inputValue.set(this.rootContext.textValue());
259
+ }
260
+ onKeydownEnter(event) {
261
+ const target = event.target;
262
+ this.rootContext.applyInputValue(target.value);
263
+ }
264
+ onKeydownUp(event) {
265
+ event.preventDefault();
266
+ this.rootContext.handleIncrease();
267
+ }
268
+ onKeydownDown(event) {
269
+ event.preventDefault();
270
+ this.rootContext.handleDecrease();
271
+ }
272
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
273
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.4", type: RdxNumberFieldInputDirective, isStandalone: true, selector: "input[rdxNumberFieldInput]", host: { attributes: { "role": "spinbutton", "type": "text", "tabindex": "0", "autocomplete": "off", "autocorrect": "off", "spellcheck": "false", "aria-roledescription": "Number field" }, listeners: { "change": "onChange()", "input": "onInput($event)", "blur": "onKeydownEnter($event)", "beforeinput": "onBeforeInput($event)", "keydown.enter": "onKeydownEnter($event)", "keydown.arrowUp": "onKeydownUp($event)", "keydown.arrowDown": "onKeydownDown($event)", "keydown.home": "onKeydownHome($event)", "keydown.end": "onKeydownEnd($event)", "keydown.pageUp": "onKeydownPageUp($event)", "keydown.pageDown": "onKeydownPageDown($event)", "wheel": "onWheelEvent($event)" }, properties: { "attr.aria-valuenow": "rootContext.value()", "attr.aria-valuemin": "rootContext.min()", "attr.aria-valuemax": "rootContext.max()", "attr.inputmode": "rootContext.inputMode()", "attr.disabled": "rootContext.disabled() ? \"\" : undefined", "attr.data-disabled": "rootContext.disabled() ? \"\" : undefined", "attr.value": "inputValue()" } }, ngImport: i0 }); }
274
+ }
275
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldInputDirective, decorators: [{
276
+ type: Directive,
277
+ args: [{
278
+ selector: 'input[rdxNumberFieldInput]',
279
+ host: {
280
+ role: 'spinbutton',
281
+ type: 'text',
282
+ tabindex: '0',
283
+ autocomplete: 'off',
284
+ autocorrect: 'off',
285
+ spellcheck: 'false',
286
+ 'aria-roledescription': 'Number field',
287
+ '[attr.aria-valuenow]': 'rootContext.value()',
288
+ '[attr.aria-valuemin]': 'rootContext.min()',
289
+ '[attr.aria-valuemax]': 'rootContext.max()',
290
+ '[attr.inputmode]': 'rootContext.inputMode()',
291
+ '[attr.disabled]': 'rootContext.disabled() ? "" : undefined',
292
+ '[attr.data-disabled]': 'rootContext.disabled() ? "" : undefined',
293
+ '[attr.value]': 'inputValue()',
294
+ '(change)': 'onChange()',
295
+ '(input)': 'onInput($event)',
296
+ '(blur)': 'onKeydownEnter($event)',
297
+ '(beforeinput)': 'onBeforeInput($event)',
298
+ '(keydown.enter)': 'onKeydownEnter($event)',
299
+ '(keydown.arrowUp)': 'onKeydownUp($event)',
300
+ '(keydown.arrowDown)': 'onKeydownDown($event)',
301
+ '(keydown.home)': 'onKeydownHome($event)',
302
+ '(keydown.end)': 'onKeydownEnd($event)',
303
+ '(keydown.pageUp)': 'onKeydownPageUp($event)',
304
+ '(keydown.pageDown)': 'onKeydownPageDown($event)',
305
+ '(wheel)': 'onWheelEvent($event)'
306
+ }
307
+ }]
308
+ }], ctorParameters: () => [] });
309
+
310
+ class RdxNumberFieldRootDirective {
311
+ constructor() {
312
+ this.value = model();
313
+ this.min = input(undefined, { transform: numberAttribute });
314
+ this.max = input(undefined, { transform: numberAttribute });
315
+ this.step = input(1, { transform: numberAttribute });
316
+ this.stepSnapping = input(false, { transform: booleanAttribute });
317
+ this.disableWheelChange = input(false, { transform: booleanAttribute });
318
+ this.locale = input('en');
319
+ this.disabled = input(false, { transform: booleanAttribute });
320
+ this.formatOptions = input();
321
+ /**
322
+ * @ignore
323
+ */
324
+ this.inputEl = signal(undefined);
325
+ /**
326
+ * @ignore
327
+ */
328
+ this.isDecreaseDisabled = computed(() => this.clampInputValue(this.value()) === this.min() ||
329
+ (this.min() && !isNaN(this.value())
330
+ ? handleDecimalOperation('-', this.value(), this.step()) < this.min()
331
+ : false));
332
+ /**
333
+ * @ignore
334
+ */
335
+ this.isIncreaseDisabled = computed(() => this.clampInputValue(this.value()) === this.max() ||
336
+ (this.max() && !isNaN(this.value())
337
+ ? handleDecimalOperation('+', this.value(), this.step()) > this.max()
338
+ : false));
339
+ /**
340
+ * @ignore
341
+ */
342
+ this.inputMode = computed(() => {
343
+ // The inputMode attribute influences the software keyboard that is shown on touch devices.
344
+ // Browsers and operating systems are quite inconsistent about what keys are available, however.
345
+ // We choose between numeric and decimal based on whether we allow negative and fractional numbers,
346
+ // and based on testing on various devices to determine what keys are available in each inputMode.
347
+ const hasDecimals = this.numberFormatter().resolvedOptions().maximumFractionDigits > 0;
348
+ return hasDecimals ? 'decimal' : 'numeric';
349
+ });
350
+ /**
351
+ * Replace negative textValue formatted using currencySign: 'accounting'
352
+ * with a textValue that can be announced using a minus sign.
353
+ * @ignore
354
+ */
355
+ this.textValue = computed(() => (isNaN(this.value()) ? '' : this.textValueFormatter().format(this.value())));
356
+ /**
357
+ * @ignore
358
+ */
359
+ this.onInputElement = (el) => this.inputEl.set(el);
360
+ }
361
+ /**
362
+ * @ignore
363
+ */
364
+ clampInputValue(val) {
365
+ // Clamp to min and max, round to the nearest step, and round to the specified number of digits
366
+ let clampedValue;
367
+ if (this.step() === undefined || isNaN(this.step()) || !this.stepSnapping()) {
368
+ clampedValue = clamp(val, this.min(), this.max());
369
+ }
370
+ else {
371
+ clampedValue = snapValueToStep(val, this.min(), this.max(), this.step());
372
+ }
373
+ clampedValue = this.numberParser().parse(this.numberFormatter().format(clampedValue));
374
+ return clampedValue;
375
+ }
376
+ ngOnInit() {
377
+ this.numberParser = useNumberParser(this.locale, this.formatOptions);
378
+ this.numberFormatter = useNumberFormatter(this.locale, this.formatOptions);
379
+ this.textValueFormatter = useNumberFormatter(this.locale, this.formatOptions);
380
+ }
381
+ /**
382
+ * @ignore
383
+ */
384
+ handleMinMaxValue(type) {
385
+ if (type === 'min' && this.min() !== undefined) {
386
+ this.value.set(this.clampInputValue(this.min()));
387
+ }
388
+ else if (type === 'max' && this.max() !== undefined) {
389
+ this.value.set(this.clampInputValue(this.max()));
390
+ }
391
+ }
392
+ /**
393
+ * @ignore
394
+ */
395
+ handleDecrease(multiplier = 1) {
396
+ this.handleChangingValue('decrease', multiplier);
397
+ }
398
+ /**
399
+ * @ignore
400
+ */
401
+ handleIncrease(multiplier = 1) {
402
+ this.handleChangingValue('increase', multiplier);
403
+ }
404
+ /**
405
+ * @ignore
406
+ */
407
+ applyInputValue(val) {
408
+ const parsedValue = this.numberParser().parse(val);
409
+ this.value.set(this.clampInputValue(parsedValue));
410
+ // Set to empty state if input value is empty
411
+ if (!val.length) {
412
+ return this.setInputValue(val);
413
+ }
414
+ // if it failed to parse, then reset input to formatted version of current number
415
+ if (isNaN(parsedValue)) {
416
+ return this.setInputValue(this.textValue());
417
+ }
418
+ return this.setInputValue(this.textValue());
419
+ }
420
+ /**
421
+ * @ignore
422
+ */
423
+ setInputValue(val) {
424
+ if (this.inputEl()) {
425
+ this.inputEl.update((el) => {
426
+ if (el)
427
+ el.value = val;
428
+ return el;
429
+ });
430
+ }
431
+ }
432
+ /**
433
+ * @ignore
434
+ */
435
+ validate(val) {
436
+ return this.numberParser().isValidPartialNumber(val, this.min(), this.max());
437
+ }
438
+ handleChangingValue(type, multiplier = 1) {
439
+ this.inputEl()?.focus();
440
+ const currentInputValue = this.numberParser().parse(this.inputEl()?.value ?? '');
441
+ if (this.disabled()) {
442
+ return;
443
+ }
444
+ if (isNaN(currentInputValue)) {
445
+ this.value.set(this.min() ?? 0);
446
+ }
447
+ else {
448
+ if (type === 'increase') {
449
+ this.value.set(this.clampInputValue(currentInputValue + (this.step() ?? 1) * multiplier));
450
+ }
451
+ else {
452
+ this.value.set(this.clampInputValue(currentInputValue - (this.step() ?? 1) * multiplier));
453
+ }
454
+ }
455
+ }
456
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
457
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxNumberFieldRootDirective, isStandalone: true, selector: "[rdxNumberFieldRoot]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, stepSnapping: { classPropertyName: "stepSnapping", publicName: "stepSnapping", isSignal: true, isRequired: false, transformFunction: null }, disableWheelChange: { classPropertyName: "disableWheelChange", publicName: "disableWheelChange", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, formatOptions: { classPropertyName: "formatOptions", publicName: "formatOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "group" }, properties: { "attr.data-disabled": "disabled() ? \"\" : undefined" } }, providers: [provideToken(NUMBER_FIELD_ROOT_CONTEXT, RdxNumberFieldRootDirective)], exportAs: ["rdxNumberFieldRoot"], ngImport: i0 }); }
458
+ }
459
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldRootDirective, decorators: [{
460
+ type: Directive,
461
+ args: [{
462
+ selector: '[rdxNumberFieldRoot]',
463
+ exportAs: 'rdxNumberFieldRoot',
464
+ providers: [provideToken(NUMBER_FIELD_ROOT_CONTEXT, RdxNumberFieldRootDirective)],
465
+ host: {
466
+ role: 'group',
467
+ '[attr.data-disabled]': 'disabled() ? "" : undefined'
468
+ }
469
+ }]
470
+ }] });
471
+
472
+ const _imports = [
473
+ RdxNumberFieldRootDirective,
474
+ RdxNumberFieldInputDirective,
475
+ RdxNumberFieldIncrementDirective,
476
+ RdxNumberFieldDecrementDirective
477
+ ];
478
+ class RdxNumberFieldModule {
479
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
480
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldModule, imports: [RdxNumberFieldRootDirective,
481
+ RdxNumberFieldInputDirective,
482
+ RdxNumberFieldIncrementDirective,
483
+ RdxNumberFieldDecrementDirective], exports: [RdxNumberFieldRootDirective,
484
+ RdxNumberFieldInputDirective,
485
+ RdxNumberFieldIncrementDirective,
486
+ RdxNumberFieldDecrementDirective] }); }
487
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldModule }); }
488
+ }
489
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxNumberFieldModule, decorators: [{
490
+ type: NgModule,
491
+ args: [{
492
+ imports: [..._imports],
493
+ exports: [..._imports]
494
+ }]
495
+ }] });
496
+
497
+ /**
498
+ * Generated bundle index. Do not edit.
499
+ */
500
+
501
+ export { NUMBER_FIELD_ROOT_CONTEXT, PressedHoldService, RdxNumberFieldDecrementDirective, RdxNumberFieldIncrementDirective, RdxNumberFieldInputDirective, RdxNumberFieldModule, RdxNumberFieldRootDirective, handleDecimalOperation, injectNumberFieldRootContext, useNumberFormatter, useNumberParser };
502
+ //# sourceMappingURL=radix-ng-primitives-number-field.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radix-ng-primitives-number-field.mjs","sources":["../../../packages/primitives/number-field/src/number-field-context.token.ts","../../../packages/primitives/number-field/src/utils.ts","../../../packages/primitives/number-field/src/number-field-decrement.directive.ts","../../../packages/primitives/number-field/src/number-field-increment.directive.ts","../../../packages/primitives/number-field/src/number-field-input.directive.ts","../../../packages/primitives/number-field/src/number-field-root.directive.ts","../../../packages/primitives/number-field/index.ts","../../../packages/primitives/number-field/radix-ng-primitives-number-field.ts"],"sourcesContent":["import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { inject, InjectionToken, InputSignal, InputSignalWithTransform, ModelSignal, Signal } from '@angular/core';\nimport { InputMode } from './types';\n\nexport interface NumberFieldContextToken {\n value: ModelSignal<number | undefined>;\n locale: InputSignal<string>;\n inputMode: Signal<InputMode>;\n textValue: Signal<any>;\n max: InputSignalWithTransform<number | undefined, NumberInput>;\n min: InputSignalWithTransform<number | undefined, NumberInput>;\n onInputElement: (el: HTMLInputElement) => void;\n disabled: InputSignalWithTransform<boolean, BooleanInput>;\n disableWheelChange: InputSignalWithTransform<boolean, BooleanInput>;\n handleIncrease: (multiplier?: number) => void;\n handleDecrease: (multiplier?: number) => void;\n applyInputValue: (val: string) => void;\n validate: (val: string) => boolean;\n setInputValue: (val: string) => void;\n isIncreaseDisabled: Signal<boolean>;\n isDecreaseDisabled: Signal<boolean>;\n handleMinMaxValue: (type: 'min' | 'max') => void;\n}\n\nexport const NUMBER_FIELD_ROOT_CONTEXT = new InjectionToken<NumberFieldContextToken>('NUMBER_FIELD_ROOT_CONTEXT');\n\nexport function injectNumberFieldRootContext(): NumberFieldContextToken {\n return inject(NUMBER_FIELD_ROOT_CONTEXT);\n}\n","import { computed, DestroyRef, effect, inject, Injectable, signal, Signal } from '@angular/core';\nimport { NumberFormatter, NumberParser } from '@internationalized/number';\nimport { fromEvent, Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\n@Injectable()\nexport class PressedHoldService {\n private readonly destroyRef = inject(DestroyRef);\n\n create(options: { target?: Signal<HTMLElement | undefined>; disabled: Signal<boolean> }) {\n const timeout = signal<number | undefined>(undefined);\n const triggerHook = new Subject<void>();\n const isPressed = signal(false);\n\n const resetTimeout = () => {\n const timer = timeout();\n if (timer !== undefined) {\n window.clearTimeout(timer);\n timeout.set(undefined);\n }\n };\n\n const onIncrementPressStart = (delay: number) => {\n resetTimeout();\n if (options.disabled()) return;\n\n triggerHook.next();\n\n timeout.set(\n window.setTimeout(() => {\n onIncrementPressStart(60);\n }, delay)\n );\n };\n\n const onPressStart = (event: PointerEvent) => {\n if (event.button !== 0 || isPressed()) return;\n event.preventDefault();\n isPressed.set(true);\n onIncrementPressStart(400);\n };\n\n const onPressRelease = () => {\n isPressed.set(false);\n resetTimeout();\n };\n\n effect(() => {\n // Skip SSR environments\n if (typeof window === 'undefined') return;\n\n const targetElement = options.target?.() || window;\n const destroy$ = new Subject<void>();\n\n const pointerDownSub = fromEvent(targetElement, 'pointerdown')\n .pipe(takeUntil(destroy$))\n .subscribe((e) => onPressStart(e as PointerEvent));\n\n const pointerUpSub = fromEvent(window, 'pointerup').pipe(takeUntil(destroy$)).subscribe(onPressRelease);\n\n const pointerCancelSub = fromEvent(window, 'pointercancel')\n .pipe(takeUntil(destroy$))\n .subscribe(onPressRelease);\n\n this.destroyRef.onDestroy(() => {\n destroy$.next();\n destroy$.complete();\n pointerDownSub.unsubscribe();\n pointerUpSub.unsubscribe();\n pointerCancelSub.unsubscribe();\n });\n });\n\n return {\n isPressed: isPressed.asReadonly(),\n onTrigger: (fn: () => void) => {\n const sub = triggerHook.subscribe(fn);\n this.destroyRef.onDestroy(() => sub.unsubscribe());\n }\n };\n }\n}\n\nexport function useNumberFormatter(\n locale: Signal<string>,\n options: Signal<Intl.NumberFormatOptions | undefined> = signal({})\n): Signal<NumberFormatter> {\n return computed(() => new NumberFormatter(locale(), options()));\n}\n\nexport function useNumberParser(\n locale: Signal<string>,\n options: Signal<Intl.NumberFormatOptions | undefined> = signal({})\n): Signal<NumberParser> {\n return computed(() => new NumberParser(locale(), options()));\n}\n\nexport function handleDecimalOperation(operator: '-' | '+', value1: number, value2: number): number {\n let result = operator === '+' ? value1 + value2 : value1 - value2;\n\n // Check if we have decimals\n if (value1 % 1 !== 0 || value2 % 1 !== 0) {\n const value1Decimal = value1.toString().split('.');\n const value2Decimal = value2.toString().split('.');\n const value1DecimalLength = (value1Decimal[1] && value1Decimal[1].length) || 0;\n const value2DecimalLength = (value2Decimal[1] && value2Decimal[1].length) || 0;\n const multiplier = 10 ** Math.max(value1DecimalLength, value2DecimalLength);\n\n // Transform the decimals to integers based on the precision\n value1 = Math.round(value1 * multiplier);\n value2 = Math.round(value2 * multiplier);\n\n // Perform the operation on integers values to make sure we don't get a fancy decimal value\n result = operator === '+' ? value1 + value2 : value1 - value2;\n\n // Transform the integer result back to decimal\n result /= multiplier;\n }\n\n return result;\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, ElementRef, inject, input, OnInit, signal } from '@angular/core';\nimport { injectNumberFieldRootContext } from './number-field-context.token';\nimport { PressedHoldService } from './utils';\n\n@Directive({\n selector: 'button[rdxNumberFieldDecrement]',\n providers: [PressedHoldService],\n host: {\n tabindex: '-1',\n type: '\"button\"',\n '[attr.aria-label]': '\"Decrease\"',\n '[attr.disabled]': 'isDisabled() ? \"\" : undefined',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : undefined',\n '[attr.data-pressed]': 'useHold.isPressed() ? \"true\" : undefined',\n\n '[style.user-select]': 'useHold.isPressed() ? \"none\" : null',\n\n '(contextmenu)': '$event.preventDefault()'\n }\n})\nexport class RdxNumberFieldDecrementDirective implements OnInit {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n private readonly pressedHold = inject(PressedHoldService);\n\n protected readonly rootContext = injectNumberFieldRootContext();\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * @ignore\n */\n readonly isDisabled = computed(\n () => this.rootContext.disabled() || this.disabled() || this.rootContext.isDecreaseDisabled()\n );\n\n /**\n * @ignore\n */\n readonly useHold = this.pressedHold.create({\n target: signal(this.elementRef.nativeElement),\n disabled: this.disabled\n });\n\n ngOnInit() {\n this.useHold.onTrigger(() => this.rootContext.handleDecrease());\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, ElementRef, inject, input, OnInit, signal } from '@angular/core';\nimport { injectNumberFieldRootContext } from './number-field-context.token';\nimport { PressedHoldService } from './utils';\n\n@Directive({\n selector: 'button[rdxNumberFieldIncrement]',\n providers: [PressedHoldService],\n host: {\n tabindex: '-1',\n type: '\"button\"',\n '[attr.aria-label]': '\"Increase\"',\n '[attr.disabled]': 'isDisabled() ? \"\" : undefined',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : undefined',\n '[attr.data-pressed]': 'useHold.isPressed() ? \"true\" : undefined',\n\n '[style.user-select]': 'useHold.isPressed() ? \"none\" : null',\n\n '(contextmenu)': '$event.preventDefault()'\n }\n})\nexport class RdxNumberFieldIncrementDirective implements OnInit {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n private readonly pressedHold = inject(PressedHoldService);\n\n protected readonly rootContext = injectNumberFieldRootContext();\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * @ignore\n */\n readonly isDisabled = computed(\n () => this.rootContext.disabled() || this.disabled() || this.rootContext.isIncreaseDisabled()\n );\n\n /**\n * @ignore\n */\n readonly useHold = this.pressedHold.create({\n target: signal(this.elementRef.nativeElement),\n disabled: this.disabled\n });\n\n ngOnInit() {\n this.useHold.onTrigger(() => this.rootContext.handleIncrease());\n }\n}\n","import { Directive, effect, ElementRef, inject, OnInit, signal } from '@angular/core';\nimport { getActiveElement } from '@radix-ng/primitives/core';\nimport { injectNumberFieldRootContext } from './number-field-context.token';\n\n@Directive({\n selector: 'input[rdxNumberFieldInput]',\n host: {\n role: 'spinbutton',\n type: 'text',\n tabindex: '0',\n autocomplete: 'off',\n autocorrect: 'off',\n spellcheck: 'false',\n 'aria-roledescription': 'Number field',\n\n '[attr.aria-valuenow]': 'rootContext.value()',\n '[attr.aria-valuemin]': 'rootContext.min()',\n '[attr.aria-valuemax]': 'rootContext.max()',\n '[attr.inputmode]': 'rootContext.inputMode()',\n '[attr.disabled]': 'rootContext.disabled() ? \"\" : undefined',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"\" : undefined',\n '[attr.value]': 'inputValue()',\n\n '(change)': 'onChange()',\n '(input)': 'onInput($event)',\n '(blur)': 'onKeydownEnter($event)',\n '(beforeinput)': 'onBeforeInput($event)',\n '(keydown.enter)': 'onKeydownEnter($event)',\n '(keydown.arrowUp)': 'onKeydownUp($event)',\n '(keydown.arrowDown)': 'onKeydownDown($event)',\n '(keydown.home)': 'onKeydownHome($event)',\n '(keydown.end)': 'onKeydownEnd($event)',\n '(keydown.pageUp)': 'onKeydownPageUp($event)',\n '(keydown.pageDown)': 'onKeydownPageDown($event)',\n '(wheel)': 'onWheelEvent($event)'\n }\n})\nexport class RdxNumberFieldInputDirective implements OnInit {\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n protected readonly rootContext = injectNumberFieldRootContext();\n\n readonly inputValue = signal(this.rootContext.textValue());\n\n constructor() {\n effect(() => {\n this.inputValue.set(this.rootContext.textValue());\n this.rootContext.setInputValue(this.inputValue());\n });\n }\n\n ngOnInit() {\n this.rootContext.onInputElement(this.elementRef.nativeElement as HTMLInputElement);\n }\n\n onBeforeInput(event: InputEvent) {\n const target = event.target as HTMLInputElement;\n const nextValue =\n target.value.slice(0, target.selectionStart ?? undefined) +\n (event.data ?? '') +\n target.value.slice(target.selectionEnd ?? undefined);\n\n if (!this.rootContext.validate(nextValue)) {\n event.preventDefault();\n }\n }\n\n onWheelEvent(event: WheelEvent) {\n if (this.rootContext.disableWheelChange()) {\n return;\n }\n\n // only handle when in focus\n if (event.target !== getActiveElement()) return;\n\n // if on a trackpad, users can scroll in both X and Y at once, check the magnitude of the change\n // if it's mostly in the X direction, then just return, the user probably doesn't mean to inc/dec\n // this isn't perfect, events come in fast with small deltas and a part of the scroll may give a false indication\n // especially if the user is scrolling near 45deg\n if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) {\n return;\n }\n\n event.preventDefault();\n if (event.deltaY > 0) {\n this.rootContext.handleIncrease();\n } else if (event.deltaY < 0) {\n this.rootContext.handleDecrease();\n }\n }\n\n onKeydownPageUp(event: KeyboardEvent) {\n event.preventDefault();\n this.rootContext.handleIncrease(10);\n }\n\n onKeydownPageDown(event: KeyboardEvent) {\n event.preventDefault();\n this.rootContext.handleDecrease(10);\n }\n\n onKeydownHome(event: KeyboardEvent) {\n event.preventDefault();\n this.rootContext.handleMinMaxValue('min');\n }\n\n onKeydownEnd(event: KeyboardEvent) {\n event.preventDefault();\n this.rootContext.handleMinMaxValue('max');\n }\n\n onInput(event: InputEvent) {\n const target = event.target as HTMLInputElement;\n this.rootContext.applyInputValue(target.value);\n }\n\n onChange() {\n this.inputValue.set(this.rootContext.textValue());\n }\n\n onKeydownEnter(event: KeyboardEvent) {\n const target = event.target as HTMLInputElement;\n this.rootContext.applyInputValue(target.value);\n }\n\n onKeydownUp(event: KeyboardEvent) {\n event.preventDefault();\n this.rootContext.handleIncrease();\n }\n\n onKeydownDown(event: KeyboardEvent) {\n event.preventDefault();\n this.rootContext.handleDecrease();\n }\n}\n","import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, input, model, numberAttribute, OnInit, signal } from '@angular/core';\nimport { clamp, provideToken, snapValueToStep } from '@radix-ng/primitives/core';\nimport { NUMBER_FIELD_ROOT_CONTEXT, NumberFieldContextToken } from './number-field-context.token';\nimport { InputMode } from './types';\nimport { handleDecimalOperation, useNumberFormatter, useNumberParser } from './utils';\n\n@Directive({\n selector: '[rdxNumberFieldRoot]',\n exportAs: 'rdxNumberFieldRoot',\n providers: [provideToken(NUMBER_FIELD_ROOT_CONTEXT, RdxNumberFieldRootDirective)],\n host: {\n role: 'group',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxNumberFieldRootDirective implements OnInit, NumberFieldContextToken {\n readonly value = model<number>();\n\n readonly min = input<number | undefined, NumberInput>(undefined, { transform: numberAttribute });\n\n readonly max = input<number | undefined, NumberInput>(undefined, { transform: numberAttribute });\n\n readonly step = input<number, NumberInput>(1, { transform: numberAttribute });\n\n readonly stepSnapping = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly disableWheelChange = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly locale = input<string>('en');\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly formatOptions = input<Intl.NumberFormatOptions>();\n\n /**\n * @ignore\n */\n readonly inputEl = signal<HTMLInputElement | undefined>(undefined);\n\n /**\n * @ignore\n */\n readonly isDecreaseDisabled = computed(\n () =>\n this.clampInputValue(this.value()!) === this.min() ||\n (this.min() && !isNaN(this.value()!)\n ? handleDecimalOperation('-', this.value()!, this.step()) < this.min()!\n : false)\n );\n\n /**\n * @ignore\n */\n readonly isIncreaseDisabled = computed(\n () =>\n this.clampInputValue(this.value()!) === this.max() ||\n (this.max() && !isNaN(this.value()!)\n ? handleDecimalOperation('+', this.value()!, this.step()) > this.max()!\n : false)\n );\n\n /**\n * @ignore\n */\n readonly inputMode = computed<InputMode>(() => {\n // The inputMode attribute influences the software keyboard that is shown on touch devices.\n // Browsers and operating systems are quite inconsistent about what keys are available, however.\n // We choose between numeric and decimal based on whether we allow negative and fractional numbers,\n // and based on testing on various devices to determine what keys are available in each inputMode.\n const hasDecimals = this.numberFormatter().resolvedOptions().maximumFractionDigits! > 0;\n\n return hasDecimals ? 'decimal' : 'numeric';\n });\n\n /**\n * Replace negative textValue formatted using currencySign: 'accounting'\n * with a textValue that can be announced using a minus sign.\n * @ignore\n */\n readonly textValue = computed(() => (isNaN(this.value()!) ? '' : this.textValueFormatter().format(this.value())));\n\n /**\n * @ignore\n */\n readonly onInputElement = (el: HTMLInputElement) => this.inputEl.set(el);\n\n /**\n * @ignore\n */\n numberParser: any;\n /**\n * @ignore\n */\n numberFormatter: any;\n /**\n * @ignore\n */\n textValueFormatter: any;\n\n /**\n * @ignore\n */\n clampInputValue(val: number) {\n // Clamp to min and max, round to the nearest step, and round to the specified number of digits\n let clampedValue: number;\n if (this.step() === undefined || isNaN(this.step()) || !this.stepSnapping()) {\n clampedValue = clamp(val, this.min(), this.max());\n } else {\n clampedValue = snapValueToStep(val, this.min(), this.max(), this.step());\n }\n\n clampedValue = this.numberParser().parse(this.numberFormatter().format(clampedValue));\n return clampedValue;\n }\n\n ngOnInit() {\n this.numberParser = useNumberParser(this.locale, this.formatOptions);\n this.numberFormatter = useNumberFormatter(this.locale, this.formatOptions);\n this.textValueFormatter = useNumberFormatter(this.locale, this.formatOptions);\n }\n\n /**\n * @ignore\n */\n handleMinMaxValue(type: 'min' | 'max') {\n if (type === 'min' && this.min() !== undefined) {\n this.value.set(this.clampInputValue(this.min()!));\n } else if (type === 'max' && this.max() !== undefined) {\n this.value.set(this.clampInputValue(this.max()!));\n }\n }\n\n /**\n * @ignore\n */\n handleDecrease(multiplier = 1) {\n this.handleChangingValue('decrease', multiplier);\n }\n\n /**\n * @ignore\n */\n handleIncrease(multiplier = 1) {\n this.handleChangingValue('increase', multiplier);\n }\n\n /**\n * @ignore\n */\n applyInputValue(val: string) {\n const parsedValue = this.numberParser().parse(val);\n\n this.value.set(this.clampInputValue(parsedValue));\n\n // Set to empty state if input value is empty\n if (!val.length) {\n return this.setInputValue(val);\n }\n\n // if it failed to parse, then reset input to formatted version of current number\n if (isNaN(parsedValue)) {\n return this.setInputValue(this.textValue());\n }\n\n return this.setInputValue(this.textValue());\n }\n\n /**\n * @ignore\n */\n setInputValue(val: string) {\n if (this.inputEl()) {\n this.inputEl.update((el) => {\n if (el) el.value = val;\n return el;\n });\n }\n }\n\n /**\n * @ignore\n */\n validate(val: string) {\n return this.numberParser().isValidPartialNumber(val, this.min(), this.max());\n }\n\n private handleChangingValue(type: 'increase' | 'decrease', multiplier = 1) {\n this.inputEl()?.focus();\n const currentInputValue = this.numberParser().parse(this.inputEl()?.value ?? '');\n\n if (this.disabled()) {\n return;\n }\n\n if (isNaN(currentInputValue)) {\n this.value.set(this.min() ?? 0);\n } else {\n if (type === 'increase') {\n this.value.set(this.clampInputValue(currentInputValue + (this.step() ?? 1) * multiplier));\n } else {\n this.value.set(this.clampInputValue(currentInputValue - (this.step() ?? 1) * multiplier));\n }\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxNumberFieldDecrementDirective } from './src/number-field-decrement.directive';\nimport { RdxNumberFieldIncrementDirective } from './src/number-field-increment.directive';\nimport { RdxNumberFieldInputDirective } from './src/number-field-input.directive';\nimport { RdxNumberFieldRootDirective } from './src/number-field-root.directive';\n\nexport * from './src/number-field-context.token';\nexport * from './src/number-field-decrement.directive';\nexport * from './src/number-field-increment.directive';\nexport * from './src/number-field-input.directive';\nexport * from './src/number-field-root.directive';\nexport * from './src/types';\nexport * from './src/utils';\n\nconst _imports = [\n RdxNumberFieldRootDirective,\n RdxNumberFieldInputDirective,\n RdxNumberFieldIncrementDirective,\n RdxNumberFieldDecrementDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxNumberFieldModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAwBa,yBAAyB,GAAG,IAAI,cAAc,CAA0B,2BAA2B;SAEhG,4BAA4B,GAAA;AACxC,IAAA,OAAO,MAAM,CAAC,yBAAyB,CAAC;AAC5C;;MCtBa,kBAAkB,CAAA;AAD/B,IAAA,WAAA,GAAA;AAEqB,QAAA,IAAA,CAAA,UAAU,G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B,oBAAoB,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;ACxBD;;AAEG;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, inject, Directive, input, numberAttribute, booleanAttribute, computed, forwardRef, model, output, signal, effect, ElementRef, NgModule } from '@angular/core';
3
3
  import * as kbd from '@radix-ng/primitives/core';
4
- import { _IdGenerator } from '@radix-ng/primitives/core';
4
+ import { _IdGenerator, getActiveElement } from '@radix-ng/primitives/core';
5
5
  import { LiveAnnouncer } from '@angular/cdk/a11y';
6
6
  import * as i1 from '@radix-ng/primitives/separator';
7
7
  import { RdxSeparatorRootDirective } from '@radix-ng/primitives/separator';
@@ -252,19 +252,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
252
252
  }]
253
253
  }] });
254
254
 
255
- function getActiveElement() {
256
- let activeElement = document.activeElement;
257
- if (activeElement == null) {
258
- return null;
259
- }
260
- while (activeElement != null &&
261
- activeElement.shadowRoot != null &&
262
- activeElement.shadowRoot.activeElement != null) {
263
- activeElement = activeElement.shadowRoot.activeElement;
264
- }
265
- return activeElement;
266
- }
267
-
268
255
  // made by https://reka-ui.com/
269
256
  const ignoredElement = ['INPUT', 'TEXTAREA'];
270
257
  /**