@spartan-ng/brain 0.0.1-alpha.437 → 0.0.1-alpha.438
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.
- package/calendar/index.d.ts +5 -2
- package/calendar/lib/brn-calendar-cell-button.directive.d.ts +2 -2
- package/calendar/lib/brn-calendar-grid.directive.d.ts +1 -1
- package/calendar/lib/brn-calendar.directive.d.ts +4 -1
- package/calendar/lib/brn-calendar.token.d.ts +19 -5
- package/calendar/lib/mode/brn-calendar-multiple.directive.d.ts +61 -0
- package/fesm2022/spartan-ng-brain-calendar.mjs +196 -9
- package/fesm2022/spartan-ng-brain-calendar.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-select.mjs +2 -1
- package/fesm2022/spartan-ng-brain-select.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-slider.mjs +278 -342
- package/fesm2022/spartan-ng-brain-slider.mjs.map +1 -1
- package/fesm2022/spartan-ng-brain-toggle-group.mjs +260 -0
- package/fesm2022/spartan-ng-brain-toggle-group.mjs.map +1 -0
- package/fesm2022/spartan-ng-brain-toggle.mjs +6 -197
- package/fesm2022/spartan-ng-brain-toggle.mjs.map +1 -1
- package/package.json +5 -1
- package/slider/index.d.ts +9 -4
- package/slider/lib/brn-slider-range.directive.d.ts +7 -0
- package/slider/lib/brn-slider-thumb.directive.d.ts +18 -11
- package/slider/lib/brn-slider-tick.directive.d.ts +12 -0
- package/slider/lib/brn-slider-track.directive.d.ts +8 -136
- package/slider/lib/brn-slider-track.token.d.ts +5 -0
- package/slider/lib/brn-slider.directive.d.ts +37 -0
- package/slider/lib/brn-slider.token.d.ts +4 -0
- package/toggle/index.d.ts +0 -7
- package/toggle/lib/brn-toggle.directive.d.ts +0 -2
- package/toggle-group/README.md +3 -0
- package/toggle-group/index.d.ts +15 -0
- package/{toggle → toggle-group}/lib/brn-toggle-group.component.d.ts +5 -5
- package/toggle-group/lib/brn-toggle-item.directive.d.ts +25 -0
- package/slider/lib/brn-slider-tick-mark.directive.d.ts +0 -15
- package/slider/lib/brn-slider-track-active-fill.directive.d.ts +0 -10
- /package/{toggle → toggle-group}/lib/brn-toggle-group.token.d.ts +0 -0
|
@@ -1,175 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
-
|
|
5
|
-
const BrnToggleGroupToken = new InjectionToken('BrnToggleGroupToken');
|
|
6
|
-
function injectBrnToggleGroup() {
|
|
7
|
-
return inject(BrnToggleGroupToken, { optional: true });
|
|
8
|
-
}
|
|
9
|
-
function provideBrnToggleGroup(value) {
|
|
10
|
-
return { provide: BrnToggleGroupToken, useExisting: value };
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const BRN_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR = {
|
|
14
|
-
provide: NG_VALUE_ACCESSOR,
|
|
15
|
-
useExisting: forwardRef(() => BrnToggleGroupComponent),
|
|
16
|
-
multi: true,
|
|
17
|
-
};
|
|
18
|
-
class BrnButtonToggleChange {
|
|
19
|
-
source;
|
|
20
|
-
value;
|
|
21
|
-
constructor(source, value) {
|
|
22
|
-
this.source = source;
|
|
23
|
-
this.value = value;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
class BrnToggleGroupComponent {
|
|
27
|
-
/**
|
|
28
|
-
* The method to be called in order to update ngModel.
|
|
29
|
-
*/
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
31
|
-
_onChange = () => { };
|
|
32
|
-
/** onTouch function registered via registerOnTouch (ControlValueAccessor). */
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
34
|
-
onTouched = () => { };
|
|
35
|
-
/** Whether the button toggle group has a vertical orientation */
|
|
36
|
-
vertical = input(false, {
|
|
37
|
-
transform: booleanAttribute,
|
|
38
|
-
});
|
|
39
|
-
/** Value of the toggle group. */
|
|
40
|
-
value = model(undefined);
|
|
41
|
-
/** Whether no button toggles need to be selected. */
|
|
42
|
-
nullable = input(false, {
|
|
43
|
-
transform: booleanAttribute,
|
|
44
|
-
});
|
|
45
|
-
/** Whether multiple button toggles can be selected. */
|
|
46
|
-
multiple = input(false, {
|
|
47
|
-
transform: booleanAttribute,
|
|
48
|
-
});
|
|
49
|
-
/** Whether the button toggle group is disabled. */
|
|
50
|
-
disabled = input(false, {
|
|
51
|
-
transform: booleanAttribute,
|
|
52
|
-
});
|
|
53
|
-
/** The internal state of the component. This can be replaced with linkedSignal in the future. */
|
|
54
|
-
state = computed(() => ({
|
|
55
|
-
disabled: signal(this.disabled()),
|
|
56
|
-
}));
|
|
57
|
-
/** Emit event when the group value changes. */
|
|
58
|
-
change = output();
|
|
59
|
-
writeValue(value) {
|
|
60
|
-
this.value.set(value);
|
|
61
|
-
}
|
|
62
|
-
registerOnChange(fn) {
|
|
63
|
-
this._onChange = fn;
|
|
64
|
-
}
|
|
65
|
-
registerOnTouched(fn) {
|
|
66
|
-
this.onTouched = fn;
|
|
67
|
-
}
|
|
68
|
-
setDisabledState(isDisabled) {
|
|
69
|
-
this.state().disabled.set(isDisabled);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @internal
|
|
73
|
-
* Determines whether a value can be set on the group.
|
|
74
|
-
*/
|
|
75
|
-
canDeselect(value) {
|
|
76
|
-
// if null values are allowed, the group can always be nullable
|
|
77
|
-
if (this.nullable())
|
|
78
|
-
return true;
|
|
79
|
-
const currentValue = this.value();
|
|
80
|
-
if (this.multiple() && Array.isArray(currentValue)) {
|
|
81
|
-
return !(currentValue.length === 1 && currentValue[0] === value);
|
|
82
|
-
}
|
|
83
|
-
return currentValue !== value;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @internal
|
|
87
|
-
* Selects a value.
|
|
88
|
-
*/
|
|
89
|
-
select(value, source) {
|
|
90
|
-
if (this.state().disabled() || this.isSelected(value)) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const currentValue = this.value();
|
|
94
|
-
// emit the valueChange event here as we should only emit based on user interaction
|
|
95
|
-
if (this.multiple()) {
|
|
96
|
-
this.emitSelectionChange([...(currentValue ?? []), value], source);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
this.emitSelectionChange(value, source);
|
|
100
|
-
}
|
|
101
|
-
this._onChange(this.value());
|
|
102
|
-
this.change.emit(new BrnButtonToggleChange(source, this.value()));
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* @internal
|
|
106
|
-
* Deselects a value.
|
|
107
|
-
*/
|
|
108
|
-
deselect(value, source) {
|
|
109
|
-
if (this.state().disabled() || !this.isSelected(value) || !this.canDeselect(value)) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
const currentValue = this.value();
|
|
113
|
-
if (this.multiple()) {
|
|
114
|
-
this.emitSelectionChange((currentValue ?? []).filter((v) => v !== value), source);
|
|
115
|
-
}
|
|
116
|
-
else if (currentValue === value) {
|
|
117
|
-
this.emitSelectionChange(null, source);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @internal
|
|
122
|
-
* Determines whether a value is selected.
|
|
123
|
-
*/
|
|
124
|
-
isSelected(value) {
|
|
125
|
-
const currentValue = this.value();
|
|
126
|
-
if (currentValue == null ||
|
|
127
|
-
currentValue === undefined ||
|
|
128
|
-
(Array.isArray(currentValue) && currentValue.length === 0)) {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
if (this.multiple()) {
|
|
132
|
-
return currentValue?.includes(value);
|
|
133
|
-
}
|
|
134
|
-
return currentValue === value;
|
|
135
|
-
}
|
|
136
|
-
/** Update the value of the group */
|
|
137
|
-
emitSelectionChange(value, source) {
|
|
138
|
-
this.value.set(value);
|
|
139
|
-
this._onChange(value);
|
|
140
|
-
this.change.emit(new BrnButtonToggleChange(source, this.value()));
|
|
141
|
-
}
|
|
142
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: BrnToggleGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
143
|
-
/** @nocollapse */ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.1", type: BrnToggleGroupComponent, isStandalone: true, selector: "brn-toggle-group", inputs: { vertical: { classPropertyName: "vertical", publicName: "vertical", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, nullable: { classPropertyName: "nullable", publicName: "nullable", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", change: "change" }, host: { attributes: { "role": "group" }, listeners: { "focusout": "onTouched()" }, properties: { "attr.aria-disabled": "state().disabled()", "attr.data-disabled": "state().disabled()", "attr.data-vertical": "vertical()" }, classAttribute: "brn-button-toggle-group" }, providers: [provideBrnToggleGroup(BrnToggleGroupComponent), BRN_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR], exportAs: ["brnToggleGroup"], ngImport: i0, template: `
|
|
144
|
-
<ng-content />
|
|
145
|
-
`, isInline: true });
|
|
146
|
-
}
|
|
147
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: BrnToggleGroupComponent, decorators: [{
|
|
148
|
-
type: Component,
|
|
149
|
-
args: [{
|
|
150
|
-
selector: 'brn-toggle-group',
|
|
151
|
-
standalone: true,
|
|
152
|
-
providers: [provideBrnToggleGroup(BrnToggleGroupComponent), BRN_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR],
|
|
153
|
-
host: {
|
|
154
|
-
role: 'group',
|
|
155
|
-
class: 'brn-button-toggle-group',
|
|
156
|
-
'[attr.aria-disabled]': 'state().disabled()',
|
|
157
|
-
'[attr.data-disabled]': 'state().disabled()',
|
|
158
|
-
'[attr.data-vertical]': 'vertical()',
|
|
159
|
-
'(focusout)': 'onTouched()',
|
|
160
|
-
},
|
|
161
|
-
exportAs: 'brnToggleGroup',
|
|
162
|
-
template: `
|
|
163
|
-
<ng-content />
|
|
164
|
-
`,
|
|
165
|
-
}]
|
|
166
|
-
}] });
|
|
2
|
+
import { inject, ChangeDetectorRef, input, booleanAttribute, model, computed, Directive, NgModule } from '@angular/core';
|
|
167
3
|
|
|
168
4
|
class BrnToggleDirective {
|
|
169
5
|
static _uniqueId = 0;
|
|
170
6
|
_changeDetector = inject(ChangeDetectorRef);
|
|
171
|
-
/** Access the toggle group if available. */
|
|
172
|
-
group = injectBrnToggleGroup();
|
|
173
7
|
/** The id of the toggle. */
|
|
174
8
|
id = input(`brn-toggle-${BrnToggleDirective._uniqueId++}`);
|
|
175
9
|
/** The value this toggle represents. */
|
|
@@ -188,28 +22,15 @@ class BrnToggleDirective {
|
|
|
188
22
|
isOn = computed(() => this._state() === 'on');
|
|
189
23
|
/** The current state that reflects the group state or the model state. */
|
|
190
24
|
_state = computed(() => {
|
|
191
|
-
if (this.group) {
|
|
192
|
-
return this.group.isSelected(this.value()) ? 'on' : 'off';
|
|
193
|
-
}
|
|
194
25
|
return this.state();
|
|
195
26
|
});
|
|
196
27
|
toggle() {
|
|
197
28
|
if (this.disableToggleClick())
|
|
198
29
|
return;
|
|
199
|
-
|
|
200
|
-
if (this.isOn()) {
|
|
201
|
-
this.group.deselect(this.value(), this);
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
this.group.select(this.value(), this);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
this.state.set(this.isOn() ? 'off' : 'on');
|
|
209
|
-
}
|
|
30
|
+
this.state.set(this.isOn() ? 'off' : 'on');
|
|
210
31
|
}
|
|
211
32
|
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: BrnToggleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
212
|
-
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.1", type: BrnToggleDirective, isStandalone: true, selector: "button[hlmToggle], button[brnToggle]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, disableToggleClick: { classPropertyName: "disableToggleClick", publicName: "disableToggleClick", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { state: "stateChange" }, host: { listeners: { "click": "toggle()" }, properties: { "id": "id()", "attr.disabled": "disabled()
|
|
33
|
+
/** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.1", type: BrnToggleDirective, isStandalone: true, selector: "button[hlmToggle], button[brnToggle]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, disableToggleClick: { classPropertyName: "disableToggleClick", publicName: "disableToggleClick", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { state: "stateChange" }, host: { listeners: { "click": "toggle()" }, properties: { "id": "id()", "attr.disabled": "disabled() ? true : null", "attr.data-disabled": "disabled() ? true : null", "attr.data-state": "_state()", "attr.aria-pressed": "isOn()" } }, ngImport: i0 });
|
|
213
34
|
}
|
|
214
35
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: BrnToggleDirective, decorators: [{
|
|
215
36
|
type: Directive,
|
|
@@ -218,8 +39,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
218
39
|
standalone: true,
|
|
219
40
|
host: {
|
|
220
41
|
'[id]': 'id()',
|
|
221
|
-
'[attr.disabled]': 'disabled()
|
|
222
|
-
'[attr.data-disabled]': 'disabled()
|
|
42
|
+
'[attr.disabled]': 'disabled() ? true : null',
|
|
43
|
+
'[attr.data-disabled]': 'disabled() ? true : null',
|
|
223
44
|
'[attr.data-state]': '_state()',
|
|
224
45
|
'[attr.aria-pressed]': 'isOn()',
|
|
225
46
|
'(click)': 'toggle()',
|
|
@@ -239,22 +60,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImpor
|
|
|
239
60
|
exports: [BrnToggleDirective],
|
|
240
61
|
}]
|
|
241
62
|
}] });
|
|
242
|
-
class BrnToggleGroupModule {
|
|
243
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: BrnToggleGroupModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
244
|
-
/** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.1", ngImport: i0, type: BrnToggleGroupModule, imports: [BrnToggleDirective, BrnToggleGroupComponent], exports: [BrnToggleDirective, BrnToggleGroupComponent] });
|
|
245
|
-
/** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: BrnToggleGroupModule });
|
|
246
|
-
}
|
|
247
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: BrnToggleGroupModule, decorators: [{
|
|
248
|
-
type: NgModule,
|
|
249
|
-
args: [{
|
|
250
|
-
imports: [BrnToggleDirective, BrnToggleGroupComponent],
|
|
251
|
-
exports: [BrnToggleDirective, BrnToggleGroupComponent],
|
|
252
|
-
}]
|
|
253
|
-
}] });
|
|
254
63
|
|
|
255
64
|
/**
|
|
256
65
|
* Generated bundle index. Do not edit.
|
|
257
66
|
*/
|
|
258
67
|
|
|
259
|
-
export {
|
|
68
|
+
export { BrnToggleDirective, BrnToggleModule };
|
|
260
69
|
//# sourceMappingURL=spartan-ng-brain-toggle.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spartan-ng-brain-toggle.mjs","sources":["../../../../libs/brain/toggle/src/lib/brn-toggle-group.token.ts","../../../../libs/brain/toggle/src/lib/brn-toggle-group.component.ts","../../../../libs/brain/toggle/src/lib/brn-toggle.directive.ts","../../../../libs/brain/toggle/src/index.ts","../../../../libs/brain/toggle/src/spartan-ng-brain-toggle.ts"],"sourcesContent":["import { ExistingProvider, InjectionToken, Type, inject } from '@angular/core';\nimport type { BrnToggleGroupComponent } from './brn-toggle-group.component';\n\nconst BrnToggleGroupToken = new InjectionToken<BrnToggleGroupComponent>('BrnToggleGroupToken');\n\nexport function injectBrnToggleGroup<T>(): BrnToggleGroupComponent<T> | null {\n\treturn inject(BrnToggleGroupToken, { optional: true }) as BrnToggleGroupComponent<T> | null;\n}\n\nexport function provideBrnToggleGroup<T>(value: Type<BrnToggleGroupComponent<T>>): ExistingProvider {\n\treturn { provide: BrnToggleGroupToken, useExisting: value };\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { Component, booleanAttribute, computed, forwardRef, input, model, output, signal } from '@angular/core';\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { provideBrnToggleGroup } from './brn-toggle-group.token';\nimport { BrnToggleDirective } from './brn-toggle.directive';\n\nexport const BRN_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR = {\n\tprovide: NG_VALUE_ACCESSOR,\n\tuseExisting: forwardRef(() => BrnToggleGroupComponent),\n\tmulti: true,\n};\n\nexport class BrnButtonToggleChange<T = unknown> {\n\tconstructor(\n\t\tpublic source: BrnToggleDirective<T>,\n\t\tpublic value: ToggleValue<T>,\n\t) {}\n}\n\n@Component({\n\tselector: 'brn-toggle-group',\n\tstandalone: true,\n\tproviders: [provideBrnToggleGroup(BrnToggleGroupComponent), BRN_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR],\n\thost: {\n\t\trole: 'group',\n\t\tclass: 'brn-button-toggle-group',\n\t\t'[attr.aria-disabled]': 'state().disabled()',\n\t\t'[attr.data-disabled]': 'state().disabled()',\n\t\t'[attr.data-vertical]': 'vertical()',\n\t\t'(focusout)': 'onTouched()',\n\t},\n\texportAs: 'brnToggleGroup',\n\ttemplate: `\n\t\t<ng-content />\n\t`,\n})\nexport class BrnToggleGroupComponent<T = unknown> implements ControlValueAccessor {\n\t/**\n\t * The method to be called in order to update ngModel.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprivate _onChange: (value: ToggleValue<T>) => void = () => {};\n\n\t/** onTouch function registered via registerOnTouch (ControlValueAccessor). */\n\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\tprotected onTouched: () => void = () => {};\n\n\t/** Whether the button toggle group has a vertical orientation */\n\tpublic readonly vertical = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** Value of the toggle group. */\n\tpublic readonly value = model<ToggleValue<T>>(undefined);\n\n\t/** Whether no button toggles need to be selected. */\n\tpublic readonly nullable = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** Whether multiple button toggles can be selected. */\n\tpublic readonly multiple = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** Whether the button toggle group is disabled. */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** The internal state of the component. This can be replaced with linkedSignal in the future. */\n\tpublic readonly state = computed(() => ({\n\t\tdisabled: signal(this.disabled()),\n\t}));\n\n\t/** Emit event when the group value changes. */\n\tpublic readonly change = output<BrnButtonToggleChange<T>>();\n\n\twriteValue(value: ToggleValue<T>): void {\n\t\tthis.value.set(value);\n\t}\n\n\tregisterOnChange(fn: (value: ToggleValue<T>) => void) {\n\t\tthis._onChange = fn;\n\t}\n\n\tregisterOnTouched(fn: () => void) {\n\t\tthis.onTouched = fn;\n\t}\n\n\tsetDisabledState(isDisabled: boolean): void {\n\t\tthis.state().disabled.set(isDisabled);\n\t}\n\n\t/**\n\t * @internal\n\t * Determines whether a value can be set on the group.\n\t */\n\tcanDeselect(value: ToggleValue<T>): boolean {\n\t\t// if null values are allowed, the group can always be nullable\n\t\tif (this.nullable()) return true;\n\n\t\tconst currentValue = this.value();\n\n\t\tif (this.multiple() && Array.isArray(currentValue)) {\n\t\t\treturn !(currentValue.length === 1 && currentValue[0] === value);\n\t\t}\n\n\t\treturn currentValue !== value;\n\t}\n\n\t/**\n\t * @internal\n\t * Selects a value.\n\t */\n\tselect(value: T, source: BrnToggleDirective<T>): void {\n\t\tif (this.state().disabled() || this.isSelected(value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentValue = this.value();\n\n\t\t// emit the valueChange event here as we should only emit based on user interaction\n\t\tif (this.multiple()) {\n\t\t\tthis.emitSelectionChange([...((currentValue ?? []) as T[]), value], source);\n\t\t} else {\n\t\t\tthis.emitSelectionChange(value, source);\n\t\t}\n\n\t\tthis._onChange(this.value());\n\t\tthis.change.emit(new BrnButtonToggleChange<T>(source, this.value()));\n\t}\n\n\t/**\n\t * @internal\n\t * Deselects a value.\n\t */\n\tdeselect(value: T, source: BrnToggleDirective<T>): void {\n\t\tif (this.state().disabled() || !this.isSelected(value) || !this.canDeselect(value)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentValue = this.value();\n\n\t\tif (this.multiple()) {\n\t\t\tthis.emitSelectionChange(\n\t\t\t\t((currentValue ?? []) as T[]).filter((v) => v !== value),\n\t\t\t\tsource,\n\t\t\t);\n\t\t} else if (currentValue === value) {\n\t\t\tthis.emitSelectionChange(null, source);\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t * Determines whether a value is selected.\n\t */\n\tisSelected(value: T): boolean {\n\t\tconst currentValue = this.value();\n\n\t\tif (\n\t\t\tcurrentValue == null ||\n\t\t\tcurrentValue === undefined ||\n\t\t\t(Array.isArray(currentValue) && currentValue.length === 0)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif (this.multiple()) {\n\t\t\treturn (currentValue as T[])?.includes(value);\n\t\t}\n\t\treturn currentValue === value;\n\t}\n\n\t/** Update the value of the group */\n\tprivate emitSelectionChange(value: ToggleValue<T>, source: BrnToggleDirective<T>): void {\n\t\tthis.value.set(value);\n\t\tthis._onChange(value);\n\t\tthis.change.emit(new BrnButtonToggleChange<T>(source, this.value()));\n\t}\n}\n\ntype ToggleValue<T> = T | T[] | null | undefined;\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { ChangeDetectorRef, Directive, booleanAttribute, computed, inject, input, model } from '@angular/core';\nimport { injectBrnToggleGroup } from './brn-toggle-group.token';\n\n@Directive({\n\tselector: 'button[hlmToggle], button[brnToggle]',\n\tstandalone: true,\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'[attr.disabled]': 'disabled() || group?.disabled() ? true : null',\n\t\t'[attr.data-disabled]': 'disabled() || group?.disabled() ? true : null',\n\t\t'[attr.data-state]': '_state()',\n\t\t'[attr.aria-pressed]': 'isOn()',\n\t\t'(click)': 'toggle()',\n\t},\n})\nexport class BrnToggleDirective<T> {\n\tprivate static _uniqueId = 0;\n\n\tprivate readonly _changeDetector = inject(ChangeDetectorRef);\n\n\t/** Access the toggle group if available. */\n\tprotected readonly group = injectBrnToggleGroup<T>();\n\n\t/** The id of the toggle. */\n\tpublic readonly id = input(`brn-toggle-${BrnToggleDirective._uniqueId++}`);\n\n\t/** The value this toggle represents. */\n\tpublic readonly value = input<T>();\n\n\t/** Whether the toggle is disabled. */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** The current state of the toggle when not used in a group. */\n\tpublic readonly state = model<'on' | 'off'>('off');\n\n\t/** Whether the toggle is responds to click events. */\n\tpublic readonly disableToggleClick = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** Whether the toggle is in the on state. */\n\tprotected readonly isOn = computed(() => this._state() === 'on');\n\n\t/** The current state that reflects the group state or the model state. */\n\tprotected readonly _state = computed(() => {\n\t\tif (this.group) {\n\t\t\treturn this.group.isSelected(this.value() as T) ? 'on' : 'off';\n\t\t}\n\t\treturn this.state();\n\t});\n\n\ttoggle(): void {\n\t\tif (this.disableToggleClick()) return;\n\n\t\tif (this.group) {\n\t\t\tif (this.isOn()) {\n\t\t\t\tthis.group.deselect(this.value() as T, this);\n\t\t\t} else {\n\t\t\t\tthis.group.select(this.value() as T, this);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.state.set(this.isOn() ? 'off' : 'on');\n\t\t}\n\t}\n}\n","import { NgModule } from '@angular/core';\nimport { BrnToggleGroupComponent } from './lib/brn-toggle-group.component';\nimport { BrnToggleDirective } from './lib/brn-toggle.directive';\n\nexport * from './lib/brn-toggle-group.component';\nexport * from './lib/brn-toggle.directive';\n\n@NgModule({\n\timports: [BrnToggleDirective],\n\texports: [BrnToggleDirective],\n})\nexport class BrnToggleModule {}\n\n@NgModule({\n\timports: [BrnToggleDirective, BrnToggleGroupComponent],\n\texports: [BrnToggleDirective, BrnToggleGroupComponent],\n})\nexport class BrnToggleGroupModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA,MAAM,mBAAmB,GAAG,IAAI,cAAc,CAA0B,qBAAqB,CAAC;SAE9E,oBAAoB,GAAA;IACnC,OAAO,MAAM,CAAC,mBAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAA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AO,EAAE,CAAC,kBAAkB,EAAE,uBAAuB,CAAC;AACtD,oBAAA,OAAO,EAAE,CAAC,kBAAkB,EAAE,uBAAuB,CAAC;AACtD,iBAAA;;;AChBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"spartan-ng-brain-toggle.mjs","sources":["../../../../libs/brain/toggle/src/lib/brn-toggle.directive.ts","../../../../libs/brain/toggle/src/index.ts","../../../../libs/brain/toggle/src/spartan-ng-brain-toggle.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport { ChangeDetectorRef, Directive, booleanAttribute, computed, inject, input, model } from '@angular/core';\n\n@Directive({\n\tselector: 'button[hlmToggle], button[brnToggle]',\n\tstandalone: true,\n\thost: {\n\t\t'[id]': 'id()',\n\t\t'[attr.disabled]': 'disabled() ? true : null',\n\t\t'[attr.data-disabled]': 'disabled() ? true : null',\n\t\t'[attr.data-state]': '_state()',\n\t\t'[attr.aria-pressed]': 'isOn()',\n\t\t'(click)': 'toggle()',\n\t},\n})\nexport class BrnToggleDirective<T> {\n\tprivate static _uniqueId = 0;\n\n\tprivate readonly _changeDetector = inject(ChangeDetectorRef);\n\n\t/** The id of the toggle. */\n\tpublic readonly id = input(`brn-toggle-${BrnToggleDirective._uniqueId++}`);\n\n\t/** The value this toggle represents. */\n\tpublic readonly value = input<T>();\n\n\t/** Whether the toggle is disabled. */\n\tpublic readonly disabled = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** The current state of the toggle when not used in a group. */\n\tpublic readonly state = model<'on' | 'off'>('off');\n\n\t/** Whether the toggle is responds to click events. */\n\tpublic readonly disableToggleClick = input<boolean, BooleanInput>(false, {\n\t\ttransform: booleanAttribute,\n\t});\n\n\t/** Whether the toggle is in the on state. */\n\tprotected readonly isOn = computed(() => this._state() === 'on');\n\n\t/** The current state that reflects the group state or the model state. */\n\tprotected readonly _state = computed(() => {\n\t\treturn this.state();\n\t});\n\n\ttoggle(): void {\n\t\tif (this.disableToggleClick()) return;\n\n\t\tthis.state.set(this.isOn() ? 'off' : 'on');\n\t}\n}\n","import { NgModule } from '@angular/core';\nimport { BrnToggleDirective } from './lib/brn-toggle.directive';\n\nexport * from './lib/brn-toggle.directive';\n\n@NgModule({\n\timports: [BrnToggleDirective],\n\texports: [BrnToggleDirective],\n})\nexport class BrnToggleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAea,kBAAkB,CAAA;AACtB,IAAA,OAAO,SAAS,GAAG,CAAC;AAEX,IAAA,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC;;IAG5C,EAAE,GAAG,KAAK,CAAC,CAAc,WAAA,EAAA,kBAAkB,CAAC,SAAS,EAAE,CAAE,CAAA,CAAC;;IAG1D,KAAK,GAAG,KAAK,EAAK;;AAGlB,IAAA,QAAQ,GAAG,KAAK,CAAwB,KAAK,EAAE;AAC9D,QAAA,SAAS,EAAE,gBAAgB;AAC3B,KAAA,CAAC;;AAGc,IAAA,KAAK,GAAG,KAAK,CAAe,KAAK,CAAC;;AAGlC,IAAA,kBAAkB,GAAG,KAAK,CAAwB,KAAK,EAAE;AACxE,QAAA,SAAS,EAAE,gBAAgB;AAC3B,KAAA,CAAC;;AAGiB,IAAA,IAAI,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC;;AAG7C,IAAA,MAAM,GAAG,QAAQ,CAAC,MAAK;AACzC,QAAA,OAAO,IAAI,CAAC,KAAK,EAAE;AACpB,KAAC,CAAC;IAEF,MAAM,GAAA;QACL,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAAE;AAE/B,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,IAAI,CAAC;;0HAnC/B,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA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AA;AACV,oBAAA,QAAQ,EAAE,sCAAsC;AAChD,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACL,wBAAA,MAAM,EAAE,MAAM;AACd,wBAAA,iBAAiB,EAAE,0BAA0B;AAC7C,wBAAA,sBAAsB,EAAE,0BAA0B;AAClD,wBAAA,mBAAmB,EAAE,UAAU;AAC/B,wBAAA,qBAAqB,EAAE,QAAQ;AAC/B,wBAAA,SAAS,EAAE,UAAU;AACrB,qBAAA;AACD,iBAAA;;;MCLY,eAAe,CAAA;0HAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;2HAAf,eAAe,EAAA,OAAA,EAAA,CAHjB,kBAAkB,CAAA,EAAA,OAAA,EAAA,CAClB,kBAAkB,CAAA,EAAA,CAAA;2HAEhB,eAAe,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACT,OAAO,EAAE,CAAC,kBAAkB,CAAC;oBAC7B,OAAO,EAAE,CAAC,kBAAkB,CAAC;AAC7B,iBAAA;;;ACRD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spartan-ng/brain",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.438",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"exports": {
|
|
6
6
|
"./hlm-tailwind-preset": {
|
|
@@ -122,6 +122,10 @@
|
|
|
122
122
|
"types": "./toggle/index.d.ts",
|
|
123
123
|
"default": "./fesm2022/spartan-ng-brain-toggle.mjs"
|
|
124
124
|
},
|
|
125
|
+
"./toggle-group": {
|
|
126
|
+
"types": "./toggle-group/index.d.ts",
|
|
127
|
+
"default": "./fesm2022/spartan-ng-brain-toggle-group.mjs"
|
|
128
|
+
},
|
|
125
129
|
"./tooltip": {
|
|
126
130
|
"types": "./tooltip/index.d.ts",
|
|
127
131
|
"default": "./fesm2022/spartan-ng-brain-tooltip.mjs"
|
package/slider/index.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { BrnSliderRangeDirective } from './lib/brn-slider-range.directive';
|
|
1
2
|
import { BrnSliderThumbDirective } from './lib/brn-slider-thumb.directive';
|
|
2
|
-
import {
|
|
3
|
+
import { BrnSliderTickDirective } from './lib/brn-slider-tick.directive';
|
|
4
|
+
import { BrnSliderTrackDirective } from './lib/brn-slider-track.directive';
|
|
5
|
+
import { BrnSliderDirective } from './lib/brn-slider.directive';
|
|
6
|
+
export * from './lib/brn-slider-range.directive';
|
|
3
7
|
export * from './lib/brn-slider-thumb.directive';
|
|
4
|
-
export * from './lib/brn-slider-tick
|
|
5
|
-
export * from './lib/brn-slider-track-active-fill.directive';
|
|
8
|
+
export * from './lib/brn-slider-tick.directive';
|
|
6
9
|
export * from './lib/brn-slider-track.directive';
|
|
7
|
-
export
|
|
10
|
+
export * from './lib/brn-slider.directive';
|
|
11
|
+
export * from './lib/brn-slider.token';
|
|
12
|
+
export declare const BrnSliderImports: readonly [typeof BrnSliderDirective, typeof BrnSliderTrackDirective, typeof BrnSliderThumbDirective, typeof BrnSliderRangeDirective, typeof BrnSliderTickDirective];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class BrnSliderRangeDirective {
|
|
3
|
+
/** Access the slider */
|
|
4
|
+
protected readonly slider: import("@spartan-ng/brain/slider").BrnSliderDirective;
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnSliderRangeDirective, never>;
|
|
6
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnSliderRangeDirective, "[brnSliderRange]", never, {}, {}, never, never, true, never>;
|
|
7
|
+
}
|
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
import { type Signal } from '@angular/core';
|
|
2
1
|
import * as i0 from "@angular/core";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export declare class BrnSliderThumbDirective implements BrnSliderThumb {
|
|
8
|
-
private readonly _platformId;
|
|
2
|
+
export declare class BrnSliderThumbDirective {
|
|
3
|
+
protected readonly slider: import("@spartan-ng/brain/slider").BrnSliderDirective;
|
|
4
|
+
private readonly _document;
|
|
9
5
|
private readonly _elementRef;
|
|
10
|
-
private readonly
|
|
11
|
-
|
|
6
|
+
private readonly _platform;
|
|
7
|
+
/**
|
|
8
|
+
* Offsets the thumb centre point while sliding to ensure it remains
|
|
9
|
+
* within the bounds of the slider when reaching the edges.
|
|
10
|
+
* Based on https://github.com/radix-ui/primitives/blob/main/packages/react/slider/src/slider.tsx
|
|
11
|
+
*/
|
|
12
|
+
protected readonly thumbOffset: import("@angular/core").Signal<string>;
|
|
12
13
|
constructor();
|
|
13
|
-
|
|
14
|
-
private
|
|
14
|
+
/** @internal */
|
|
15
|
+
private dragThumb;
|
|
16
|
+
/**
|
|
17
|
+
* Handle keyboard events.
|
|
18
|
+
* @param event
|
|
19
|
+
*/
|
|
20
|
+
protected handleKeydown(event: KeyboardEvent): void;
|
|
21
|
+
private linearScale;
|
|
15
22
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnSliderThumbDirective, never>;
|
|
16
23
|
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnSliderThumbDirective, "[brnSliderThumb]", never, {}, {}, never, never, true, never>;
|
|
17
24
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class BrnSliderTickDirective implements OnDestroy {
|
|
4
|
+
private readonly _slider;
|
|
5
|
+
private readonly _templateRef;
|
|
6
|
+
private readonly _viewContainer;
|
|
7
|
+
private _ticks;
|
|
8
|
+
constructor();
|
|
9
|
+
ngOnDestroy(): void;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnSliderTickDirective, never>;
|
|
11
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnSliderTickDirective, "[brnSliderTick]", never, {}, {}, never, never, true, never>;
|
|
12
|
+
}
|
|
@@ -1,140 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type AfterViewInit, InjectionToken, type OnDestroy, type Signal, type WritableSignal } from '@angular/core';
|
|
3
|
-
import { type ControlValueAccessor } from '@angular/forms';
|
|
4
|
-
import type { BrnLabelDirective } from '@spartan-ng/brain/label';
|
|
1
|
+
import { ElementRef } from '@angular/core';
|
|
5
2
|
import * as i0 from "@angular/core";
|
|
6
|
-
export declare
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
isFocused: Signal<boolean>;
|
|
12
|
-
}
|
|
13
|
-
export declare const BRN_SLIDER_TRACK: InjectionToken<BrnSliderTrack>;
|
|
14
|
-
export declare const BRN_SLIDER: InjectionToken<BrnSlider>;
|
|
15
|
-
export interface BrnSlider {
|
|
16
|
-
/** The minimun value of the slider. */
|
|
17
|
-
min: WritableSignal<number>;
|
|
18
|
-
/** The maximun value of the slider. */
|
|
19
|
-
max: WritableSignal<number>;
|
|
20
|
-
/** The amount that slider values can increment or decrement by. */
|
|
21
|
-
step: Signal<number>;
|
|
22
|
-
/** Whether the slider is disabled. */
|
|
23
|
-
disabled: WritableSignal<boolean>;
|
|
24
|
-
/** Whether the slider displays tick marks along the slider track. */
|
|
25
|
-
showTickMarks: Signal<boolean>;
|
|
26
|
-
/** Whether the slider is ltr or rtl.
|
|
27
|
-
* Any consumer of slider interested in getting the current
|
|
28
|
-
* direction state, will consume this signal.
|
|
29
|
-
*/
|
|
30
|
-
direction: Signal<Direction>;
|
|
31
|
-
/** The underlying slider's track element */
|
|
32
|
-
brnSliderTrack: Signal<BrnSliderTrack | undefined>;
|
|
33
|
-
/** The aria-labelledby element */
|
|
34
|
-
label: Signal<BrnLabelDirective | null>;
|
|
35
|
-
/** The optional aria-label fallback value.
|
|
36
|
-
* If no label is provided, this input must be provided by the user,
|
|
37
|
-
* otherwise an error will be displayed prompting the user to either
|
|
38
|
-
* provide a spartan-ui label or a fallback aria label text.
|
|
39
|
-
*/
|
|
40
|
-
ariaLabel: Signal<string | null>;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Directive that adds slider-specific behaviors to an input element inside `<brn-slider>`.
|
|
44
|
-
*/
|
|
45
|
-
export declare class BrnSliderInputDirective implements ControlValueAccessor, BrnSliderInput {
|
|
46
|
-
private _onChangeFn;
|
|
47
|
-
private _onTouchedFn;
|
|
48
|
-
protected isDisabled: Signal<true | undefined>;
|
|
49
|
-
protected valueNow: Signal<number>;
|
|
50
|
-
protected valueMin: Signal<number>;
|
|
51
|
-
protected valueMax: Signal<number>;
|
|
52
|
-
protected ariaLabelledby: Signal<import("@angular/core").InputSignal<string> | undefined>;
|
|
53
|
-
protected ariaLabel: Signal<string | null>;
|
|
54
|
-
readonly value: WritableSignal<number>;
|
|
55
|
-
readonly isFocused: WritableSignal<boolean>;
|
|
56
|
-
private readonly _platformId;
|
|
57
|
-
private readonly _elementRef;
|
|
58
|
-
private readonly _slider;
|
|
59
|
-
private readonly _renderer2;
|
|
60
|
-
private readonly _changeDetector;
|
|
3
|
+
export declare class BrnSliderTrackDirective {
|
|
4
|
+
/** Access the slider */
|
|
5
|
+
protected readonly slider: import("@spartan-ng/brain/slider").BrnSliderDirective;
|
|
6
|
+
/** @internal Access the slider track */
|
|
7
|
+
readonly elementRef: ElementRef<HTMLElement>;
|
|
61
8
|
constructor();
|
|
62
|
-
|
|
63
|
-
onBlur(): void;
|
|
64
|
-
onInput(): void;
|
|
65
|
-
onChange(): void;
|
|
66
|
-
writeValue(obj: number): void;
|
|
67
|
-
registerOnChange(fn: (value: string | number) => void): void;
|
|
68
|
-
registerOnTouched(fn: () => void): void;
|
|
69
|
-
/**
|
|
70
|
-
* Sets the disabled state of the slider.
|
|
71
|
-
* @param isDisabled The new disabled state
|
|
72
|
-
*/
|
|
73
|
-
setDisabledState(isDisabled: boolean): void;
|
|
74
|
-
private _updateHostElementValue;
|
|
75
|
-
private _updateValue;
|
|
76
|
-
private _updateHostElementStep;
|
|
77
|
-
private _updateMinValue;
|
|
78
|
-
private _updateMaxValue;
|
|
79
|
-
private _updateDirection;
|
|
80
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BrnSliderInputDirective, never>;
|
|
81
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnSliderInputDirective, "input[brnSliderInput]", never, {}, {}, never, never, true, never>;
|
|
82
|
-
}
|
|
83
|
-
export declare class BrnSliderDirective implements BrnSlider, AfterViewInit, OnDestroy {
|
|
84
|
-
readonly label: import("@angular/core").InputSignal<BrnLabelDirective | null>;
|
|
85
|
-
readonly ariaLabel: import("@angular/core").InputSignal<string | null>;
|
|
86
|
-
/** Used only as an input. */
|
|
87
|
-
readonly dir: import("@angular/core").InputSignal<Direction>;
|
|
88
|
-
readonly disabled: import("@angular/core").ModelSignal<boolean>;
|
|
89
|
-
readonly min: import("@angular/core").ModelSignal<number>;
|
|
90
|
-
readonly max: import("@angular/core").ModelSignal<number>;
|
|
91
|
-
readonly step: import("@angular/core").InputSignal<number>;
|
|
92
|
-
readonly showTickMarks: import("@angular/core").InputSignal<boolean>;
|
|
93
|
-
readonly direction: WritableSignal<Direction>;
|
|
94
|
-
private readonly _destroyed;
|
|
95
|
-
private readonly _injector;
|
|
96
|
-
private readonly _dir;
|
|
97
|
-
private readonly _platformId;
|
|
98
|
-
readonly brnSliderTrack: Signal<BrnSliderTrack | undefined>;
|
|
99
|
-
ngAfterViewInit(): void;
|
|
100
|
-
ngOnDestroy(): void;
|
|
101
|
-
/**
|
|
102
|
-
* The method is responsible of setting the current direction state
|
|
103
|
-
* based on the latest 'dir' input or bidi state change. The only
|
|
104
|
-
* source of truth for slider direction state is the 'direction' signal
|
|
105
|
-
* and all interested consumers of it, will consume this interface exposed signal.
|
|
106
|
-
*/
|
|
107
|
-
private _updateDirectionality;
|
|
108
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BrnSliderDirective, never>;
|
|
109
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnSliderDirective, "[brnSlider]", ["brnSlider"], { "label": { "alias": "label"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "dir": { "alias": "dir"; "required": false; "isSignal": true; }; "disabled": { "alias": "brnSliderDisabled"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "showTickMarks": { "alias": "showTickMarks"; "required": false; "isSignal": true; }; }, { "disabled": "brnSliderDisabledChange"; "min": "minChange"; "max": "maxChange"; }, ["brnSliderTrack"], never, true, never>;
|
|
110
|
-
}
|
|
111
|
-
export interface BrnSliderTrack {
|
|
112
|
-
/** The track's active portion. */
|
|
113
|
-
activeTrackPercentage: Signal<number>;
|
|
114
|
-
/** The host element's bounding client rect width without padding left and right. */
|
|
115
|
-
hostElementWidth: Signal<number>;
|
|
116
|
-
/** The available tick mark track width based on slider's step min and max values. */
|
|
117
|
-
tickMarkTrackWidth: Signal<number>;
|
|
118
|
-
/** The tick marks array indicating if a mark is currently active or inactive. */
|
|
119
|
-
tickMarks: Signal<Array<boolean>>;
|
|
120
|
-
/** The underlying slider's track input element */
|
|
121
|
-
brnSliderInput: Signal<BrnSliderInput | undefined>;
|
|
122
|
-
}
|
|
123
|
-
export declare class BrnSliderTrackDirective implements BrnSliderTrack, AfterViewInit, OnDestroy {
|
|
124
|
-
readonly hostElementWidth: WritableSignal<number>;
|
|
125
|
-
private readonly _destroyed;
|
|
126
|
-
private readonly _slider;
|
|
127
|
-
private readonly _platformId;
|
|
128
|
-
private readonly _elementRef;
|
|
129
|
-
private readonly _sharedResizeObserver;
|
|
130
|
-
readonly brnSliderInput: Signal<BrnSliderInput | undefined>;
|
|
131
|
-
activeTrackPercentage: Signal<number>;
|
|
132
|
-
tickMarkTrackWidth: Signal<number>;
|
|
133
|
-
tickMarks: Signal<any[]>;
|
|
134
|
-
ngAfterViewInit(): void;
|
|
135
|
-
ngOnDestroy(): void;
|
|
136
|
-
private _onResize;
|
|
137
|
-
private _storeDimensions;
|
|
9
|
+
protected moveThumbToPoint(event: MouseEvent): void;
|
|
138
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnSliderTrackDirective, never>;
|
|
139
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnSliderTrackDirective, "[brnSliderTrack]", never, {}, {},
|
|
11
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnSliderTrackDirective, "[brnSliderTrack]", never, {}, {}, never, never, true, never>;
|
|
140
12
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ExistingProvider, InjectionToken, Type } from '@angular/core';
|
|
2
|
+
import type { BrnSliderTrackDirective } from './brn-slider-track.directive';
|
|
3
|
+
export declare const BrnSliderTrackToken: InjectionToken<BrnSliderTrackDirective>;
|
|
4
|
+
export declare function provideBrnSliderTrack(slider: Type<BrnSliderTrackDirective>): ExistingProvider;
|
|
5
|
+
export declare function injectBrnSliderTrack(): BrnSliderTrackDirective;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
4
|
+
import { ChangeFn, TouchFn } from '@spartan-ng/brain/forms';
|
|
5
|
+
import type { BrnSliderTrackDirective } from './brn-slider-track.directive';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class BrnSliderDirective implements ControlValueAccessor, OnInit {
|
|
8
|
+
private readonly _changeDetectorRef;
|
|
9
|
+
private readonly _elementRef;
|
|
10
|
+
readonly value: import("@angular/core").ModelSignal<number>;
|
|
11
|
+
readonly min: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
|
|
12
|
+
readonly max: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
|
|
13
|
+
readonly step: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
|
|
14
|
+
readonly _disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
15
|
+
/** Whether we should show tick marks */
|
|
16
|
+
readonly showTicks: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
|
17
|
+
/** @internal */
|
|
18
|
+
readonly ticks: import("@angular/core").Signal<any[]>;
|
|
19
|
+
/** @internal */
|
|
20
|
+
readonly disabled: import("@angular/core").WritableSignal<boolean>;
|
|
21
|
+
/** @internal */
|
|
22
|
+
readonly percentage: import("@angular/core").Signal<number>;
|
|
23
|
+
/** @internal Store the on change callback */
|
|
24
|
+
protected _onChange?: ChangeFn<number>;
|
|
25
|
+
/** @internal Store the on touched callback */
|
|
26
|
+
protected _onTouched?: TouchFn;
|
|
27
|
+
/** @internal Store the track */
|
|
28
|
+
readonly track: import("@angular/core").WritableSignal<BrnSliderTrackDirective | null>;
|
|
29
|
+
ngOnInit(): void;
|
|
30
|
+
registerOnChange(fn: (value: number) => void): void;
|
|
31
|
+
registerOnTouched(fn: () => void): void;
|
|
32
|
+
setDisabledState(isDisabled: boolean): void;
|
|
33
|
+
writeValue(value: number): void;
|
|
34
|
+
setValue(value: number): void;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BrnSliderDirective, never>;
|
|
36
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BrnSliderDirective, "[brnSlider]", ["brnSlider"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "_disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "showTicks": { "alias": "showTicks"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExistingProvider, Type } from '@angular/core';
|
|
2
|
+
import type { BrnSliderDirective } from './brn-slider.directive';
|
|
3
|
+
export declare function provideBrnSlider(slider: Type<BrnSliderDirective>): ExistingProvider;
|
|
4
|
+
export declare function injectBrnSlider(): BrnSliderDirective;
|
package/toggle/index.d.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import * as i1 from "./lib/brn-toggle.directive";
|
|
3
|
-
import * as i2 from "./lib/brn-toggle-group.component";
|
|
4
|
-
export * from './lib/brn-toggle-group.component';
|
|
5
3
|
export * from './lib/brn-toggle.directive';
|
|
6
4
|
export declare class BrnToggleModule {
|
|
7
5
|
static ɵfac: i0.ɵɵFactoryDeclaration<BrnToggleModule, never>;
|
|
8
6
|
static ɵmod: i0.ɵɵNgModuleDeclaration<BrnToggleModule, never, [typeof i1.BrnToggleDirective], [typeof i1.BrnToggleDirective]>;
|
|
9
7
|
static ɵinj: i0.ɵɵInjectorDeclaration<BrnToggleModule>;
|
|
10
8
|
}
|
|
11
|
-
export declare class BrnToggleGroupModule {
|
|
12
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BrnToggleGroupModule, never>;
|
|
13
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<BrnToggleGroupModule, never, [typeof i1.BrnToggleDirective, typeof i2.BrnToggleGroupComponent], [typeof i1.BrnToggleDirective, typeof i2.BrnToggleGroupComponent]>;
|
|
14
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<BrnToggleGroupModule>;
|
|
15
|
-
}
|
|
@@ -3,8 +3,6 @@ import * as i0 from "@angular/core";
|
|
|
3
3
|
export declare class BrnToggleDirective<T> {
|
|
4
4
|
private static _uniqueId;
|
|
5
5
|
private readonly _changeDetector;
|
|
6
|
-
/** Access the toggle group if available. */
|
|
7
|
-
protected readonly group: import("@spartan-ng/brain/toggle").BrnToggleGroupComponent<T> | null;
|
|
8
6
|
/** The id of the toggle. */
|
|
9
7
|
readonly id: import("@angular/core").InputSignal<string>;
|
|
10
8
|
/** The value this toggle represents. */
|