@muxima-ui/core 1.0.0 → 1.1.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 (35) hide show
  1. package/README.md +7 -4
  2. package/fesm2022/muxima-ui-core-chips.mjs +349 -0
  3. package/fesm2022/muxima-ui-core-chips.mjs.map +1 -0
  4. package/fesm2022/muxima-ui-core-clipboard.mjs +110 -0
  5. package/fesm2022/muxima-ui-core-clipboard.mjs.map +1 -0
  6. package/fesm2022/muxima-ui-core-date-picker.mjs +494 -12
  7. package/fesm2022/muxima-ui-core-date-picker.mjs.map +1 -1
  8. package/fesm2022/muxima-ui-core-file-upload.mjs +392 -0
  9. package/fesm2022/muxima-ui-core-file-upload.mjs.map +1 -0
  10. package/fesm2022/muxima-ui-core-rating.mjs +212 -0
  11. package/fesm2022/muxima-ui-core-rating.mjs.map +1 -0
  12. package/fesm2022/muxima-ui-core-slider.mjs +211 -3
  13. package/fesm2022/muxima-ui-core-slider.mjs.map +1 -1
  14. package/fesm2022/muxima-ui-core-time-picker.mjs +389 -0
  15. package/fesm2022/muxima-ui-core-time-picker.mjs.map +1 -0
  16. package/fesm2022/muxima-ui-core.mjs +1 -1
  17. package/fesm2022/muxima-ui-core.mjs.map +1 -1
  18. package/package.json +21 -1
  19. package/styles/base.css +9 -1
  20. package/styles/components/chips.css +170 -0
  21. package/styles/components/clipboard.css +52 -0
  22. package/styles/components/date-picker.css +135 -0
  23. package/styles/components/file-upload.css +164 -0
  24. package/styles/components/rating.css +89 -0
  25. package/styles/components/slider.css +111 -0
  26. package/styles/components/time-picker.css +39 -0
  27. package/styles/muxima.css +5 -0
  28. package/types/muxima-ui-core-chips.d.ts +120 -0
  29. package/types/muxima-ui-core-clipboard.d.ts +42 -0
  30. package/types/muxima-ui-core-date-picker.d.ts +130 -2
  31. package/types/muxima-ui-core-file-upload.d.ts +96 -0
  32. package/types/muxima-ui-core-rating.d.ts +64 -0
  33. package/types/muxima-ui-core-slider.d.ts +68 -6
  34. package/types/muxima-ui-core-time-picker.d.ts +83 -0
  35. package/types/muxima-ui-core.d.ts +1 -1
