ngx-core-components 0.3.29 → 0.3.31

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 (34) hide show
  1. package/charts/bar-chart/bar-chart.component.d.ts +2 -1
  2. package/charts/calendar-heatmap/calendar-heatmap.component.d.ts +49 -0
  3. package/charts/multi-needle-gauge/multi-needle-gauge.component.d.ts +74 -0
  4. package/charts/nested-donut-chart/nested-donut-chart.component.d.ts +70 -0
  5. package/charts/org-chart/org-chart.component.d.ts +69 -0
  6. package/charts/pie-chart/pie-chart.component.d.ts +3 -1
  7. package/charts/public-api.d.ts +24 -0
  8. package/charts/pyramid-chart/pyramid-chart.component.d.ts +58 -0
  9. package/charts/range-bar-chart/range-bar-chart.component.d.ts +61 -0
  10. package/charts/shared/chart-annotations.d.ts +26 -0
  11. package/charts/shared/chart-brush-zoom.component.d.ts +53 -0
  12. package/charts/shared/chart-skeleton.component.d.ts +10 -0
  13. package/charts/shared/chart-sync-group.directive.d.ts +14 -0
  14. package/charts/shared/chart-theme.service.d.ts +21 -0
  15. package/charts/shared/chart-tooltip.service.d.ts +28 -0
  16. package/charts/step-line-chart/step-line-chart.component.d.ts +71 -0
  17. package/charts/timeline-chart/timeline-chart.component.d.ts +63 -0
  18. package/fesm2022/ngx-core-components-charts.mjs +3074 -4
  19. package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
  20. package/fesm2022/ngx-core-components-inputs.mjs +839 -529
  21. package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
  22. package/fesm2022/ngx-core-components.mjs +2 -2
  23. package/fesm2022/ngx-core-components.mjs.map +1 -1
  24. package/inputs/date-picker/date-picker.component.d.ts +32 -33
  25. package/inputs/directives/mask.directive.d.ts +9 -0
  26. package/inputs/form-builder/form-builder.component.d.ts +22 -31
  27. package/inputs/numeric-textbox/numeric-textbox.component.d.ts +33 -23
  28. package/inputs/pipes/form-error.pipe.d.ts +9 -0
  29. package/inputs/public-api.d.ts +8 -1
  30. package/inputs/services/form-error.service.d.ts +33 -0
  31. package/inputs/textbox/textbox.component.d.ts +3 -1
  32. package/inputs/utils/mask.util.d.ts +16 -0
  33. package/package.json +1 -1
  34. package/public-api.d.ts +18 -1
@@ -1,11 +1,111 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, output, signal, computed, forwardRef, ChangeDetectionStrategy, Component, inject, ElementRef, HostListener, model, effect, viewChildren, viewChild, ViewChild } from '@angular/core';
2
+ import { input, output, signal, computed, forwardRef, ChangeDetectionStrategy, Component, inject, ElementRef, HostListener, model, effect, viewChildren, viewChild, ViewChild, InjectionToken, Injectable, Pipe, Directive } from '@angular/core';
3
3
  import * as i2 from '@angular/forms';
4
4
  import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
5
5
  import { NGX_CORE_I18N } from 'ngx-core-components/i18n';
6
6
  import * as i1 from '@angular/common';
7
7
  import { CommonModule } from '@angular/common';
8
8
 
