ngx-core-components 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/buttons/button/button.component.d.ts +3 -1
  2. package/buttons/chip/chip.component.d.ts +5 -3
  3. package/buttons/split-button/split-button.component.d.ts +3 -0
  4. package/charts/gantt-chart/gantt-chart.component.d.ts +1 -0
  5. package/feedback/badge/badge.component.d.ts +1 -0
  6. package/feedback/progress-bar/progress-bar.component.d.ts +1 -1
  7. package/fesm2022/ngx-core-components-buttons.mjs +92 -27
  8. package/fesm2022/ngx-core-components-buttons.mjs.map +1 -1
  9. package/fesm2022/ngx-core-components-charts.mjs +17 -4
  10. package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
  11. package/fesm2022/ngx-core-components-dialog.mjs +16 -9
  12. package/fesm2022/ngx-core-components-dialog.mjs.map +1 -1
  13. package/fesm2022/ngx-core-components-feedback.mjs +18 -16
  14. package/fesm2022/ngx-core-components-feedback.mjs.map +1 -1
  15. package/fesm2022/ngx-core-components-inputs.mjs +104 -17
  16. package/fesm2022/ngx-core-components-inputs.mjs.map +1 -1
  17. package/fesm2022/ngx-core-components-layout.mjs +42 -27
  18. package/fesm2022/ngx-core-components-layout.mjs.map +1 -1
  19. package/fesm2022/ngx-core-components-navigation.mjs +15 -5
  20. package/fesm2022/ngx-core-components-navigation.mjs.map +1 -1
  21. package/fesm2022/ngx-core-components-views.mjs +27 -4
  22. package/fesm2022/ngx-core-components-views.mjs.map +1 -1
  23. package/fesm2022/ngx-core-components.mjs.map +1 -1
  24. package/inputs/dropdown/dropdown.component.d.ts +4 -1
  25. package/inputs/slider/slider.component.d.ts +13 -5
  26. package/inputs/textbox/textbox.component.d.ts +7 -1
  27. package/layout/card/card.component.d.ts +3 -2
  28. package/layout/tab-strip/tab-strip.component.d.ts +2 -0
  29. package/navigation/menu/menu.component.d.ts +4 -1
  30. package/package.json +1 -1
  31. package/public-api.d.ts +6 -6
  32. package/views/tree-view/tree-view.component.d.ts +5 -0