@@ -0,0 +1,212 @@
1
+ import * as i0 from '@angular/core';
2
+ import { model, input, numberAttribute, booleanAttribute, inject, computed, signal, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { NgControl, Validators } from '@angular/forms';
4
+ import { MxFormField, mxUniqueId, MX_FORM_FIELD_CONTROL } from '@muxima-ui/core/form-field';
5
+
6
+ const STAR = 'M12 3.2l2.7 5.6 6.1.8-4.5 4.2 1.1 6.1L12 17l-5.4 2.9 1.1-6.1-4.5-4.2 6.1-.8z';
7
+ /**
8
+ * Avaliação com estrelas. Para escolher, são botões de rádio nativos (setas mudam a nota,
9
+ * Tab sai do grupo); em `readonly` é uma imagem com o texto "4 de 5 estrelas".
10
+ *
11
+ * ```html
12
+ * <mx-form-field>
13
+ * <label mxLabel>Como correu o atendimento?</label>
14
+ * <mx-rating formControlName="nota" />
15
+ * </mx-form-field>
16
+ * <mx-rating [value]="4.5" readonly />
17
+ * ```
18
+ */
19
+ class MxRating {
20
+ value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
21
+ max = input(5, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: numberAttribute });
22
+ /** Só mostra a nota (aceita meias estrelas, ex.: 4,5). */
23
+ readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
24
+ /** Carregar outra vez na nota escolhida limpa a avaliação. */
25
+ clearable = input(false, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
26
+ /** Mostra o número ao lado ("4,5"). */
27
+ showValue = input(false, { ...(ngDevMode ? { debugName: "showValue" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
28
+ starLabel = input((n) => (n === 1 ? '1 estrela' : `${n} estrelas`), ...(ngDevMode ? [{ debugName: "starLabel" }] : /* istanbul ignore next */ []));
29
+ locale = input('pt-AO', ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
30
+ size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
31
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
32
+ required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
33
+ invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
34
+ id = input(undefined, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
35
+ ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
36
+ field = inject(MxFormField, { optional: true });
37
+ ngControl = inject(NgControl, { self: true, optional: true });
38
+ star = STAR;
39
+ name = mxUniqueId('mx-rating');
40
+ generatedId = mxUniqueId('mx-rating-input');
41
+ controlId = computed(() => this.id() ?? this.generatedId, ...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
42
+ hover = signal(0, ...(ngDevMode ? [{ debugName: "hover" }] : /* istanbul ignore next */ []));
43
+ formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
44
+ isDisabled = computed(() => this.disabled() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
45
+ stars = computed(() => Array.from({ length: this.max() }, (_, i) => i + 1), ...(ngDevMode ? [{ debugName: "stars" }] : /* istanbul ignore next */ []));
46
+ shown = computed(() => this.hover() || this.value() || 0, ...(ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []));
47
+ valueText = computed(() => new Intl.NumberFormat(this.locale(), { maximumFractionDigits: 1 }).format(this.value() ?? 0), ...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
48
+ readonlyLabel = computed(() => `${this.valueText()} de ${this.max()} estrelas`, ...(ngDevMode ? [{ debugName: "readonlyLabel" }] : /* istanbul ignore next */ []));
49
+ onChange = () => { };
50
+ onTouched = () => { };
51
+ constructor() {
52
+ if (this.ngControl)
53
+ this.ngControl.valueAccessor = this;
54
+ }
55
+ fillPct(s) {
56
+ const v = this.value() ?? 0;
57
+ return Math.max(0, Math.min(1, v - (s - 1))) * 100;
58
+ }
59
+ choose(s) {
60
+ this.set(s);
61
+ }
62
+ onClick(s) {
63
+ // um clique na nota já escolhida não dispara "change": limpa se clearable
64
+ if (this.clearable() && this.value() === s) {
65
+ this.set(null);
66
+ this.hover.set(0);
67
+ }
68
+ }
69
+ set(v) {
70
+ this.value.set(v);
71
+ this.onChange(v);
72
+ }
73
+ // ---- MxFormFieldControl ----
74
+ errorState() {
75
+ if (this.invalid())
76
+ return true;
77
+ const c = this.ngControl;
78
+ return !!c && !!c.invalid && !!(c.touched || c.dirty);
79
+ }
80
+ isRequired() {
81
+ return this.required() || !!this.ngControl?.control?.hasValidator?.(Validators.required);
82
+ }
83
+ // ---- ControlValueAccessor ----
84
+ writeValue(value) {
85
+ this.value.set(value ?? null);
86
+ }
87
+ registerOnChange(fn) {
88
+ this.onChange = fn;
89
+ }
90
+ registerOnTouched(fn) {
91
+ this.onTouched = fn;
92
+ }
93
+ setDisabledState(isDisabled) {
94
+ this.formDisabled.set(isDisabled);
95
+ }
96
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxRating, deps: [], target: i0.ɵɵFactoryTarget.Component });
97
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: MxRating, isStandalone: true, selector: "mx-rating", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, starLabel: { classPropertyName: "starLabel", publicName: "starLabel", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "attr.data-size": "size() === \"md\" ? null : size()", "attr.data-readonly": "readonly() ? \"\" : null", "attr.data-disabled": "isDisabled() ? \"\" : null", "attr.data-invalid": "errorState() ? \"\" : null", "attr.aria-label": "null" }, classAttribute: "mx-rating" }, providers: [{ provide: MX_FORM_FIELD_CONTROL, useExisting: MxRating }], exportAs: ["mxRating"], ngImport: i0, template: `
98
+ @if (readonly()) {
99
+ <span class="mx-rating-stars" role="img" [attr.aria-label]="readonlyLabel()">
100
+ @for (s of stars(); track s) {
101
+ <span class="mx-rating-star" aria-hidden="true">
102
+ <svg viewBox="0 0 24 24"><path [attr.d]="star" /></svg>
103
+ <span class="mx-rating-star-fill" [style.width.%]="fillPct(s)"><svg viewBox="0 0 24 24"><path [attr.d]="star" /></svg></span>
104
+ </span>
105
+ }
106
+ </span>
107
+ } @else {
108
+ <div
109
+ class="mx-rating-stars"
110
+ role="radiogroup"
111
+ [attr.aria-labelledby]="field?.labelId() ?? null"
112
+ [attr.aria-label]="field?.labelId() ? null : (ariaLabel() ?? 'Avaliação')"
113
+ [attr.aria-describedby]="field?.describedBy() ?? null"
114
+ [attr.aria-required]="isRequired() ? 'true' : null"
115
+ [attr.aria-invalid]="errorState() ? 'true' : null"
116
+ (mouseleave)="hover.set(0)"
117
+ >
118
+ @for (s of stars(); track s) {
119
+ <label class="mx-rating-star" [attr.data-on]="s <= shown() ? '' : null" (mouseenter)="hover.set(isDisabled() ? 0 : s)">
120
+ <input
121
+ type="radio"
122
+ class="mx-rating-input"
123
+ [id]="s === 1 ? controlId() : null"
124
+ [name]="name"
125
+ [value]="s"
126
+ [checked]="value() === s"
127
+ [disabled]="isDisabled()"
128
+ (change)="choose(s)"
129
+ (click)="onClick(s)"
130
+ (blur)="onTouched()"
131
+ />
132
+ <span class="mx-visually-hidden">{{ starLabel()(s) }}</span>
133
+ <svg viewBox="0 0 24 24" aria-hidden="true"><path [attr.d]="star" /></svg>
134
+ </label>
135
+ }
136
+ </div>
137
+ }
138
+ @if (showValue() && (readonly() || value())) {
139
+ <span class="mx-rating-value" aria-hidden="true">{{ valueText() }}</span>
140
+ }
141
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
142
+ }
143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxRating, decorators: [{
144
+ type: Component,
145
+ args: [{
146
+ selector: 'mx-rating',
147
+ exportAs: 'mxRating',
148
+ providers: [{ provide: MX_FORM_FIELD_CONTROL, useExisting: MxRating }],
149
+ changeDetection: ChangeDetectionStrategy.OnPush,
150
+ encapsulation: ViewEncapsulation.None,
151
+ host: {
152
+ class: 'mx-rating',
153
+ '[attr.data-size]': 'size() === "md" ? null : size()',
154
+ '[attr.data-readonly]': 'readonly() ? "" : null',
155
+ '[attr.data-disabled]': 'isDisabled() ? "" : null',
156
+ '[attr.data-invalid]': 'errorState() ? "" : null',
157
+ '[attr.aria-label]': 'null',
158
+ },
159
+ template: `
160
+ @if (readonly()) {
161
+ <span class="mx-rating-stars" role="img" [attr.aria-label]="readonlyLabel()">
162
+ @for (s of stars(); track s) {
163
+ <span class="mx-rating-star" aria-hidden="true">
164
+ <svg viewBox="0 0 24 24"><path [attr.d]="star" /></svg>
165
+ <span class="mx-rating-star-fill" [style.width.%]="fillPct(s)"><svg viewBox="0 0 24 24"><path [attr.d]="star" /></svg></span>
166
+ </span>
167
+ }
168
+ </span>
169
+ } @else {
170
+ <div
171
+ class="mx-rating-stars"
172
+ role="radiogroup"
173
+ [attr.aria-labelledby]="field?.labelId() ?? null"
174
+ [attr.aria-label]="field?.labelId() ? null : (ariaLabel() ?? 'Avaliação')"
175
+ [attr.aria-describedby]="field?.describedBy() ?? null"
176
+ [attr.aria-required]="isRequired() ? 'true' : null"
177
+ [attr.aria-invalid]="errorState() ? 'true' : null"
178
+ (mouseleave)="hover.set(0)"
179
+ >
180
+ @for (s of stars(); track s) {
181
+ <label class="mx-rating-star" [attr.data-on]="s <= shown() ? '' : null" (mouseenter)="hover.set(isDisabled() ? 0 : s)">
182
+ <input
183
+ type="radio"
184
+ class="mx-rating-input"
185
+ [id]="s === 1 ? controlId() : null"
186
+ [name]="name"
187
+ [value]="s"
188
+ [checked]="value() === s"
189
+ [disabled]="isDisabled()"
190
+ (change)="choose(s)"
191
+ (click)="onClick(s)"
192
+ (blur)="onTouched()"
193
+ />
194
+ <span class="mx-visually-hidden">{{ starLabel()(s) }}</span>
195
+ <svg viewBox="0 0 24 24" aria-hidden="true"><path [attr.d]="star" /></svg>
196
+ </label>
197
+ }
198
+ </div>
199
+ }
200
+ @if (showValue() && (readonly() || value())) {
201
+ <span class="mx-rating-value" aria-hidden="true">{{ valueText() }}</span>
202
+ }
203
+ `,
204
+ }]
205
+ }], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], showValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValue", required: false }] }], starLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "starLabel", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
206
+
207
+ /**
208
+ * Generated bundle index. Do not edit.
209
+ */
210
+
211
+ export { MxRating };
212
+ //# sourceMappingURL=muxima-ui-core-rating.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"muxima-ui-core-rating.mjs","sources":["../../../projects/core/rating/rating.ts","../../../projects/core/rating/muxima-ui-core-rating.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n inject,\n input,\n model,\n numberAttribute,\n signal,\n} from '@angular/core';\nimport { ControlValueAccessor, NgControl, Validators } from '@angular/forms';\nimport { MX_FORM_FIELD_CONTROL, MxFormField, MxFormFieldControl, mxUniqueId } from '@muxima-ui/core/form-field';\n\nconst STAR = 'M12 3.2l2.7 5.6 6.1.8-4.5 4.2 1.1 6.1L12 17l-5.4 2.9 1.1-6.1-4.5-4.2 6.1-.8z';\n\n/**\n * Avaliação com estrelas. Para escolher, são botões de rádio nativos (setas mudam a nota,\n * Tab sai do grupo); em `readonly` é uma imagem com o texto \"4 de 5 estrelas\".\n *\n * ```html\n * <mx-form-field>\n * <label mxLabel>Como correu o atendimento?</label>\n * <mx-rating formControlName=\"nota\" />\n * </mx-form-field>\n * <mx-rating [value]=\"4.5\" readonly />\n * ```\n */\n@Component({\n selector: 'mx-rating',\n exportAs: 'mxRating',\n providers: [{ provide: MX_FORM_FIELD_CONTROL, useExisting: MxRating }],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'mx-rating',\n '[attr.data-size]': 'size() === \"md\" ? null : size()',\n '[attr.data-readonly]': 'readonly() ? \"\" : null',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : null',\n '[attr.data-invalid]': 'errorState() ? \"\" : null',\n '[attr.aria-label]': 'null',\n },\n template: `\n @if (readonly()) {\n <span class=\"mx-rating-stars\" role=\"img\" [attr.aria-label]=\"readonlyLabel()\">\n @for (s of stars(); track s) {\n <span class=\"mx-rating-star\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\"><path [attr.d]=\"star\" /></svg>\n <span class=\"mx-rating-star-fill\" [style.width.%]=\"fillPct(s)\"><svg viewBox=\"0 0 24 24\"><path [attr.d]=\"star\" /></svg></span>\n </span>\n }\n </span>\n } @else {\n <div\n class=\"mx-rating-stars\"\n role=\"radiogroup\"\n [attr.aria-labelledby]=\"field?.labelId() ?? null\"\n [attr.aria-label]=\"field?.labelId() ? null : (ariaLabel() ?? 'Avaliação')\"\n [attr.aria-describedby]=\"field?.describedBy() ?? null\"\n [attr.aria-required]=\"isRequired() ? 'true' : null\"\n [attr.aria-invalid]=\"errorState() ? 'true' : null\"\n (mouseleave)=\"hover.set(0)\"\n >\n @for (s of stars(); track s) {\n <label class=\"mx-rating-star\" [attr.data-on]=\"s <= shown() ? '' : null\" (mouseenter)=\"hover.set(isDisabled() ? 0 : s)\">\n <input\n type=\"radio\"\n class=\"mx-rating-input\"\n [id]=\"s === 1 ? controlId() : null\"\n [name]=\"name\"\n [value]=\"s\"\n [checked]=\"value() === s\"\n [disabled]=\"isDisabled()\"\n (change)=\"choose(s)\"\n (click)=\"onClick(s)\"\n (blur)=\"onTouched()\"\n />\n <span class=\"mx-visually-hidden\">{{ starLabel()(s) }}</span>\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path [attr.d]=\"star\" /></svg>\n </label>\n }\n </div>\n }\n @if (showValue() && (readonly() || value())) {\n <span class=\"mx-rating-value\" aria-hidden=\"true\">{{ valueText() }}</span>\n }\n `,\n})\nexport class MxRating implements ControlValueAccessor, MxFormFieldControl {\n readonly value = model<number | null>(null);\n readonly max = input(5, { transform: numberAttribute });\n /** Só mostra a nota (aceita meias estrelas, ex.: 4,5). */\n readonly readonly = input(false, { transform: booleanAttribute });\n /** Carregar outra vez na nota escolhida limpa a avaliação. */\n readonly clearable = input(false, { transform: booleanAttribute });\n /** Mostra o número ao lado (\"4,5\"). */\n readonly showValue = input(false, { transform: booleanAttribute });\n readonly starLabel = input<(n: number) => string>((n) => (n === 1 ? '1 estrela' : `${n} estrelas`));\n readonly locale = input('pt-AO');\n readonly size = input<'sm' | 'md' | 'lg'>('md');\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly required = input(false, { transform: booleanAttribute });\n readonly invalid = input(false, { transform: booleanAttribute });\n readonly id = input<string | undefined>(undefined);\n readonly ariaLabel = input<string | undefined>(undefined, { alias: 'aria-label' });\n\n protected readonly field = inject(MxFormField, { optional: true });\n private readonly ngControl = inject(NgControl, { self: true, optional: true });\n protected readonly star = STAR;\n protected readonly name = mxUniqueId('mx-rating');\n private readonly generatedId = mxUniqueId('mx-rating-input');\n readonly controlId = computed(() => this.id() ?? this.generatedId);\n protected readonly hover = signal(0);\n private readonly formDisabled = signal(false);\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled());\n protected readonly stars = computed(() => Array.from({ length: this.max() }, (_, i) => i + 1));\n protected readonly shown = computed(() => this.hover() || this.value() || 0);\n protected readonly valueText = computed(() =>\n new Intl.NumberFormat(this.locale(), { maximumFractionDigits: 1 }).format(this.value() ?? 0),\n );\n protected readonly readonlyLabel = computed(() => `${this.valueText()} de ${this.max()} estrelas`);\n\n private onChange: (value: number | null) => void = () => {};\n protected onTouched: () => void = () => {};\n\n constructor() {\n if (this.ngControl) this.ngControl.valueAccessor = this;\n }\n\n protected fillPct(s: number): number {\n const v = this.value() ?? 0;\n return Math.max(0, Math.min(1, v - (s - 1))) * 100;\n }\n\n protected choose(s: number): void {\n this.set(s);\n }\n\n protected onClick(s: number): void {\n // um clique na nota já escolhida não dispara \"change\": limpa se clearable\n if (this.clearable() && this.value() === s) {\n this.set(null);\n this.hover.set(0);\n }\n }\n\n private set(v: number | null): void {\n this.value.set(v);\n this.onChange(v);\n }\n\n // ---- MxFormFieldControl ----\n errorState(): boolean {\n if (this.invalid()) return true;\n const c = this.ngControl;\n return !!c && !!c.invalid && !!(c.touched || c.dirty);\n }\n isRequired(): boolean {\n return this.required() || !!this.ngControl?.control?.hasValidator?.(Validators.required);\n }\n\n // ---- ControlValueAccessor ----\n writeValue(value: number | null): void {\n this.value.set(value ?? null);\n }\n registerOnChange(fn: (value: number | null) => void): void {\n this.onChange = fn;\n }\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n setDisabledState(isDisabled: boolean): void {\n this.formDisabled.set(isDisabled);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAeA,MAAM,IAAI,GAAG,8EAA8E;AAE3F;;;;;;;;;;;AAWG;MA6DU,QAAQ,CAAA;AACV,IAAA,KAAK,GAAG,KAAK,CAAgB,IAAI,4EAAC;IAClC,GAAG,GAAG,KAAK,CAAC,CAAC,2EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;IAE9C,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAExD,SAAS,GAAG,KAAK,CAAC,KAAK,iFAAI,SAAS,EAAE,gBAAgB,EAAA,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ativeControl, MX_FORM_FIELD_CONTROL } from '@muxima-ui/core/form-field';
2
+ import { input, afterEveryRender, inject, DestroyRef, Directive, model, numberAttribute, booleanAttribute, computed, signal, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { MxNativeControl, MX_FORM_FIELD_CONTROL, MxFormField, mxUniqueId } from '@muxima-ui/core/form-field';
4
+ import { NgControl, Validators } from '@angular/forms';
4
5
 
5
6
  /**
6
7
  * Cursor de intervalo sobre o `<input type="range">` nativo: setas, Page Up/Down,
@@ -52,9 +53,216 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImpo
52
53
  }]
53
54
  }], ctorParameters: () => [], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
54
55
 
56
+ /**
57
+ * Intervalo com dois cursores (mínimo e máximo), feito com dois `<input type="range">`
58
+ * nativos: cada cursor tem o seu teclado e é anunciado como "Preço, mínimo, 20 000 Kz".
59
+ *
60
+ * ```html
61
+ * <mx-form-field>
62
+ * <label mxLabel>Preço</label>
63
+ * <mx-range-slider formControlName="preco" [min]="0" [max]="100000" [step]="1000" [format]="kz" />
64
+ * </mx-form-field>
65
+ * ```
66
+ *
67
+ * O valor é `[mínimo, máximo]`. Os cursores não se cruzam: ficam a pelo menos `minGap` um do outro.
68
+ */
69
+ class MxRangeSlider {
70
+ value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
71
+ min = input(0, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: numberAttribute });
72
+ max = input(100, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: numberAttribute });
73
+ step = input(1, { ...(ngDevMode ? { debugName: "step" } : /* istanbul ignore next */ {}), transform: numberAttribute });
74
+ /** Distância mínima entre os dois cursores. */
75
+ minGap = input(0, { ...(ngDevMode ? { debugName: "minGap" } : /* istanbul ignore next */ {}), transform: numberAttribute });
76
+ /** Texto de cada valor, para o leitor de ecrã e as etiquetas. */
77
+ format = input((v) => String(v), ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
78
+ /** Mostra os dois valores por baixo da barra. */
79
+ showValues = input(false, { ...(ngDevMode ? { debugName: "showValues" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
80
+ lowLabel = input('mínimo', ...(ngDevMode ? [{ debugName: "lowLabel" }] : /* istanbul ignore next */ []));
81
+ highLabel = input('máximo', ...(ngDevMode ? [{ debugName: "highLabel" }] : /* istanbul ignore next */ []));
82
+ size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
83
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
84
+ required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
85
+ invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
86
+ id = input(undefined, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
87
+ ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
88
+ field = inject(MxFormField, { optional: true });
89
+ ngControl = inject(NgControl, { self: true, optional: true });
90
+ generatedId = mxUniqueId('mx-range');
91
+ controlId = computed(() => this.id() ?? this.generatedId, ...(ngDevMode ? [{ debugName: "controlId" }] : /* istanbul ignore next */ []));
92
+ lowId = mxUniqueId('mx-range-low');
93
+ highId = mxUniqueId('mx-range-high');
94
+ nameId = mxUniqueId('mx-range-name');
95
+ formDisabled = signal(false, ...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
96
+ isDisabled = computed(() => this.disabled() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
97
+ low = computed(() => this.value()?.[0] ?? this.min(), ...(ngDevMode ? [{ debugName: "low" }] : /* istanbul ignore next */ []));
98
+ high = computed(() => this.value()?.[1] ?? this.max(), ...(ngDevMode ? [{ debugName: "high" }] : /* istanbul ignore next */ []));
99
+ pct(v) {
100
+ const span = this.max() - this.min();
101
+ return span > 0 ? ((v - this.min()) / span) * 100 : 0;
102
+ }
103
+ fromPct = computed(() => this.pct(this.low()), ...(ngDevMode ? [{ debugName: "fromPct" }] : /* istanbul ignore next */ []));
104
+ toPct = computed(() => this.pct(this.high()), ...(ngDevMode ? [{ debugName: "toPct" }] : /* istanbul ignore next */ []));
105
+ onChange = () => { };
106
+ onTouched = () => { };
107
+ constructor() {
108
+ if (this.ngControl)
109
+ this.ngControl.valueAccessor = this;
110
+ }
111
+ labelledBy(partId) {
112
+ return `${this.field?.labelId() ?? this.nameId} ${partId}`;
113
+ }
114
+ onInput(which, event) {
115
+ const el = event.target;
116
+ let v = Number(el.value);
117
+ const gap = this.minGap();
118
+ if (which === 0)
119
+ v = Math.min(v, this.high() - gap);
120
+ else
121
+ v = Math.max(v, this.low() + gap);
122
+ // o input nativo pode ter passado o outro cursor: repõe a posição
123
+ el.value = String(v);
124
+ const next = which === 0 ? [v, this.high()] : [this.low(), v];
125
+ this.value.set(next);
126
+ this.onChange(next);
127
+ }
128
+ // ---- MxFormFieldControl ----
129
+ errorState() {
130
+ if (this.invalid())
131
+ return true;
132
+ const c = this.ngControl;
133
+ return !!c && !!c.invalid && !!(c.touched || c.dirty);
134
+ }
135
+ isRequired() {
136
+ return this.required() || !!this.ngControl?.control?.hasValidator?.(Validators.required);
137
+ }
138
+ // ---- ControlValueAccessor ----
139
+ writeValue(value) {
140
+ this.value.set(value ? [value[0], value[1]] : null);
141
+ }
142
+ registerOnChange(fn) {
143
+ this.onChange = fn;
144
+ }
145
+ registerOnTouched(fn) {
146
+ this.onTouched = fn;
147
+ }
148
+ setDisabledState(isDisabled) {
149
+ this.formDisabled.set(isDisabled);
150
+ }
151
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxRangeSlider, deps: [], target: i0.ɵɵFactoryTarget.Component });
152
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: MxRangeSlider, isStandalone: true, selector: "mx-range-slider", 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 }, minGap: { classPropertyName: "minGap", publicName: "minGap", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, showValues: { classPropertyName: "showValues", publicName: "showValues", isSignal: true, isRequired: false, transformFunction: null }, lowLabel: { classPropertyName: "lowLabel", publicName: "lowLabel", isSignal: true, isRequired: false, transformFunction: null }, highLabel: { classPropertyName: "highLabel", publicName: "highLabel", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "attr.data-size": "size() === \"md\" ? null : size()", "attr.data-disabled": "isDisabled() ? \"\" : null", "attr.data-invalid": "errorState() ? \"\" : null", "attr.aria-label": "null", "style.--mx-range-from": "fromPct() + \"%\"", "style.--mx-range-to": "toPct() + \"%\"" }, classAttribute: "mx-range-slider" }, providers: [{ provide: MX_FORM_FIELD_CONTROL, useExisting: MxRangeSlider }], exportAs: ["mxRangeSlider"], ngImport: i0, template: `
153
+ <div class="mx-range-slider-track" aria-hidden="true"><div class="mx-range-slider-fill"></div></div>
154
+ <input
155
+ type="range"
156
+ class="mx-range-slider-input"
157
+ [id]="controlId()"
158
+ [min]="min()"
159
+ [max]="max()"
160
+ [step]="step()"
161
+ [value]="low()"
162
+ [disabled]="isDisabled()"
163
+ [attr.aria-labelledby]="labelledBy(lowId)"
164
+ [attr.aria-valuetext]="format()(low())"
165
+ [attr.aria-describedby]="field?.describedBy() ?? null"
166
+ [attr.aria-invalid]="errorState() ? 'true' : null"
167
+ (input)="onInput(0, $event)"
168
+ (blur)="onTouched()"
169
+ />
170
+ <input
171
+ type="range"
172
+ class="mx-range-slider-input"
173
+ [min]="min()"
174
+ [max]="max()"
175
+ [step]="step()"
176
+ [value]="high()"
177
+ [disabled]="isDisabled()"
178
+ [attr.aria-labelledby]="labelledBy(highId)"
179
+ [attr.aria-valuetext]="format()(high())"
180
+ [attr.aria-describedby]="field?.describedBy() ?? null"
181
+ [attr.aria-invalid]="errorState() ? 'true' : null"
182
+ (input)="onInput(1, $event)"
183
+ (blur)="onTouched()"
184
+ />
185
+ <span class="mx-visually-hidden" [id]="lowId">{{ lowLabel() }}</span>
186
+ <span class="mx-visually-hidden" [id]="highId">{{ highLabel() }}</span>
187
+ @if (!field?.labelId()) {
188
+ <span class="mx-visually-hidden" [id]="nameId">{{ ariaLabel() }}</span>
189
+ }
190
+ @if (showValues()) {
191
+ <div class="mx-range-slider-values" aria-hidden="true">
192
+ <span>{{ format()(low()) }}</span>
193
+ <span>{{ format()(high()) }}</span>
194
+ </div>
195
+ }
196
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
197
+ }
198
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxRangeSlider, decorators: [{
199
+ type: Component,
200
+ args: [{
201
+ selector: 'mx-range-slider',
202
+ exportAs: 'mxRangeSlider',
203
+ providers: [{ provide: MX_FORM_FIELD_CONTROL, useExisting: MxRangeSlider }],
204
+ changeDetection: ChangeDetectionStrategy.OnPush,
205
+ encapsulation: ViewEncapsulation.None,
206
+ host: {
207
+ class: 'mx-range-slider',
208
+ '[attr.data-size]': 'size() === "md" ? null : size()',
209
+ '[attr.data-disabled]': 'isDisabled() ? "" : null',
210
+ '[attr.data-invalid]': 'errorState() ? "" : null',
211
+ '[attr.aria-label]': 'null',
212
+ '[style.--mx-range-from]': 'fromPct() + "%"',
213
+ '[style.--mx-range-to]': 'toPct() + "%"',
214
+ },
215
+ template: `
216
+ <div class="mx-range-slider-track" aria-hidden="true"><div class="mx-range-slider-fill"></div></div>
217
+ <input
218
+ type="range"
219
+ class="mx-range-slider-input"
220
+ [id]="controlId()"
221
+ [min]="min()"
222
+ [max]="max()"
223
+ [step]="step()"
224
+ [value]="low()"
225
+ [disabled]="isDisabled()"
226
+ [attr.aria-labelledby]="labelledBy(lowId)"
227
+ [attr.aria-valuetext]="format()(low())"
228
+ [attr.aria-describedby]="field?.describedBy() ?? null"
229
+ [attr.aria-invalid]="errorState() ? 'true' : null"
230
+ (input)="onInput(0, $event)"
231
+ (blur)="onTouched()"
232
+ />
233
+ <input
234
+ type="range"
235
+ class="mx-range-slider-input"
236
+ [min]="min()"
237
+ [max]="max()"
238
+ [step]="step()"
239
+ [value]="high()"
240
+ [disabled]="isDisabled()"
241
+ [attr.aria-labelledby]="labelledBy(highId)"
242
+ [attr.aria-valuetext]="format()(high())"
243
+ [attr.aria-describedby]="field?.describedBy() ?? null"
244
+ [attr.aria-invalid]="errorState() ? 'true' : null"
245
+ (input)="onInput(1, $event)"
246
+ (blur)="onTouched()"
247
+ />
248
+ <span class="mx-visually-hidden" [id]="lowId">{{ lowLabel() }}</span>
249
+ <span class="mx-visually-hidden" [id]="highId">{{ highLabel() }}</span>
250
+ @if (!field?.labelId()) {
251
+ <span class="mx-visually-hidden" [id]="nameId">{{ ariaLabel() }}</span>
252
+ }
253
+ @if (showValues()) {
254
+ <div class="mx-range-slider-values" aria-hidden="true">
255
+ <span>{{ format()(low()) }}</span>
256
+ <span>{{ format()(high()) }}</span>
257
+ </div>
258
+ }
259
+ `,
260
+ }]
261
+ }], ctorParameters: () => [], 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 }] }], minGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "minGap", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], showValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValues", required: false }] }], lowLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "lowLabel", required: false }] }], highLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "highLabel", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
262
+
55
263
  /**
56
264
  * Generated bundle index. Do not edit.
57
265
  */
58
266
 
59
- export { MxSlider };
267
+ export { MxRangeSlider, MxSlider };
60
268
  //# sourceMappingURL=muxima-ui-core-slider.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"muxima-ui-core-slider.mjs","sources":["../../../projects/core/slider/slider.ts","../../../projects/core/slider/muxima-ui-core-slider.ts"],"sourcesContent":["import { DestroyRef, Directive, OnInit, afterEveryRender, inject, input } from '@angular/core';\nimport { MX_FORM_FIELD_CONTROL, MxNativeControl } from '@muxima-ui/core/form-field';\n\n/**\n * Cursor de intervalo sobre o `<input type=\"range\">` nativo: setas, Page Up/Down,\n * Home e End funcionam como no navegador, e o valor é anunciado pelo leitor de ecrã.\n *\n * ```html\n * <mx-form-field>\n * <label mxLabel>Orçamento (mil Kz)</label>\n * <input type=\"range\" mxSlider min=\"0\" max=\"500\" step=\"10\" formControlName=\"orcamento\" />\n * </mx-form-field>\n * ```\n */\n@Directive({\n selector: 'input[type=range][mxSlider]',\n exportAs: 'mxSlider',\n providers: [{ provide: MX_FORM_FIELD_CONTROL, useExisting: MxSlider }],\n host: {\n class: 'mx-slider',\n '[attr.data-size]': 'size() === \"md\" ? null : size()',\n '(input)': 'paint()',\n },\n})\nexport class MxSlider extends MxNativeControl implements OnInit {\n /** Espessura da barra: sm 4 px, md 6 px, lg 8 px. */\n readonly size = input<'sm' | 'md' | 'lg'>('md');\n\n constructor() {\n super();\n // O valor pode mudar por formulário ou atributo sem evento \"input\": repinta após cada render.\n afterEveryRender({ write: () => this.paint() });\n }\n\n private readonly destroyRef = inject(DestroyRef);\n\n ngOnInit(): void {\n // setValue/patchValue escrevem no input sem evento nem render: repinta quando o valor muda.\n const sub = this.ngControl?.valueChanges?.subscribe(() => this.paint());\n if (sub) this.destroyRef.onDestroy(() => sub.unsubscribe());\n }\n\n protected paint(): void {\n const el = this.element as HTMLInputElement;\n const min = Number(el.min || 0);\n const max = Number(el.max || 100);\n const pct = max > min ? ((Number(el.value) - min) / (max - min)) * 100 : 0;\n el.style.setProperty('--mx-slider-fill', `${pct}%`);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA;;;;;;;;;;AAUG;AAWG,MAAO,QAAS,SAAQ,eAAe,CAAA;;AAElC,IAAA,IAAI,GA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,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,SAAA,EAAA,EAAA,UAAA,EAAA,EAAA,gBAAA,EAAA,mCAAA,EAAA,EAAA,cAAA,EAAA,WAAA,EAAA,EAAA,SAAA,EAPR,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,eAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAO3D,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAVpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,6BAA6B;AACvC,oBAAA,QAAQ,EAAE,UAAU;oBACpB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAA,QAAU,EAAE,CAAC;AACtE,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,WAAW;AAClB,wBAAA,kBAAkB,EAAE,iCAAiC;AACrD,wBAAA,SAAS,EAAE,SAAS;AACrB,qBAAA;AACF,iBAAA;;;ACvBD;;AAEG;;"}
1
+ {"version":3,"file":"muxima-ui-core-slider.mjs","sources":["../../../projects/core/slider/slider.ts","../../../projects/core/slider/range-slider.ts","../../../projects/core/slider/muxima-ui-core-slider.ts"],"sourcesContent":["import { DestroyRef, Directive, OnInit, afterEveryRender, inject, input } from '@angular/core';\nimport { MX_FORM_FIELD_CONTROL, MxNativeControl } from '@muxima-ui/core/form-field';\n\n/**\n * Cursor de intervalo sobre o `<input type=\"range\">` nativo: setas, Page Up/Down,\n * Home e End funcionam como no navegador, e o valor é anunciado pelo leitor de ecrã.\n *\n * ```html\n * <mx-form-field>\n * <label mxLabel>Orçamento (mil Kz)</label>\n * <input type=\"range\" mxSlider min=\"0\" max=\"500\" step=\"10\" formControlName=\"orcamento\" />\n * </mx-form-field>\n * ```\n */\n@Directive({\n selector: 'input[type=range][mxSlider]',\n exportAs: 'mxSlider',\n providers: [{ provide: MX_FORM_FIELD_CONTROL, useExisting: MxSlider }],\n host: {\n class: 'mx-slider',\n '[attr.data-size]': 'size() === \"md\" ? null : size()',\n '(input)': 'paint()',\n },\n})\nexport class MxSlider extends MxNativeControl implements OnInit {\n /** Espessura da barra: sm 4 px, md 6 px, lg 8 px. */\n readonly size = input<'sm' | 'md' | 'lg'>('md');\n\n constructor() {\n super();\n // O valor pode mudar por formulário ou atributo sem evento \"input\": repinta após cada render.\n afterEveryRender({ write: () => this.paint() });\n }\n\n private readonly destroyRef = inject(DestroyRef);\n\n ngOnInit(): void {\n // setValue/patchValue escrevem no input sem evento nem render: repinta quando o valor muda.\n const sub = this.ngControl?.valueChanges?.subscribe(() => this.paint());\n if (sub) this.destroyRef.onDestroy(() => sub.unsubscribe());\n }\n\n protected paint(): void {\n const el = this.element as HTMLInputElement;\n const min = Number(el.min || 0);\n const max = Number(el.max || 100);\n const pct = max > min ? ((Number(el.value) - min) / (max - min)) * 100 : 0;\n el.style.setProperty('--mx-slider-fill', `${pct}%`);\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n inject,\n input,\n model,\n numberAttribute,\n signal,\n} from '@angular/core';\nimport { ControlValueAccessor, NgControl, Validators } from '@angular/forms';\nimport { MX_FORM_FIELD_CONTROL, MxFormField, MxFormFieldControl, mxUniqueId } from '@muxima-ui/core/form-field';\n\n/**\n * Intervalo com dois cursores (mínimo e máximo), feito com dois `<input type=\"range\">`\n * nativos: cada cursor tem o seu teclado e é anunciado como \"Preço, mínimo, 20 000 Kz\".\n *\n * ```html\n * <mx-form-field>\n * <label mxLabel>Preço</label>\n * <mx-range-slider formControlName=\"preco\" [min]=\"0\" [max]=\"100000\" [step]=\"1000\" [format]=\"kz\" />\n * </mx-form-field>\n * ```\n *\n * O valor é `[mínimo, máximo]`. Os cursores não se cruzam: ficam a pelo menos `minGap` um do outro.\n */\n@Component({\n selector: 'mx-range-slider',\n exportAs: 'mxRangeSlider',\n providers: [{ provide: MX_FORM_FIELD_CONTROL, useExisting: MxRangeSlider }],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'mx-range-slider',\n '[attr.data-size]': 'size() === \"md\" ? null : size()',\n '[attr.data-disabled]': 'isDisabled() ? \"\" : null',\n '[attr.data-invalid]': 'errorState() ? \"\" : null',\n '[attr.aria-label]': 'null',\n '[style.--mx-range-from]': 'fromPct() + \"%\"',\n '[style.--mx-range-to]': 'toPct() + \"%\"',\n },\n template: `\n <div class=\"mx-range-slider-track\" aria-hidden=\"true\"><div class=\"mx-range-slider-fill\"></div></div>\n <input\n type=\"range\"\n class=\"mx-range-slider-input\"\n [id]=\"controlId()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [step]=\"step()\"\n [value]=\"low()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-labelledby]=\"labelledBy(lowId)\"\n [attr.aria-valuetext]=\"format()(low())\"\n [attr.aria-describedby]=\"field?.describedBy() ?? null\"\n [attr.aria-invalid]=\"errorState() ? 'true' : null\"\n (input)=\"onInput(0, $event)\"\n (blur)=\"onTouched()\"\n />\n <input\n type=\"range\"\n class=\"mx-range-slider-input\"\n [min]=\"min()\"\n [max]=\"max()\"\n [step]=\"step()\"\n [value]=\"high()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-labelledby]=\"labelledBy(highId)\"\n [attr.aria-valuetext]=\"format()(high())\"\n [attr.aria-describedby]=\"field?.describedBy() ?? null\"\n [attr.aria-invalid]=\"errorState() ? 'true' : null\"\n (input)=\"onInput(1, $event)\"\n (blur)=\"onTouched()\"\n />\n <span class=\"mx-visually-hidden\" [id]=\"lowId\">{{ lowLabel() }}</span>\n <span class=\"mx-visually-hidden\" [id]=\"highId\">{{ highLabel() }}</span>\n @if (!field?.labelId()) {\n <span class=\"mx-visually-hidden\" [id]=\"nameId\">{{ ariaLabel() }}</span>\n }\n @if (showValues()) {\n <div class=\"mx-range-slider-values\" aria-hidden=\"true\">\n <span>{{ format()(low()) }}</span>\n <span>{{ format()(high()) }}</span>\n </div>\n }\n `,\n})\nexport class MxRangeSlider implements ControlValueAccessor, MxFormFieldControl {\n readonly value = model<[number, number] | null>(null);\n readonly min = input(0, { transform: numberAttribute });\n readonly max = input(100, { transform: numberAttribute });\n readonly step = input(1, { transform: numberAttribute });\n /** Distância mínima entre os dois cursores. */\n readonly minGap = input(0, { transform: numberAttribute });\n /** Texto de cada valor, para o leitor de ecrã e as etiquetas. */\n readonly format = input<(v: number) => string>((v) => String(v));\n /** Mostra os dois valores por baixo da barra. */\n readonly showValues = input(false, { transform: booleanAttribute });\n readonly lowLabel = input('mínimo');\n readonly highLabel = input('máximo');\n readonly size = input<'sm' | 'md' | 'lg'>('md');\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly required = input(false, { transform: booleanAttribute });\n readonly invalid = input(false, { transform: booleanAttribute });\n readonly id = input<string | undefined>(undefined);\n readonly ariaLabel = input<string | undefined>(undefined, { alias: 'aria-label' });\n\n protected readonly field = inject(MxFormField, { optional: true });\n private readonly ngControl = inject(NgControl, { self: true, optional: true });\n private readonly generatedId = mxUniqueId('mx-range');\n readonly controlId = computed(() => this.id() ?? this.generatedId);\n protected readonly lowId = mxUniqueId('mx-range-low');\n protected readonly highId = mxUniqueId('mx-range-high');\n protected readonly nameId = mxUniqueId('mx-range-name');\n private readonly formDisabled = signal(false);\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled());\n\n protected readonly low = computed(() => this.value()?.[0] ?? this.min());\n protected readonly high = computed(() => this.value()?.[1] ?? this.max());\n private pct(v: number): number {\n const span = this.max() - this.min();\n return span > 0 ? ((v - this.min()) / span) * 100 : 0;\n }\n protected readonly fromPct = computed(() => this.pct(this.low()));\n protected readonly toPct = computed(() => this.pct(this.high()));\n\n private onChange: (value: [number, number] | null) => void = () => {};\n protected onTouched: () => void = () => {};\n\n constructor() {\n if (this.ngControl) this.ngControl.valueAccessor = this;\n }\n\n protected labelledBy(partId: string): string {\n return `${this.field?.labelId() ?? this.nameId} ${partId}`;\n }\n\n protected onInput(which: 0 | 1, event: Event): void {\n const el = event.target as HTMLInputElement;\n let v = Number(el.value);\n const gap = this.minGap();\n if (which === 0) v = Math.min(v, this.high() - gap);\n else v = Math.max(v, this.low() + gap);\n // o input nativo pode ter passado o outro cursor: repõe a posição\n el.value = String(v);\n const next: [number, number] = which === 0 ? [v, this.high()] : [this.low(), v];\n this.value.set(next);\n this.onChange(next);\n }\n\n // ---- MxFormFieldControl ----\n errorState(): boolean {\n if (this.invalid()) return true;\n const c = this.ngControl;\n return !!c && !!c.invalid && !!(c.touched || c.dirty);\n }\n isRequired(): boolean {\n return this.required() || !!this.ngControl?.control?.hasValidator?.(Validators.required);\n }\n\n // ---- ControlValueAccessor ----\n writeValue(value: [number, number] | null): void {\n this.value.set(value ? [value[0], value[1]] : null);\n }\n registerOnChange(fn: (value: [number, number] | null) => void): void {\n this.onChange = fn;\n }\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n setDisabledState(isDisabled: boolean): void {\n this.formDisabled.set(isDisabled);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAGA;;;;;;;;;;AAUG;AAWG,MAAO,QAAS,SAAQ,eAAe,CAAA;;AAElC,IAAA,IAAI,GAAG,KAAK,CAAqB,IAAI,2EAAC;AAE/C,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE;;AAEP,QAAA,gBAAgB,CAAC,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;IACjD;AAEiB,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAEhD,QAAQ,GAAA;;AAEN,QAAA,MAAM,GAAG,GAAG,IAAI,CAAC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