@energinet/watt 4.3.79 → 4.3.80
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.
|
@@ -49,7 +49,7 @@ class WattChipComponent {
|
|
|
49
49
|
<watt-icon class="dismissible-icon" name="close" size="s" [attr.aria-hidden]="true" />
|
|
50
50
|
}
|
|
51
51
|
</label>
|
|
52
|
-
`, isInline: true, styles: ["label{font-size:.875rem;line-height:1.25rem;font-weight:400;text-transform:none;letter-spacing:0;position:relative;background:var(--input-background, var(--watt-color-neutral-white));border-radius:var(--watt-space-m);border:1px solid var(--input-border-color, var(--watt-on-light-low-emphasis));color:var(--watt-on-light-high-emphasis);cursor:pointer;display:inline-flex;align-items:center;padding:5px 12px;-webkit-user-select:none;user-select:none;white-space:nowrap;max-width:100%}label:hover{border:1px solid var(--watt-on-light-medium-emphasis)}label:active:not(.disabled,.read-only),label:focus-within{background:var(--watt-color-primary-ultralight);border:1px solid var(--watt-on-light-medium-emphasis);outline:none}label.selected{background:var(--watt-color-primary);color:var(--watt-on-dark-high-emphasis)
|
|
52
|
+
`, isInline: true, styles: ["label{font-size:.875rem;line-height:1.25rem;font-weight:400;text-transform:none;letter-spacing:0;position:relative;background:var(--input-background, var(--watt-color-neutral-white));border-radius:var(--watt-space-m);border:1px solid var(--input-border-color, var(--watt-on-light-low-emphasis));color:var(--watt-on-light-high-emphasis);cursor:pointer;display:inline-flex;align-items:center;padding:5px 12px;-webkit-user-select:none;user-select:none;white-space:nowrap;max-width:100%}label:hover{border:1px solid var(--watt-on-light-medium-emphasis)}label:active:not(.disabled,.read-only),label:focus-within{background:var(--watt-color-primary-ultralight);border:1px solid var(--watt-on-light-medium-emphasis);outline:none}label.selected{background:var(--watt-color-primary);border-color:transparent;color:var(--watt-on-dark-high-emphasis)}label.selected:hover,label.selected:focus-within{background:var(--watt-color-primary-dark);border-color:transparent}label.disabled{border:1px solid var(--watt-on-light-surface-overlay);color:var(--watt-on-light-low-emphasis);cursor:not-allowed}label.read-only{cursor:inherit;border:1px solid var(--watt-on-light-surface-overlay)}label.read-only:hover,label.read-only:focus-within{background:transparent}label .selected-icon{margin-right:var(--watt-space-s)}label .dismissible-icon{margin-left:var(--watt-space-s)}\n"], dependencies: [{ kind: "component", type: WattIconComponent, selector: "watt-icon", inputs: ["name", "label", "size", "state"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
53
53
|
}
|
|
54
54
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: WattChipComponent, decorators: [{
|
|
55
55
|
type: Component,
|
|
@@ -68,7 +68,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
68
68
|
<watt-icon class="dismissible-icon" name="close" size="s" [attr.aria-hidden]="true" />
|
|
69
69
|
}
|
|
70
70
|
</label>
|
|
71
|
-
`, styles: ["label{font-size:.875rem;line-height:1.25rem;font-weight:400;text-transform:none;letter-spacing:0;position:relative;background:var(--input-background, var(--watt-color-neutral-white));border-radius:var(--watt-space-m);border:1px solid var(--input-border-color, var(--watt-on-light-low-emphasis));color:var(--watt-on-light-high-emphasis);cursor:pointer;display:inline-flex;align-items:center;padding:5px 12px;-webkit-user-select:none;user-select:none;white-space:nowrap;max-width:100%}label:hover{border:1px solid var(--watt-on-light-medium-emphasis)}label:active:not(.disabled,.read-only),label:focus-within{background:var(--watt-color-primary-ultralight);border:1px solid var(--watt-on-light-medium-emphasis);outline:none}label.selected{background:var(--watt-color-primary);color:var(--watt-on-dark-high-emphasis)
|
|
71
|
+
`, styles: ["label{font-size:.875rem;line-height:1.25rem;font-weight:400;text-transform:none;letter-spacing:0;position:relative;background:var(--input-background, var(--watt-color-neutral-white));border-radius:var(--watt-space-m);border:1px solid var(--input-border-color, var(--watt-on-light-low-emphasis));color:var(--watt-on-light-high-emphasis);cursor:pointer;display:inline-flex;align-items:center;padding:5px 12px;-webkit-user-select:none;user-select:none;white-space:nowrap;max-width:100%}label:hover{border:1px solid var(--watt-on-light-medium-emphasis)}label:active:not(.disabled,.read-only),label:focus-within{background:var(--watt-color-primary-ultralight);border:1px solid var(--watt-on-light-medium-emphasis);outline:none}label.selected{background:var(--watt-color-primary);border-color:transparent;color:var(--watt-on-dark-high-emphasis)}label.selected:hover,label.selected:focus-within{background:var(--watt-color-primary-dark);border-color:transparent}label.disabled{border:1px solid var(--watt-on-light-surface-overlay);color:var(--watt-on-light-low-emphasis);cursor:not-allowed}label.read-only{cursor:inherit;border:1px solid var(--watt-on-light-surface-overlay)}label.read-only:hover,label.read-only:focus-within{background:transparent}label .selected-icon{margin-right:var(--watt-space-s)}label .dismissible-icon{margin-left:var(--watt-space-s)}\n"] }]
|
|
72
72
|
}], propDecorators: { selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }] } });
|
|
73
73
|
|
|
74
74
|
//#region License
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { RouterLinkWithHref, RouterLinkActive } from '@angular/router';
|
|
3
|
-
import * as i2 from '@angular/forms';
|
|
4
|
-
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
1
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
2
|
import * as i0 from '@angular/core';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
3
|
+
import { input, signal, inject, ElementRef, ChangeDetectionStrategy, Component, contentChildren, model, effect, forwardRef } from '@angular/core';
|
|
4
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
5
|
+
import { RouterLink, RouterLinkActive } from '@angular/router';
|
|
9
6
|
|
|
10
7
|
//#region License
|
|
11
8
|
/**
|
|
@@ -26,23 +23,90 @@ import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
|
26
23
|
*/
|
|
27
24
|
//#endregion
|
|
28
25
|
class WattSegmentedButtonComponent {
|
|
29
|
-
templateRef = viewChild.required(TemplateRef);
|
|
30
26
|
value = input(...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
31
27
|
link = input(...(ngDevMode ? [undefined, { debugName: "link" }] : /* istanbul ignore next */ []));
|
|
28
|
+
selected = signal(false, ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
29
|
+
disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
30
|
+
tabIndex = signal(0, ...(ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []));
|
|
31
|
+
elementRef = inject(ElementRef);
|
|
32
|
+
focus() {
|
|
33
|
+
const host = this.elementRef.nativeElement;
|
|
34
|
+
const interactive = host.querySelector('a, button');
|
|
35
|
+
interactive?.focus();
|
|
36
|
+
}
|
|
37
|
+
onClick() {
|
|
38
|
+
if (this.disabled())
|
|
39
|
+
return;
|
|
40
|
+
const value = this.value();
|
|
41
|
+
if (value === undefined)
|
|
42
|
+
return;
|
|
43
|
+
this.elementRef.nativeElement.dispatchEvent(new CustomEvent('segmentSelect', { bubbles: true, detail: value }));
|
|
44
|
+
}
|
|
32
45
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: WattSegmentedButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
33
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
34
|
-
<ng-content
|
|
35
|
-
|
|
46
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.5", type: WattSegmentedButtonComponent, isStandalone: true, selector: "watt-segmented-button", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, link: { classPropertyName: "link", publicName: "link", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
47
|
+
<ng-template #labelTemplate><ng-content /></ng-template>
|
|
48
|
+
|
|
49
|
+
@if (link()) {
|
|
50
|
+
<a
|
|
51
|
+
role="radio"
|
|
52
|
+
[routerLink]="disabled() ? null : link()"
|
|
53
|
+
queryParamsHandling="merge"
|
|
54
|
+
routerLinkActive
|
|
55
|
+
#rla="routerLinkActive"
|
|
56
|
+
[class.active]="rla.isActive"
|
|
57
|
+
[attr.aria-checked]="selected() || rla.isActive"
|
|
58
|
+
[attr.aria-disabled]="disabled() ? true : null"
|
|
59
|
+
[attr.tabindex]="tabIndex()"
|
|
60
|
+
>
|
|
61
|
+
<ng-container *ngTemplateOutlet="labelTemplate" />
|
|
62
|
+
</a>
|
|
63
|
+
} @else {
|
|
64
|
+
<button
|
|
65
|
+
type="button"
|
|
66
|
+
role="radio"
|
|
67
|
+
[attr.aria-checked]="selected()"
|
|
68
|
+
[attr.tabindex]="tabIndex()"
|
|
69
|
+
[disabled]="disabled()"
|
|
70
|
+
(click)="onClick()"
|
|
71
|
+
>
|
|
72
|
+
<ng-container *ngTemplateOutlet="labelTemplate" />
|
|
73
|
+
</button>
|
|
74
|
+
}
|
|
75
|
+
`, isInline: true, styles: [":host{display:flex}a,button{display:flex;align-items:center;justify-content:center;min-width:6.5rem;height:2.5rem;padding:0 .75rem;border:1px solid var(--watt-color-neutral-grey-700);border-radius:4px;font-size:1rem;font-weight:600;color:var(--watt-on-light-high-emphasis);background:none;text-decoration:none;cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;font-family:inherit}a:hover,button:hover,:host(.hover) a,:host(.hover) button{background-color:var(--watt-color-neutral-grey-200)}a:focus-visible,button:focus-visible{outline:none;box-shadow:0 0 0 2px var(--watt-color-primary-dark);position:relative;z-index:1}a.active,:host(.selected) a,:host(.selected) button{background-color:var(--watt-color-primary);color:var(--watt-color-neutral-white)}:host(.disabled) a,:host(.disabled) button{cursor:default;background-color:var(--watt-color-neutral-grey-200);color:#00000042}:host(.disabled.selected) a,:host(.disabled.selected) button{background-color:var(--watt-color-neutral-grey-400);color:var( --watt-on-light-high-emphasis )}:host(.start) a,:host(.start) button{border-right-width:0;border-radius:4px 0 0 4px}:host(.middle) a,:host(.middle) button{border-right-width:0;border-radius:0}:host(.end) a,:host(.end) button{border-radius:0 4px 4px 0}\n"], dependencies: [{ kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
36
76
|
}
|
|
37
77
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: WattSegmentedButtonComponent, decorators: [{
|
|
38
78
|
type: Component,
|
|
39
|
-
args: [{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
79
|
+
args: [{ selector: 'watt-segmented-button', changeDetection: ChangeDetectionStrategy.OnPush, imports: [RouterLink, RouterLinkActive, NgTemplateOutlet], template: `
|
|
80
|
+
<ng-template #labelTemplate><ng-content /></ng-template>
|
|
81
|
+
|
|
82
|
+
@if (link()) {
|
|
83
|
+
<a
|
|
84
|
+
role="radio"
|
|
85
|
+
[routerLink]="disabled() ? null : link()"
|
|
86
|
+
queryParamsHandling="merge"
|
|
87
|
+
routerLinkActive
|
|
88
|
+
#rla="routerLinkActive"
|
|
89
|
+
[class.active]="rla.isActive"
|
|
90
|
+
[attr.aria-checked]="selected() || rla.isActive"
|
|
91
|
+
[attr.aria-disabled]="disabled() ? true : null"
|
|
92
|
+
[attr.tabindex]="tabIndex()"
|
|
93
|
+
>
|
|
94
|
+
<ng-container *ngTemplateOutlet="labelTemplate" />
|
|
95
|
+
</a>
|
|
96
|
+
} @else {
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
role="radio"
|
|
100
|
+
[attr.aria-checked]="selected()"
|
|
101
|
+
[attr.tabindex]="tabIndex()"
|
|
102
|
+
[disabled]="disabled()"
|
|
103
|
+
(click)="onClick()"
|
|
104
|
+
>
|
|
105
|
+
<ng-container *ngTemplateOutlet="labelTemplate" />
|
|
106
|
+
</button>
|
|
107
|
+
}
|
|
108
|
+
`, styles: [":host{display:flex}a,button{display:flex;align-items:center;justify-content:center;min-width:6.5rem;height:2.5rem;padding:0 .75rem;border:1px solid var(--watt-color-neutral-grey-700);border-radius:4px;font-size:1rem;font-weight:600;color:var(--watt-on-light-high-emphasis);background:none;text-decoration:none;cursor:pointer;-webkit-user-select:none;user-select:none;box-sizing:border-box;font-family:inherit}a:hover,button:hover,:host(.hover) a,:host(.hover) button{background-color:var(--watt-color-neutral-grey-200)}a:focus-visible,button:focus-visible{outline:none;box-shadow:0 0 0 2px var(--watt-color-primary-dark);position:relative;z-index:1}a.active,:host(.selected) a,:host(.selected) button{background-color:var(--watt-color-primary);color:var(--watt-color-neutral-white)}:host(.disabled) a,:host(.disabled) button{cursor:default;background-color:var(--watt-color-neutral-grey-200);color:#00000042}:host(.disabled.selected) a,:host(.disabled.selected) button{background-color:var(--watt-color-neutral-grey-400);color:var( --watt-on-light-high-emphasis )}:host(.start) a,:host(.start) button{border-right-width:0;border-radius:4px 0 0 4px}:host(.middle) a,:host(.middle) button{border-right-width:0;border-radius:0}:host(.end) a,:host(.end) button{border-radius:0 4px 4px 0}\n"] }]
|
|
109
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], link: [{ type: i0.Input, args: [{ isSignal: true, alias: "link", required: false }] }] } });
|
|
46
110
|
|
|
47
111
|
//#region License
|
|
48
112
|
/**
|
|
@@ -62,14 +126,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
62
126
|
* limitations under the License.
|
|
63
127
|
*/
|
|
64
128
|
//#endregion
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
129
|
+
const POSITION_CLASSES = ['start', 'middle', 'end'];
|
|
130
|
+
function resolvePosition(index, total) {
|
|
131
|
+
if (total === 1)
|
|
132
|
+
return null;
|
|
133
|
+
if (index === 0)
|
|
134
|
+
return 'start';
|
|
135
|
+
if (index === total - 1)
|
|
136
|
+
return 'end';
|
|
137
|
+
return 'middle';
|
|
138
|
+
}
|
|
139
|
+
function findIndexByValue(buttons, value) {
|
|
140
|
+
const index = buttons.findIndex((button) => button.value() === value);
|
|
141
|
+
return index === -1 ? 0 : index;
|
|
142
|
+
}
|
|
143
|
+
function nextKeyboardIndex(key, current, total) {
|
|
144
|
+
switch (key) {
|
|
145
|
+
case 'ArrowRight':
|
|
146
|
+
case 'ArrowDown':
|
|
147
|
+
return (current + 1) % total;
|
|
148
|
+
case 'ArrowLeft':
|
|
149
|
+
case 'ArrowUp':
|
|
150
|
+
return (current - 1 + total) % total;
|
|
151
|
+
case 'Home':
|
|
152
|
+
return 0;
|
|
153
|
+
case 'End':
|
|
154
|
+
return total - 1;
|
|
155
|
+
default:
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
68
159
|
class WattSegmentedButtonsComponent {
|
|
69
160
|
element = inject(ElementRef);
|
|
70
|
-
|
|
161
|
+
buttons = contentChildren(WattSegmentedButtonComponent, ...(ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []));
|
|
71
162
|
selected = model('', ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
72
163
|
disabled = signal(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
164
|
+
constructor() {
|
|
165
|
+
effect(() => {
|
|
166
|
+
const buttons = this.buttons();
|
|
167
|
+
const selected = this.selected();
|
|
168
|
+
const disabled = this.disabled();
|
|
169
|
+
const focusedIndex = findIndexByValue(buttons, selected);
|
|
170
|
+
for (let i = 0; i < buttons.length; i++) {
|
|
171
|
+
const button = buttons[i];
|
|
172
|
+
const isSelected = button.value() === selected;
|
|
173
|
+
button.selected.set(isSelected);
|
|
174
|
+
button.disabled.set(disabled);
|
|
175
|
+
button.tabIndex.set(!disabled && i === focusedIndex ? 0 : -1);
|
|
176
|
+
const position = resolvePosition(i, buttons.length);
|
|
177
|
+
const classList = button.elementRef.nativeElement.classList;
|
|
178
|
+
for (const cls of POSITION_CLASSES)
|
|
179
|
+
classList.toggle(cls, cls === position);
|
|
180
|
+
classList.toggle('selected', isSelected);
|
|
181
|
+
classList.toggle('disabled', disabled);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
onSegmentSelect(event) {
|
|
186
|
+
if (this.disabled())
|
|
187
|
+
return;
|
|
188
|
+
this.selected.set(event.detail);
|
|
189
|
+
}
|
|
190
|
+
onKeydown(event) {
|
|
191
|
+
if (this.disabled())
|
|
192
|
+
return;
|
|
193
|
+
const buttons = this.buttons();
|
|
194
|
+
if (buttons.length === 0)
|
|
195
|
+
return;
|
|
196
|
+
const currentIndex = findIndexByValue(buttons, this.selected());
|
|
197
|
+
const nextIndex = nextKeyboardIndex(event.key, currentIndex, buttons.length);
|
|
198
|
+
if (nextIndex === null)
|
|
199
|
+
return;
|
|
200
|
+
event.preventDefault();
|
|
201
|
+
const nextButton = buttons[nextIndex];
|
|
202
|
+
const nextValue = nextButton.value();
|
|
203
|
+
if (nextValue !== undefined)
|
|
204
|
+
this.selected.set(nextValue);
|
|
205
|
+
nextButton.focus();
|
|
206
|
+
}
|
|
73
207
|
writeValue(selected) {
|
|
74
208
|
this.selected.set(selected);
|
|
75
209
|
}
|
|
@@ -83,68 +217,28 @@ class WattSegmentedButtonsComponent {
|
|
|
83
217
|
this.disabled.set(isDisabled);
|
|
84
218
|
}
|
|
85
219
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: WattSegmentedButtonsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
86
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
220
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.5", type: WattSegmentedButtonsComponent, isStandalone: true, selector: "watt-segmented-buttons", inputs: { selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange" }, host: { attributes: { "role": "radiogroup" }, listeners: { "segmentSelect": "onSegmentSelect($event)", "keydown": "onKeydown($event)" } }, providers: [
|
|
87
221
|
{
|
|
88
222
|
provide: NG_VALUE_ACCESSOR,
|
|
89
223
|
useExisting: forwardRef(() => WattSegmentedButtonsComponent),
|
|
90
224
|
multi: true,
|
|
91
225
|
},
|
|
92
|
-
], queries: [{ propertyName: "
|
|
93
|
-
<mat-button-toggle-group
|
|
94
|
-
[(ngModel)]="selected"
|
|
95
|
-
[multiple]="false"
|
|
96
|
-
[hideSingleSelectionIndicator]="true"
|
|
97
|
-
[disabled]="disabled()"
|
|
98
|
-
>
|
|
99
|
-
@for (segmentedButton of segmentedButtonElements(); track segmentedButton) {
|
|
100
|
-
<mat-button-toggle
|
|
101
|
-
[routerLink]="segmentedButton.link()"
|
|
102
|
-
queryParamsHandling="merge"
|
|
103
|
-
routerLinkActive="mat-button-toggle-checked"
|
|
104
|
-
[disableRipple]="true"
|
|
105
|
-
[value]="segmentedButton.value()"
|
|
106
|
-
>
|
|
107
|
-
<ng-container *ngTemplateOutlet="segmentedButton.templateRef()" />
|
|
108
|
-
</mat-button-toggle>
|
|
109
|
-
}
|
|
110
|
-
</mat-button-toggle-group>
|
|
111
|
-
`, isInline: true, styles: ["@use \"@energinet/watt/utils\" as watt;@use \"@angular/material\" as mat;:root{@include mat.button-toggle-overrides((selected-state-text-color: white,selected-state-background-color: var(--watt-color-primary),height: 2.5rem,));}:root mat-button-toggle-group{border-color:var(--watt-color-neutral-grey-700)}:root mat-button-toggle-group mat-button-toggle{border-color:var(--watt-color-neutral-grey-700)!important}:root mat-button-toggle-group mat-button-toggle button{min-width:6.5rem}:root mat-button-toggle-group mat-button-toggle button span{font-size:.875rem;font-weight:600}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonToggleModule }, { kind: "directive", type: i1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled", "disabledInteractive", "hideSingleSelectionIndicator", "hideMultipleSelectionIndicator"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "disableRipple", "appearance", "checked", "disabled", "disabledInteractive"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: RouterLinkWithHref, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
226
|
+
], queries: [{ propertyName: "buttons", predicate: WattSegmentedButtonComponent, isSignal: true }], ngImport: i0, template: `<ng-content />`, isInline: true, styles: [":host{display:inline-flex}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
112
227
|
}
|
|
113
228
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: WattSegmentedButtonsComponent, decorators: [{
|
|
114
229
|
type: Component,
|
|
115
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush,
|
|
116
|
-
MatButtonToggleModule,
|
|
117
|
-
FormsModule,
|
|
118
|
-
NgTemplateOutlet,
|
|
119
|
-
RouterLinkWithHref,
|
|
120
|
-
RouterLinkActive,
|
|
121
|
-
], providers: [
|
|
230
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
122
231
|
{
|
|
123
232
|
provide: NG_VALUE_ACCESSOR,
|
|
124
233
|
useExisting: forwardRef(() => WattSegmentedButtonsComponent),
|
|
125
234
|
multi: true,
|
|
126
235
|
},
|
|
127
|
-
], selector: 'watt-segmented-buttons',
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
>
|
|
134
|
-
@for (segmentedButton of segmentedButtonElements(); track segmentedButton) {
|
|
135
|
-
<mat-button-toggle
|
|
136
|
-
[routerLink]="segmentedButton.link()"
|
|
137
|
-
queryParamsHandling="merge"
|
|
138
|
-
routerLinkActive="mat-button-toggle-checked"
|
|
139
|
-
[disableRipple]="true"
|
|
140
|
-
[value]="segmentedButton.value()"
|
|
141
|
-
>
|
|
142
|
-
<ng-container *ngTemplateOutlet="segmentedButton.templateRef()" />
|
|
143
|
-
</mat-button-toggle>
|
|
144
|
-
}
|
|
145
|
-
</mat-button-toggle-group>
|
|
146
|
-
`, styles: ["@use \"@energinet/watt/utils\" as watt;@use \"@angular/material\" as mat;:root{@include mat.button-toggle-overrides((selected-state-text-color: white,selected-state-background-color: var(--watt-color-primary),height: 2.5rem,));}:root mat-button-toggle-group{border-color:var(--watt-color-neutral-grey-700)}:root mat-button-toggle-group mat-button-toggle{border-color:var(--watt-color-neutral-grey-700)!important}:root mat-button-toggle-group mat-button-toggle button{min-width:6.5rem}:root mat-button-toggle-group mat-button-toggle button span{font-size:.875rem;font-weight:600}\n"] }]
|
|
147
|
-
}], propDecorators: { segmentedButtonElements: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => WattSegmentedButtonComponent), { isSignal: true }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }] } });
|
|
236
|
+
], selector: 'watt-segmented-buttons', host: {
|
|
237
|
+
role: 'radiogroup',
|
|
238
|
+
'(segmentSelect)': 'onSegmentSelect($event)',
|
|
239
|
+
'(keydown)': 'onKeydown($event)',
|
|
240
|
+
}, template: `<ng-content />`, styles: [":host{display:inline-flex}\n"] }]
|
|
241
|
+
}], ctorParameters: () => [], propDecorators: { buttons: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => WattSegmentedButtonComponent), { isSignal: true }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }] } });
|
|
148
242
|
|
|
149
243
|
//#region License
|
|
150
244
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energinet-watt-segmented-buttons.mjs","sources":["../../../libs/watt/package/segmented-buttons/watt-segmented-button.component.ts","../../../libs/watt/package/segmented-buttons/watt-segmented-buttons.component.ts","../../../libs/watt/package/segmented-buttons/index.ts","../../../libs/watt/package/segmented-buttons/energinet-watt-segmented-buttons.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { Component, input, TemplateRef, viewChild } from '@angular/core';\n\n@Component({\n selector: 'watt-segmented-button',\n template: ` <ng-template>\n <ng-content />\n </ng-template>`,\n})\nexport class WattSegmentedButtonComponent {\n templateRef = viewChild.required<TemplateRef<unknown>>(TemplateRef);\n value = input<string>();\n link = input<string>();\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { NgTemplateOutlet } from '@angular/common';\nimport { RouterLinkWithHref, RouterLinkActive } from '@angular/router';\nimport { ControlValueAccessor, FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport {\n model,\n signal,\n inject,\n Component,\n ElementRef,\n forwardRef,\n contentChildren,\n ViewEncapsulation,\n ChangeDetectionStrategy,\n} from '@angular/core';\n\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\nimport { WattSegmentedButtonComponent } from './watt-segmented-button.component';\n\n/**\n * Segmented buttons.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [\n MatButtonToggleModule,\n FormsModule,\n NgTemplateOutlet,\n RouterLinkWithHref,\n RouterLinkActive,\n ],\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => WattSegmentedButtonsComponent),\n multi: true,\n },\n ],\n selector: 'watt-segmented-buttons',\n styles: `\n @use '@energinet/watt/utils' as watt;\n @use '@angular/material' as mat;\n\n :root {\n @include mat.button-toggle-overrides(\n (\n selected-state-text-color: white,\n selected-state-background-color: var(--watt-color-primary),\n height: 2.5rem,\n )\n );\n\n mat-button-toggle-group {\n border-color: var(--watt-color-neutral-grey-700);\n\n mat-button-toggle {\n border-color: var(--watt-color-neutral-grey-700) !important;\n\n button {\n min-width: 6.5rem;\n\n span {\n font-size: 0.875rem;\n font-weight: 600;\n }\n }\n }\n }\n }\n `,\n template: `\n <mat-button-toggle-group\n [(ngModel)]=\"selected\"\n [multiple]=\"false\"\n [hideSingleSelectionIndicator]=\"true\"\n [disabled]=\"disabled()\"\n >\n @for (segmentedButton of segmentedButtonElements(); track segmentedButton) {\n <mat-button-toggle\n [routerLink]=\"segmentedButton.link()\"\n queryParamsHandling=\"merge\"\n routerLinkActive=\"mat-button-toggle-checked\"\n [disableRipple]=\"true\"\n [value]=\"segmentedButton.value()\"\n >\n <ng-container *ngTemplateOutlet=\"segmentedButton.templateRef()\" />\n </mat-button-toggle>\n }\n </mat-button-toggle-group>\n `,\n})\nexport class WattSegmentedButtonsComponent implements ControlValueAccessor {\n private element = inject(ElementRef);\n segmentedButtonElements = contentChildren(WattSegmentedButtonComponent);\n selected = model<string>('');\n disabled = signal(false);\n\n writeValue(selected: string): void {\n this.selected.set(selected);\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.selected.subscribe(fn);\n }\n\n registerOnTouched(fn: (value: boolean) => void): void {\n this.element.nativeElement.addEventListener('focusout', fn);\n }\n\n setDisabledState?(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { WattSegmentedButtonsComponent } from './watt-segmented-buttons.component';\nimport { WattSegmentedButtonComponent } from './watt-segmented-button.component';\n\nexport { WattSegmentedButtonsComponent } from './watt-segmented-buttons.component';\nexport { WattSegmentedButtonComponent } from './watt-segmented-button.component';\nexport const WATT_SEGMENTED_BUTTONS = [\n WattSegmentedButtonsComponent,\n WattSegmentedButtonComponent,\n] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;MASa,4BAA4B,CAAA;AACvC,IAAA,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAuB,WAAW,CAAC;IACnE,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;IACvB,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;uGAHX,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAA5B,4BAA4B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBA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A6B,EAAA,UAAA,EAAA,CAAA;kBAtEzC,SAAS;AACS,YAAA,IAAA,EAAA,CAAA,EAAA,eAAA,EAAA,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,iBAAiB,CAAC,IAAI,EAAA,OAAA,EAC5B;wBACP,qBAAqB;wBACrB,WAAW;wBACX,gBAAgB;wBAChB,kBAAkB;wBAClB,gBAAgB;qBACjB,EAAA,SAAA,EACU;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,mCAAmC,CAAC;AAC5D,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;AACF,qBAAA,EAAA,QAAA,EACS,wBAAwB,EAAA,QAAA,EAgCxB;;;;;;;;;;;;;;;;;;;AAmBT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,skBAAA,CAAA,EAAA;+GAIyC,4BAA4B,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,UAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AC/GxE;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAMO,MAAM,sBAAsB,GAAG;IACpC,6BAA6B;IAC7B,4BAA4B;;;ACzB9B;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"energinet-watt-segmented-buttons.mjs","sources":["../../../libs/watt/package/segmented-buttons/watt-segmented-button.component.ts","../../../libs/watt/package/segmented-buttons/watt-segmented-buttons.component.ts","../../../libs/watt/package/segmented-buttons/index.ts","../../../libs/watt/package/segmented-buttons/energinet-watt-segmented-buttons.ts"],"sourcesContent":["//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport {\n Component,\n ChangeDetectionStrategy,\n input,\n signal,\n inject,\n ElementRef,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { RouterLink, RouterLinkActive } from '@angular/router';\n\nexport type WattSegmentedButtonPosition = 'first' | 'middle' | 'last' | 'standalone';\n\n@Component({\n selector: 'watt-segmented-button',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [RouterLink, RouterLinkActive, NgTemplateOutlet],\n styles: `\n :host {\n display: flex;\n }\n\n a,\n button {\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 6.5rem;\n height: 2.5rem;\n padding: 0 0.75rem;\n border: 1px solid var(--watt-color-neutral-grey-700);\n border-radius: 4px;\n font-size: 1rem;\n font-weight: 600;\n color: var(--watt-on-light-high-emphasis);\n background: none;\n text-decoration: none;\n cursor: pointer;\n user-select: none;\n box-sizing: border-box;\n font-family: inherit;\n }\n\n a:hover,\n button:hover,\n :host(.hover) a,\n :host(.hover) button {\n background-color: var(--watt-color-neutral-grey-200);\n }\n\n a:focus-visible,\n button:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px var(--watt-color-primary-dark);\n position: relative;\n z-index: 1;\n }\n\n a.active,\n :host(.selected) a,\n :host(.selected) button {\n background-color: var(--watt-color-primary);\n color: var(--watt-color-neutral-white);\n }\n\n :host(.disabled) a,\n :host(.disabled) button {\n cursor: default;\n background-color: var(--watt-color-neutral-grey-200);\n color: rgba(\n 0,\n 0,\n 0,\n 0.26\n ); /* Not part of Watt foundations — see Figma note on disabled segmented buttons */\n }\n\n :host(.disabled.selected) a,\n :host(.disabled.selected) button {\n background-color: var(--watt-color-neutral-grey-400);\n color: var(\n --watt-on-light-high-emphasis\n ); /* Not part of Watt foundations — see Figma note on disabled segmented buttons */\n }\n\n :host(.start) a,\n :host(.start) button {\n border-right-width: 0;\n border-radius: 4px 0 0 4px;\n }\n\n :host(.middle) a,\n :host(.middle) button {\n border-right-width: 0;\n border-radius: 0;\n }\n\n :host(.end) a,\n :host(.end) button {\n border-radius: 0 4px 4px 0;\n }\n `,\n template: `\n <ng-template #labelTemplate><ng-content /></ng-template>\n\n @if (link()) {\n <a\n role=\"radio\"\n [routerLink]=\"disabled() ? null : link()\"\n queryParamsHandling=\"merge\"\n routerLinkActive\n #rla=\"routerLinkActive\"\n [class.active]=\"rla.isActive\"\n [attr.aria-checked]=\"selected() || rla.isActive\"\n [attr.aria-disabled]=\"disabled() ? true : null\"\n [attr.tabindex]=\"tabIndex()\"\n >\n <ng-container *ngTemplateOutlet=\"labelTemplate\" />\n </a>\n } @else {\n <button\n type=\"button\"\n role=\"radio\"\n [attr.aria-checked]=\"selected()\"\n [attr.tabindex]=\"tabIndex()\"\n [disabled]=\"disabled()\"\n (click)=\"onClick()\"\n >\n <ng-container *ngTemplateOutlet=\"labelTemplate\" />\n </button>\n }\n `,\n})\nexport class WattSegmentedButtonComponent {\n value = input<string>();\n link = input<string>();\n\n selected = signal(false);\n disabled = signal(false);\n tabIndex = signal(0);\n\n readonly elementRef = inject(ElementRef);\n\n focus(): void {\n const host = this.elementRef.nativeElement as HTMLElement;\n const interactive = host.querySelector<HTMLElement>('a, button');\n interactive?.focus();\n }\n\n onClick(): void {\n if (this.disabled()) return;\n const value = this.value();\n if (value === undefined) return;\n this.elementRef.nativeElement.dispatchEvent(\n new CustomEvent('segmentSelect', { bubbles: true, detail: value })\n );\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport {\n model,\n signal,\n inject,\n effect,\n Component,\n ElementRef,\n forwardRef,\n contentChildren,\n ChangeDetectionStrategy,\n} from '@angular/core';\n\nimport { WattSegmentedButtonComponent } from './watt-segmented-button.component';\n\ntype ReadonlyButtons = readonly WattSegmentedButtonComponent[];\n\nconst POSITION_CLASSES = ['start', 'middle', 'end'] as const;\ntype PositionClass = (typeof POSITION_CLASSES)[number] | null;\n\nfunction resolvePosition(index: number, total: number): PositionClass {\n if (total === 1) return null;\n if (index === 0) return 'start';\n if (index === total - 1) return 'end';\n return 'middle';\n}\n\nfunction findIndexByValue(buttons: ReadonlyButtons, value: string): number {\n const index = buttons.findIndex((button) => button.value() === value);\n return index === -1 ? 0 : index;\n}\n\nfunction nextKeyboardIndex(key: string, current: number, total: number): number | null {\n switch (key) {\n case 'ArrowRight':\n case 'ArrowDown':\n return (current + 1) % total;\n case 'ArrowLeft':\n case 'ArrowUp':\n return (current - 1 + total) % total;\n case 'Home':\n return 0;\n case 'End':\n return total - 1;\n default:\n return null;\n }\n}\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => WattSegmentedButtonsComponent),\n multi: true,\n },\n ],\n selector: 'watt-segmented-buttons',\n host: {\n role: 'radiogroup',\n '(segmentSelect)': 'onSegmentSelect($event)',\n '(keydown)': 'onKeydown($event)',\n },\n styles: `\n :host {\n display: inline-flex;\n }\n `,\n template: `<ng-content />`,\n})\nexport class WattSegmentedButtonsComponent implements ControlValueAccessor {\n private readonly element = inject(ElementRef);\n private readonly buttons = contentChildren(WattSegmentedButtonComponent);\n selected = model<string>('');\n disabled = signal(false);\n\n constructor() {\n effect(() => {\n const buttons = this.buttons();\n const selected = this.selected();\n const disabled = this.disabled();\n const focusedIndex = findIndexByValue(buttons, selected);\n\n for (let i = 0; i < buttons.length; i++) {\n const button = buttons[i];\n const isSelected = button.value() === selected;\n button.selected.set(isSelected);\n button.disabled.set(disabled);\n button.tabIndex.set(!disabled && i === focusedIndex ? 0 : -1);\n\n const position = resolvePosition(i, buttons.length);\n const classList = button.elementRef.nativeElement.classList;\n for (const cls of POSITION_CLASSES) classList.toggle(cls, cls === position);\n classList.toggle('selected', isSelected);\n classList.toggle('disabled', disabled);\n }\n });\n }\n\n onSegmentSelect(event: Event): void {\n if (this.disabled()) return;\n this.selected.set((event as CustomEvent<string>).detail);\n }\n\n onKeydown(event: KeyboardEvent): void {\n if (this.disabled()) return;\n const buttons = this.buttons();\n if (buttons.length === 0) return;\n\n const currentIndex = findIndexByValue(buttons, this.selected());\n const nextIndex = nextKeyboardIndex(event.key, currentIndex, buttons.length);\n if (nextIndex === null) return;\n\n event.preventDefault();\n const nextButton = buttons[nextIndex];\n const nextValue = nextButton.value();\n if (nextValue !== undefined) this.selected.set(nextValue);\n nextButton.focus();\n }\n\n writeValue(selected: string): void {\n this.selected.set(selected);\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.selected.subscribe(fn);\n }\n\n registerOnTouched(fn: (value: boolean) => void): void {\n this.element.nativeElement.addEventListener('focusout', fn);\n }\n\n setDisabledState?(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n }\n}\n","//#region License\n/**\n * @license\n * Copyright 2020 Energinet DataHub A/S\n *\n * Licensed under the Apache License, Version 2.0 (the \"License2\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n//#endregion\nimport { WattSegmentedButtonsComponent } from './watt-segmented-buttons.component';\nimport { WattSegmentedButtonComponent } from './watt-segmented-button.component';\n\nexport { WattSegmentedButtonsComponent } from './watt-segmented-buttons.component';\nexport { WattSegmentedButtonComponent } from './watt-segmented-button.component';\nexport const WATT_SEGMENTED_BUTTONS = [\n WattSegmentedButtonsComponent,\n WattSegmentedButtonComponent,\n] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;AACA;;;;;;;;;;;;;;;AAeG;AACH;MAsIa,4BAA4B,CAAA;IACvC,KAAK,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;IACvB,IAAI,GAAG,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAU;AAEtB,IAAA,QAAQ,GAAG,MAAM,CAAC,KAAK,+EAAC;AACxB,IAAA,QAAQ,GAAG,MAAM,CAAC,KAAK,+EAAC;AACxB,IAAA,QAAQ,GAAG,MAAM,CAAC,CAAC,+EAAC;AAEX,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAExC,KAAK,GAAA;AACH,QAAA,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAA4B;QACzD,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAc,WAAW,CAAC;QAChE,WAAW,EAAE,KAAK,EAAE;IACtB;IAEA,OAAO,GAAA;QACL,IAAI,IAAI,CAAC,QAAQ,EAAE;YAAE;AACrB,QAAA,MAAM,KAAK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,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,UAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AC3FzE;AACA;;;;;;;;;;;;;;;AAeG;AACH;AAMO,MAAM,sBAAsB,GAAG;IACpC,6BAA6B;IAC7B,4BAA4B;;;ACzB9B;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { ElementRef } from '@angular/core';
|
|
3
3
|
import { ControlValueAccessor } from '@angular/forms';
|
|
4
4
|
|
|
5
|
-
declare class WattSegmentedButtonComponent {
|
|
6
|
-
templateRef: _angular_core.Signal<TemplateRef<unknown>>;
|
|
7
|
-
value: _angular_core.InputSignal<string | undefined>;
|
|
8
|
-
link: _angular_core.InputSignal<string | undefined>;
|
|
9
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WattSegmentedButtonComponent, never>;
|
|
10
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WattSegmentedButtonComponent, "watt-segmented-button", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "link": { "alias": "link"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Segmented buttons.
|
|
15
|
-
*/
|
|
16
5
|
declare class WattSegmentedButtonsComponent implements ControlValueAccessor {
|
|
17
|
-
private element;
|
|
18
|
-
|
|
6
|
+
private readonly element;
|
|
7
|
+
private readonly buttons;
|
|
19
8
|
selected: _angular_core.ModelSignal<string>;
|
|
20
9
|
disabled: _angular_core.WritableSignal<boolean>;
|
|
10
|
+
constructor();
|
|
11
|
+
onSegmentSelect(event: Event): void;
|
|
12
|
+
onKeydown(event: KeyboardEvent): void;
|
|
21
13
|
writeValue(selected: string): void;
|
|
22
14
|
registerOnChange(fn: (value: string) => void): void;
|
|
23
15
|
registerOnTouched(fn: (value: boolean) => void): void;
|
|
24
16
|
setDisabledState?(isDisabled: boolean): void;
|
|
25
17
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WattSegmentedButtonsComponent, never>;
|
|
26
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WattSegmentedButtonsComponent, "watt-segmented-buttons", never, { "selected": { "alias": "selected"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; }, ["
|
|
18
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WattSegmentedButtonsComponent, "watt-segmented-buttons", never, { "selected": { "alias": "selected"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; }, ["buttons"], ["*"], true, never>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare class WattSegmentedButtonComponent {
|
|
22
|
+
value: _angular_core.InputSignal<string | undefined>;
|
|
23
|
+
link: _angular_core.InputSignal<string | undefined>;
|
|
24
|
+
selected: _angular_core.WritableSignal<boolean>;
|
|
25
|
+
disabled: _angular_core.WritableSignal<boolean>;
|
|
26
|
+
tabIndex: _angular_core.WritableSignal<number>;
|
|
27
|
+
readonly elementRef: ElementRef<any>;
|
|
28
|
+
focus(): void;
|
|
29
|
+
onClick(): void;
|
|
30
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<WattSegmentedButtonComponent, never>;
|
|
31
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<WattSegmentedButtonComponent, "watt-segmented-button", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "link": { "alias": "link"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
/**
|