@@ -11,6 +11,11 @@ class TextBoxComponent {
11
11
  readonly = input(false);
12
12
  error = input('');
13
13
  hint = input('');
14
+ maxlength = input(0);
15
+ clearable = input(false);
16
+ showCharCount = input(false);
17
+ prefixIcon = input('');
18
+ suffixIcon = input('');
14
19
  valueChange = output();
15
20
  focusChange = output();
16
21
  isFocused = signal(false);
@@ -35,6 +40,11 @@ class TextBoxComponent {
35
40
  this.focusChange.emit(false);
36
41
  this._onTouched();
37
42
  }
43
+ clearValue() {
44
+ this._cvaValue.set('');
45
+ this._onChange('');
46
+ this.valueChange.emit('');
47
+ }
38
48
  // ControlValueAccessor
39
49
  writeValue(val) {
40
50
  this._cvaActive = true;
@@ -51,7 +61,7 @@ class TextBoxComponent {
51
61
  // reactive-form disable/enable is handled at the FormControl level.
52
62
  }
53
63
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TextBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
54
- 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 } }, outputs: { valueChange: "valueChange", focusChange: "focusChange" }, providers: [
64
+ 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 } }, outputs: { valueChange: "valueChange", focusChange: "focusChange" }, providers: [
55
65
  {
56
66
  provide: NG_VALUE_ACCESSOR,
57
67
  useExisting: forwardRef(() => TextBoxComponent),
@@ -63,6 +73,9 @@ class TextBoxComponent {
63
73
  <label class="ngx-textbox-label" [class.floating]="isFocused() || !!_displayValue()">{{ label() }}</label>
64
74
  }
65
75
  <div class="ngx-textbox-wrap">
76
+ @if (prefixIcon()) {
77
+ <span class="ngx-textbox-affix ngx-textbox-prefix" aria-hidden="true">{{ prefixIcon() }}</span>
78
+ }
66
79
  <input
67
80
  class="ngx-textbox-input"
68
81
  [type]="type()"
@@ -70,19 +83,29 @@ class TextBoxComponent {
70
83
  [placeholder]="isFocused() || !label() ? placeholder() : ''"
71
84
  [disabled]="disabled()"
72
85
  [readOnly]="readonly()"
86
+ [attr.maxlength]="maxlength() > 0 ? maxlength() : null"
73
87
  [attr.aria-invalid]="!!error()"
74
88
  (input)="onInput($event)"
75
89
  (focus)="onFocus()"
76
90
  (blur)="onBlur()"
77
91
  />
92
+ @if (clearable() && !!_displayValue() && !disabled() && !readonly()) {
93
+ <button class="ngx-textbox-clear" type="button" (click)="clearValue()" aria-label="Clear">✕</button>
94
+ }
95
+ @if (suffixIcon()) {
96
+ <span class="ngx-textbox-affix ngx-textbox-suffix" aria-hidden="true">{{ suffixIcon() }}</span>
97
+ }
78
98
  </div>
99
+ @if (maxlength() > 0 && showCharCount()) {
100
+ <div class="ngx-textbox-charcount">{{ _displayValue().length }} / {{ maxlength() }}</div>
101
+ }
79
102
  @if (error()) {
80
103
  <div class="ngx-textbox-error">{{ error() }}</div>
81
104
  } @else if (hint()) {
82
105
  <div class="ngx-textbox-hint">{{ hint() }}</div>
83
106
  }
84
107
  </div>
85
- `, isInline: true, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500;transition:all .15s}.ngx-textbox-wrap{position:relative;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);transition:border-color .15s,box-shadow .15s}.focused .ngx-textbox-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.has-error .ngx-textbox-wrap{border-color:var(--ngx-input-error, #e74c3c)}.has-error.focused .ngx-textbox-wrap{box-shadow:0 0 0 2px #e74c3c2e}.disabled .ngx-textbox-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed}.ngx-textbox-input{display:block;width:100%;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);font-family:inherit}.ngx-textbox-input:disabled{cursor:not-allowed;color:#adb5bd}.ngx-textbox-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}.ngx-textbox-hint{font-size:12px;color:var(--ngx-input-label, #6c757d);margin-top:4px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
108
+ `, isInline: true, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500;transition:all .15s}.ngx-textbox-wrap{position:relative;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);transition:border-color .15s,box-shadow .15s}.focused .ngx-textbox-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.has-error .ngx-textbox-wrap{border-color:var(--ngx-input-error, #e74c3c)}.has-error.focused .ngx-textbox-wrap{box-shadow:0 0 0 2px #e74c3c2e}.disabled .ngx-textbox-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed}.ngx-textbox-input{display:block;width:100%;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);font-family:inherit}.ngx-textbox-input:disabled{cursor:not-allowed;color:#adb5bd}.ngx-textbox-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}.ngx-textbox-hint{font-size:12px;color:var(--ngx-input-label, #6c757d);margin-top:4px}.ngx-textbox-affix{display:flex;align-items:center;padding:0 10px;color:#6c757d;font-size:14px;flex-shrink:0}.ngx-textbox-clear{background:none;border:none;cursor:pointer;color:#adb5bd;font-size:12px;padding:0 8px;line-height:1;display:flex;align-items:center;flex-shrink:0}.ngx-textbox-clear:hover{color:#495057}.ngx-textbox-charcount{font-size:11px;color:#adb5bd;margin-top:3px;text-align:right}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
86
109
  }
87
110
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TextBoxComponent, decorators: [{
88
111
  type: Component,
@@ -98,6 +121,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
98
121
  <label class="ngx-textbox-label" [class.floating]="isFocused() || !!_displayValue()">{{ label() }}</label>
99
122
  }
100
123
  <div class="ngx-textbox-wrap">
124
+ @if (prefixIcon()) {
125
+ <span class="ngx-textbox-affix ngx-textbox-prefix" aria-hidden="true">{{ prefixIcon() }}</span>
126
+ }
101
127
  <input
102
128
  class="ngx-textbox-input"
103
129
  [type]="type()"
@@ -105,19 +131,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
105
131
  [placeholder]="isFocused() || !label() ? placeholder() : ''"
106
132
  [disabled]="disabled()"
107
133
  [readOnly]="readonly()"
134
+ [attr.maxlength]="maxlength() > 0 ? maxlength() : null"
108
135
  [attr.aria-invalid]="!!error()"
109
136
  (input)="onInput($event)"
110
137
  (focus)="onFocus()"
111
138
  (blur)="onBlur()"
112
139
  />
140
+ @if (clearable() && !!_displayValue() && !disabled() && !readonly()) {
141
+ <button class="ngx-textbox-clear" type="button" (click)="clearValue()" aria-label="Clear">✕</button>
142
+ }
143
+ @if (suffixIcon()) {
144
+ <span class="ngx-textbox-affix ngx-textbox-suffix" aria-hidden="true">{{ suffixIcon() }}</span>
145
+ }
113
146
  </div>
147
+ @if (maxlength() > 0 && showCharCount()) {
148
+ <div class="ngx-textbox-charcount">{{ _displayValue().length }} / {{ maxlength() }}</div>
149
+ }
114
150
  @if (error()) {
115
151
  <div class="ngx-textbox-error">{{ error() }}</div>
116
152
  } @else if (hint()) {
117
153
  <div class="ngx-textbox-hint">{{ hint() }}</div>
118
154
  }
119
155
  </div>
120
- `, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500;transition:all .15s}.ngx-textbox-wrap{position:relative;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);transition:border-color .15s,box-shadow .15s}.focused .ngx-textbox-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.has-error .ngx-textbox-wrap{border-color:var(--ngx-input-error, #e74c3c)}.has-error.focused .ngx-textbox-wrap{box-shadow:0 0 0 2px #e74c3c2e}.disabled .ngx-textbox-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed}.ngx-textbox-input{display:block;width:100%;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);font-family:inherit}.ngx-textbox-input:disabled{cursor:not-allowed;color:#adb5bd}.ngx-textbox-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}.ngx-textbox-hint{font-size:12px;color:var(--ngx-input-label, #6c757d);margin-top:4px}\n"] }]
156
+ `, styles: [":host{display:block}.ngx-textbox{position:relative;font-family:inherit}.ngx-textbox-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500;transition:all .15s}.ngx-textbox-wrap{position:relative;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);transition:border-color .15s,box-shadow .15s}.focused .ngx-textbox-wrap{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.has-error .ngx-textbox-wrap{border-color:var(--ngx-input-error, #e74c3c)}.has-error.focused .ngx-textbox-wrap{box-shadow:0 0 0 2px #e74c3c2e}.disabled .ngx-textbox-wrap{background:var(--ngx-input-disabled-bg, #f8f9fa);cursor:not-allowed}.ngx-textbox-input{display:block;width:100%;padding:8px 12px;border:none;outline:none;background:transparent;font-size:14px;color:var(--ngx-input-text, #212529);font-family:inherit}.ngx-textbox-input:disabled{cursor:not-allowed;color:#adb5bd}.ngx-textbox-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}.ngx-textbox-hint{font-size:12px;color:var(--ngx-input-label, #6c757d);margin-top:4px}.ngx-textbox-affix{display:flex;align-items:center;padding:0 10px;color:#6c757d;font-size:14px;flex-shrink:0}.ngx-textbox-clear{background:none;border:none;cursor:pointer;color:#adb5bd;font-size:12px;padding:0 8px;line-height:1;display:flex;align-items:center;flex-shrink:0}.ngx-textbox-clear:hover{color:#495057}.ngx-textbox-charcount{font-size:11px;color:#adb5bd;margin-top:3px;text-align:right}\n"] }]
121
157
  }] });
