shirkasoft-ui-components 1.13.18 → 2.0.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 (98) hide show
  1. package/README.md +415 -42
  2. package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +189 -100
  3. package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
  4. package/fesm2022/shirkasoft-ui-components-button.mjs +367 -73
  5. package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
  6. package/fesm2022/shirkasoft-ui-components-chart.mjs +206 -142
  7. package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
  8. package/fesm2022/shirkasoft-ui-components-config.mjs +976 -0
  9. package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -0
  10. package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +307 -142
  11. package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
  12. package/fesm2022/shirkasoft-ui-components-date-picker.mjs +1624 -1400
  13. package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
  14. package/fesm2022/shirkasoft-ui-components-fieldset.mjs +347 -92
  15. package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
  16. package/fesm2022/shirkasoft-ui-components-file-upload.mjs +484 -293
  17. package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
  18. package/fesm2022/shirkasoft-ui-components-icons.mjs +1141 -0
  19. package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -0
  20. package/fesm2022/shirkasoft-ui-components-knob.mjs +395 -180
  21. package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
  22. package/fesm2022/shirkasoft-ui-components-loading.mjs +505 -128
  23. package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
  24. package/fesm2022/shirkasoft-ui-components-modal.mjs +311 -303
  25. package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
  26. package/fesm2022/shirkasoft-ui-components-notification.mjs +188 -142
  27. package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
  28. package/fesm2022/shirkasoft-ui-components-price-input.mjs +517 -277
  29. package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
  30. package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +669 -289
  31. package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
  32. package/fesm2022/shirkasoft-ui-components-select.mjs +1014 -814
  33. package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
  34. package/fesm2022/shirkasoft-ui-components-sidebar.mjs +508 -184
  35. package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
  36. package/fesm2022/shirkasoft-ui-components-skeleton.mjs +197 -57
  37. package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
  38. package/fesm2022/shirkasoft-ui-components-table.mjs +1918 -1676
  39. package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
  40. package/fesm2022/shirkasoft-ui-components-tabs.mjs +419 -177
  41. package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
  42. package/fesm2022/shirkasoft-ui-components-tag.mjs +177 -51
  43. package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
  44. package/fesm2022/shirkasoft-ui-components-text-field.mjs +687 -369
  45. package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
  46. package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +466 -0
  47. package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -0
  48. package/fesm2022/shirkasoft-ui-components-theme.mjs +147 -0
  49. package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -0
  50. package/fesm2022/shirkasoft-ui-components-timeline.mjs +791 -215
  51. package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
  52. package/fesm2022/shirkasoft-ui-components-toggle.mjs +205 -128
  53. package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
  54. package/fesm2022/shirkasoft-ui-components-tooltip.mjs +244 -180
  55. package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
  56. package/fesm2022/shirkasoft-ui-components-utils.mjs +97 -125
  57. package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
  58. package/fesm2022/shirkasoft-ui-components-wizard.mjs +673 -166
  59. package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
  60. package/fesm2022/shirkasoft-ui-components.mjs +0 -9
  61. package/package.json +37 -7
  62. package/src/baseline.css +2472 -0
  63. package/src/theme.css +15 -543
  64. package/src/themes/ocean.css +56 -0
  65. package/src/themes/sunset.css +55 -0
  66. package/src/themes/violet.css +25 -0
  67. package/src/tokens.css +612 -0
  68. package/types/shirkasoft-ui-components-breadcrumb.d.ts +59 -44
  69. package/types/shirkasoft-ui-components-button.d.ts +142 -49
  70. package/types/shirkasoft-ui-components-chart.d.ts +59 -44
  71. package/types/shirkasoft-ui-components-config.d.ts +357 -0
  72. package/types/shirkasoft-ui-components-confirm-dialog.d.ts +107 -65
  73. package/types/shirkasoft-ui-components-date-picker.d.ts +527 -373
  74. package/types/shirkasoft-ui-components-fieldset.d.ts +135 -59
  75. package/types/shirkasoft-ui-components-file-upload.d.ts +176 -106
  76. package/types/shirkasoft-ui-components-icons.d.ts +1430 -0
  77. package/types/shirkasoft-ui-components-knob.d.ts +151 -64
  78. package/types/shirkasoft-ui-components-loading.d.ts +155 -64
  79. package/types/shirkasoft-ui-components-modal.d.ts +134 -132
  80. package/types/shirkasoft-ui-components-notification.d.ts +63 -58
  81. package/types/shirkasoft-ui-components-price-input.d.ts +198 -85
  82. package/types/shirkasoft-ui-components-rail-sidebar.d.ts +262 -142
  83. package/types/shirkasoft-ui-components-select.d.ts +301 -192
  84. package/types/shirkasoft-ui-components-sidebar.d.ts +198 -92
  85. package/types/shirkasoft-ui-components-skeleton.d.ts +68 -27
  86. package/types/shirkasoft-ui-components-table.d.ts +849 -649
  87. package/types/shirkasoft-ui-components-tabs.d.ts +102 -61
  88. package/types/shirkasoft-ui-components-tag.d.ts +54 -23
  89. package/types/shirkasoft-ui-components-text-field.d.ts +231 -111
  90. package/types/shirkasoft-ui-components-theme-picker.d.ts +117 -0
  91. package/types/shirkasoft-ui-components-theme.d.ts +80 -0
  92. package/types/shirkasoft-ui-components-timeline.d.ts +326 -150
  93. package/types/shirkasoft-ui-components-toggle.d.ts +76 -45
  94. package/types/shirkasoft-ui-components-tooltip.d.ts +64 -43
  95. package/types/shirkasoft-ui-components-utils.d.ts +26 -17
  96. package/types/shirkasoft-ui-components-wizard.d.ts +236 -86
  97. package/types/shirkasoft-ui-components.d.ts +1 -2
  98. package/fesm2022/shirkasoft-ui-components.mjs.map +0 -1