9
+ /**
10
+ * Pure pattern masking utility functions.
11
+ * Built-in presets: 'phone', 'ssn', 'credit-card', 'date-iso', or custom pattern string (e.g., '(###) ###-####')
12
+ * Tokens:
13
+ * '#' = digit (0-9)
14
+ * 'A' = uppercase letter (A-Z)
15
+ * 'a' = lowercase letter (a-z)
16
+ * '*' = alphanumeric (0-9, A-Z, a-z)
17
+ */
18
+ function getPresetMask(preset) {
19
+ switch (preset.toLowerCase()) {
20
+ case 'phone':
21
+ case 'us-phone':
22
+ return '(###) ###-####';
23
+ case 'ssn':
24
+ return '###-##-####';
25
+ case 'credit-card':
26
+ case 'card':
27
+ return '#### #### #### ####';
28
+ case 'date':
29
+ return '##/##/####';
30
+ case 'time':
31
+ return '##:##';
32
+ case 'zip':
33
+ case 'zipcode':
34
+ return '#####-####';
35
+ default:
36
+ return preset; // custom pattern
37
+ }
38
+ }
39
+ function applyMask(value, pattern) {
40
+ if (!value || !pattern)
41
+ return { masked: value || '', unmasked: value || '' };
42
+ const maskPattern = getPresetMask(pattern);
43
+ let masked = '';
44
+ let unmasked = '';
45
+ let valIdx = 0;
46
+ for (let pIdx = 0; pIdx < maskPattern.length && valIdx < value.length; pIdx++) {
47
+ const pChar = maskPattern[pIdx];
48
+ const vChar = value[valIdx];
49
+ if (pChar === '#') {
50
+ if (/\d/.test(vChar)) {
51
+ masked += vChar;
52
+ unmasked += vChar;
53
+ valIdx++;
54
+ }
55
+ else {
56
+ valIdx++; // skip non-matching char
57
+ pIdx--; // stay on pattern char
58
+ }
59
+ }
60
+ else if (pChar === 'A') {
61
+ if (/[a-zA-Z]/.test(vChar)) {
62
+ const upper = vChar.toUpperCase();
63
+ masked += upper;
64
+ unmasked += upper;
65
+ valIdx++;
66
+ }
67
+ else {
68
+ valIdx++;
69
+ pIdx--;
70
+ }
71
+ }
72
+ else if (pChar === 'a') {
73
+ if (/[a-zA-Z]/.test(vChar)) {
74
+ const lower = vChar.toLowerCase();
75
+ masked += lower;
76
+ unmasked += lower;
77
+ valIdx++;
78
+ }
79
+ else {
80
+ valIdx++;
81
+ pIdx--;
82
+ }
83
+ }
84
+ else if (pChar === '*') {
85
+ if (/[a-zA-Z0-9]/.test(vChar)) {
86
+ masked += vChar;
87
+ unmasked += vChar;
88
+ valIdx++;
89
+ }
90
+ else {
91
+ valIdx++;
92
+ pIdx--;
93
+ }
94
+ }
95
+ else {
96
+ // Literal delimiter char
97
+ masked += pChar;
98
+ if (vChar === pChar) {
99
+ valIdx++;
100
+ }
101
+ }
102
+ }
103
+ return { masked, unmasked };
104
+ }
105
+ function unmaskValue(value, pattern) {
106
+ return applyMask(value, pattern).unmasked;
107
+ }
108
+
9
109
  class TextBoxComponent {
10
110
  value = input('');
11
111
  label = input('');
@@ -21,9 +121,11 @@ class TextBoxComponent {
21
121
  prefixIcon = input('');
22
122
  suffixIcon = input('');
23
123
  passwordToggle = input(false);
124
+ mask = input('');
24
125
  // Enterprise status state
25
126
  status = input('default');
26
127
  valueChange = output();
128
+ unmaskedValueChange = output();
27
129
  focusChange = output();
28
130
  isFocused = signal(false);
29
131
  showPassword = signal(false);
@@ -51,7 +153,14 @@ class TextBoxComponent {
51
153
  this.showPassword.update(v => !v);
52
154
  }
53
155
  onInput(e) {
54
- const v = e.target.value;
156
+ let v = e.target.value;
157
+ const pattern = this.mask();
158
+ if (pattern) {
159
+ const { masked, unmasked } = applyMask(v, pattern);
160
+ e.target.value = masked;
161
+ v = masked;
162
+ this.unmaskedValueChange.emit(unmasked);
163
+ }
55
164
  this._cvaValue.set(v);
56
165
  this._onChange(v);
57
166
  this.valueChange.emit(v);
@@ -86,7 +195,7 @@ class TextBoxComponent {
86
195
  // reactive-form disable/enable is handled at the FormControl level.
87
196
  }
88
197
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TextBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
89
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TextBoxComponent, isStandalone: true, selector: "ngx-textbox", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, showCharCount: { classPropertyName: "showCharCount", publicName: "showCharCount", isSignal: true, isRequired: false, transformFunction: null }, prefixIcon: { classPropertyName: "prefixIcon", publicName: "prefixIcon", isSignal: true, isRequired: false, transformFunction: null }, suffixIcon: { classPropertyName: "suffixIcon", publicName: "suffixIcon", isSignal: true, isRequired: false, transformFunction: null }, passwordToggle: { classPropertyName: "passwordToggle", publicName: "passwordToggle", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", focusChange: "focusChange" }, providers: [
198
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TextBoxComponent, isStandalone: true, selector: "ngx-textbox", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, showCharCount: { classPropertyName: "showCharCount", publicName: "showCharCount", isSignal: true, isRequired: false, transformFunction: null }, prefixIcon: { classPropertyName: "prefixIcon", publicName: "prefixIcon", isSignal: true, isRequired: false, transformFunction: null }, suffixIcon: { classPropertyName: "suffixIcon", publicName: "suffixIcon", isSignal: true, isRequired: false, transformFunction: null }, passwordToggle: { classPropertyName: "passwordToggle", publicName: "passwordToggle", isSignal: true, isRequired: false, transformFunction: null }, mask: { classPropertyName: "mask", publicName: "mask", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", unmaskedValueChange: "unmaskedValueChange", focusChange: "focusChange" }, providers: [
90
199
  {
91
200
  provide: NG_VALUE_ACCESSOR,
92
201
  useExisting: forwardRef(() => TextBoxComponent),
@@ -1453,299 +1562,264 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
1453
1562
  class DatePickerComponent {
1454
1563
  value = input(null);
1455
1564
  label = input('');
1456
- placeholder = input(null);
1565
+ placeholder = input('Select date...');
1457
1566
  disabled = input(false);
1458
- min = input(null);
1459
- max = input(null);
1460
- format = input('MM/dd/yyyy');
1567
+ status = input('normal');
1568
+ error = input('');
1569
+ hint = input('');
1570
+ clearable = input(true);
1571
+ showPresets = input(true);
1461
1572
  valueChange = output();
1462
- i18n = inject(NGX_CORE_I18N);
1463
- effectivePlaceholder = computed(() => this.placeholder() ?? 'Select date...');
1464
1573
  isOpen = signal(false);
1465
- viewYear = signal(new Date().getFullYear());
1466
- viewMonth = signal(new Date().getMonth());
1574
+ currentMonth = signal(new Date().getMonth());
1575
+ currentYear = signal(new Date().getFullYear());
1467
1576
  _cvaValue = signal(null);
1468
- _cvaActive = signal(false);
1469
- _onChange = () => { };
1470
- _onTouched = () => { };
1471
- el = inject(ElementRef);
1472
- _activeValue = computed(() => this._cvaActive() ? this._cvaValue() : this.value());
1577
+ _cvaActive = false;
1578
+ _resolvedValue = computed(() => {
1579
+ const raw = this._cvaActive ? this._cvaValue() : this.value();
1580
+ if (!raw)
1581
+ return null;
1582
+ return raw instanceof Date ? raw : new Date(raw);
1583
+ });
1584
+ activePresets = computed(() => [
1585
+ { label: 'Today', getValue: () => new Date() },
1586
+ { label: 'Yesterday', getValue: () => { const d = new Date(); d.setDate(d.getDate() - 1); return d; } },
1587
+ { label: 'Last 7 Days', getValue: () => { const d = new Date(); d.setDate(d.getDate() - 7); return d; } },
1588
+ { label: 'First of Month', getValue: () => new Date(new Date().getFullYear(), new Date().getMonth(), 1) },
1589
+ ]);
1473
1590
  displayValue = computed(() => {
1474
- const v = this._activeValue();
1475
- if (!v)
1591
+ const val = this._resolvedValue();
1592
+ if (!val)
1476
1593
  return '';
1477
- const m = String(v.getMonth() + 1).padStart(2, '0');
1478
- const d = String(v.getDate()).padStart(2, '0');
1479
- const y = v.getFullYear();
1480
- return `${m}/${d}/${y}`;
1594
+ return val.toLocaleDateString();
1481
1595
  });
1482
- monthTitle = computed(() => {
1483
- const mName = this.i18n.datePicker.months[this.viewMonth()];
1484
- const y = this.viewYear();
1485
- return `${mName} ${y}`;
1596
+ monthName = computed(() => {
1597
+ const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
1598
+ return months[this.currentMonth()];
1486
1599
  });
1487
1600
  calendarDays = computed(() => {
1488
- const y = this.viewYear(), m = this.viewMonth();
1489
- const first = new Date(y, m, 1);
1490
- const last = new Date(y, m + 1, 0);
1491
- const today = new Date();
1492
- today.setHours(0, 0, 0, 0);
1493
- const selectedTime = this._activeValue()?.setHours(0, 0, 0, 0) ?? -1;
1494
- const days = [];
1495
- // Leading blanks
1496
- for (let i = 0; i < first.getDay(); i++) {
1497
- const d = new Date(y, m, -first.getDay() + i + 1);
1498
- const isDisabled = (this.min() && d < this.min()) || (this.max() && d > this.max()) || false;
1499
- days.push({
1500
- date: d, label: d.getDate().toString(), current: false,
1501
- isToday: false,
1502
- isSelected: d.setHours(0, 0, 0, 0) === selectedTime,
1503
- disabled: isDisabled
1504
- });
1505
- }
1506
- // Days in month
1507
- for (let d = 1; d <= last.getDate(); d++) {
1508
- const date = new Date(y, m, d);
1509
- const isDisabled = (this.min() && date < this.min()) || (this.max() && date > this.max()) || false;
1510
- days.push({
1511
- date, label: d.toString(), current: true,
1512
- isToday: date.getTime() === today.getTime(),
1513
- isSelected: date.setHours(0, 0, 0, 0) === selectedTime,
1514
- disabled: isDisabled,
1515
- });
1516
- }
1517
- // Trailing blanks
1518
- const remaining = 42 - days.length;
1601
+ const m = this.currentMonth();
1602
+ const y = this.currentYear();
1603
+ const firstDay = new Date(y, m, 1).getDay();
1604
+ const daysInMonth = new Date(y, m + 1, 0).getDate();
1605
+ const daysInPrevMonth = new Date(y, m, 0).getDate();
1606
+ const cells = [];
1607
+ // Prev month padding
1608
+ for (let i = firstDay - 1; i >= 0; i--) {
1609
+ cells.push({ date: new Date(y, m - 1, daysInPrevMonth - i), inMonth: false });
1610
+ }
1611
+ // Current month days
1612
+ for (let i = 1; i <= daysInMonth; i++) {
1613
+ cells.push({ date: new Date(y, m, i), inMonth: true });
1614
+ }
1615
+ // Next month padding
1616
+ const remaining = 42 - cells.length;
1519
1617
  for (let i = 1; i <= remaining; i++) {
1520
- const d = new Date(y, m + 1, i);
1521
- const isDisabled = (this.min() && d < this.min()) || (this.max() && d > this.max()) || false;
1522
- days.push({
1523
- date: d, label: i.toString(), current: false,
1524
- isToday: false,
1525
- isSelected: d.setHours(0, 0, 0, 0) === selectedTime,
1526
- disabled: isDisabled
1527
- });
1618
+ cells.push({ date: new Date(y, m + 1, i), inMonth: false });
1528
1619
  }
1529
- return days;
1620
+ return cells;
1530
1621
  });
1531
- toggle() {
1532
- if (this.disabled())
1533
- return;
1534
- this.isOpen.update(v => !v);
1535
- if (this.isOpen() && this._activeValue()) {
1536
- this.viewYear.set(this._activeValue().getFullYear());
1537
- this.viewMonth.set(this._activeValue().getMonth());
1538
- }
1622
+ onChange = () => { };
1623
+ onTouched = () => { };
1624
+ writeValue(val) {
1625
+ this._cvaActive = true;
1626
+ this._cvaValue.set(val ? (val instanceof Date ? val : new Date(val)) : null);
1539
1627
  }
1540
- prevMonth() {
1541
- if (this.viewMonth() === 0) {
1542
- this.viewMonth.set(11);
1543
- this.viewYear.update(y => y - 1);
1544
- }
1545
- else
1546
- this.viewMonth.update(m => m - 1);
1628
+ registerOnChange(fn) {
1629
+ this.onChange = fn;
1547
1630
  }
1548
- nextMonth() {
1549
- if (this.viewMonth() === 11) {
1550
- this.viewMonth.set(0);
1551
- this.viewYear.update(y => y + 1);
1552
- }
1553
- else
1554
- this.viewMonth.update(m => m + 1);
1631
+ registerOnTouched(fn) {
1632
+ this.onTouched = fn;
1555
1633
  }
1556
- onInputKeyDown(event) {
1634
+ toggleCalendar() {
1557
1635
  if (this.disabled())
1558
1636
  return;
1559
- if (event.key === 'Enter' || event.key === ' ') {
1560
- event.preventDefault();
1561
- this.toggle();
1562
- }
1563
- else if (event.key === 'Escape') {
1564
- event.preventDefault();
1565
- this.isOpen.set(false);
1566
- }
1637
+ this.isOpen.update(v => !v);
1567
1638
  }
1568
- selectDay(date) {
1569
- if (!date)
1570
- return;
1571
- this._cvaValue.set(date);
1572
- this._onChange(date);
1573
- this._onTouched();
1574
- this.valueChange.emit(date);
1639
+ selectDate(d) {
1640
+ this._cvaValue.set(d);
1641
+ this.onChange(d);
1642
+ this.valueChange.emit(d);
1575
1643
  this.isOpen.set(false);
1576
1644
  }
1577
- selectToday() { this.selectDay(new Date()); }
1578
- clearValue() {
1645
+ selectPreset(preset) {
1646
+ const date = preset.getValue();
1647
+ this.currentMonth.set(date.getMonth());
1648
+ this.currentYear.set(date.getFullYear());
1649
+ this.selectDate(date);
1650
+ }
1651
+ clearValue(e) {
1652
+ e.stopPropagation();
1579
1653
  this._cvaValue.set(null);
1580
- this._onChange(null);
1654
+ this.onChange(null);
1581
1655
  this.valueChange.emit(null);
1582
- this.isOpen.set(false);
1583
- }
1584
- onDocClick(e) {
1585
- if (!this.el.nativeElement.contains(e.target))
1586
- this.isOpen.set(false);
1587
1656
  }
1588
- writeValue(val) {
1589
- this._cvaActive.set(true);
1590
- this._cvaValue.set(val instanceof Date ? val : null);
1657
+ prevMonth() {
1658
+ if (this.currentMonth() === 0) {
1659
+ this.currentMonth.set(11);
1660
+ this.currentYear.update(y => y - 1);
1661
+ }
1662
+ else {
1663
+ this.currentMonth.update(m => m - 1);
1664
+ }
1591
1665
  }
1592
- registerOnChange(fn) {
1593
- this._onChange = fn;
1666
+ nextMonth() {
1667
+ if (this.currentMonth() === 11) {
1668
+ this.currentMonth.set(0);
1669
+ this.currentYear.update(y => y + 1);
1670
+ }
1671
+ else {
1672
+ this.currentMonth.update(m => m + 1);
1673
+ }
1594
1674
  }
1595
- registerOnTouched(fn) {
1596
- this._onTouched = fn;
1675
+ isSelected(d) {
1676
+ const val = this._resolvedValue();
1677
+ if (!val)
1678
+ return false;
1679
+ return val.toDateString() === d.toDateString();
1597
1680
  }
1598
- setDisabledState(_isDisabled) {
1599
- // disabled is controlled via input() for template usage.
1681
+ isToday(d) {
1682
+ return new Date().toDateString() === d.toDateString();
1600
1683
  }
1601
1684
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DatePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1602
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DatePickerComponent, isStandalone: true, selector: "ngx-date-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", 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 }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocClick($event)" } }, providers: [
1685
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DatePickerComponent, isStandalone: true, selector: "ngx-date-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, showPresets: { classPropertyName: "showPresets", publicName: "showPresets", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, providers: [
1603
1686
  {
1604
1687
  provide: NG_VALUE_ACCESSOR,
1605
1688
  useExisting: forwardRef(() => DatePickerComponent),
1606
1689
  multi: true,
1607
1690
  },
1608
1691
  ], ngImport: i0, template: `
1609
- <div class="ngx-date-picker" [class.open]="isOpen()" [class.disabled]="disabled()">
1692
+ <div class="ngx-date-picker" [class.has-error]="status() === 'error'" [class.disabled]="disabled()">
1610
1693
  @if (label()) {
1611
- <label class="dp-label">{{ label() }}</label>
1694
+ <label class="ngx-date-label">{{ label() }}</label>
1612
1695
  }
1613
- <!-- Input trigger -->
1614
- <div
1615
- class="dp-input-wrap"
1616
- (click)="toggle()"
1617
- (keydown)="onInputKeyDown($event)"
1618
- [attr.tabindex]="disabled() ? -1 : 0"
1619
- role="combobox"
1620
- [attr.aria-expanded]="isOpen()"
1621
- aria-haspopup="grid"
1622
- >
1696
+ <div class="ngx-date-wrap" (click)="toggleCalendar()">
1697
+ <span class="ngx-date-icon">📅</span>
1623
1698
  <input
1624
- class="dp-input"
1699
+ class="ngx-date-input"
1700
+ type="text"
1625
1701
  readonly
1626
1702
  [value]="displayValue()"
1627
- [placeholder]="effectivePlaceholder()"
1703
+ [placeholder]="placeholder()"
1628
1704
  [disabled]="disabled()"
1629
- tabindex="-1"
1630
1705
  />
1631
- <span class="dp-icon">&#128197;</span>
1706
+ @if (clearable() && _resolvedValue() && !disabled()) {
1707
+ <button type="button" class="ngx-date-clear" (click)="clearValue($event)">✕</button>
1708
+ }
1632
1709
  </div>
1633
1710
 
1634
- <!-- Calendar popup -->
1635
1711
  @if (isOpen()) {
1636
- <div class="dp-popup" (click)="$event.stopPropagation()">
1637
- <!-- Month/Year nav -->
1638
- <div class="dp-nav">
1639
- <button class="dp-nav-btn" (click)="prevMonth()" aria-label="Previous month">&#8249;</button>
1640
- <span class="dp-nav-title" aria-live="polite">{{ monthTitle() }}</span>
1641
- <button class="dp-nav-btn" (click)="nextMonth()" aria-label="Next month">&#8250;</button>
1642
- </div>
1643
- <!-- Weekday headers -->
1644
- <div class="dp-weekdays">
1645
- @for (d of i18n.datePicker.shortWeekdays; track d) {
1646
- <span class="dp-wd">{{ d }}</span>
1647
- }
1648
- </div>
1649
- <!-- Days grid -->
1650
- <div class="dp-days" role="grid">
1651
- @for (day of calendarDays(); track day.date?.getTime() ?? $index) {
1652
- <button
1653
- class="dp-day"
1654
- [class.other-month]="!day.current"
1655
- [class.today]="day.isToday"
1656
- [class.selected]="day.isSelected"
1657
- [class.disabled]="day.disabled"
1658
- [disabled]="day.disabled || !day.date"
1659
- (click)="selectDay(day.date)"
1660
- >{{ day.label }}</button>
1661
- }
1712
+ <div class="ngx-date-popover" (click)="$event.stopPropagation()">
1713
+ @if (showPresets()) {
1714
+ <div class="ngx-date-presets">
1715
+ <span class="presets-title">Presets:</span>
1716
+ @for (preset of activePresets(); track preset.label) {
1717
+ <button type="button" class="preset-chip" (click)="selectPreset(preset)">{{ preset.label }}</button>
1718
+ }
1719
+ </div>
1720
+ }
1721
+
1722
+ <div class="calendar-header">
1723
+ <button type="button" class="cal-nav" (click)="prevMonth()">‹</button>
1724
+ <span class="cal-title">{{ monthName() }} {{ currentYear() }}</span>
1725
+ <button type="button" class="cal-nav" (click)="nextMonth()">›</button>
1662
1726
  </div>
1663
- <!-- Footer -->
1664
- <div class="dp-footer">
1665
- <button class="dp-today-btn" (click)="selectToday()">{{ i18n.datePicker.today }}</button>
1666
- <button class="dp-clear-btn" (click)="clearValue()">{{ i18n.datePicker.clear }}</button>
1727
+
1728
+ <div class="calendar-grid">
1729
+ <span class="day-header" *ngFor="let d of ['Su','Mo','Tu','We','Th','Fr','Sa']">{{ d }}</span>
1730
+ <button
1731
+ *ngFor="let cell of calendarDays()"
1732
+ type="button"
1733
+ class="day-cell"
1734
+ [class.other-month]="!cell.inMonth"
1735
+ [class.selected]="isSelected(cell.date)"
1736
+ [class.today]="isToday(cell.date)"
1737
+ (click)="selectDate(cell.date)"
1738
+ >
1739
+ {{ cell.date.getDate() }}
1740
+ </button>
1667
1741
  </div>
1668
1742
  </div>
1669
1743
  }
1744
+
1745
+ @if (error()) {
1746
+ <div class="ngx-date-error">{{ error() }}</div>
1747
+ } @else if (hint()) {
1748
+ <div class="ngx-date-hint">{{ hint() }}</div>
1749
+ }
1670
1750
  </div>
1671
- `, isInline: true, styles: [":host{display:block}.ngx-date-picker{position:relative;font-family:inherit}.dp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px}.dp-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #fff);cursor:pointer;transition:border-color .2s,box-shadow .2s;outline:none}.dp-input-wrap:focus-visible{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.dp-input-wrap:hover{border-color:var(--primary-color, #4f46e5)}.open .dp-input-wrap{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.disabled .dp-input-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed;opacity:.7}.dp-input{flex:1;padding:10px 14px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #0f172a);cursor:pointer;font-family:inherit}.dp-input:disabled{cursor:not-allowed;color:var(--ngx-color-text-disabled, #767b83)}.dp-icon{padding:0 12px;color:#64748b;font-size:14px}.dp-popup{position:absolute;top:calc(100% + 6px);left:0;z-index:1000;background:var(--bg-secondary, #fff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--ngx-input-radius, 12px);box-shadow:var(--shadow-lg, 0 10px 25px rgba(0,0,0,.08));padding:16px;width:280px}.dp-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.dp-nav-btn{background:none;border:none;cursor:pointer;font-size:20px;color:#64748b;padding:2px 8px;border-radius:6px;line-height:1;transition:background .15s}.dp-nav-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.dp-nav-title{font-size:14px;font-weight:750;color:var(--text-primary, #0f172a);font-family:var(--ngx-heading-font-family, inherit)}.dp-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-bottom:6px}.dp-wd{text-align:center;font-size:11px;color:var(--ngx-color-text-secondary, #657080);font-weight:700;padding:4px 0;text-transform:uppercase;letter-spacing:.5px}.dp-days{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}.dp-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:500;border:none;background:none;cursor:pointer;border-radius:50%;color:var(--text-primary, #0f172a);transition:all .15s}.dp-day:hover:not(.disabled):not(.selected){background:var(--border-light, #f1f5f9)}.dp-day.other-month{color:var(--ngx-color-text-disabled, #767b83)}.dp-day.today{font-weight:700;color:var(--primary-color, #4f46e5);border:1.5px solid var(--primary-color, #4f46e5)}.dp-day.selected{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-weight:600;box-shadow:0 3px 8px #4f46e54d}.dp-day.disabled{color:var(--ngx-color-text-disabled, #767b83);cursor:not-allowed;text-decoration:line-through}.dp-footer{display:flex;justify-content:space-between;margin-top:12px;padding-top:10px;border-top:1px solid var(--border-color, #e2e8f0)}.dp-today-btn,.dp-clear-btn{background:none;border:none;cursor:pointer;font-size:12px;font-weight:700;color:var(--primary-color, #4f46e5);padding:6px 12px;border-radius:6px;font-family:inherit;transition:background .15s}.dp-today-btn:hover{background:var(--primary-glow, rgba(79, 70, 229, .08))}.dp-clear-btn{color:var(--text-secondary, #64748b)}.dp-clear-btn:hover{background:var(--border-light, #f1f5f9)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1751
+ `, isInline: true, styles: [":host{display:block;position:relative}.ngx-date-picker{font-family:var(--ngx-font-family, inherit)}.ngx-date-label{display:block;font-size:12px;font-weight:700;color:#475569;margin-bottom:4px}.ngx-date-wrap{display:flex;align-items:center;border:1px solid #cbd5e1;border-radius:8px;background:#fff;padding:8px 12px;cursor:pointer;gap:8px}.ngx-date-input{border:none;background:transparent;outline:none;flex:1;font-size:13px;color:#0f172a;cursor:pointer}.ngx-date-icon{font-size:14px}.ngx-date-clear{border:none;background:transparent;cursor:pointer;color:#94a3b8;font-size:12px}.ngx-date-popover{position:absolute;top:100%;left:0;margin-top:4px;background:#fff;border:1px solid #e2e8f0;border-radius:12px;box-shadow:0 10px 25px -5px #0000001a;padding:14px;z-index:1000;width:280px}.ngx-date-presets{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid #f1f5f9;align-items:center}.presets-title{font-size:10px;font-weight:700;color:#94a3b8;text-transform:uppercase;margin-right:4px}.preset-chip{border:1px solid #e2e8f0;background:#f8fafc;border-radius:6px;padding:2px 8px;font-size:11px;cursor:pointer;color:#334155;transition:all .15s}.preset-chip:hover{border-color:#4f46e5;color:#4f46e5;background:#eef2ff}.calendar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.cal-title{font-weight:700;font-size:13px;color:#0f172a}.cal-nav{border:none;background:#f8fafc;border-radius:6px;width:24px;height:24px;cursor:pointer;font-size:14px}.calendar-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;text-align:center}.day-header{font-size:10px;font-weight:700;color:#94a3b8;padding:4px 0}.day-cell{border:none;background:transparent;padding:6px 0;font-size:12px;border-radius:6px;cursor:pointer;color:#0f172a}.day-cell:hover{background:#f1f5f9}.day-cell.other-month{color:#cbd5e1}.day-cell.selected{background:#4f46e5!important;color:#fff!important;font-weight:700}.day-cell.today{font-weight:700;color:#4f46e5;text-decoration:underline}.ngx-date-error{font-size:11px;color:#ef4444;margin-top:4px}.ngx-date-hint{font-size:11px;color:#64748b;margin-top:4px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1672
1752
  }
1673
1753
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DatePickerComponent, decorators: [{
1674
1754
  type: Component,
1675
- args: [{ selector: 'ngx-date-picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
1755
+ args: [{ selector: 'ngx-date-picker', standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
1676
1756
  {
1677
1757
  provide: NG_VALUE_ACCESSOR,
1678
1758
  useExisting: forwardRef(() => DatePickerComponent),
1679
1759
  multi: true,
1680
1760
  },
1681
1761
  ], template: `
1682
- <div class="ngx-date-picker" [class.open]="isOpen()" [class.disabled]="disabled()">
1762
+ <div class="ngx-date-picker" [class.has-error]="status() === 'error'" [class.disabled]="disabled()">
1683
1763
  @if (label()) {
1684
- <label class="dp-label">{{ label() }}</label>
1764
+ <label class="ngx-date-label">{{ label() }}</label>
1685
1765
  }
1686
- <!-- Input trigger -->
1687
- <div
1688
- class="dp-input-wrap"
1689
- (click)="toggle()"
1690
- (keydown)="onInputKeyDown($event)"
1691
- [attr.tabindex]="disabled() ? -1 : 0"
1692
- role="combobox"
1693
- [attr.aria-expanded]="isOpen()"
1694
- aria-haspopup="grid"
1695
- >
1766
+ <div class="ngx-date-wrap" (click)="toggleCalendar()">
1767
+ <span class="ngx-date-icon">📅</span>
1696
1768
  <input
1697
- class="dp-input"
1769
+ class="ngx-date-input"
1770
+ type="text"
1698
1771
  readonly
1699
1772
  [value]="displayValue()"
1700
- [placeholder]="effectivePlaceholder()"
1773
+ [placeholder]="placeholder()"
1701
1774
  [disabled]="disabled()"
1702
- tabindex="-1"
1703
1775
  />
1704
- <span class="dp-icon">&#128197;</span>
1776
+ @if (clearable() && _resolvedValue() && !disabled()) {
1777
+ <button type="button" class="ngx-date-clear" (click)="clearValue($event)">✕</button>
1778
+ }
1705
1779
  </div>
1706
1780
 
1707
- <!-- Calendar popup -->
1708
1781
  @if (isOpen()) {
1709
- <div class="dp-popup" (click)="$event.stopPropagation()">
1710
- <!-- Month/Year nav -->
1711
- <div class="dp-nav">
1712
- <button class="dp-nav-btn" (click)="prevMonth()" aria-label="Previous month">&#8249;</button>
1713
- <span class="dp-nav-title" aria-live="polite">{{ monthTitle() }}</span>
1714
- <button class="dp-nav-btn" (click)="nextMonth()" aria-label="Next month">&#8250;</button>
1715
- </div>
1716
- <!-- Weekday headers -->
1717
- <div class="dp-weekdays">
1718
- @for (d of i18n.datePicker.shortWeekdays; track d) {
1719
- <span class="dp-wd">{{ d }}</span>
1720
- }
1721
- </div>
1722
- <!-- Days grid -->
1723
- <div class="dp-days" role="grid">
1724
- @for (day of calendarDays(); track day.date?.getTime() ?? $index) {
1725
- <button
1726
- class="dp-day"
1727
- [class.other-month]="!day.current"
1728
- [class.today]="day.isToday"
1729
- [class.selected]="day.isSelected"
1730
- [class.disabled]="day.disabled"
1731
- [disabled]="day.disabled || !day.date"
1732
- (click)="selectDay(day.date)"
1733
- >{{ day.label }}</button>
1734
- }
1782
+ <div class="ngx-date-popover" (click)="$event.stopPropagation()">
1783
+ @if (showPresets()) {
1784
+ <div class="ngx-date-presets">
1785
+ <span class="presets-title">Presets:</span>
1786
+ @for (preset of activePresets(); track preset.label) {
1787
+ <button type="button" class="preset-chip" (click)="selectPreset(preset)">{{ preset.label }}</button>
1788
+ }
1789
+ </div>
1790
+ }
1791
+
1792
+ <div class="calendar-header">
1793
+ <button type="button" class="cal-nav" (click)="prevMonth()">‹</button>
1794
+ <span class="cal-title">{{ monthName() }} {{ currentYear() }}</span>
1795
+ <button type="button" class="cal-nav" (click)="nextMonth()">›</button>
1735
1796
  </div>
1736
- <!-- Footer -->
1737
- <div class="dp-footer">
1738
- <button class="dp-today-btn" (click)="selectToday()">{{ i18n.datePicker.today }}</button>
1739
- <button class="dp-clear-btn" (click)="clearValue()">{{ i18n.datePicker.clear }}</button>
1797
+
1798
+ <div class="calendar-grid">
1799
+ <span class="day-header" *ngFor="let d of ['Su','Mo','Tu','We','Th','Fr','Sa']">{{ d }}</span>
1800
+ <button
1801
+ *ngFor="let cell of calendarDays()"
1802
+ type="button"
1803
+ class="day-cell"
1804
+ [class.other-month]="!cell.inMonth"
1805
+ [class.selected]="isSelected(cell.date)"
1806
+ [class.today]="isToday(cell.date)"
1807
+ (click)="selectDate(cell.date)"
1808
+ >
1809
+ {{ cell.date.getDate() }}
1810
+ </button>
1740
1811
  </div>
1741
1812
  </div>
1742
1813
  }
1814
+
1815
+ @if (error()) {
1816
+ <div class="ngx-date-error">{{ error() }}</div>
1817
+ } @else if (hint()) {
1818
+ <div class="ngx-date-hint">{{ hint() }}</div>
1819
+ }
1743
1820
  </div>
1744
- `, styles: [":host{display:block}.ngx-date-picker{position:relative;font-family:inherit}.dp-label{display:block;font-size:12px;font-weight:600;color:var(--ngx-input-label, #475569);margin-bottom:6px}.dp-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #fff);cursor:pointer;transition:border-color .2s,box-shadow .2s;outline:none}.dp-input-wrap:focus-visible{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.dp-input-wrap:hover{border-color:var(--primary-color, #4f46e5)}.open .dp-input-wrap{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79, 70, 229, .15))}.disabled .dp-input-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed;opacity:.7}.dp-input{flex:1;padding:10px 14px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #0f172a);cursor:pointer;font-family:inherit}.dp-input:disabled{cursor:not-allowed;color:var(--ngx-color-text-disabled, #767b83)}.dp-icon{padding:0 12px;color:#64748b;font-size:14px}.dp-popup{position:absolute;top:calc(100% + 6px);left:0;z-index:1000;background:var(--bg-secondary, #fff);border:1px solid var(--border-color, #e2e8f0);border-radius:var(--ngx-input-radius, 12px);box-shadow:var(--shadow-lg, 0 10px 25px rgba(0,0,0,.08));padding:16px;width:280px}.dp-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.dp-nav-btn{background:none;border:none;cursor:pointer;font-size:20px;color:#64748b;padding:2px 8px;border-radius:6px;line-height:1;transition:background .15s}.dp-nav-btn:hover{background:var(--border-light, #f1f5f9);color:var(--text-primary, #0f172a)}.dp-nav-title{font-size:14px;font-weight:750;color:var(--text-primary, #0f172a);font-family:var(--ngx-heading-font-family, inherit)}.dp-weekdays{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;margin-bottom:6px}.dp-wd{text-align:center;font-size:11px;color:var(--ngx-color-text-secondary, #657080);font-weight:700;padding:4px 0;text-transform:uppercase;letter-spacing:.5px}.dp-days{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}.dp-day{aspect-ratio:1;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:500;border:none;background:none;cursor:pointer;border-radius:50%;color:var(--text-primary, #0f172a);transition:all .15s}.dp-day:hover:not(.disabled):not(.selected){background:var(--border-light, #f1f5f9)}.dp-day.other-month{color:var(--ngx-color-text-disabled, #767b83)}.dp-day.today{font-weight:700;color:var(--primary-color, #4f46e5);border:1.5px solid var(--primary-color, #4f46e5)}.dp-day.selected{background:var(--primary-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));color:#fff;font-weight:600;box-shadow:0 3px 8px #4f46e54d}.dp-day.disabled{color:var(--ngx-color-text-disabled, #767b83);cursor:not-allowed;text-decoration:line-through}.dp-footer{display:flex;justify-content:space-between;margin-top:12px;padding-top:10px;border-top:1px solid var(--border-color, #e2e8f0)}.dp-today-btn,.dp-clear-btn{background:none;border:none;cursor:pointer;font-size:12px;font-weight:700;color:var(--primary-color, #4f46e5);padding:6px 12px;border-radius:6px;font-family:inherit;transition:background .15s}.dp-today-btn:hover{background:var(--primary-glow, rgba(79, 70, 229, .08))}.dp-clear-btn{color:var(--text-secondary, #64748b)}.dp-clear-btn:hover{background:var(--border-light, #f1f5f9)}\n"] }]
1745
- }], propDecorators: { onDocClick: [{
1746
- type: HostListener,
1747
- args: ['document:click', ['$event']]
1748
- }] } });
1821
+ `, styles: [":host{display:block;position:relative}.ngx-date-picker{font-family:var(--ngx-font-family, inherit)}.ngx-date-label{display:block;font-size:12px;font-weight:700;color:#475569;margin-bottom:4px}.ngx-date-wrap{display:flex;align-items:center;border:1px solid #cbd5e1;border-radius:8px;background:#fff;padding:8px 12px;cursor:pointer;gap:8px}.ngx-date-input{border:none;background:transparent;outline:none;flex:1;font-size:13px;color:#0f172a;cursor:pointer}.ngx-date-icon{font-size:14px}.ngx-date-clear{border:none;background:transparent;cursor:pointer;color:#94a3b8;font-size:12px}.ngx-date-popover{position:absolute;top:100%;left:0;margin-top:4px;background:#fff;border:1px solid #e2e8f0;border-radius:12px;box-shadow:0 10px 25px -5px #0000001a;padding:14px;z-index:1000;width:280px}.ngx-date-presets{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid #f1f5f9;align-items:center}.presets-title{font-size:10px;font-weight:700;color:#94a3b8;text-transform:uppercase;margin-right:4px}.preset-chip{border:1px solid #e2e8f0;background:#f8fafc;border-radius:6px;padding:2px 8px;font-size:11px;cursor:pointer;color:#334155;transition:all .15s}.preset-chip:hover{border-color:#4f46e5;color:#4f46e5;background:#eef2ff}.calendar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.cal-title{font-weight:700;font-size:13px;color:#0f172a}.cal-nav{border:none;background:#f8fafc;border-radius:6px;width:24px;height:24px;cursor:pointer;font-size:14px}.calendar-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;text-align:center}.day-header{font-size:10px;font-weight:700;color:#94a3b8;padding:4px 0}.day-cell{border:none;background:transparent;padding:6px 0;font-size:12px;border-radius:6px;cursor:pointer;color:#0f172a}.day-cell:hover{background:#f1f5f9}.day-cell.other-month{color:#cbd5e1}.day-cell.selected{background:#4f46e5!important;color:#fff!important;font-weight:700}.day-cell.today{font-weight:700;color:#4f46e5;text-decoration:underline}.ngx-date-error{font-size:11px;color:#ef4444;margin-top:4px}.ngx-date-hint{font-size:11px;color:#64748b;margin-top:4px}\n"] }]
1822
+ }] });
1749
1823
 
1750
1824
  class SliderComponent {
1751
1825
  label = input('');
@@ -2202,206 +2276,223 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
2202
2276
  }] });
2203
2277
 
2204
2278
  class NumericTextBoxComponent {
2205
- label = input('');
2206
- value = input(0);
2207
- min = input(-Infinity);
2208
- max = input(Infinity);
2279
+ value = input(null);
2280
+ min = input(null);
2281
+ max = input(null);
2209
2282
  step = input(1);
2210
- currentValue = signal(0);
2211
- disabled = input(false);
2283
+ decimals = input(null);
2284
+ useGrouping = input(true);
2285
+ currency = input('');
2286
+ currencyPosition = input('prefix');
2287
+ label = input('');
2212
2288
  placeholder = input('');
2213
- prefix = input('');
2214
- suffix = input('');
2215
- focused = signal(false);
2216
- // Enterprise validation inputs
2217
- status = input('default');
2289
+ disabled = input(false);
2290
+ readonly = input(false);
2291
+ status = input('normal');
2218
2292
  error = input('');
2219
2293
  hint = input('');
2294
+ prefixIcon = input('');
2295
+ showSpinners = input(true);
2296
+ clearable = input(false);
2220
2297
  valueChange = output();
2221
- _resolvedStatus = computed(() => {
2222
- if (this.error())
2223
- return 'error';
2224
- return this.status();
2225
- });
2226
- onChangeFn = () => { };
2227
- onTouchedFn = () => { };
2228
- constructor() {
2229
- effect(() => {
2230
- this.currentValue.set(this.clamp(this.value()));
2298
+ isFocused = signal(false);
2299
+ _cvaValue = signal(null);
2300
+ _cvaActive = false;
2301
+ _resolvedValue = computed(() => this._cvaActive ? this._cvaValue() : this.value());
2302
+ formattedValue = computed(() => {
2303
+ const val = this._resolvedValue();
2304
+ if (val === null || val === undefined)
2305
+ return '';
2306
+ if (this.isFocused()) {
2307
+ return String(val);
2308
+ }
2309
+ const dec = this.decimals();
2310
+ const formatter = new Intl.NumberFormat('en-US', {
2311
+ useGrouping: this.useGrouping(),
2312
+ minimumFractionDigits: dec ?? 0,
2313
+ maximumFractionDigits: dec ?? 20,
2231
2314
  });
2315
+ return formatter.format(val);
2316
+ });
2317
+ onChange = () => { };
2318
+ onTouched = () => { };
2319
+ writeValue(val) {
2320
+ this._cvaActive = true;
2321
+ this._cvaValue.set(val);
2232
2322
  }
2233
- onChange(e) {
2234
- const rawValue = e.target.value;
2235
- if (rawValue === '') {
2236
- e.target.value = String(this.currentValue());
2237
- return;
2323
+ registerOnChange(fn) {
2324
+ this.onChange = fn;
2325
+ }
2326
+ registerOnTouched(fn) {
2327
+ this.onTouched = fn;
2328
+ }
2329
+ setDisabledState(isDisabled) {
2330
+ // handled via signal input
2331
+ }
2332
+ onInput(event) {
2333
+ const inputVal = event.target.value;
2334
+ const num = parseFloat(inputVal.replace(/,/g, ''));
2335
+ if (isNaN(num)) {
2336
+ this.updateValue(null);
2238
2337
  }
2239
- const nextValue = Number(rawValue);
2240
- if (Number.isFinite(nextValue)) {
2241
- this.setValue(nextValue);
2338
+ else {
2339
+ this.updateValue(this.clamp(num));
2242
2340
  }
2243
2341
  }
2342
+ onFocus() {
2343
+ this.isFocused.set(true);
2344
+ }
2244
2345
  onBlur() {
2245
- this.focused.set(false);
2246
- this.onTouchedFn();
2346
+ this.isFocused.set(false);
2347
+ this.onTouched();
2247
2348
  }
2248
2349
  onKeyDown(event) {
2249
- if (this.disabled()) {
2250
- return;
2251
- }
2252
2350
  if (event.key === 'ArrowUp') {
2253
2351
  event.preventDefault();
2254
- this.spin(1);
2352
+ this.stepUp();
2255
2353
  }
2256
- if (event.key === 'ArrowDown') {
2354
+ else if (event.key === 'ArrowDown') {
2257
2355
  event.preventDefault();
2258
- this.spin(-1);
2356
+ this.stepDown();
2259
2357
  }
2260
2358
  }
2261
- spin(dir) { this.setValue(this.currentValue() + dir * this.step()); }
2262
- setValue(v) {
2263
- const clamped = this.clamp(v);
2264
- this.currentValue.set(clamped);
2265
- this.onChangeFn(clamped);
2266
- this.valueChange.emit(clamped);
2267
- }
2268
- clamp(value) {
2269
- return Math.max(this.min(), Math.min(this.max(), value));
2270
- }
2271
- // ControlValueAccessor implementation
2272
- writeValue(val) {
2273
- this.currentValue.set(this.clamp(val ?? 0));
2359
+ stepUp() {
2360
+ const current = this._resolvedValue() ?? 0;
2361
+ this.updateValue(this.clamp(current + this.step()));
2274
2362
  }
2275
- registerOnChange(fn) {
2276
- this.onChangeFn = fn;
2363
+ stepDown() {
2364
+ const current = this._resolvedValue() ?? 0;
2365
+ this.updateValue(this.clamp(current - this.step()));
2277
2366
  }
2278
- registerOnTouched(fn) {
2279
- this.onTouchedFn = fn;
2367
+ clearValue() {
2368
+ this.updateValue(null);
2280
2369
  }
2281
- setDisabledState(_isDisabled) {
2282
- // Handled at form control template level
2370
+ clamp(val) {
2371
+ let result = val;
2372
+ const minVal = this.min();
2373
+ const maxVal = this.max();
2374
+ if (minVal !== null && result < minVal)
2375
+ result = minVal;
2376
+ if (maxVal !== null && result > maxVal)
2377
+ result = maxVal;
2378
+ const dec = this.decimals();
2379
+ if (dec !== null && dec >= 0) {
2380
+ result = parseFloat(result.toFixed(dec));
2381
+ }
2382
+ return result;
2383
+ }
2384
+ updateValue(val) {
2385
+ this._cvaValue.set(val);
2386
+ this.onChange(val);
2387
+ this.valueChange.emit(val);
2283
2388
  }
2284
2389
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NumericTextBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2285
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: NumericTextBoxComponent, isStandalone: true, selector: "ngx-numeric-textbox", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, prefix: { classPropertyName: "prefix", publicName: "prefix", isSignal: true, isRequired: false, transformFunction: null }, suffix: { classPropertyName: "suffix", publicName: "suffix", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, providers: [
2390
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: NumericTextBoxComponent, isStandalone: true, selector: "ngx-numeric-textbox", 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 }, decimals: { classPropertyName: "decimals", publicName: "decimals", isSignal: true, isRequired: false, transformFunction: null }, useGrouping: { classPropertyName: "useGrouping", publicName: "useGrouping", isSignal: true, isRequired: false, transformFunction: null }, currency: { classPropertyName: "currency", publicName: "currency", isSignal: true, isRequired: false, transformFunction: null }, currencyPosition: { classPropertyName: "currencyPosition", publicName: "currencyPosition", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, hint: { classPropertyName: "hint", publicName: "hint", isSignal: true, isRequired: false, transformFunction: null }, prefixIcon: { classPropertyName: "prefixIcon", publicName: "prefixIcon", isSignal: true, isRequired: false, transformFunction: null }, showSpinners: { classPropertyName: "showSpinners", publicName: "showSpinners", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, providers: [
2286
2391
  {
2287
2392
  provide: NG_VALUE_ACCESSOR,
2288
2393
  useExisting: forwardRef(() => NumericTextBoxComponent),
2289
- multi: true
2290
- }
2394
+ multi: true,
2395
+ },
2291
2396
  ], ngImport: i0, template: `
2292
- <div class="ngx-numeric" [class.disabled]="disabled()" [class.focused]="focused()" [class.has-error]="_resolvedStatus() === 'error'">
2293
- @if (label()) { <label class="numeric-label">{{ label() }}</label> }
2294
- <div class="numeric-input-wrap" [class]="'status-' + _resolvedStatus()">
2295
- <ng-content select="[prefix]" />
2296
- @if (prefix()) { <span class="numeric-prefix">{{ prefix() }}</span> }
2397
+ <div class="ngx-numeric-textbox" [class.focused]="isFocused()" [class.has-error]="status() === 'error'" [class.disabled]="disabled()">
2398
+ @if (label()) {
2399
+ <label class="ngx-numeric-label">{{ label() }}</label>
2400
+ }
2401
+ <div class="ngx-numeric-wrap" [class]="'status-' + status()">
2402
+ @if (currency() && currencyPosition() === 'prefix') {
2403
+ <span class="ngx-numeric-affix ngx-numeric-prefix">{{ currency() }}</span>
2404
+ }
2405
+ @if (prefixIcon()) {
2406
+ <span class="ngx-numeric-affix ngx-numeric-prefix">{{ prefixIcon() }}</span>
2407
+ }
2297
2408
  <input
2298
- type="number" class="numeric-input"
2299
- [min]="min()" [max]="max()" [step]="step()"
2300
- [value]="currentValue()" [disabled]="disabled()" [placeholder]="placeholder()"
2301
- [attr.aria-invalid]="_resolvedStatus() === 'error' ? 'true' : null"
2302
- (focus)="focused.set(true)" (blur)="onBlur()"
2409
+ class="ngx-numeric-input"
2410
+ type="text"
2411
+ inputmode="decimal"
2412
+ [value]="formattedValue()"
2413
+ [placeholder]="placeholder()"
2414
+ [disabled]="disabled()"
2415
+ [readOnly]="readonly()"
2416
+ (input)="onInput($event)"
2417
+ (focus)="onFocus()"
2418
+ (blur)="onBlur()"
2303
2419
  (keydown)="onKeyDown($event)"
2304
- (change)="onChange($event)"
2305
2420
  />
2306
-
2307
- <!-- Status Indicator Icons -->
2308
- @if (_resolvedStatus() === 'success') {
2309
- <span class="status-icon status-icon-success" aria-hidden="true">
2310
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
2311
- </span>
2312
- } @else if (_resolvedStatus() === 'warning') {
2313
- <span class="status-icon status-icon-warning" aria-hidden="true">
2314
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
2315
- </span>
2316
- } @else if (_resolvedStatus() === 'error') {
2317
- <span class="status-icon status-icon-error" aria-hidden="true">
2318
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
2319
- </span>
2421
+ @if (currency() && currencyPosition() === 'suffix') {
2422
+ <span class="ngx-numeric-affix ngx-numeric-suffix">{{ currency() }}</span>
2320
2423
  }
2321
-
2322
- @if (suffix()) { <span class="numeric-suffix">{{ suffix() }}</span> }
2323
- <ng-content select="[suffix]" />
2324
- <div class="numeric-spin">
2325
- <button class="spin-btn spin-up" type="button" [disabled]="disabled() || currentValue() >= max()" (click)="spin(1)" aria-label="Increase value">
2326
- <svg viewBox="0 0 24 24" width="8" height="8" fill="currentColor"><path d="M12 8l-6 6h12z"/></svg>
2327
- </button>
2328
- <button class="spin-btn spin-down" type="button" [disabled]="disabled() || currentValue() <= min()" (click)="spin(-1)" aria-label="Decrease value">
2329
- <svg viewBox="0 0 24 24" width="8" height="8" fill="currentColor"><path d="M12 16l6-6H6z"/></svg>
2330
- </button>
2331
- </div>
2332
- </div>
2333
-
2334
- <div class="numeric-footer">
2335
- @if (error()) {
2336
- <div class="numeric-error">{{ error() }}</div>
2337
- } @else if (hint()) {
2338
- <div class="numeric-hint">{{ hint() }}</div>
2424
+ @if (showSpinners() && !disabled() && !readonly()) {
2425
+ <div class="ngx-numeric-spinners">
2426
+ <button type="button" class="spinner-btn spinner-up" (click)="stepUp()" tabindex="-1">▲</button>
2427
+ <button type="button" class="spinner-btn spinner-down" (click)="stepDown()" tabindex="-1">▼</button>
2428
+ </div>
2429
+ }
2430
+ @if (clearable() && value() !== null && !disabled()) {
2431
+ <button type="button" class="ngx-numeric-clear" (click)="clearValue()">✕</button>
2339
2432
  }
2340
2433
  </div>
2434
+ @if (error()) {
2435
+ <div class="ngx-numeric-error">{{ error() }}</div>
2436
+ } @else if (hint()) {
2437
+ <div class="ngx-numeric-hint">{{ hint() }}</div>
2438
+ }
2341
2439
  </div>
2342
- `, isInline: true, styles: [":host{display:block;--ngx-input-bg: #ffffff;--ngx-input-text: #0f172a;--ngx-input-border: #cbd5e1;--ngx-input-focus-border: #4f46e5;--ngx-input-focus-shadow: 0 0 0 3px rgba(79, 70, 229, .15);--ngx-input-disabled-bg: #f1f5f9;--ngx-input-label: #475569;--ngx-input-label-active: #4f46e5;--ngx-input-placeholder: #94a3b8;--ngx-input-success-border: #10b981;--ngx-input-success-shadow: 0 0 0 3px rgba(16, 185, 129, .15);--ngx-input-warning-border: #f59e0b;--ngx-input-warning-shadow: 0 0 0 3px rgba(245, 158, 11, .15);--ngx-input-error-border: #ef4444;--ngx-input-error-shadow: 0 0 0 3px rgba(239, 68, 68, .15)}:host-context(body.dark),:host-context(.dark),:host-context(.dark-theme){--ngx-input-bg: #0f172a;--ngx-input-text: #f8fafc;--ngx-input-border: #334155;--ngx-input-focus-border: #818cf8;--ngx-input-focus-shadow: 0 0 0 3px rgba(129, 140, 248, .25);--ngx-input-disabled-bg: #1e293b;--ngx-input-label: #94a3b8;--ngx-input-label-active: #818cf8;--ngx-input-placeholder: #475569;--ngx-input-success-border: #34d399;--ngx-input-success-shadow: 0 0 0 3px rgba(52, 211, 153, .25);--ngx-input-warning-border: #fbbf24;--ngx-input-warning-shadow: 0 0 0 3px rgba(251, 191, 36, .25);--ngx-input-error-border: #f87171;--ngx-input-error-shadow: 0 0 0 3px rgba(248, 113, 113, .25)}.ngx-numeric{width:100%;font-family:inherit}.numeric-label{display:inline-flex;align-items:center;font-size:12px;font-weight:600;color:var(--ngx-input-label);margin-bottom:6px;transition:all .2s cubic-bezier(.4,0,.2,1)}.focused .numeric-label{color:var(--ngx-input-label-active);transform:translate(2px)}.numeric-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg);overflow:hidden;transition:all .2s cubic-bezier(.4,0,.2,1);box-shadow:0 1px 2px #0000000d}.focused .numeric-input-wrap{border-color:var(--ngx-input-focus-border);box-shadow:var(--ngx-input-focus-shadow),0 1px 2px #0000000d}.numeric-input-wrap.status-success{border-color:var(--ngx-input-success-border)}.focused .numeric-input-wrap.status-success{box-shadow:var(--ngx-input-success-shadow),0 1px 2px #0000000d}.numeric-input-wrap.status-warning{border-color:var(--ngx-input-warning-border)}.focused .numeric-input-wrap.status-warning{box-shadow:var(--ngx-input-warning-shadow),0 1px 2px #0000000d}.numeric-input-wrap.status-error{border-color:var(--ngx-input-error-border)}.focused .numeric-input-wrap.status-error{box-shadow:var(--ngx-input-error-shadow),0 1px 2px #0000000d}.disabled .numeric-input-wrap{background:var(--ngx-input-disabled-bg);cursor:not-allowed;opacity:.7;box-shadow:none}.numeric-input{flex:1;padding:10px 14px;border:none;background:transparent;font-size:14px;color:var(--ngx-input-text);outline:none;min-width:0;-moz-appearance:textfield}.numeric-input::placeholder{color:var(--ngx-input-placeholder);opacity:.8}.numeric-input::-webkit-outer-spin-button,.numeric-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.numeric-input:disabled{cursor:not-allowed}.status-icon{display:inline-flex;align-items:center;justify-content:center;padding:0 8px;flex-shrink:0;animation:icon-scale-in .2s cubic-bezier(.175,.885,.32,1.275) forwards}.status-icon-success{color:var(--ngx-input-success-border)}.status-icon-warning{color:var(--ngx-input-warning-border)}.status-icon-error{color:var(--ngx-input-error-border)}@keyframes icon-scale-in{0%{transform:scale(.6);opacity:0}to{transform:scale(1);opacity:1}}.numeric-prefix,.numeric-suffix{padding:0 10px;color:var(--ngx-input-label);font-size:14px;flex-shrink:0}.numeric-spin{display:flex;flex-direction:column;border-left:1px solid var(--ngx-input-border);align-self:stretch}.spin-btn{border:none;background:transparent;cursor:pointer;padding:0 10px;color:var(--ngx-input-label);flex:1;display:inline-flex;align-items:center;justify-content:center;transition:all .15s}.spin-btn:hover:not(:disabled){background:#4f46e514;color:var(--ngx-input-label-active)}.spin-btn:active:not(:disabled){background:#4f46e526}.spin-btn:disabled{opacity:.4;cursor:not-allowed}.spin-up{border-bottom:.5px solid var(--ngx-input-border)}.numeric-footer{margin-top:5px;font-size:12px}.numeric-error{color:var(--ngx-input-error-border);font-weight:550;animation:slide-down .2s ease-out}.numeric-hint{color:var(--ngx-input-label)}@keyframes slide-down{0%{transform:translateY(-4px);opacity:0}to{transform:translateY(0);opacity:1}}\n"] });
2440
+ `, isInline: true, styles: [":host{display:block}.ngx-numeric-textbox{font-family:var(--ngx-font-family, inherit)}.ngx-numeric-label{display:block;font-size:12px;font-weight:700;color:var(--ngx-input-label, #475569);margin-bottom:4px}.ngx-numeric-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #ffffff);overflow:hidden;transition:all .15s}.ngx-numeric-wrap:focus-within{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px #4f46e51f}.ngx-numeric-wrap.status-error{border-color:#ef4444}.ngx-numeric-affix{padding:0 10px;font-size:13px;font-weight:600;color:#64748b;background:#f8fafc;height:38px;display:flex;align-items:center}.ngx-numeric-input{flex:1;border:none;background:transparent;outline:none;padding:8px 12px;font-size:13px;color:var(--ngx-input-text, #0f172a);width:100%;font-variant-numeric:tabular-nums}.ngx-numeric-spinners{display:flex;flex-direction:column;border-left:1px solid #e2e8f0;height:38px}.spinner-btn{flex:1;border:none;background:#f8fafc;font-size:8px;cursor:pointer;color:#64748b;padding:0 6px;transition:background .15s}.spinner-btn:hover{background:#e2e8f0;color:#4f46e5}.ngx-numeric-clear{border:none;background:transparent;cursor:pointer;color:#94a3b8;padding:0 8px;font-size:12px}.ngx-numeric-error{font-size:11px;color:#ef4444;margin-top:4px}.ngx-numeric-hint{font-size:11px;color:#64748b;margin-top:4px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2343
2441
  }
2344
2442
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NumericTextBoxComponent, decorators: [{
2345
2443
  type: Component,
2346
- args: [{ selector: 'ngx-numeric-textbox', standalone: true, providers: [
2444
+ args: [{ selector: 'ngx-numeric-textbox', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
2347
2445
  {
2348
2446
  provide: NG_VALUE_ACCESSOR,
2349
2447
  useExisting: forwardRef(() => NumericTextBoxComponent),
2350
- multi: true
2351
- }
2448
+ multi: true,
2449
+ },
2352
2450
  ], template: `
2353
- <div class="ngx-numeric" [class.disabled]="disabled()" [class.focused]="focused()" [class.has-error]="_resolvedStatus() === 'error'">
2354
- @if (label()) { <label class="numeric-label">{{ label() }}</label> }
2355
- <div class="numeric-input-wrap" [class]="'status-' + _resolvedStatus()">
2356
- <ng-content select="[prefix]" />
2357
- @if (prefix()) { <span class="numeric-prefix">{{ prefix() }}</span> }
2451
+ <div class="ngx-numeric-textbox" [class.focused]="isFocused()" [class.has-error]="status() === 'error'" [class.disabled]="disabled()">
2452
+ @if (label()) {
2453
+ <label class="ngx-numeric-label">{{ label() }}</label>
2454
+ }
2455
+ <div class="ngx-numeric-wrap" [class]="'status-' + status()">
2456
+ @if (currency() && currencyPosition() === 'prefix') {
2457
+ <span class="ngx-numeric-affix ngx-numeric-prefix">{{ currency() }}</span>
2458
+ }
2459
+ @if (prefixIcon()) {
2460
+ <span class="ngx-numeric-affix ngx-numeric-prefix">{{ prefixIcon() }}</span>
2461
+ }
2358
2462
  <input
2359
- type="number" class="numeric-input"
2360
- [min]="min()" [max]="max()" [step]="step()"
2361
- [value]="currentValue()" [disabled]="disabled()" [placeholder]="placeholder()"
2362
- [attr.aria-invalid]="_resolvedStatus() === 'error' ? 'true' : null"
2363
- (focus)="focused.set(true)" (blur)="onBlur()"
2463
+ class="ngx-numeric-input"
2464
+ type="text"
2465
+ inputmode="decimal"
2466
+ [value]="formattedValue()"
2467
+ [placeholder]="placeholder()"
2468
+ [disabled]="disabled()"
2469
+ [readOnly]="readonly()"
2470
+ (input)="onInput($event)"
2471
+ (focus)="onFocus()"
2472
+ (blur)="onBlur()"
2364
2473
  (keydown)="onKeyDown($event)"
2365
- (change)="onChange($event)"
2366
2474
  />
2367
-
2368
- <!-- Status Indicator Icons -->
2369
- @if (_resolvedStatus() === 'success') {
2370
- <span class="status-icon status-icon-success" aria-hidden="true">
2371
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
2372
- </span>
2373
- } @else if (_resolvedStatus() === 'warning') {
2374
- <span class="status-icon status-icon-warning" aria-hidden="true">
2375
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>
2376
- </span>
2377
- } @else if (_resolvedStatus() === 'error') {
2378
- <span class="status-icon status-icon-error" aria-hidden="true">
2379
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
2380
- </span>
2475
+ @if (currency() && currencyPosition() === 'suffix') {
2476
+ <span class="ngx-numeric-affix ngx-numeric-suffix">{{ currency() }}</span>
2381
2477
  }
2382
-
2383
- @if (suffix()) { <span class="numeric-suffix">{{ suffix() }}</span> }
2384
- <ng-content select="[suffix]" />
2385
- <div class="numeric-spin">
2386
- <button class="spin-btn spin-up" type="button" [disabled]="disabled() || currentValue() >= max()" (click)="spin(1)" aria-label="Increase value">
2387
- <svg viewBox="0 0 24 24" width="8" height="8" fill="currentColor"><path d="M12 8l-6 6h12z"/></svg>
2388
- </button>
2389
- <button class="spin-btn spin-down" type="button" [disabled]="disabled() || currentValue() <= min()" (click)="spin(-1)" aria-label="Decrease value">
2390
- <svg viewBox="0 0 24 24" width="8" height="8" fill="currentColor"><path d="M12 16l6-6H6z"/></svg>
2391
- </button>
2392
- </div>
2393
- </div>
2394
-
2395
- <div class="numeric-footer">
2396
- @if (error()) {
2397
- <div class="numeric-error">{{ error() }}</div>
2398
- } @else if (hint()) {
2399
- <div class="numeric-hint">{{ hint() }}</div>
2478
+ @if (showSpinners() && !disabled() && !readonly()) {
2479
+ <div class="ngx-numeric-spinners">
2480
+ <button type="button" class="spinner-btn spinner-up" (click)="stepUp()" tabindex="-1">▲</button>
2481
+ <button type="button" class="spinner-btn spinner-down" (click)="stepDown()" tabindex="-1">▼</button>
2482
+ </div>
2483
+ }
2484
+ @if (clearable() && value() !== null && !disabled()) {
2485
+ <button type="button" class="ngx-numeric-clear" (click)="clearValue()">✕</button>
2400
2486
  }
2401
2487
  </div>
2488
+ @if (error()) {
2489
+ <div class="ngx-numeric-error">{{ error() }}</div>
2490
+ } @else if (hint()) {
2491
+ <div class="ngx-numeric-hint">{{ hint() }}</div>
2492
+ }
2402
2493
  </div>
2403
- `, styles: [":host{display:block;--ngx-input-bg: #ffffff;--ngx-input-text: #0f172a;--ngx-input-border: #cbd5e1;--ngx-input-focus-border: #4f46e5;--ngx-input-focus-shadow: 0 0 0 3px rgba(79, 70, 229, .15);--ngx-input-disabled-bg: #f1f5f9;--ngx-input-label: #475569;--ngx-input-label-active: #4f46e5;--ngx-input-placeholder: #94a3b8;--ngx-input-success-border: #10b981;--ngx-input-success-shadow: 0 0 0 3px rgba(16, 185, 129, .15);--ngx-input-warning-border: #f59e0b;--ngx-input-warning-shadow: 0 0 0 3px rgba(245, 158, 11, .15);--ngx-input-error-border: #ef4444;--ngx-input-error-shadow: 0 0 0 3px rgba(239, 68, 68, .15)}:host-context(body.dark),:host-context(.dark),:host-context(.dark-theme){--ngx-input-bg: #0f172a;--ngx-input-text: #f8fafc;--ngx-input-border: #334155;--ngx-input-focus-border: #818cf8;--ngx-input-focus-shadow: 0 0 0 3px rgba(129, 140, 248, .25);--ngx-input-disabled-bg: #1e293b;--ngx-input-label: #94a3b8;--ngx-input-label-active: #818cf8;--ngx-input-placeholder: #475569;--ngx-input-success-border: #34d399;--ngx-input-success-shadow: 0 0 0 3px rgba(52, 211, 153, .25);--ngx-input-warning-border: #fbbf24;--ngx-input-warning-shadow: 0 0 0 3px rgba(251, 191, 36, .25);--ngx-input-error-border: #f87171;--ngx-input-error-shadow: 0 0 0 3px rgba(248, 113, 113, .25)}.ngx-numeric{width:100%;font-family:inherit}.numeric-label{display:inline-flex;align-items:center;font-size:12px;font-weight:600;color:var(--ngx-input-label);margin-bottom:6px;transition:all .2s cubic-bezier(.4,0,.2,1)}.focused .numeric-label{color:var(--ngx-input-label-active);transform:translate(2px)}.numeric-input-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg);overflow:hidden;transition:all .2s cubic-bezier(.4,0,.2,1);box-shadow:0 1px 2px #0000000d}.focused .numeric-input-wrap{border-color:var(--ngx-input-focus-border);box-shadow:var(--ngx-input-focus-shadow),0 1px 2px #0000000d}.numeric-input-wrap.status-success{border-color:var(--ngx-input-success-border)}.focused .numeric-input-wrap.status-success{box-shadow:var(--ngx-input-success-shadow),0 1px 2px #0000000d}.numeric-input-wrap.status-warning{border-color:var(--ngx-input-warning-border)}.focused .numeric-input-wrap.status-warning{box-shadow:var(--ngx-input-warning-shadow),0 1px 2px #0000000d}.numeric-input-wrap.status-error{border-color:var(--ngx-input-error-border)}.focused .numeric-input-wrap.status-error{box-shadow:var(--ngx-input-error-shadow),0 1px 2px #0000000d}.disabled .numeric-input-wrap{background:var(--ngx-input-disabled-bg);cursor:not-allowed;opacity:.7;box-shadow:none}.numeric-input{flex:1;padding:10px 14px;border:none;background:transparent;font-size:14px;color:var(--ngx-input-text);outline:none;min-width:0;-moz-appearance:textfield}.numeric-input::placeholder{color:var(--ngx-input-placeholder);opacity:.8}.numeric-input::-webkit-outer-spin-button,.numeric-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.numeric-input:disabled{cursor:not-allowed}.status-icon{display:inline-flex;align-items:center;justify-content:center;padding:0 8px;flex-shrink:0;animation:icon-scale-in .2s cubic-bezier(.175,.885,.32,1.275) forwards}.status-icon-success{color:var(--ngx-input-success-border)}.status-icon-warning{color:var(--ngx-input-warning-border)}.status-icon-error{color:var(--ngx-input-error-border)}@keyframes icon-scale-in{0%{transform:scale(.6);opacity:0}to{transform:scale(1);opacity:1}}.numeric-prefix,.numeric-suffix{padding:0 10px;color:var(--ngx-input-label);font-size:14px;flex-shrink:0}.numeric-spin{display:flex;flex-direction:column;border-left:1px solid var(--ngx-input-border);align-self:stretch}.spin-btn{border:none;background:transparent;cursor:pointer;padding:0 10px;color:var(--ngx-input-label);flex:1;display:inline-flex;align-items:center;justify-content:center;transition:all .15s}.spin-btn:hover:not(:disabled){background:#4f46e514;color:var(--ngx-input-label-active)}.spin-btn:active:not(:disabled){background:#4f46e526}.spin-btn:disabled{opacity:.4;cursor:not-allowed}.spin-up{border-bottom:.5px solid var(--ngx-input-border)}.numeric-footer{margin-top:5px;font-size:12px}.numeric-error{color:var(--ngx-input-error-border);font-weight:550;animation:slide-down .2s ease-out}.numeric-hint{color:var(--ngx-input-label)}@keyframes slide-down{0%{transform:translateY(-4px);opacity:0}to{transform:translateY(0);opacity:1}}\n"] }]
2404
- }], ctorParameters: () => [] });
2494
+ `, styles: [":host{display:block}.ngx-numeric-textbox{font-family:var(--ngx-font-family, inherit)}.ngx-numeric-label{display:block;font-size:12px;font-weight:700;color:var(--ngx-input-label, #475569);margin-bottom:4px}.ngx-numeric-wrap{display:flex;align-items:center;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #ffffff);overflow:hidden;transition:all .15s}.ngx-numeric-wrap:focus-within{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px #4f46e51f}.ngx-numeric-wrap.status-error{border-color:#ef4444}.ngx-numeric-affix{padding:0 10px;font-size:13px;font-weight:600;color:#64748b;background:#f8fafc;height:38px;display:flex;align-items:center}.ngx-numeric-input{flex:1;border:none;background:transparent;outline:none;padding:8px 12px;font-size:13px;color:var(--ngx-input-text, #0f172a);width:100%;font-variant-numeric:tabular-nums}.ngx-numeric-spinners{display:flex;flex-direction:column;border-left:1px solid #e2e8f0;height:38px}.spinner-btn{flex:1;border:none;background:#f8fafc;font-size:8px;cursor:pointer;color:#64748b;padding:0 6px;transition:background .15s}.spinner-btn:hover{background:#e2e8f0;color:#4f46e5}.ngx-numeric-clear{border:none;background:transparent;cursor:pointer;color:#94a3b8;padding:0 8px;font-size:12px}.ngx-numeric-error{font-size:11px;color:#ef4444;margin-top:4px}.ngx-numeric-hint{font-size:11px;color:#64748b;margin-top:4px}\n"] }]
2495
+ }] });
2405
2496
 
2406
2497
  class TextareaComponent {
2407
2498
  label = input('');
@@ -4206,195 +4297,324 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
4206
4297
  }] } });
4207
4298
 
4208
4299
  class FormBuilderComponent {
4209
- /**
4210
- * The schema definition list of form fields to render dynamically.
4211
- */
4212
4300
  fields = input([]);
4213
- /**
4214
- * The initial/controlled form value dictionary mapping field keys to values.
4215
- */
4216
4301
  value = input({});
4217
- /**
4218
- * Whether to render the default form submit button at the bottom.
4219
- * @default true
4220
- */
4221
- showSubmit = input(true);
4222
- /**
4223
- * The text label to display on the default form submit button.
4224
- * @default 'Submit'
4225
- */
4226
4302
  submitLabel = input('Submit');
4227
- /**
4228
- * Emits when any field value in the form changes.
4229
- */
4230
- valueChange = output();
4231
- /**
4232
- * Emits the entire form value dictionary when the form is submitted successfully.
4233
- */
4303
+ showSubmit = input(true);
4234
4304
  formSubmit = output();
4235
- formValue = signal({});
4236
- syncValue = effect(() => {
4237
- const fromFields = this.fields().reduce((acc, field) => {
4238
- if (field.value !== undefined)
4239
- acc[field.key] = field.value;
4240
- return acc;
4241
- }, {});
4242
- this.formValue.set({ ...fromFields, ...this.value() });
4305
+ formChange = output();
4306
+ formState = signal({});
4307
+ visibleFields = computed(() => {
4308
+ const allFields = this.fields();
4309
+ const state = this.formState();
4310
+ return allFields.filter(f => {
4311
+ if (!f.conditions || f.conditions.length === 0)
4312
+ return true;
4313
+ for (const cond of f.conditions) {
4314
+ const val = state[cond.field];
4315
+ const match = this.evaluateCondition(val, cond);
4316
+ if (cond.action === 'hide' && match)
4317
+ return false;
4318
+ if (cond.action === 'show' && !match)
4319
+ return false;
4320
+ }
4321
+ return true;
4322
+ });
4243
4323
  });
4244
- filledValue = computed(() => this.formValue());
4245
- valueFor(key) {
4246
- return this.filledValue()[key] ?? '';
4324
+ constructor() {
4325
+ effect(() => {
4326
+ const initial = this.value() || {};
4327
+ const fields = this.fields();
4328
+ const next = { ...initial };
4329
+ fields.forEach(f => {
4330
+ if (next[f.key] === undefined && f.value !== undefined) {
4331
+ next[f.key] = f.value;
4332
+ }
4333
+ });
4334
+ this.formState.set(next);
4335
+ }, { allowSignalWrites: true });
4247
4336
  }
4248
- updateValue(key, value) {
4249
- const next = { ...this.formValue(), [key]: value };
4250
- this.formValue.set(next);
4251
- this.valueChange.emit(next);
4337
+ valueFor(key) {
4338
+ const val = this.formState()[key];
4339
+ return val ?? '';
4340
+ }
4341
+ isFieldDisabled(field) {
4342
+ if (field.disabled)
4343
+ return true;
4344
+ if (!field.conditions)
4345
+ return false;
4346
+ const state = this.formState();
4347
+ for (const cond of field.conditions) {
4348
+ const val = state[cond.field];
4349
+ const match = this.evaluateCondition(val, cond);
4350
+ if (cond.action === 'disable' && match)
4351
+ return true;
4352
+ if (cond.action === 'enable' && !match)
4353
+ return true;
4354
+ }
4355
+ return false;
4356
+ }
4357
+ updateValue(key, val) {
4358
+ const updated = { ...this.formState(), [key]: val };
4359
+ this.formState.set(updated);
4360
+ this.formChange.emit(updated);
4252
4361
  }
4253
4362
  submit(event) {
4254
4363
  event.preventDefault();
4255
- this.formSubmit.emit(this.formValue());
4364
+ this.formSubmit.emit(this.formState());
4256
4365
  }
4257
- coerceInputValue(field, value) {
4258
- return field.type === 'number' ? (value === '' ? null : Number(value)) : value;
4259
- }
4260
- readOptionValue(field, rawValue) {
4261
- return field.options?.find(option => String(option.value) === rawValue)?.value ?? rawValue;
4366
+ coerceInputValue(field, val) {
4367
+ if (field.type === 'number') {
4368
+ if (val === '')
4369
+ return null;
4370
+ const num = Number(val);
4371
+ return isNaN(num) ? null : num;
4372
+ }
4373
+ return val;
4374
+ }
4375
+ readOptionValue(field, valStr) {
4376
+ const opt = field.options?.find(o => String(o.value) === valStr);
4377
+ return opt ? opt.value : valStr;
4378
+ }
4379
+ evaluateCondition(actualVal, cond) {
4380
+ switch (cond.operator) {
4381
+ case 'eq':
4382
+ return String(actualVal) === String(cond.value);
4383
+ case 'neq':
4384
+ return String(actualVal) !== String(cond.value);
4385
+ case 'contains':
4386
+ return String(actualVal || '').toLowerCase().includes(String(cond.value || '').toLowerCase());
4387
+ case 'gt':
4388
+ return Number(actualVal) > Number(cond.value);
4389
+ case 'lt':
4390
+ return Number(actualVal) < Number(cond.value);
4391
+ case 'isTrue':
4392
+ return actualVal === true || String(actualVal) === 'true';
4393
+ case 'isFalse':
4394
+ return actualVal === false || String(actualVal) === 'false';
4395
+ default:
4396
+ return false;
4397
+ }
4262
4398
  }
4263
4399
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FormBuilderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4264
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: FormBuilderComponent, isStandalone: true, selector: "ngx-form-builder", inputs: { fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, showSubmit: { classPropertyName: "showSubmit", publicName: "showSubmit", isSignal: true, isRequired: false, transformFunction: null }, submitLabel: { classPropertyName: "submitLabel", publicName: "submitLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", formSubmit: "formSubmit" }, ngImport: i0, template: `
4400
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: FormBuilderComponent, isStandalone: true, selector: "ngx-form-builder", inputs: { fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, submitLabel: { classPropertyName: "submitLabel", publicName: "submitLabel", isSignal: true, isRequired: false, transformFunction: null }, showSubmit: { classPropertyName: "showSubmit", publicName: "showSubmit", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formSubmit: "formSubmit", formChange: "formChange" }, ngImport: i0, template: `
4265
4401
  <form class="ngx-form-builder" (submit)="submit($event)">
4266
- @for (field of fields(); track field.key) {
4267
- <label class="form-field" [class.checkbox-field]="field.type === 'checkbox'">
4268
- @if (field.type !== 'checkbox') {
4269
- <span class="field-label">{{ field.label }}@if (field.required) { <strong>*</strong> }</span>
4270
- }
4271
-
4272
- @switch (field.type || 'text') {
4273
- @case ('textarea') {
4274
- <textarea
4275
- [placeholder]="field.placeholder || ''"
4276
- [required]="field.required || false"
4277
- [disabled]="field.disabled || false"
4278
- [value]="valueFor(field.key)"
4279
- (input)="updateValue(field.key, $any($event.target).value)"
4280
- ></textarea>
4281
- }
4282
- @case ('select') {
4283
- <select
4284
- [required]="field.required || false"
4285
- [disabled]="field.disabled || false"
4286
- [value]="valueFor(field.key)"
4287
- (change)="updateValue(field.key, readOptionValue(field, $any($event.target).value))"
4288
- >
4289
- <option value="">Select...</option>
4290
- @for (option of field.options || []; track option.value) {
4291
- <option [value]="option.value">{{ option.label }}</option>
4292
- }
4293
- </select>
4402
+ <div class="form-grid">
4403
+ @for (field of visibleFields(); track field.key) {
4404
+ <div
4405
+ class="form-field-wrap"
4406
+ [style.grid-column]="'span ' + (field.colSpan || 12)"
4407
+ [class.checkbox-field]="field.type === 'checkbox'"
4408
+ >
4409
+ @if (field.type !== 'checkbox') {
4410
+ <label class="field-label" [attr.for]="field.key">
4411
+ {{ field.label }}@if (field.required) { <strong class="req-star">*</strong> }
4412
+ </label>
4294
4413
  }
4295
- @case ('checkbox') {
4296
- <input
4297
- type="checkbox"
4298
- [checked]="!!valueFor(field.key)"
4299
- [required]="field.required || false"
4300
- [disabled]="field.disabled || false"
4301
- (change)="updateValue(field.key, $any($event.target).checked)"
4302
- />
4303
- <span class="field-label">{{ field.label }}@if (field.required) { <strong>*</strong> }</span>
4414
+
4415
+ @switch (field.type || 'text') {
4416
+ @case ('textarea') {
4417
+ <textarea
4418
+ [id]="field.key"
4419
+ [placeholder]="field.placeholder || ''"
4420
+ [required]="field.required || false"
4421
+ [disabled]="isFieldDisabled(field)"
4422
+ [value]="valueFor(field.key)"
4423
+ (input)="updateValue(field.key, $any($event.target).value)"
4424
+ ></textarea>
4425
+ }
4426
+ @case ('select') {
4427
+ <select
4428
+ [id]="field.key"
4429
+ [required]="field.required || false"
4430
+ [disabled]="isFieldDisabled(field)"
4431
+ [value]="valueFor(field.key)"
4432
+ (change)="updateValue(field.key, readOptionValue(field, $any($event.target).value))"
4433
+ >
4434
+ <option value="">Select...</option>
4435
+ @for (option of field.options || []; track option.value) {
4436
+ <option [value]="option.value">{{ option.label }}</option>
4437
+ }
4438
+ </select>
4439
+ }
4440
+ @case ('checkbox') {
4441
+ <label class="checkbox-label">
4442
+ <input
4443
+ type="checkbox"
4444
+ [id]="field.key"
4445
+ [checked]="!!valueFor(field.key)"
4446
+ [required]="field.required || false"
4447
+ [disabled]="isFieldDisabled(field)"
4448
+ (change)="updateValue(field.key, $any($event.target).checked)"
4449
+ />
4450
+ <span class="field-label">{{ field.label }}@if (field.required) { <strong class="req-star">*</strong> }</span>
4451
+ </label>
4452
+ }
4453
+ @case ('switch') {
4454
+ <label class="switch-wrap">
4455
+ <input
4456
+ type="checkbox"
4457
+ [id]="field.key"
4458
+ [checked]="!!valueFor(field.key)"
4459
+ [disabled]="isFieldDisabled(field)"
4460
+ (change)="updateValue(field.key, $any($event.target).checked)"
4461
+ />
4462
+ <span class="switch-slider"></span>
4463
+ <span class="field-label">{{ field.label }}</span>
4464
+ </label>
4465
+ }
4466
+ @case ('range') {
4467
+ }
4468
+ @case ('color-picker') {
4469
+ <input
4470
+ type="color"
4471
+ [id]="field.key"
4472
+ [value]="valueFor(field.key) || '#4f46e5'"
4473
+ [disabled]="isFieldDisabled(field)"
4474
+ (change)="updateValue(field.key, $any($event.target).value)"
4475
+ />
4476
+ }
4477
+ @default {
4478
+ <input
4479
+ [id]="field.key"
4480
+ [type]="field.type || 'text'"
4481
+ [placeholder]="field.placeholder || ''"
4482
+ [required]="field.required || false"
4483
+ [disabled]="isFieldDisabled(field)"
4484
+ [min]="field.min ?? null"
4485
+ [max]="field.max ?? null"
4486
+ [step]="field.step ?? null"
4487
+ [value]="valueFor(field.key)"
4488
+ (input)="updateValue(field.key, coerceInputValue(field, $any($event.target).value))"
4489
+ />
4490
+ }
4304
4491
  }
4305
- @default {
4306
- <input
4307
- [type]="field.type || 'text'"
4308
- [placeholder]="field.placeholder || ''"
4309
- [required]="field.required || false"
4310
- [disabled]="field.disabled || false"
4311
- [min]="field.min ?? null"
4312
- [max]="field.max ?? null"
4313
- [step]="field.step ?? null"
4314
- [value]="valueFor(field.key)"
4315
- (input)="updateValue(field.key, coerceInputValue(field, $any($event.target).value))"
4316
- />
4492
+
4493
+ @if (field.hint) {
4494
+ <div class="field-hint">{{ field.hint }}</div>
4317
4495
  }
4318
- }
4319
- </label>
4320
- }
4496
+ </div>
4497
+ }
4498
+ </div>
4321
4499
 
4322
4500
  @if (showSubmit()) {
4323
4501
  <div class="form-actions">
4324
- <button type="submit">{{ submitLabel() }}</button>
4502
+ <button type="submit" class="submit-btn">{{ submitLabel() }}</button>
4325
4503
  </div>
4326
4504
  }
4327
4505
  </form>
4328
- `, isInline: true, styles: [":host{display:block}.ngx-form-builder{display:grid;gap:14px;font-family:var(--ngx-font-family, inherit);color:var(--text-primary, #0f172a)}.form-field{display:grid;gap:6px}.checkbox-field{display:flex;align-items:center;gap:8px}.field-label{font-size:12px;font-weight:700;color:var(--ngx-input-label, #475569)}.field-label strong{color:var(--ngx-input-error, #dc2626);margin-left:2px}input:not([type=checkbox]),textarea,select{width:100%;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #ffffff);color:var(--ngx-input-text, #0f172a);font:inherit;font-size:13px;padding:9px 11px;outline:none;transition:all .15s}textarea{min-height:96px;resize:vertical}input:focus,textarea:focus,select:focus{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79,70,229,.12))}input:disabled,textarea:disabled,select:disabled{background:var(--ngx-input-disabled-bg, #f8fafc);color:var(--text-secondary, #64748b);cursor:not-allowed}input[type=checkbox]{width:16px;height:16px;accent-color:var(--primary-color, #4f46e5)}.form-actions{display:flex;justify-content:flex-end}.form-actions button{border:0;border-radius:7px;background:var(--primary-color, #4f46e5);color:#fff;cursor:pointer;font:inherit;font-size:13px;font-weight:750;padding:9px 14px}.form-actions button:hover,.form-actions button:focus-visible{background:var(--primary-hover, #4338ca);outline:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
4506
+ `, isInline: true, styles: [":host{display:block}.ngx-form-builder{font-family:var(--ngx-font-family, inherit);color:var(--text-primary, #0f172a)}.form-grid{display:grid;grid-template-columns:repeat(12,1fr);gap:14px}.form-field-wrap{display:flex;flex-direction:column;gap:6px}.field-label{font-size:12px;font-weight:700;color:var(--ngx-input-label, #475569)}.req-star{color:var(--ngx-input-error, #dc2626);margin-left:2px}.checkbox-label{display:flex;align-items:center;gap:8px;cursor:pointer}.field-hint{font-size:11px;color:#64748b}input:not([type=checkbox]):not([type=color]),textarea,select{width:100%;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #ffffff);color:var(--ngx-input-text, #0f172a);font:inherit;font-size:13px;padding:9px 11px;outline:none;transition:all .15s}input:focus,textarea:focus,select:focus{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px #4f46e51f}textarea{min-height:80px;resize:vertical}.form-actions{margin-top:18px;display:flex;justify-content:flex-end}.submit-btn{padding:9px 20px;font-size:13px;font-weight:700;border-radius:8px;border:none;background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff;cursor:pointer;transition:all .2s}.submit-btn:hover{background:var(--ngx-btn-primary-hover, #4338ca)}.switch-wrap{display:flex;align-items:center;gap:10px;cursor:pointer}.switch-wrap input{display:none}.switch-slider{width:36px;height:20px;background:#cbd5e1;border-radius:20px;position:relative;transition:background .2s}.switch-slider:before{content:\"\";position:absolute;top:2px;left:2px;width:16px;height:16px;background:#fff;border-radius:50%;transition:transform .2s}.switch-wrap input:checked+.switch-slider{background:#4f46e5}.switch-wrap input:checked+.switch-slider:before{transform:translate(16px)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
4329
4507
  }
4330
4508
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FormBuilderComponent, decorators: [{
4331
4509
  type: Component,
4332
4510
  args: [{ selector: 'ngx-form-builder', standalone: true, imports: [CommonModule], template: `
4333
4511
  <form class="ngx-form-builder" (submit)="submit($event)">
4334
- @for (field of fields(); track field.key) {
4335
- <label class="form-field" [class.checkbox-field]="field.type === 'checkbox'">
4336
- @if (field.type !== 'checkbox') {
4337
- <span class="field-label">{{ field.label }}@if (field.required) { <strong>*</strong> }</span>
4338
- }
4339
-
4340
- @switch (field.type || 'text') {
4341
- @case ('textarea') {
4342
- <textarea
4343
- [placeholder]="field.placeholder || ''"
4344
- [required]="field.required || false"
4345
- [disabled]="field.disabled || false"
4346
- [value]="valueFor(field.key)"
4347
- (input)="updateValue(field.key, $any($event.target).value)"
4348
- ></textarea>
4349
- }
4350
- @case ('select') {
4351
- <select
4352
- [required]="field.required || false"
4353
- [disabled]="field.disabled || false"
4354
- [value]="valueFor(field.key)"
4355
- (change)="updateValue(field.key, readOptionValue(field, $any($event.target).value))"
4356
- >
4357
- <option value="">Select...</option>
4358
- @for (option of field.options || []; track option.value) {
4359
- <option [value]="option.value">{{ option.label }}</option>
4360
- }
4361
- </select>
4512
+ <div class="form-grid">
4513
+ @for (field of visibleFields(); track field.key) {
4514
+ <div
4515
+ class="form-field-wrap"
4516
+ [style.grid-column]="'span ' + (field.colSpan || 12)"
4517
+ [class.checkbox-field]="field.type === 'checkbox'"
4518
+ >
4519
+ @if (field.type !== 'checkbox') {
4520
+ <label class="field-label" [attr.for]="field.key">
4521
+ {{ field.label }}@if (field.required) { <strong class="req-star">*</strong> }
4522
+ </label>
4362
4523
  }
4363
- @case ('checkbox') {
4364
- <input
4365
- type="checkbox"
4366
- [checked]="!!valueFor(field.key)"
4367
- [required]="field.required || false"
4368
- [disabled]="field.disabled || false"
4369
- (change)="updateValue(field.key, $any($event.target).checked)"
4370
- />
4371
- <span class="field-label">{{ field.label }}@if (field.required) { <strong>*</strong> }</span>
4524
+
4525
+ @switch (field.type || 'text') {
4526
+ @case ('textarea') {
4527
+ <textarea
4528
+ [id]="field.key"
4529
+ [placeholder]="field.placeholder || ''"
4530
+ [required]="field.required || false"
4531
+ [disabled]="isFieldDisabled(field)"
4532
+ [value]="valueFor(field.key)"
4533
+ (input)="updateValue(field.key, $any($event.target).value)"
4534
+ ></textarea>
4535
+ }
4536
+ @case ('select') {
4537
+ <select
4538
+ [id]="field.key"
4539
+ [required]="field.required || false"
4540
+ [disabled]="isFieldDisabled(field)"
4541
+ [value]="valueFor(field.key)"
4542
+ (change)="updateValue(field.key, readOptionValue(field, $any($event.target).value))"
4543
+ >
4544
+ <option value="">Select...</option>
4545
+ @for (option of field.options || []; track option.value) {
4546
+ <option [value]="option.value">{{ option.label }}</option>
4547
+ }
4548
+ </select>
4549
+ }
4550
+ @case ('checkbox') {
4551
+ <label class="checkbox-label">
4552
+ <input
4553
+ type="checkbox"
4554
+ [id]="field.key"
4555
+ [checked]="!!valueFor(field.key)"
4556
+ [required]="field.required || false"
4557
+ [disabled]="isFieldDisabled(field)"
4558
+ (change)="updateValue(field.key, $any($event.target).checked)"
4559
+ />
4560
+ <span class="field-label">{{ field.label }}@if (field.required) { <strong class="req-star">*</strong> }</span>
4561
+ </label>
4562
+ }
4563
+ @case ('switch') {
4564
+ <label class="switch-wrap">
4565
+ <input
4566
+ type="checkbox"
4567
+ [id]="field.key"
4568
+ [checked]="!!valueFor(field.key)"
4569
+ [disabled]="isFieldDisabled(field)"
4570
+ (change)="updateValue(field.key, $any($event.target).checked)"
4571
+ />
4572
+ <span class="switch-slider"></span>
4573
+ <span class="field-label">{{ field.label }}</span>
4574
+ </label>
4575
+ }
4576
+ @case ('range') {
4577
+ }
4578
+ @case ('color-picker') {
4579
+ <input
4580
+ type="color"
4581
+ [id]="field.key"
4582
+ [value]="valueFor(field.key) || '#4f46e5'"
4583
+ [disabled]="isFieldDisabled(field)"
4584
+ (change)="updateValue(field.key, $any($event.target).value)"
4585
+ />
4586
+ }
4587
+ @default {
4588
+ <input
4589
+ [id]="field.key"
4590
+ [type]="field.type || 'text'"
4591
+ [placeholder]="field.placeholder || ''"
4592
+ [required]="field.required || false"
4593
+ [disabled]="isFieldDisabled(field)"
4594
+ [min]="field.min ?? null"
4595
+ [max]="field.max ?? null"
4596
+ [step]="field.step ?? null"
4597
+ [value]="valueFor(field.key)"
4598
+ (input)="updateValue(field.key, coerceInputValue(field, $any($event.target).value))"
4599
+ />
4600
+ }
4372
4601
  }
4373
- @default {
4374
- <input
4375
- [type]="field.type || 'text'"
4376
- [placeholder]="field.placeholder || ''"
4377
- [required]="field.required || false"
4378
- [disabled]="field.disabled || false"
4379
- [min]="field.min ?? null"
4380
- [max]="field.max ?? null"
4381
- [step]="field.step ?? null"
4382
- [value]="valueFor(field.key)"
4383
- (input)="updateValue(field.key, coerceInputValue(field, $any($event.target).value))"
4384
- />
4602
+
4603
+ @if (field.hint) {
4604
+ <div class="field-hint">{{ field.hint }}</div>
4385
4605
  }
4386
- }
4387
- </label>
4388
- }
4606
+ </div>
4607
+ }
4608
+ </div>
4389
4609
 
4390
4610
  @if (showSubmit()) {
4391
4611
  <div class="form-actions">
4392
- <button type="submit">{{ submitLabel() }}</button>
4612
+ <button type="submit" class="submit-btn">{{ submitLabel() }}</button>
4393
4613
  </div>
4394
4614
  }
4395
4615
  </form>
4396
- `, styles: [":host{display:block}.ngx-form-builder{display:grid;gap:14px;font-family:var(--ngx-font-family, inherit);color:var(--text-primary, #0f172a)}.form-field{display:grid;gap:6px}.checkbox-field{display:flex;align-items:center;gap:8px}.field-label{font-size:12px;font-weight:700;color:var(--ngx-input-label, #475569)}.field-label strong{color:var(--ngx-input-error, #dc2626);margin-left:2px}input:not([type=checkbox]),textarea,select{width:100%;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #ffffff);color:var(--ngx-input-text, #0f172a);font:inherit;font-size:13px;padding:9px 11px;outline:none;transition:all .15s}textarea{min-height:96px;resize:vertical}input:focus,textarea:focus,select:focus{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 3px var(--primary-glow, rgba(79,70,229,.12))}input:disabled,textarea:disabled,select:disabled{background:var(--ngx-input-disabled-bg, #f8fafc);color:var(--text-secondary, #64748b);cursor:not-allowed}input[type=checkbox]{width:16px;height:16px;accent-color:var(--primary-color, #4f46e5)}.form-actions{display:flex;justify-content:flex-end}.form-actions button{border:0;border-radius:7px;background:var(--primary-color, #4f46e5);color:#fff;cursor:pointer;font:inherit;font-size:13px;font-weight:750;padding:9px 14px}.form-actions button:hover,.form-actions button:focus-visible{background:var(--primary-hover, #4338ca);outline:none}\n"] }]
4397
- }] });
4616
+ `, styles: [":host{display:block}.ngx-form-builder{font-family:var(--ngx-font-family, inherit);color:var(--text-primary, #0f172a)}.form-grid{display:grid;grid-template-columns:repeat(12,1fr);gap:14px}.form-field-wrap{display:flex;flex-direction:column;gap:6px}.field-label{font-size:12px;font-weight:700;color:var(--ngx-input-label, #475569)}.req-star{color:var(--ngx-input-error, #dc2626);margin-left:2px}.checkbox-label{display:flex;align-items:center;gap:8px;cursor:pointer}.field-hint{font-size:11px;color:#64748b}input:not([type=checkbox]):not([type=color]),textarea,select{width:100%;border:1px solid var(--ngx-input-border, #cbd5e1);border-radius:var(--ngx-input-radius, 8px);background:var(--ngx-input-bg, #ffffff);color:var(--ngx-input-text, #0f172a);font:inherit;font-size:13px;padding:9px 11px;outline:none;transition:all .15s}input:focus,textarea:focus,select:focus{border-color:var(--ngx-input-focus, #4f46e5);box-shadow:0 0 0 3px #4f46e51f}textarea{min-height:80px;resize:vertical}.form-actions{margin-top:18px;display:flex;justify-content:flex-end}.submit-btn{padding:9px 20px;font-size:13px;font-weight:700;border-radius:8px;border:none;background:var(--ngx-btn-primary-bg, #4f46e5);color:#fff;cursor:pointer;transition:all .2s}.submit-btn:hover{background:var(--ngx-btn-primary-hover, #4338ca)}.switch-wrap{display:flex;align-items:center;gap:10px;cursor:pointer}.switch-wrap input{display:none}.switch-slider{width:36px;height:20px;background:#cbd5e1;border-radius:20px;position:relative;transition:background .2s}.switch-slider:before{content:\"\";position:absolute;top:2px;left:2px;width:16px;height:16px;background:#fff;border-radius:50%;transition:transform .2s}.switch-wrap input:checked+.switch-slider{background:#4f46e5}.switch-wrap input:checked+.switch-slider:before{transform:translate(16px)}\n"] }]
4617
+ }], ctorParameters: () => [] });
4398
4618
 
4399
4619
  class FormDesignerComponent {
4400
4620
  theme = input('light');
@@ -4850,7 +5070,7 @@ class FormDesignerComponent {
4850
5070
  </div>
4851
5071
  }
4852
5072
  </div>
4853
- `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-form-designer-container{display:flex;flex-direction:column;height:100%;min-height:580px;background:var(--ngx-designer-bg, #f8fafc);color:var(--ngx-designer-text, #0f172a);font-family:var(--ngx-font-family, sans-serif);border-radius:12px;overflow:hidden;border:1px solid var(--ngx-designer-border, #e2e8f0)}.ngx-form-designer-container.dark-mode{--ngx-designer-bg: #0f172a;--ngx-designer-text: #f8fafc;--ngx-designer-border: #334155}.designer-header{display:flex;justify-content:space-between;align-items:center;padding:14px 20px;border-bottom:1px solid var(--ngx-designer-border, #e2e8f0);background:var(--ngx-designer-bg, #ffffff)}.designer-title{margin:0;font-size:16px;font-weight:700}.designer-header-actions{display:flex;gap:10px}.header-action-btn{border:1px solid var(--ngx-designer-border, #e2e8f0);background:transparent;padding:7px 14px;border-radius:6px;font-size:12px;font-weight:600;color:inherit;cursor:pointer;transition:all .15s}.header-action-btn:hover{background:#00000008}.header-action-btn.primary{background:var(--primary-color, #4f46e5);color:#fff;border:none}.header-action-btn.primary:hover{background:var(--primary-hover, #4338ca)}.designer-workspace{display:grid;grid-template-columns:240px 1fr 340px;flex:1;height:calc(100% - 60px);overflow:hidden}@media (max-width: 950px){.designer-workspace{grid-template-columns:200px 1fr}.inspector-panel{grid-column:1 / span 2;border-top:1px solid var(--ngx-designer-border, #e2e8f0);height:auto}}.designer-panel{display:flex;flex-direction:column;overflow:hidden;background:var(--ngx-designer-panel-bg, #ffffff)}.dark-mode .designer-panel{--ngx-designer-panel-bg: #1e293b}.toolbox-panel{border-right:1px solid var(--ngx-designer-border, #e2e8f0);padding:16px}.panel-title{margin:0;font-size:14px;font-weight:700}.panel-subtitle{margin:4px 0 16px;font-size:11px;opacity:.6}.toolbox-items{display:flex;flex-direction:column;gap:10px;overflow-y:auto}.toolbox-card{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px dashed var(--ngx-designer-border, #cbd5e1);border-radius:8px;cursor:grab;font-size:12px;font-weight:600;transition:all .2s}.toolbox-card:hover{border-color:var(--primary-color, #4f46e5);background:#4f46e508}.toolbox-icon{font-size:16px}.canvas-panel{border-right:1px solid var(--ngx-designer-border, #e2e8f0);background:var(--ngx-designer-canvas-bg, #f1f5f9);padding:16px}.dark-mode .canvas-panel{--ngx-designer-canvas-bg: #0f172a}.panel-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.field-count-badge{font-size:10px;font-weight:700;background:#0000000f;padding:3px 8px;border-radius:12px}.dark-mode .field-count-badge{background:#ffffff14}.canvas-dropzone{flex:1;border:2px dashed var(--ngx-designer-border, #cbd5e1);border-radius:10px;background:var(--ngx-designer-panel-bg, #ffffff);padding:16px;overflow-y:auto;transition:all .2s;min-height:250px}.canvas-dropzone.drag-over{border-color:var(--primary-color, #4f46e5);background:#4f46e505}.canvas-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;text-align:center;opacity:.5;padding:40px 10px}.placeholder-icon{font-size:32px;margin-bottom:10px}.placeholder-text{font-size:12px;max-width:200px;margin:0}.canvas-fields-list{display:flex;flex-direction:column;gap:12px}.canvas-field-row{display:flex;align-items:center;padding:12px 14px;border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:8px;background:var(--ngx-designer-panel-bg, #ffffff);cursor:pointer;position:relative;transition:all .2s}.canvas-field-row:hover{box-shadow:0 4px 12px #0000000a;border-color:var(--ngx-designer-border-hover, #cbd5e1)}.canvas-field-row.selected{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 2px #4f46e514;background:#4f46e503}.canvas-field-row.dragging{opacity:.4;border-style:dashed}.canvas-field-row.drag-over{border-top:2px solid var(--primary-color, #4f46e5)}.field-drag-handle{cursor:grab;margin-right:12px;opacity:.3;font-size:16px;-webkit-user-select:none;user-select:none}.field-details{flex:1;display:flex;flex-direction:column;gap:2px}.field-header{display:flex;gap:8px;align-items:center;margin-bottom:2px}.field-type-badge{font-size:9px;font-weight:700;text-transform:uppercase;background:#4f46e514;color:var(--primary-color, #4f46e5);padding:1px 6px;border-radius:4px}.field-key-badge{font-size:9px;font-family:monospace;opacity:.5}.field-label-text{font-size:13px;font-weight:600}.req-star{color:#dc2626}.field-placeholder-text{font-size:10px;opacity:.5}.delete-field-btn{background:transparent;border:0;color:#ef4444;cursor:pointer;font-size:12px;font-weight:700;opacity:.3;padding:6px;border-radius:4px;transition:all .15s}.canvas-field-row:hover .delete-field-btn{opacity:1}.delete-field-btn:hover{background:#ef44440f}.inspector-panel{padding:0}.inspector-tabs{display:flex;border-bottom:1px solid var(--ngx-designer-border, #e2e8f0)}.tab-btn{flex:1;border:0;background:transparent;padding:12px 6px;font-size:11px;font-weight:700;color:inherit;opacity:.6;cursor:pointer;border-bottom:2px solid transparent;transition:all .2s}.tab-btn:hover{opacity:.9}.tab-btn.active{opacity:1;border-bottom-color:var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5)}.tab-content{flex:1;overflow-y:auto;padding:16px}.inspector-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;text-align:center;opacity:.5;padding:40px 10px}.inspector-placeholder span{font-size:32px;margin-bottom:10px}.inspector-placeholder p{font-size:11px;margin:0;max-width:180px}.properties-form{display:flex;flex-direction:column;gap:14px}.inspector-field{display:flex;flex-direction:column;gap:4px}.inspector-label{font-size:11px;font-weight:700;opacity:.7}.properties-form input[type=text],.properties-form input[type=number]{width:100%;border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:6px;background:transparent;color:inherit;padding:8px 10px;font-size:12px;outline:none;transition:border-color .2s}.properties-form input[type=text]:focus,.properties-form input[type=number]:focus{border-color:var(--primary-color, #4f46e5)}.properties-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}.checkbox-row{display:flex;flex-direction:column;gap:8px;margin:6px 0}.inspector-checkbox{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:600;cursor:pointer}.inspector-checkbox input{accent-color:var(--primary-color, #4f46e5)}.options-editor-section{border-top:1px solid var(--ngx-designer-border, #e2e8f0);padding-top:14px;margin-top:6px}.options-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.add-opt-btn{background:transparent;border:0;color:var(--primary-color, #4f46e5);font-size:11px;font-weight:700;cursor:pointer}.options-list{display:flex;flex-direction:column;gap:8px}.option-edit-row{display:grid;grid-template-columns:1fr 1fr 24px;gap:6px;align-items:center}.option-edit-row input{border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:4px;padding:5px 8px;font-size:11px;background:transparent;color:inherit}.delete-opt-btn{background:transparent;border:0;color:#ef4444;cursor:pointer;font-size:11px;font-weight:700}.schema-actions{display:flex;justify-content:flex-end;margin-bottom:10px}.schema-action-btn{border:0;background:var(--primary-color, #4f46e5);color:#fff;border-radius:5px;padding:6px 12px;font-size:11px;font-weight:600;cursor:pointer}.schema-code-block{background:#00000008;padding:12px;border-radius:8px;font-family:monospace;font-size:11px;overflow-x:auto;white-space:pre-wrap;margin:0}.dark-mode .schema-code-block{background:#ffffff08}.preview-card{border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:8px;padding:16px;background:var(--ngx-designer-panel-bg, #ffffff)}.preview-submit-banner{margin-top:14px;padding:10px 12px;background:#10b98114;border:1px solid rgba(16,185,129,.15);border-radius:6px}.banner-title{font-size:11px;font-weight:700;color:#059669}.preview-submit-banner pre{margin:6px 0 0;font-family:monospace;font-size:10px;overflow-x:auto}.designer-modal-overlay{position:fixed;inset:0;background:#00000073;backdrop-filter:blur(4px);display:flex;align-items:center;justify-content:center;z-index:1000}.designer-modal-card{background:var(--ngx-designer-panel-bg, #ffffff);border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:12px;padding:20px;width:420px;box-shadow:0 10px 25px #0000001a;display:flex;flex-direction:column;gap:10px}.modal-title{margin:0;font-size:14px;font-weight:700}.modal-subtitle{margin:0;font-size:11px;opacity:.6}.modal-textarea{width:100%;height:140px;border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:6px;background:transparent;color:inherit;padding:8px 10px;font-family:monospace;font-size:11px;outline:none;resize:none}.modal-error-banner{color:#dc2626;font-size:10px;font-weight:600}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}.modal-action-btn{border:0;border-radius:5px;padding:7px 14px;font-size:12px;font-weight:600;cursor:pointer}.modal-action-btn.cancel{background:transparent;border:1px solid var(--ngx-designer-border, #cbd5e1);color:inherit}.modal-action-btn.primary{background:var(--primary-color, #4f46e5);color:#fff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.JsonPipe, name: "json" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: FormBuilderComponent, selector: "ngx-form-builder", inputs: ["fields", "value", "showSubmit", "submitLabel"], outputs: ["valueChange", "formSubmit"] }] });
5073
+ `, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-form-designer-container{display:flex;flex-direction:column;height:100%;min-height:580px;background:var(--ngx-designer-bg, #f8fafc);color:var(--ngx-designer-text, #0f172a);font-family:var(--ngx-font-family, sans-serif);border-radius:12px;overflow:hidden;border:1px solid var(--ngx-designer-border, #e2e8f0)}.ngx-form-designer-container.dark-mode{--ngx-designer-bg: #0f172a;--ngx-designer-text: #f8fafc;--ngx-designer-border: #334155}.designer-header{display:flex;justify-content:space-between;align-items:center;padding:14px 20px;border-bottom:1px solid var(--ngx-designer-border, #e2e8f0);background:var(--ngx-designer-bg, #ffffff)}.designer-title{margin:0;font-size:16px;font-weight:700}.designer-header-actions{display:flex;gap:10px}.header-action-btn{border:1px solid var(--ngx-designer-border, #e2e8f0);background:transparent;padding:7px 14px;border-radius:6px;font-size:12px;font-weight:600;color:inherit;cursor:pointer;transition:all .15s}.header-action-btn:hover{background:#00000008}.header-action-btn.primary{background:var(--primary-color, #4f46e5);color:#fff;border:none}.header-action-btn.primary:hover{background:var(--primary-hover, #4338ca)}.designer-workspace{display:grid;grid-template-columns:240px 1fr 340px;flex:1;height:calc(100% - 60px);overflow:hidden}@media (max-width: 950px){.designer-workspace{grid-template-columns:200px 1fr}.inspector-panel{grid-column:1 / span 2;border-top:1px solid var(--ngx-designer-border, #e2e8f0);height:auto}}.designer-panel{display:flex;flex-direction:column;overflow:hidden;background:var(--ngx-designer-panel-bg, #ffffff)}.dark-mode .designer-panel{--ngx-designer-panel-bg: #1e293b}.toolbox-panel{border-right:1px solid var(--ngx-designer-border, #e2e8f0);padding:16px}.panel-title{margin:0;font-size:14px;font-weight:700}.panel-subtitle{margin:4px 0 16px;font-size:11px;opacity:.6}.toolbox-items{display:flex;flex-direction:column;gap:10px;overflow-y:auto}.toolbox-card{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px dashed var(--ngx-designer-border, #cbd5e1);border-radius:8px;cursor:grab;font-size:12px;font-weight:600;transition:all .2s}.toolbox-card:hover{border-color:var(--primary-color, #4f46e5);background:#4f46e508}.toolbox-icon{font-size:16px}.canvas-panel{border-right:1px solid var(--ngx-designer-border, #e2e8f0);background:var(--ngx-designer-canvas-bg, #f1f5f9);padding:16px}.dark-mode .canvas-panel{--ngx-designer-canvas-bg: #0f172a}.panel-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.field-count-badge{font-size:10px;font-weight:700;background:#0000000f;padding:3px 8px;border-radius:12px}.dark-mode .field-count-badge{background:#ffffff14}.canvas-dropzone{flex:1;border:2px dashed var(--ngx-designer-border, #cbd5e1);border-radius:10px;background:var(--ngx-designer-panel-bg, #ffffff);padding:16px;overflow-y:auto;transition:all .2s;min-height:250px}.canvas-dropzone.drag-over{border-color:var(--primary-color, #4f46e5);background:#4f46e505}.canvas-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;text-align:center;opacity:.5;padding:40px 10px}.placeholder-icon{font-size:32px;margin-bottom:10px}.placeholder-text{font-size:12px;max-width:200px;margin:0}.canvas-fields-list{display:flex;flex-direction:column;gap:12px}.canvas-field-row{display:flex;align-items:center;padding:12px 14px;border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:8px;background:var(--ngx-designer-panel-bg, #ffffff);cursor:pointer;position:relative;transition:all .2s}.canvas-field-row:hover{box-shadow:0 4px 12px #0000000a;border-color:var(--ngx-designer-border-hover, #cbd5e1)}.canvas-field-row.selected{border-color:var(--primary-color, #4f46e5);box-shadow:0 0 0 2px #4f46e514;background:#4f46e503}.canvas-field-row.dragging{opacity:.4;border-style:dashed}.canvas-field-row.drag-over{border-top:2px solid var(--primary-color, #4f46e5)}.field-drag-handle{cursor:grab;margin-right:12px;opacity:.3;font-size:16px;-webkit-user-select:none;user-select:none}.field-details{flex:1;display:flex;flex-direction:column;gap:2px}.field-header{display:flex;gap:8px;align-items:center;margin-bottom:2px}.field-type-badge{font-size:9px;font-weight:700;text-transform:uppercase;background:#4f46e514;color:var(--primary-color, #4f46e5);padding:1px 6px;border-radius:4px}.field-key-badge{font-size:9px;font-family:monospace;opacity:.5}.field-label-text{font-size:13px;font-weight:600}.req-star{color:#dc2626}.field-placeholder-text{font-size:10px;opacity:.5}.delete-field-btn{background:transparent;border:0;color:#ef4444;cursor:pointer;font-size:12px;font-weight:700;opacity:.3;padding:6px;border-radius:4px;transition:all .15s}.canvas-field-row:hover .delete-field-btn{opacity:1}.delete-field-btn:hover{background:#ef44440f}.inspector-panel{padding:0}.inspector-tabs{display:flex;border-bottom:1px solid var(--ngx-designer-border, #e2e8f0)}.tab-btn{flex:1;border:0;background:transparent;padding:12px 6px;font-size:11px;font-weight:700;color:inherit;opacity:.6;cursor:pointer;border-bottom:2px solid transparent;transition:all .2s}.tab-btn:hover{opacity:.9}.tab-btn.active{opacity:1;border-bottom-color:var(--primary-color, #4f46e5);color:var(--primary-color, #4f46e5)}.tab-content{flex:1;overflow-y:auto;padding:16px}.inspector-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;text-align:center;opacity:.5;padding:40px 10px}.inspector-placeholder span{font-size:32px;margin-bottom:10px}.inspector-placeholder p{font-size:11px;margin:0;max-width:180px}.properties-form{display:flex;flex-direction:column;gap:14px}.inspector-field{display:flex;flex-direction:column;gap:4px}.inspector-label{font-size:11px;font-weight:700;opacity:.7}.properties-form input[type=text],.properties-form input[type=number]{width:100%;border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:6px;background:transparent;color:inherit;padding:8px 10px;font-size:12px;outline:none;transition:border-color .2s}.properties-form input[type=text]:focus,.properties-form input[type=number]:focus{border-color:var(--primary-color, #4f46e5)}.properties-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}.checkbox-row{display:flex;flex-direction:column;gap:8px;margin:6px 0}.inspector-checkbox{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:600;cursor:pointer}.inspector-checkbox input{accent-color:var(--primary-color, #4f46e5)}.options-editor-section{border-top:1px solid var(--ngx-designer-border, #e2e8f0);padding-top:14px;margin-top:6px}.options-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.add-opt-btn{background:transparent;border:0;color:var(--primary-color, #4f46e5);font-size:11px;font-weight:700;cursor:pointer}.options-list{display:flex;flex-direction:column;gap:8px}.option-edit-row{display:grid;grid-template-columns:1fr 1fr 24px;gap:6px;align-items:center}.option-edit-row input{border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:4px;padding:5px 8px;font-size:11px;background:transparent;color:inherit}.delete-opt-btn{background:transparent;border:0;color:#ef4444;cursor:pointer;font-size:11px;font-weight:700}.schema-actions{display:flex;justify-content:flex-end;margin-bottom:10px}.schema-action-btn{border:0;background:var(--primary-color, #4f46e5);color:#fff;border-radius:5px;padding:6px 12px;font-size:11px;font-weight:600;cursor:pointer}.schema-code-block{background:#00000008;padding:12px;border-radius:8px;font-family:monospace;font-size:11px;overflow-x:auto;white-space:pre-wrap;margin:0}.dark-mode .schema-code-block{background:#ffffff08}.preview-card{border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:8px;padding:16px;background:var(--ngx-designer-panel-bg, #ffffff)}.preview-submit-banner{margin-top:14px;padding:10px 12px;background:#10b98114;border:1px solid rgba(16,185,129,.15);border-radius:6px}.banner-title{font-size:11px;font-weight:700;color:#059669}.preview-submit-banner pre{margin:6px 0 0;font-family:monospace;font-size:10px;overflow-x:auto}.designer-modal-overlay{position:fixed;inset:0;background:#00000073;backdrop-filter:blur(4px);display:flex;align-items:center;justify-content:center;z-index:1000}.designer-modal-card{background:var(--ngx-designer-panel-bg, #ffffff);border:1px solid var(--ngx-designer-border, #e2e8f0);border-radius:12px;padding:20px;width:420px;box-shadow:0 10px 25px #0000001a;display:flex;flex-direction:column;gap:10px}.modal-title{margin:0;font-size:14px;font-weight:700}.modal-subtitle{margin:0;font-size:11px;opacity:.6}.modal-textarea{width:100%;height:140px;border:1px solid var(--ngx-designer-border, #cbd5e1);border-radius:6px;background:transparent;color:inherit;padding:8px 10px;font-family:monospace;font-size:11px;outline:none;resize:none}.modal-error-banner{color:#dc2626;font-size:10px;font-weight:600}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}.modal-action-btn{border:0;border-radius:5px;padding:7px 14px;font-size:12px;font-weight:600;cursor:pointer}.modal-action-btn.cancel{background:transparent;border:1px solid var(--ngx-designer-border, #cbd5e1);color:inherit}.modal-action-btn.primary{background:var(--primary-color, #4f46e5);color:#fff}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.JsonPipe, name: "json" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: FormBuilderComponent, selector: "ngx-form-builder", inputs: ["fields", "value", "submitLabel", "showSubmit"], outputs: ["formSubmit", "formChange"] }] });
4854
5074
  }
4855
5075
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: FormDesignerComponent, decorators: [{
4856
5076
  type: Component,
@@ -5211,6 +5431,96 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
5211
5431
  args: ['canvas', { static: true }]
5212
5432
  }] } });
5213
5433
 
5434
+ const DEFAULT_FORM_ERROR_MESSAGES = {
5435
+ required: 'This field is required',
5436
+ email: 'Please enter a valid email address',
5437
+ minlength: (err) => `Minimum ${err.requiredLength} characters required`,
5438
+ maxlength: (err) => `Maximum ${err.requiredLength} characters allowed`,
5439
+ min: (err) => `Value must be at least ${err.min}`,
5440
+ max: (err) => `Value must not exceed ${err.max}`,
5441
+ pattern: 'Invalid format',
5442
+ };
5443
+ const NGX_FORM_ERROR_MESSAGES = new InjectionToken('NGX_FORM_ERROR_MESSAGES', {
5444
+ providedIn: 'root',
5445
+ factory: () => DEFAULT_FORM_ERROR_MESSAGES,
5446
+ });
5447
+ class NgxFormErrorService {
5448
+ messages = DEFAULT_FORM_ERROR_MESSAGES;
5449
+ setMessageTemplates(customMessages) {
5450
+ this.messages = { ...this.messages, ...customMessages };
5451
+ }
5452
+ resolveError(errorKey, errorValue) {
5453
+ const template = this.messages[errorKey];
5454
+ if (typeof template === 'function') {
5455
+ return template(errorValue);
5456
+ }
5457
+ if (typeof template === 'string') {
5458
+ return template;
5459
+ }
5460
+ if (typeof errorValue === 'string') {
5461
+ return errorValue;
5462
+ }
5463
+ return `Invalid value (${errorKey})`;
5464
+ }
5465
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NgxFormErrorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5466
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NgxFormErrorService, providedIn: 'root' });
5467
+ }
5468
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NgxFormErrorService, decorators: [{
5469
+ type: Injectable,
5470
+ args: [{ providedIn: 'root' }]
5471
+ }] });
5472
+
5473
+ class NgxFormErrorPipe {
5474
+ errorService = inject(NgxFormErrorService);
5475
+ transform(errors) {
5476
+ if (!errors)
5477
+ return null;
5478
+ const keys = Object.keys(errors);
5479
+ if (keys.length === 0)
5480
+ return null;
5481
+ // Resolve the first validation error message
5482
+ const firstKey = keys[0];
5483
+ return this.errorService.resolveError(firstKey, errors[firstKey]);
5484
+ }
5485
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NgxFormErrorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
5486
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.20", ngImport: i0, type: NgxFormErrorPipe, isStandalone: true, name: "ngxFormError" });
5487
+ }
5488
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NgxFormErrorPipe, decorators: [{
5489
+ type: Pipe,
5490
+ args: [{
5491
+ name: 'ngxFormError',
5492
+ standalone: true,
5493
+ }]
5494
+ }] });
5495
+
5496
+ class NgxMaskDirective {
5497
+ ngxMask = input.required();
5498
+ unmaskedValueChange = output();
5499
+ el = inject((ElementRef));
5500
+ onInput(event) {
5501
+ const inputEl = this.el.nativeElement;
5502
+ const rawVal = inputEl.value;
5503
+ const pattern = this.ngxMask();
5504
+ if (!pattern)
5505
+ return;
5506
+ const { masked, unmasked } = applyMask(rawVal, pattern);
5507
+ inputEl.value = masked;
5508
+ this.unmaskedValueChange.emit(unmasked);
5509
+ }
5510
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NgxMaskDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
5511
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.20", type: NgxMaskDirective, isStandalone: true, selector: "input[ngxMask]", inputs: { ngxMask: { classPropertyName: "ngxMask", publicName: "ngxMask", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { unmaskedValueChange: "unmaskedValueChange" }, host: { listeners: { "input": "onInput($event)" } }, ngImport: i0 });
5512
+ }
5513
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: NgxMaskDirective, decorators: [{
5514
+ type: Directive,
5515
+ args: [{
5516
+ selector: 'input[ngxMask]',
5517
+ standalone: true,
5518
+ }]
5519
+ }], propDecorators: { onInput: [{
5520
+ type: HostListener,
5521
+ args: ['input', ['$event']]
5522
+ }] } });
5523
+
5214
5524
  /*
5215
5525
  * Public API Surface — secondary entry point: ngx-core-components/inputs
5216
5526
  */
@@ -5220,5 +5530,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
5220
5530
  * Generated bundle index. Do not edit.
5221
5531
  */
5222
5532
 
5223
- export { AutocompleteComponent, CheckboxComponent, ColorPickerComponent, DatePickerComponent, DateRangePickerComponent, DropdownComponent, FilePreviewComponent, FileUploadComponent, FormBuilderComponent, FormDesignerComponent, MultiSelectComponent, NumericTextBoxComponent, RadioGroupComponent, RatingComponent, SegmentedControlComponent, SignaturePadComponent, SliderComponent, SwitchComponent, TagInputComponent, TextBoxComponent, TextareaComponent, TimePickerComponent };
5533
+ export { AutocompleteComponent, CheckboxComponent, ColorPickerComponent, DEFAULT_FORM_ERROR_MESSAGES, DatePickerComponent, DateRangePickerComponent, DropdownComponent, FilePreviewComponent, FileUploadComponent, FormBuilderComponent, FormDesignerComponent, MultiSelectComponent, NGX_FORM_ERROR_MESSAGES, NgxFormErrorPipe, NgxFormErrorService, NgxMaskDirective, NumericTextBoxComponent, RadioGroupComponent, RatingComponent, SegmentedControlComponent, SignaturePadComponent, SliderComponent, SwitchComponent, TagInputComponent, TextBoxComponent, TextareaComponent, TimePickerComponent, applyMask, getPresetMask, unmaskValue };
5224
5534
  //# sourceMappingURL=ngx-core-components-inputs.mjs.map