122
158
 
123
159
  class CheckboxComponent {
@@ -332,6 +368,9 @@ class DropdownComponent {
332
368
  placeholder = input('Select...');
333
369
  disabled = input(false);
334
370
  filterable = input(false);
371
+ required = input(false);
372
+ error = input('');
373
+ hint = input('');
335
374
  valueChange = output();
336
375
  isOpen = signal(false);
337
376
  filterText = signal('');
@@ -355,12 +394,21 @@ class DropdownComponent {
355
394
  if (this.disabled())
356
395
  return;
357
396
  this.isOpen.update(v => !v);
358
- if (!this.isOpen())
397
+ if (this.isOpen()) {
398
+ const opts = this.filteredOptions();
399
+ const selectedIndex = opts.findIndex(o => o.value === this._activeValue());
400
+ this.focusedIndex.set(selectedIndex >= 0 ? selectedIndex : (opts.length > 0 ? 0 : -1));
401
+ }
402
+ else {
359
403
  this.filterText.set('');
404
+ this.focusedIndex.set(-1);
405
+ this._onTouched();
406
+ }
360
407
  }
361
408
  selectOption(opt) {
362
409
  if (opt.disabled)
363
410
  return;
411
+ this._cvaActive = true;
364
412
  this._cvaValue.set(opt.value);
365
413
  this._onChange(opt.value);
366
414
  this._onTouched();
@@ -407,12 +455,20 @@ class DropdownComponent {
407
455
  }
408
456
  moveFocus(delta) {
409
457
  const n = this.filteredOptions().length;
458
+ if (n <= 0) {
459
+ this.focusedIndex.set(-1);
460
+ return;
461
+ }
410
462
  this.focusedIndex.update(i => Math.max(0, Math.min(n - 1, i + delta)));
411
463
  }
412
464
  onDocClick(e) {
413
465
  if (!this.el.nativeElement.contains(e.target)) {
414
- this.isOpen.set(false);
415
- this.filterText.set('');
466
+ if (this.isOpen()) {
467
+ this.isOpen.set(false);
468
+ this.filterText.set('');
469
+ this.focusedIndex.set(-1);
470
+ this._onTouched();
471
+ }
416
472
  }
417
473
  }
418
474
  // ControlValueAccessor
@@ -430,7 +486,7 @@ class DropdownComponent {
430
486
  // disabled is controlled via input() for template usage.
431
487
  }
432
488
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
433
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DropdownComponent, isStandalone: true, selector: "ngx-dropdown", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, 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 }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "document:click": "onDocClick($event)" } }, providers: [
489
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: DropdownComponent, isStandalone: true, selector: "ngx-dropdown", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, 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 }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", 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" }, host: { listeners: { "document:click": "onDocClick($event)" } }, providers: [
434
490
  {
435
491
  provide: NG_VALUE_ACCESSOR,
436
492
  useExisting: forwardRef(() => DropdownComponent),
@@ -441,20 +497,25 @@ class DropdownComponent {
441
497
  class="ngx-dropdown"
442
498
  [class.open]="isOpen()"
443
499
  [class.disabled]="disabled()"
500
+ [class.has-error]="!!error()"
444
501
  [attr.aria-expanded]="isOpen()"
445
502
  role="combobox"
446
503
  >
447
504
  @if (label()) {
448
- <label class="ngx-dropdown-label">{{ label() }}</label>
505
+ <label class="ngx-dropdown-label">
506
+ {{ label() }}
507
+ @if (required()) { <span class="ngx-dropdown-required" aria-hidden="true">*</span> }
508
+ </label>
449
509
  }
450
510
 
451
511
  <!-- Trigger -->
452
512
  <div
453
513
  class="ngx-dropdown-trigger"
454
- tabindex="0"
514
+ [attr.tabindex]="disabled() ? -1 : 0"
455
515
  (click)="toggle()"
456
516
  (keydown)="onTriggerKey($event)"
457
517
  [attr.aria-label]="selectedLabel() || placeholder()"
518
+ [attr.aria-disabled]="disabled()"
458
519
  >
459
520
  <span class="trigger-text" [class.placeholder]="!selectedLabel()">
460
521
  {{ selectedLabel() || placeholder() }}
@@ -496,8 +557,13 @@ class DropdownComponent {
496
557
  </div>
497
558
  </div>
498
559
  }
560
+ @if (error()) {
561
+ <div class="ngx-dropdown-error">{{ error() }}</div>
562
+ } @else if (hint()) {
563
+ <div class="ngx-dropdown-hint">{{ hint() }}</div>
564
+ }
499
565
  </div>
500
- `, isInline: true, styles: [":host{display:block}.ngx-dropdown{position:relative;font-family:inherit}.ngx-dropdown-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ngx-dropdown-trigger{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;font-size:14px;transition:border-color .15s,box-shadow .15s}.ngx-dropdown-trigger:hover{border-color:#adb5bd}.open .ngx-dropdown-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ngx-dropdown-trigger{background:#f8f9fa;cursor:not-allowed;color:#adb5bd}.trigger-text{flex:1;color:var(--ngx-input-text, #212529)}.trigger-text.placeholder{color:#adb5bd}.trigger-arrow{font-size:10px;color:#6c757d;transition:transform .15s}.trigger-arrow.open{transform:rotate(180deg)}.ngx-dropdown-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.popup-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.popup-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.popup-list{max-height:240px;overflow-y:auto}.popup-item{padding:8px 12px;font-size:14px;cursor:pointer;color:var(--ngx-input-text, #212529);transition:background .1s}.popup-item:hover,.popup-item.focused{background:var(--ngx-input-hover-bg, #f1f3f5)}.popup-item.selected{background:var(--ngx-input-selected-bg, #e8f0fe);color:var(--ngx-input-focus, #4a90d9);font-weight:500}.popup-item.disabled{color:#adb5bd;cursor:not-allowed}.popup-item.disabled:hover{background:none}.popup-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
566
+ `, isInline: true, styles: [":host{display:block}.ngx-dropdown{position:relative;font-family:inherit}.ngx-dropdown-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ngx-dropdown-trigger{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;font-size:14px;transition:border-color .15s,box-shadow .15s}.ngx-dropdown-trigger:hover{border-color:#adb5bd}.open .ngx-dropdown-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ngx-dropdown-trigger{background:#f8f9fa;cursor:not-allowed;color:#adb5bd}.trigger-text{flex:1;color:var(--ngx-input-text, #212529)}.trigger-text.placeholder{color:#adb5bd}.trigger-arrow{font-size:10px;color:#6c757d;transition:transform .15s}.trigger-arrow.open{transform:rotate(180deg)}.ngx-dropdown-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.popup-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.popup-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.popup-list{max-height:240px;overflow-y:auto}.popup-item{padding:8px 12px;font-size:14px;cursor:pointer;color:var(--ngx-input-text, #212529);transition:background .1s}.popup-item:hover,.popup-item.focused{background:var(--ngx-input-hover-bg, #f1f3f5)}.popup-item.selected{background:var(--ngx-input-selected-bg, #e8f0fe);color:var(--ngx-input-focus, #4a90d9);font-weight:500}.popup-item.disabled{color:#adb5bd;cursor:not-allowed}.popup-item.disabled:hover{background:none}.popup-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}.has-error .ngx-dropdown-trigger{border-color:var(--ngx-input-error, #e74c3c)}.has-error.focused .ngx-dropdown-trigger,.has-error.open .ngx-dropdown-trigger{box-shadow:0 0 0 2px #e74c3c2e}.ngx-dropdown-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}.ngx-dropdown-hint{font-size:12px;color:var(--ngx-input-label, #6c757d);margin-top:4px}.ngx-dropdown-required{color:var(--ngx-input-error, #e74c3c);margin-left:2px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
501
567
  }
502
568
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: DropdownComponent, decorators: [{
503
569
  type: Component,
@@ -512,20 +578,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
512
578
  class="ngx-dropdown"
513
579
  [class.open]="isOpen()"
514
580
  [class.disabled]="disabled()"
581
+ [class.has-error]="!!error()"
515
582
  [attr.aria-expanded]="isOpen()"
516
583
  role="combobox"
517
584
  >
518
585
  @if (label()) {
519
- <label class="ngx-dropdown-label">{{ label() }}</label>
586
+ <label class="ngx-dropdown-label">
587
+ {{ label() }}
588
+ @if (required()) { <span class="ngx-dropdown-required" aria-hidden="true">*</span> }
589
+ </label>
520
590
  }
521
591
 
522
592
  <!-- Trigger -->
523
593
  <div
524
594
  class="ngx-dropdown-trigger"
525
- tabindex="0"
595
+ [attr.tabindex]="disabled() ? -1 : 0"
526
596
  (click)="toggle()"
527
597
  (keydown)="onTriggerKey($event)"
528
598
  [attr.aria-label]="selectedLabel() || placeholder()"
599
+ [attr.aria-disabled]="disabled()"
529
600
  >
530
601
  <span class="trigger-text" [class.placeholder]="!selectedLabel()">
531
602
  {{ selectedLabel() || placeholder() }}
@@ -567,8 +638,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
567
638
  </div>
568
639
  </div>
569
640
  }
641
+ @if (error()) {
642
+ <div class="ngx-dropdown-error">{{ error() }}</div>
643
+ } @else if (hint()) {
644
+ <div class="ngx-dropdown-hint">{{ hint() }}</div>
645
+ }
570
646
  </div>
571
- `, styles: [":host{display:block}.ngx-dropdown{position:relative;font-family:inherit}.ngx-dropdown-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ngx-dropdown-trigger{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;font-size:14px;transition:border-color .15s,box-shadow .15s}.ngx-dropdown-trigger:hover{border-color:#adb5bd}.open .ngx-dropdown-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ngx-dropdown-trigger{background:#f8f9fa;cursor:not-allowed;color:#adb5bd}.trigger-text{flex:1;color:var(--ngx-input-text, #212529)}.trigger-text.placeholder{color:#adb5bd}.trigger-arrow{font-size:10px;color:#6c757d;transition:transform .15s}.trigger-arrow.open{transform:rotate(180deg)}.ngx-dropdown-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.popup-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.popup-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.popup-list{max-height:240px;overflow-y:auto}.popup-item{padding:8px 12px;font-size:14px;cursor:pointer;color:var(--ngx-input-text, #212529);transition:background .1s}.popup-item:hover,.popup-item.focused{background:var(--ngx-input-hover-bg, #f1f3f5)}.popup-item.selected{background:var(--ngx-input-selected-bg, #e8f0fe);color:var(--ngx-input-focus, #4a90d9);font-weight:500}.popup-item.disabled{color:#adb5bd;cursor:not-allowed}.popup-item.disabled:hover{background:none}.popup-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}\n"] }]
647
+ `, styles: [":host{display:block}.ngx-dropdown{position:relative;font-family:inherit}.ngx-dropdown-label{display:block;font-size:13px;color:var(--ngx-input-label, #6c757d);margin-bottom:4px;font-weight:500}.ngx-dropdown-trigger{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);background:var(--ngx-input-bg, #fff);cursor:pointer;-webkit-user-select:none;user-select:none;font-size:14px;transition:border-color .15s,box-shadow .15s}.ngx-dropdown-trigger:hover{border-color:#adb5bd}.open .ngx-dropdown-trigger{border-color:var(--ngx-input-focus, #4a90d9);box-shadow:0 0 0 2px #4a90d92e}.disabled .ngx-dropdown-trigger{background:#f8f9fa;cursor:not-allowed;color:#adb5bd}.trigger-text{flex:1;color:var(--ngx-input-text, #212529)}.trigger-text.placeholder{color:#adb5bd}.trigger-arrow{font-size:10px;color:#6c757d;transition:transform .15s}.trigger-arrow.open{transform:rotate(180deg)}.ngx-dropdown-popup{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background:var(--ngx-input-bg, #fff);border:1px solid var(--ngx-input-border, #ced4da);border-radius:var(--ngx-input-radius, 4px);box-shadow:0 4px 16px #0000001f;overflow:hidden}.popup-search{padding:8px;border-bottom:1px solid var(--ngx-input-border, #ced4da)}.popup-search-input{width:100%;padding:6px 10px;border:1px solid var(--ngx-input-border, #ced4da);border-radius:3px;font-size:13px;outline:none;font-family:inherit}.popup-list{max-height:240px;overflow-y:auto}.popup-item{padding:8px 12px;font-size:14px;cursor:pointer;color:var(--ngx-input-text, #212529);transition:background .1s}.popup-item:hover,.popup-item.focused{background:var(--ngx-input-hover-bg, #f1f3f5)}.popup-item.selected{background:var(--ngx-input-selected-bg, #e8f0fe);color:var(--ngx-input-focus, #4a90d9);font-weight:500}.popup-item.disabled{color:#adb5bd;cursor:not-allowed}.popup-item.disabled:hover{background:none}.popup-empty{padding:12px;text-align:center;color:#adb5bd;font-size:13px}.has-error .ngx-dropdown-trigger{border-color:var(--ngx-input-error, #e74c3c)}.has-error.focused .ngx-dropdown-trigger,.has-error.open .ngx-dropdown-trigger{box-shadow:0 0 0 2px #e74c3c2e}.ngx-dropdown-error{font-size:12px;color:var(--ngx-input-error, #e74c3c);margin-top:4px}.ngx-dropdown-hint{font-size:12px;color:var(--ngx-input-label, #6c757d);margin-top:4px}.ngx-dropdown-required{color:var(--ngx-input-error, #e74c3c);margin-left:2px}\n"] }]
572
648
  }], propDecorators: { onDocClick: [{
573
649
  type: HostListener,
574
650
  args: ['document:click', ['$event']]
@@ -1312,15 +1388,26 @@ class SliderComponent {
1312
1388
  min = input(0);
1313
1389
  max = input(100);
1314
1390
  step = input(1);
1315
- value = signal(0);
1316
- low = signal(20);
1317
- high = signal(80);
1318
1391
  range = input(false);
1319
1392
  disabled = input(false);
1320
1393
  showValue = input(true);
1321
1394
  showTicks = input(false);
1395
+ /** Initial value for single-handle mode. */
1396
+ initialValue = input(0);
1397
+ /** Initial low value for range mode. */
1398
+ initialLow = input(20);
1399
+ /** Initial high value for range mode. */
1400
+ initialHigh = input(80);
1401
+ value = signal(0);
1402
+ low = signal(20);
1403
+ high = signal(80);
1322
1404
  valueChange = output();
1323
1405
  rangeChange = output();
1406
+ ngOnInit() {
1407
+ this.value.set(this.clamp(this.initialValue(), this.min(), this.max()));
1408
+ this.low.set(this.clamp(this.initialLow(), this.min(), this.max()));
1409
+ this.high.set(this.clamp(this.initialHigh(), this.min(), this.max()));
1410
+ }
1324
1411
  pct = computed(() => {
1325
1412
  const min = this.min();
1326
1413
  const max = this.max();
@@ -1384,7 +1471,7 @@ class SliderComponent {
1384
1471
  this.rangeChange.emit([currentLow, nextHigh]);
1385
1472
  }
1386
1473
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: SliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1387
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: SliderComponent, isStandalone: true, selector: "ngx-slider", inputs: { label: { classPropertyName: "label", publicName: "label", 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 }, range: { classPropertyName: "range", publicName: "range", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, showTicks: { classPropertyName: "showTicks", publicName: "showTicks", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", rangeChange: "rangeChange" }, ngImport: i0, template: `
1474
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: SliderComponent, isStandalone: true, selector: "ngx-slider", inputs: { label: { classPropertyName: "label", publicName: "label", 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 }, range: { classPropertyName: "range", publicName: "range", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, showTicks: { classPropertyName: "showTicks", publicName: "showTicks", isSignal: true, isRequired: false, transformFunction: null }, initialValue: { classPropertyName: "initialValue", publicName: "initialValue", isSignal: true, isRequired: false, transformFunction: null }, initialLow: { classPropertyName: "initialLow", publicName: "initialLow", isSignal: true, isRequired: false, transformFunction: null }, initialHigh: { classPropertyName: "initialHigh", publicName: "initialHigh", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", rangeChange: "rangeChange" }, ngImport: i0, template: `
1388
1475
  <div class="ngx-slider">
1389
1476
  @if (label()) { <label class="slider-label">{{ label() }}@if (showValue()) { <span class="slider-value">{{ range() ? (low() + ' – ' + high()) : value() }}</span> }</label> }
1390
1477
  <div class="slider-track-wrap">