@@ -1,160 +1,245 @@
1
- import * as i0 from '@angular/core';
2
- import { model, input, output, viewChild, signal, computed, forwardRef, ChangeDetectionStrategy, Component } from '@angular/core';
3
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
-
5
- /**
6
- * Shirkasoft UI Components.
7
- * Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
8
- * Belongs to Shirkasoft.
9
- */
10
- /** SVG radial knob with drag and keyboard support. Implements ControlValueAccessor. */
11
- class KnobComponent {
12
- constructor() {
13
- /** Current value. Two-way bindable with [(value)]. */
14
- this.value = model(0, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
15
- /** Minimum value. */
16
- this.min = input(0, ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
17
- /** Maximum value. */
18
- this.max = input(100, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
19
- /** Increment used by arrows and pointer drag rounding. */
20
- this.step = input(1, ...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
21
- /** Diameter of the knob in px. */
22
- this.size = input(100, ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
23
- /** Thickness of the arc stroke. */
24
- this.strokeWidth = input(14, ...(ngDevMode ? [{ debugName: "strokeWidth" }] : /* istanbul ignore next */ []));
25
- /** Color of the filled arc. */
26
- this.valueColor = input('var(--shk-primary-600)', ...(ngDevMode ? [{ debugName: "valueColor" }] : /* istanbul ignore next */ []));
27
- /** Color of the track arc. */
28
- this.rangeColor = input('var(--shk-surface-200)', ...(ngDevMode ? [{ debugName: "rangeColor" }] : /* istanbul ignore next */ []));
29
- /** Whether the current value is shown in the center. */
30
- this.showValue = input(true, ...(ngDevMode ? [{ debugName: "showValue" }] : /* istanbul ignore next */ []));
31
- /** Disables user interaction. */
32
- this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
33
- /** Blocks editing but keeps the control styled as enabled. */
34
- this.readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []));
35
- /** Accessible label. */
36
- this.ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
37
- /** Emitted when the knob value changes. */
38
- this.change = output();
39
- /** Emitted when the user releases the pointer. */
40
- this.end = output();
41
- this.knobSvg = viewChild('knobSvg', ...(ngDevMode ? [{ debugName: "knobSvg" }] : /* istanbul ignore next */ []));
42
- this.onChange = () => { };
43
- this.onTouched = () => { };
44
- this.dragging = false;
45
- this.formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
46
- /** Effective disabled state combining the `disabled` input and the form binding. */
47
- this.effectiveDisabled = computed(() => this.disabled() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
48
- this.r = computed(() => (this.size() - this.strokeWidth()) / 2, ...(ngDevMode ? [{ debugName: "r" }] : /* istanbul ignore next */ []));
49
- this.center = computed(() => this.size() / 2, ...(ngDevMode ? [{ debugName: "center" }] : /* istanbul ignore next */ []));
50
- this.fraction = computed(() => {
51
- const range = this.max() - this.min();
52
- if (range <= 0)
53
- return 0;
54
- return Math.max(0, Math.min(1, (this.value() - this.min()) / range));
55
- }, ...(ngDevMode ? [{ debugName: "fraction" }] : /* istanbul ignore next */ []));
56
- this.rangeArc = computed(() => this.getArcPath(135, 405), ...(ngDevMode ? [{ debugName: "rangeArc" }] : /* istanbul ignore next */ []));
57
- this.valueArc = computed(() => this.getArcPath(135, 135 + 270 * this.fraction()), ...(ngDevMode ? [{ debugName: "valueArc" }] : /* istanbul ignore next */ []));
58
- }
59
- writeValue(value) {
60
- this.value.set(this.clamp(Number(value) || this.min()));
61
- }
62
- registerOnChange(fn) {
63
- this.onChange = fn;
64
- }
65
- registerOnTouched(fn) {
66
- this.onTouched = fn;
67
- }
68
- setDisabledState(isDisabled) {
69
- this.formDisabled.set(isDisabled);
70
- }
71
- onPointerDown(event) {
72
- if (this.effectiveDisabled() || this.readonly())
73
- return;
74
- this.dragging = true;
75
- this.knobSvg()?.nativeElement.setPointerCapture(event.pointerId);
76
- this.applyEvent(event);
77
- }
78
- onPointerMove(event) {
79
- if (!this.dragging)
80
- return;
81
- this.applyEvent(event);
82
- }
83
- onPointerUp(event) {
84
- if (!this.dragging)
85
- return;
86
- this.dragging = false;
87
- try {
88
- this.knobSvg()?.nativeElement.releasePointerCapture(event.pointerId);
89
- }
90
- catch {
91
- /* noop */
92
- }
93
- this.change.emit(this.value());
94
- this.end.emit(this.value());
95
- }
96
- updateByKey(step) {
97
- if (this.effectiveDisabled() || this.readonly())
98
- return;
99
- this.setValue(this.value() + step);
100
- this.onTouched();
101
- }
102
- applyEvent(event) {
103
- const svg = this.knobSvg()?.nativeElement;
104
- if (!svg)
105
- return;
106
- const rect = svg.getBoundingClientRect();
107
- const cx = rect.left + rect.width / 2;
108
- const cy = rect.top + rect.height / 2;
109
- const angle = Math.atan2(event.clientY - cy, event.clientX - cx);
110
- const deg = ((angle * 180) / Math.PI + 360) % 360;
111
- let t = deg - 135;
112
- if (t < 0)
113
- t += 360;
114
- let fraction;
115
- if (t > 270) {
116
- fraction = 360 - t < t - 270 ? 0 : 1;
117
- }
118
- else {
119
- fraction = t / 270;
120
- }
121
- const raw = this.min() + fraction * (this.max() - this.min());
122
- this.setValue(raw);
123
- this.onTouched();
124
- }
125
- setValue(raw) {
126
- const rounded = Math.round(raw / this.step()) * this.step();
127
- const clamped = this.clamp(rounded);
128
- this.value.set(clamped);
129
- this.onChange(clamped);
130
- }
131
- clamp(value) {
132
- return Math.max(this.min(), Math.min(this.max(), value));
133
- }
134
- getArcPath(startDeg, endDeg) {
135
- const cx = this.center();
136
- const cy = this.center();
137
- const r = this.r();
138
- const start = this.anglePoint(cx, cy, r, startDeg);
139
- const end = this.anglePoint(cx, cy, r, endDeg);
140
- const largeArc = endDeg - startDeg > 180 ? '1' : '0';
141
- return `M ${start.x.toFixed(2)} ${start.y.toFixed(2)} A ${r.toFixed(2)} ${r.toFixed(2)} 0 ${largeArc} 1 ${end.x.toFixed(2)} ${end.y.toFixed(2)}`;
142
- }
143
- anglePoint(cx, cy, r, angleDeg) {
144
- const rad = (Math.PI * angleDeg) / 180;
145
- return {
146
- x: cx + r * Math.cos(rad),
147
- y: cy + r * Math.sin(rad),
148
- };
149
- }
150
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: KnobComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
151
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.23", type: KnobComponent, isStandalone: true, selector: "shk-knob", 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 }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, valueColor: { classPropertyName: "valueColor", publicName: "valueColor", isSignal: true, isRequired: false, transformFunction: null }, rangeColor: { classPropertyName: "rangeColor", publicName: "rangeColor", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", 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 }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", change: "change", end: "end" }, providers: [
152
- {
153
- provide: NG_VALUE_ACCESSOR,
154
- useExisting: forwardRef(() => KnobComponent),
155
- multi: true,
156
- },
157
- ], viewQueries: [{ propertyName: "knobSvg", first: true, predicate: ["knobSvg"], descendants: true, isSignal: true }], ngImport: i0, template: `
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, computed, forwardRef, input, model, output, signal, viewChild } from "@angular/core";
3
+ import { NG_VALUE_ACCESSOR } from "@angular/forms";
4
+ var KnobComponent = class KnobComponent {
5
+ constructor() {
6
+ this.value = model(0, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
7
+ this.min = input(0, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
8
+ this.max = input(100, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
9
+ this.step = input(1, ...ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []);
10
+ this.size = input(100, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
11
+ this.strokeWidth = input(14, ...ngDevMode ? [{ debugName: "strokeWidth" }] : /* istanbul ignore next */ []);
12
+ this.valueColor = input("var(--shk-primary-600)", ...ngDevMode ? [{ debugName: "valueColor" }] : /* istanbul ignore next */ []);
13
+ this.rangeColor = input("var(--shk-surface-200)", ...ngDevMode ? [{ debugName: "rangeColor" }] : /* istanbul ignore next */ []);
14
+ this.showValue = input(true, ...ngDevMode ? [{ debugName: "showValue" }] : /* istanbul ignore next */ []);
15
+ this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
16
+ this.readonly = input(false, ...ngDevMode ? [{ debugName: "readonly" }] : /* istanbul ignore next */ []);
17
+ this.ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
18
+ this.change = output();
19
+ this.end = output();
20
+ this.touch = output();
21
+ this.knobSvg = viewChild("knobSvg", ...ngDevMode ? [{ debugName: "knobSvg" }] : /* istanbul ignore next */ []);
22
+ this.onChange = () => {};
23
+ this.onTouched = () => {};
24
+ this.dragging = false;
25
+ this.formDisabled = signal(false, ...ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []);
26
+ this.effectiveDisabled = computed(() => this.disabled() || this.formDisabled(), ...ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []);
27
+ this.effectiveMin = computed(() => this.min() ?? 0, ...ngDevMode ? [{ debugName: "effectiveMin" }] : /* istanbul ignore next */ []);
28
+ this.effectiveMax = computed(() => this.max() ?? 100, ...ngDevMode ? [{ debugName: "effectiveMax" }] : /* istanbul ignore next */ []);
29
+ this.r = computed(() => (this.size() - this.strokeWidth()) / 2, ...ngDevMode ? [{ debugName: "r" }] : /* istanbul ignore next */ []);
30
+ this.center = computed(() => this.size() / 2, ...ngDevMode ? [{ debugName: "center" }] : /* istanbul ignore next */ []);
31
+ this.fraction = computed(() => {
32
+ const range = this.effectiveMax() - this.effectiveMin();
33
+ if (range <= 0) return 0;
34
+ return Math.max(0, Math.min(1, (this.value() - this.effectiveMin()) / range));
35
+ }, ...ngDevMode ? [{ debugName: "fraction" }] : /* istanbul ignore next */ []);
36
+ this.rangeArc = computed(() => this.getArcPath(135, 405), ...ngDevMode ? [{ debugName: "rangeArc" }] : /* istanbul ignore next */ []);
37
+ this.valueArc = computed(() => this.getArcPath(135, 135 + 270 * this.fraction()), ...ngDevMode ? [{ debugName: "valueArc" }] : /* istanbul ignore next */ []);
38
+ }
39
+ writeValue(value) {
40
+ const numeric = value === null || value === void 0 || value === "" ? NaN : Number(value);
41
+ this.value.set(this.clamp(Number.isFinite(numeric) ? numeric : this.effectiveMin()));
42
+ }
43
+ registerOnChange(fn) {
44
+ this.onChange = fn;
45
+ }
46
+ registerOnTouched(fn) {
47
+ this.onTouched = fn;
48
+ }
49
+ onBlur() {
50
+ this.onTouched();
51
+ this.touch.emit();
52
+ }
53
+ setDisabledState(isDisabled) {
54
+ this.formDisabled.set(isDisabled);
55
+ }
56
+ onPointerDown(event) {
57
+ if (this.effectiveDisabled() || this.readonly()) return;
58
+ this.dragging = true;
59
+ this.knobSvg()?.nativeElement.setPointerCapture(event.pointerId);
60
+ this.applyEvent(event);
61
+ }
62
+ onPointerMove(event) {
63
+ if (!this.dragging) return;
64
+ this.applyEvent(event);
65
+ }
66
+ onPointerUp(event) {
67
+ if (!this.dragging) return;
68
+ this.dragging = false;
69
+ try {
70
+ this.knobSvg()?.nativeElement.releasePointerCapture(event.pointerId);
71
+ } catch {}
72
+ this.change.emit(this.value());
73
+ this.end.emit(this.value());
74
+ }
75
+ updateByKey(step) {
76
+ if (this.effectiveDisabled() || this.readonly()) return;
77
+ this.setValue(this.value() + step);
78
+ this.onTouched();
79
+ }
80
+ applyEvent(event) {
81
+ const svg = this.knobSvg()?.nativeElement;
82
+ if (!svg) return;
83
+ const rect = svg.getBoundingClientRect();
84
+ const cx = rect.left + rect.width / 2;
85
+ const cy = rect.top + rect.height / 2;
86
+ let t = (Math.atan2(event.clientY - cy, event.clientX - cx) * 180 / Math.PI + 360) % 360 - 135;
87
+ if (t < 0) t += 360;
88
+ let fraction;
89
+ if (t > 270) fraction = 360 - t < t - 270 ? 0 : 1;
90
+ else fraction = t / 270;
91
+ const raw = this.effectiveMin() + fraction * (this.effectiveMax() - this.effectiveMin());
92
+ this.setValue(raw);
93
+ this.onTouched();
94
+ }
95
+ setValue(raw) {
96
+ const rounded = Math.round(raw / this.step()) * this.step();
97
+ const clamped = this.clamp(rounded);
98
+ this.value.set(clamped);
99
+ this.onChange(clamped);
100
+ }
101
+ clamp(value) {
102
+ return Math.max(this.effectiveMin(), Math.min(this.effectiveMax(), value));
103
+ }
104
+ getArcPath(startDeg, endDeg) {
105
+ const cx = this.center();
106
+ const cy = this.center();
107
+ const r = this.r();
108
+ const start = this.anglePoint(cx, cy, r, startDeg);
109
+ const end = this.anglePoint(cx, cy, r, endDeg);
110
+ const largeArc = endDeg - startDeg > 180 ? "1" : "0";
111
+ return `M ${start.x.toFixed(2)} ${start.y.toFixed(2)} A ${r.toFixed(2)} ${r.toFixed(2)} 0 ${largeArc} 1 ${end.x.toFixed(2)} ${end.y.toFixed(2)}`;
112
+ }
113
+ anglePoint(cx, cy, r, angleDeg) {
114
+ const rad = Math.PI * angleDeg / 180;
115
+ return {
116
+ x: cx + r * Math.cos(rad),
117
+ y: cy + r * Math.sin(rad)
118
+ };
119
+ }
120
+ static {
121
+ this.ɵfac = i0.ɵɵngDeclareFactory({
122
+ minVersion: "12.0.0",
123
+ version: "22.3.2",
124
+ ngImport: i0,
125
+ type: KnobComponent,
126
+ deps: [],
127
+ target: i0.ɵɵFactoryTarget.Component
128
+ });
129
+ }
130
+ static {
131
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
132
+ minVersion: "17.0.0",
133
+ version: "22.3.2",
134
+ type: KnobComponent,
135
+ isStandalone: true,
136
+ selector: "shk-knob",
137
+ inputs: {
138
+ value: {
139
+ classPropertyName: "value",
140
+ publicName: "value",
141
+ isSignal: true,
142
+ isRequired: false,
143
+ transformFunction: null
144
+ },
145
+ min: {
146
+ classPropertyName: "min",
147
+ publicName: "min",
148
+ isSignal: true,
149
+ isRequired: false,
150
+ transformFunction: null
151
+ },
152
+ max: {
153
+ classPropertyName: "max",
154
+ publicName: "max",
155
+ isSignal: true,
156
+ isRequired: false,
157
+ transformFunction: null
158
+ },
159
+ step: {
160
+ classPropertyName: "step",
161
+ publicName: "step",
162
+ isSignal: true,
163
+ isRequired: false,
164
+ transformFunction: null
165
+ },
166
+ size: {
167
+ classPropertyName: "size",
168
+ publicName: "size",
169
+ isSignal: true,
170
+ isRequired: false,
171
+ transformFunction: null
172
+ },
173
+ strokeWidth: {
174
+ classPropertyName: "strokeWidth",
175
+ publicName: "strokeWidth",
176
+ isSignal: true,
177
+ isRequired: false,
178
+ transformFunction: null
179
+ },
180
+ valueColor: {
181
+ classPropertyName: "valueColor",
182
+ publicName: "valueColor",
183
+ isSignal: true,
184
+ isRequired: false,
185
+ transformFunction: null
186
+ },
187
+ rangeColor: {
188
+ classPropertyName: "rangeColor",
189
+ publicName: "rangeColor",
190
+ isSignal: true,
191
+ isRequired: false,
192
+ transformFunction: null
193
+ },
194
+ showValue: {
195
+ classPropertyName: "showValue",
196
+ publicName: "showValue",
197
+ isSignal: true,
198
+ isRequired: false,
199
+ transformFunction: null
200
+ },
201
+ disabled: {
202
+ classPropertyName: "disabled",
203
+ publicName: "disabled",
204
+ isSignal: true,
205
+ isRequired: false,
206
+ transformFunction: null
207
+ },
208
+ readonly: {
209
+ classPropertyName: "readonly",
210
+ publicName: "readonly",
211
+ isSignal: true,
212
+ isRequired: false,
213
+ transformFunction: null
214
+ },
215
+ ariaLabel: {
216
+ classPropertyName: "ariaLabel",
217
+ publicName: "ariaLabel",
218
+ isSignal: true,
219
+ isRequired: false,
220
+ transformFunction: null
221
+ }
222
+ },
223
+ outputs: {
224
+ value: "valueChange",
225
+ change: "change",
226
+ end: "end",
227
+ touch: "touch"
228
+ },
229
+ providers: [{
230
+ provide: NG_VALUE_ACCESSOR,
231
+ useExisting: forwardRef(() => KnobComponent),
232
+ multi: true
233
+ }],
234
+ viewQueries: [{
235
+ propertyName: "knobSvg",
236
+ first: true,
237
+ predicate: ["knobSvg"],
238
+ descendants: true,
239
+ isSignal: true
240
+ }],
241
+ ngImport: i0,
242
+ template: `
158
243
  <div
159
244
  class="shk-knob"
160
245
  [class.shk-knob-disabled]="effectiveDisabled()"
@@ -169,11 +254,12 @@ class KnobComponent {
169
254
  role="slider"
170
255
  tabindex="0"
171
256
  [attr.aria-label]="ariaLabel() || 'Valor'"
172
- [attr.aria-valuemin]="min()"
173
- [attr.aria-valuemax]="max()"
257
+ [attr.aria-valuemin]="effectiveMin()"
258
+ [attr.aria-valuemax]="effectiveMax()"
174
259
  [attr.aria-valuenow]="value()"
175
260
  [class.shk-knob-svg-focusable]="!effectiveDisabled()"
176
261
  (pointerdown)="onPointerDown($event)"
262
+ (blur)="onBlur()"
177
263
  (pointermove)="onPointerMove($event)"
178
264
  (pointerup)="onPointerUp($event)"
179
265
  (pointercancel)="onPointerUp($event)"
@@ -201,11 +287,24 @@ class KnobComponent {
201
287
  <div class="shk-knob-label">{{ value() }}</div>
202
288
  }
203
289
  </div>
204
- `, isInline: true, styles: [".shk-knob{position:relative;display:inline-block}.shk-knob-svg{display:block;touch-action:none}.shk-knob-svg-focusable{cursor:pointer;outline:none}.shk-knob-svg-focusable:focus-visible{border-radius:9999px;outline:2px solid var(--shk-primary-400);outline-offset:2px}.shk-knob-disabled{opacity:.55}.shk-knob-disabled .shk-knob-svg{cursor:not-allowed}.shk-knob-label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:1.125rem;font-weight:600;color:var(--shk-surface-800);pointer-events:none;-webkit-user-select:none;user-select:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
205
- }
206
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: KnobComponent, decorators: [{
207
- type: Component,
208
- args: [{ selector: 'shk-knob', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: `
290
+ `,
291
+ isInline: true,
292
+ styles: [".shk-knob{position:relative;display:inline-block}.shk-knob-svg{display:block;touch-action:none}.shk-knob-svg-focusable{cursor:pointer;outline:none}.shk-knob-svg-focusable:focus-visible{border-radius:9999px;outline:2px solid var(--shk-primary-400);outline-offset:2px}.shk-knob-disabled{opacity:.55}.shk-knob-disabled .shk-knob-svg{cursor:not-allowed}.shk-knob-label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:1.125rem;font-weight:600;color:var(--shk-surface-800);pointer-events:none;-webkit-user-select:none;user-select:none}\n"],
293
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
294
+ });
295
+ }
296
+ };
297
+ i0.ɵɵngDeclareClassMetadata({
298
+ minVersion: "12.0.0",
299
+ version: "22.3.2",
300
+ ngImport: i0,
301
+ type: KnobComponent,
302
+ decorators: [{
303
+ type: Component,
304
+ args: [{
305
+ selector: "shk-knob",
306
+ changeDetection: ChangeDetectionStrategy.OnPush,
307
+ template: `
209
308
  <div
210
309
  class="shk-knob"
211
310
  [class.shk-knob-disabled]="effectiveDisabled()"
@@ -220,11 +319,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImpo
220
319
  role="slider"
221
320
  tabindex="0"
222
321
  [attr.aria-label]="ariaLabel() || 'Valor'"
223
- [attr.aria-valuemin]="min()"
224
- [attr.aria-valuemax]="max()"
322
+ [attr.aria-valuemin]="effectiveMin()"
323
+ [attr.aria-valuemax]="effectiveMax()"
225
324
  [attr.aria-valuenow]="value()"
226
325
  [class.shk-knob-svg-focusable]="!effectiveDisabled()"
227
326
  (pointerdown)="onPointerDown($event)"
327
+ (blur)="onBlur()"
228
328
  (pointermove)="onPointerMove($event)"
229
329
  (pointerup)="onPointerUp($event)"
230
330
  (pointercancel)="onPointerUp($event)"
@@ -252,18 +352,133 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImpo
252
352
  <div class="shk-knob-label">{{ value() }}</div>
253
353
  }
254
354
  </div>
255
- `, providers: [
256
- {
257
- provide: NG_VALUE_ACCESSOR,
258
- useExisting: forwardRef(() => KnobComponent),
259
- multi: true,
260
- },
261
- ], styles: [".shk-knob{position:relative;display:inline-block}.shk-knob-svg{display:block;touch-action:none}.shk-knob-svg-focusable{cursor:pointer;outline:none}.shk-knob-svg-focusable:focus-visible{border-radius:9999px;outline:2px solid var(--shk-primary-400);outline-offset:2px}.shk-knob-disabled{opacity:.55}.shk-knob-disabled .shk-knob-svg{cursor:not-allowed}.shk-knob-label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:1.125rem;font-weight:600;color:var(--shk-surface-800);pointer-events:none;-webkit-user-select:none;user-select:none}\n"] }]
262
- }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], strokeWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "strokeWidth", required: false }] }], valueColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueColor", required: false }] }], rangeColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "rangeColor", required: false }] }], showValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValue", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], change: [{ type: i0.Output, args: ["change"] }], end: [{ type: i0.Output, args: ["end"] }], knobSvg: [{ type: i0.ViewChild, args: ['knobSvg', { isSignal: true }] }] } });
263
-
264
- /**
265
- * Generated bundle index. Do not edit.
266
- */
267
-
355
+ `,
356
+ providers: [{
357
+ provide: NG_VALUE_ACCESSOR,
358
+ useExisting: forwardRef(() => KnobComponent),
359
+ multi: true
360
+ }],
361
+ styles: [".shk-knob{position:relative;display:inline-block}.shk-knob-svg{display:block;touch-action:none}.shk-knob-svg-focusable{cursor:pointer;outline:none}.shk-knob-svg-focusable:focus-visible{border-radius:9999px;outline:2px solid var(--shk-primary-400);outline-offset:2px}.shk-knob-disabled{opacity:.55}.shk-knob-disabled .shk-knob-svg{cursor:not-allowed}.shk-knob-label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:1.125rem;font-weight:600;color:var(--shk-surface-800);pointer-events:none;-webkit-user-select:none;user-select:none}\n"]
362
+ }]
363
+ }],
364
+ propDecorators: {
365
+ value: [{
366
+ type: i0.Input,
367
+ args: [{
368
+ isSignal: true,
369
+ alias: "value",
370
+ required: false
371
+ }]
372
+ }, {
373
+ type: i0.Output,
374
+ args: ["valueChange"]
375
+ }],
376
+ min: [{
377
+ type: i0.Input,
378
+ args: [{
379
+ isSignal: true,
380
+ alias: "min",
381
+ required: false
382
+ }]
383
+ }],
384
+ max: [{
385
+ type: i0.Input,
386
+ args: [{
387
+ isSignal: true,
388
+ alias: "max",
389
+ required: false
390
+ }]
391
+ }],
392
+ step: [{
393
+ type: i0.Input,
394
+ args: [{
395
+ isSignal: true,
396
+ alias: "step",
397
+ required: false
398
+ }]
399
+ }],
400
+ size: [{
401
+ type: i0.Input,
402
+ args: [{
403
+ isSignal: true,
404
+ alias: "size",
405
+ required: false
406
+ }]
407
+ }],
408
+ strokeWidth: [{
409
+ type: i0.Input,
410
+ args: [{
411
+ isSignal: true,
412
+ alias: "strokeWidth",
413
+ required: false
414
+ }]
415
+ }],
416
+ valueColor: [{
417
+ type: i0.Input,
418
+ args: [{
419
+ isSignal: true,
420
+ alias: "valueColor",
421
+ required: false
422
+ }]
423
+ }],
424
+ rangeColor: [{
425
+ type: i0.Input,
426
+ args: [{
427
+ isSignal: true,
428
+ alias: "rangeColor",
429
+ required: false
430
+ }]
431
+ }],
432
+ showValue: [{
433
+ type: i0.Input,
434
+ args: [{
435
+ isSignal: true,
436
+ alias: "showValue",
437
+ required: false
438
+ }]
439
+ }],
440
+ disabled: [{
441
+ type: i0.Input,
442
+ args: [{
443
+ isSignal: true,
444
+ alias: "disabled",
445
+ required: false
446
+ }]
447
+ }],
448
+ readonly: [{
449
+ type: i0.Input,
450
+ args: [{
451
+ isSignal: true,
452
+ alias: "readonly",
453
+ required: false
454
+ }]
455
+ }],
456
+ ariaLabel: [{
457
+ type: i0.Input,
458
+ args: [{
459
+ isSignal: true,
460
+ alias: "ariaLabel",
461
+ required: false
462
+ }]
463
+ }],
464
+ change: [{
465
+ type: i0.Output,
466
+ args: ["change"]
467
+ }],
468
+ end: [{
469
+ type: i0.Output,
470
+ args: ["end"]
471
+ }],
472
+ touch: [{
473
+ type: i0.Output,
474
+ args: ["touch"]
475
+ }],
476
+ knobSvg: [{
477
+ type: i0.ViewChild,
478
+ args: ["knobSvg", { isSignal: true }]
479
+ }]
480
+ }
481
+ });
268
482
  export { KnobComponent };
269
- //# sourceMappingURL=shirkasoft-ui-components-knob.mjs.map
483
+
484
+ //# sourceMappingURL=shirkasoft-ui-components-knob.mjs.map