@luzmo/ngx-lucero 1.0.1-alpha.78
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/README.md +41 -0
- package/esm/components/accordion-item.d.ts +32 -0
- package/esm/components/accordion-item.js +89 -0
- package/esm/components/accordion.d.ts +38 -0
- package/esm/components/accordion.js +107 -0
- package/esm/components/action-bar.d.ts +32 -0
- package/esm/components/action-bar.js +83 -0
- package/esm/components/action-button.d.ts +59 -0
- package/esm/components/action-button.js +205 -0
- package/esm/components/action-group.d.ts +42 -0
- package/esm/components/action-group.js +155 -0
- package/esm/components/action-menu.d.ts +75 -0
- package/esm/components/action-menu.js +337 -0
- package/esm/components/avatar.d.ts +35 -0
- package/esm/components/avatar.js +94 -0
- package/esm/components/badge.d.ts +31 -0
- package/esm/components/badge.js +86 -0
- package/esm/components/button-group.d.ts +28 -0
- package/esm/components/button-group.js +71 -0
- package/esm/components/button.d.ts +40 -0
- package/esm/components/button.js +140 -0
- package/esm/components/calendar.d.ts +64 -0
- package/esm/components/calendar.js +218 -0
- package/esm/components/chat-message-group.d.ts +29 -0
- package/esm/components/chat-message-group.js +76 -0
- package/esm/components/chat-message.d.ts +50 -0
- package/esm/components/chat-message.js +156 -0
- package/esm/components/checkbox.d.ts +55 -0
- package/esm/components/checkbox.js +196 -0
- package/esm/components/clear-button.d.ts +32 -0
- package/esm/components/clear-button.js +88 -0
- package/esm/components/close-button.d.ts +33 -0
- package/esm/components/close-button.js +95 -0
- package/esm/components/color-area.d.ts +45 -0
- package/esm/components/color-area.js +167 -0
- package/esm/components/color-field.d.ts +91 -0
- package/esm/components/color-field.js +321 -0
- package/esm/components/color-handle.d.ts +31 -0
- package/esm/components/color-handle.js +90 -0
- package/esm/components/color-loupe.d.ts +29 -0
- package/esm/components/color-loupe.js +76 -0
- package/esm/components/color-menu.d.ts +36 -0
- package/esm/components/color-menu.js +97 -0
- package/esm/components/color-palette-group.d.ts +40 -0
- package/esm/components/color-palette-group.js +117 -0
- package/esm/components/color-palette.d.ts +43 -0
- package/esm/components/color-palette.js +126 -0
- package/esm/components/color-picker.d.ts +49 -0
- package/esm/components/color-picker.js +143 -0
- package/esm/components/color-slider.d.ts +53 -0
- package/esm/components/color-slider.js +215 -0
- package/esm/components/date-range-picker.d.ts +69 -0
- package/esm/components/date-range-picker.js +228 -0
- package/esm/components/date-time-picker.d.ts +71 -0
- package/esm/components/date-time-picker.js +249 -0
- package/esm/components/divider.d.ts +31 -0
- package/esm/components/divider.js +78 -0
- package/esm/components/field-group.d.ts +32 -0
- package/esm/components/field-group.js +101 -0
- package/esm/components/field-label.d.ts +37 -0
- package/esm/components/field-label.js +104 -0
- package/esm/components/help-text.d.ts +30 -0
- package/esm/components/help-text.js +77 -0
- package/esm/components/icon.d.ts +33 -0
- package/esm/components/icon.js +104 -0
- package/esm/components/infield-button.d.ts +35 -0
- package/esm/components/infield-button.js +103 -0
- package/esm/components/label.d.ts +29 -0
- package/esm/components/label.js +76 -0
- package/esm/components/menu.d.ts +53 -0
- package/esm/components/menu.js +218 -0
- package/esm/components/multi-language-field.d.ts +58 -0
- package/esm/components/multi-language-field.js +263 -0
- package/esm/components/number-field.d.ts +103 -0
- package/esm/components/number-field.js +372 -0
- package/esm/components/options.d.ts +58 -0
- package/esm/components/options.js +207 -0
- package/esm/components/overlay.d.ts +67 -0
- package/esm/components/overlay.js +212 -0
- package/esm/components/picker-button.d.ts +32 -0
- package/esm/components/picker-button.js +94 -0
- package/esm/components/picker.d.ts +79 -0
- package/esm/components/picker.js +340 -0
- package/esm/components/popover.d.ts +33 -0
- package/esm/components/popover.js +93 -0
- package/esm/components/progress-bar.d.ts +35 -0
- package/esm/components/progress-bar.js +121 -0
- package/esm/components/progress-circle.d.ts +35 -0
- package/esm/components/progress-circle.js +94 -0
- package/esm/components/progress-steps.d.ts +46 -0
- package/esm/components/progress-steps.js +127 -0
- package/esm/components/prompt-box.d.ts +88 -0
- package/esm/components/prompt-box.js +280 -0
- package/esm/components/radio-group.d.ts +39 -0
- package/esm/components/radio-group.js +136 -0
- package/esm/components/radio.d.ts +46 -0
- package/esm/components/radio.js +172 -0
- package/esm/components/search.d.ts +95 -0
- package/esm/components/search.js +351 -0
- package/esm/components/select.d.ts +82 -0
- package/esm/components/select.js +351 -0
- package/esm/components/slider.d.ts +47 -0
- package/esm/components/slider.js +185 -0
- package/esm/components/status-light.d.ts +30 -0
- package/esm/components/status-light.js +78 -0
- package/esm/components/swatch-group.d.ts +37 -0
- package/esm/components/swatch-group.js +126 -0
- package/esm/components/swatch.d.ts +49 -0
- package/esm/components/swatch.js +197 -0
- package/esm/components/switch.d.ts +48 -0
- package/esm/components/switch.js +160 -0
- package/esm/components/tab-panel.d.ts +29 -0
- package/esm/components/tab-panel.js +78 -0
- package/esm/components/tab.d.ts +32 -0
- package/esm/components/tab.js +100 -0
- package/esm/components/tabs-overflow.d.ts +33 -0
- package/esm/components/tabs-overflow.js +97 -0
- package/esm/components/tabs.d.ts +43 -0
- package/esm/components/tabs.js +150 -0
- package/esm/components/tag.d.ts +31 -0
- package/esm/components/tag.js +90 -0
- package/esm/components/tags.d.ts +30 -0
- package/esm/components/tags.js +81 -0
- package/esm/components/text-field.d.ts +87 -0
- package/esm/components/text-field.js +308 -0
- package/esm/components/toast.d.ts +30 -0
- package/esm/components/toast.js +68 -0
- package/esm/components/tooltip.d.ts +44 -0
- package/esm/components/tooltip.js +154 -0
- package/esm/components/top-nav-item.d.ts +35 -0
- package/esm/components/top-nav-item.js +120 -0
- package/esm/components/top-nav.d.ts +35 -0
- package/esm/components/top-nav.js +110 -0
- package/esm/index.d.ts +135 -0
- package/esm/index.js +269 -0
- package/package.json +40 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, inject, Input, Renderer2 } from '@angular/core';
|
|
2
|
+
import '@luzmo/lucero/status-light';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
const _c0 = ["*"];
|
|
5
|
+
/**
|
|
6
|
+
* Angular wrapper component for <luzmo-status-light>
|
|
7
|
+
*
|
|
8
|
+
* @slot (default) - text label of the Status Light
|
|
9
|
+
*/
|
|
10
|
+
export class LuzmoStatusLight {
|
|
11
|
+
elementRef = inject(ElementRef);
|
|
12
|
+
renderer = inject(Renderer2);
|
|
13
|
+
destroyRef = inject(DestroyRef);
|
|
14
|
+
host = this.elementRef.nativeElement;
|
|
15
|
+
listenerCleanup = [];
|
|
16
|
+
/** The underlying custom element instance. Use to call imperative methods. */
|
|
17
|
+
get nativeElement() {
|
|
18
|
+
return this.host;
|
|
19
|
+
}
|
|
20
|
+
variant;
|
|
21
|
+
disabled;
|
|
22
|
+
constructor() {
|
|
23
|
+
this.bindEvents();
|
|
24
|
+
this.destroyRef.onDestroy(() => {
|
|
25
|
+
for (const cleanup of this.listenerCleanup) {
|
|
26
|
+
cleanup();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
ngOnChanges(changes) {
|
|
31
|
+
for (const key of Object.keys(changes)) {
|
|
32
|
+
switch (key) {
|
|
33
|
+
case 'variant':
|
|
34
|
+
this.setHostProperty('variant', changes['variant'].currentValue);
|
|
35
|
+
break;
|
|
36
|
+
case 'disabled':
|
|
37
|
+
this.setHostProperty('disabled', changes['disabled'].currentValue);
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Forward a wrapper @Input to the underlying host element via Renderer2 so
|
|
46
|
+
* the wrapper stays compatible with non-DOM Angular platforms (SSR, tests).
|
|
47
|
+
* Unlike a "skip undefined" guard, this lets consumers reset values back to
|
|
48
|
+
* undefined / null by clearing their bindings.
|
|
49
|
+
*/
|
|
50
|
+
setHostProperty(key, value) {
|
|
51
|
+
this.renderer.setProperty(this.host, key, value);
|
|
52
|
+
}
|
|
53
|
+
bindEvents() {
|
|
54
|
+
// No custom events for this wrapper.
|
|
55
|
+
}
|
|
56
|
+
static ɵfac = function LuzmoStatusLight_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LuzmoStatusLight)(); };
|
|
57
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: LuzmoStatusLight, selectors: [["luzmo-status-light"]], inputs: { variant: "variant", disabled: "disabled" }, exportAs: ["luzmoStatusLight"], features: [i0.ɵɵNgOnChangesFeature], ngContentSelectors: _c0, decls: 1, vars: 0, template: function LuzmoStatusLight_Template(rf, ctx) { if (rf & 1) {
|
|
58
|
+
i0.ɵɵprojectionDef();
|
|
59
|
+
i0.ɵɵprojection(0);
|
|
60
|
+
} }, encapsulation: 2, changeDetection: 0 });
|
|
61
|
+
}
|
|
62
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LuzmoStatusLight, [{
|
|
63
|
+
type: Component,
|
|
64
|
+
args: [{
|
|
65
|
+
selector: 'luzmo-status-light',
|
|
66
|
+
exportAs: 'luzmoStatusLight',
|
|
67
|
+
standalone: true,
|
|
68
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
69
|
+
template: '<ng-content />'
|
|
70
|
+
}]
|
|
71
|
+
}], () => [], { variant: [{
|
|
72
|
+
type: Input,
|
|
73
|
+
args: [{ alias: 'variant' }]
|
|
74
|
+
}], disabled: [{
|
|
75
|
+
type: Input,
|
|
76
|
+
args: [{ alias: 'disabled' }]
|
|
77
|
+
}] }); })();
|
|
78
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(LuzmoStatusLight, { className: "LuzmoStatusLight", filePath: "components/status-light.ts", lineNumber: 18 }); })();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import '@luzmo/lucero/swatch';
|
|
3
|
+
import type { LuzmoSwatchGroup as LuzmoSwatchGroupHostElement, LuzmoSwatch } from '@luzmo/lucero/swatch';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class LuzmoSwatchGroup implements OnChanges {
|
|
6
|
+
private readonly elementRef;
|
|
7
|
+
private readonly renderer;
|
|
8
|
+
private readonly destroyRef;
|
|
9
|
+
private readonly host;
|
|
10
|
+
private readonly listenerCleanup;
|
|
11
|
+
/** The underlying custom element instance. Use to call imperative methods. */
|
|
12
|
+
get nativeElement(): LuzmoSwatchGroupHostElement;
|
|
13
|
+
border?: ('none' | 'light' | undefined);
|
|
14
|
+
density?: 'compact' | 'spacious';
|
|
15
|
+
rounding?: ('none' | 'full' | undefined);
|
|
16
|
+
selected?: string[];
|
|
17
|
+
selects?: ('single' | 'multiple' | undefined);
|
|
18
|
+
shape?: ('rectangle' | undefined);
|
|
19
|
+
swatches?: LuzmoSwatch[];
|
|
20
|
+
rovingTabindexController?: unknown;
|
|
21
|
+
readonly changeEvent: import("@angular/core").OutputEmitterRef<Event>;
|
|
22
|
+
constructor();
|
|
23
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
24
|
+
/**
|
|
25
|
+
* Forward a wrapper @Input to the underlying host element via Renderer2 so
|
|
26
|
+
* the wrapper stays compatible with non-DOM Angular platforms (SSR, tests).
|
|
27
|
+
* Unlike a "skip undefined" guard, this lets consumers reset values back to
|
|
28
|
+
* undefined / null by clearing their bindings.
|
|
29
|
+
*/
|
|
30
|
+
private setHostProperty;
|
|
31
|
+
private bindEvents;
|
|
32
|
+
focus(options?: FocusOptions): void;
|
|
33
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LuzmoSwatchGroup, never>;
|
|
34
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LuzmoSwatchGroup, "luzmo-swatch-group", ["luzmoSwatchGroup"], { "border": { "alias": "border"; "required": false; }; "density": { "alias": "density"; "required": false; }; "rounding": { "alias": "rounding"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "selects": { "alias": "selects"; "required": false; }; "shape": { "alias": "shape"; "required": false; }; "swatches": { "alias": "swatches"; "required": false; }; "rovingTabindexController": { "alias": "roving-tabindex-controller"; "required": false; }; }, { "changeEvent": "change"; }, never, ["*"], true, never>;
|
|
35
|
+
}
|
|
36
|
+
/** The underlying custom element type for LuzmoSwatchGroup */
|
|
37
|
+
export type LuzmoSwatchGroupElement = LuzmoSwatchGroupHostElement;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, inject, Input, output, Renderer2 } from '@angular/core';
|
|
2
|
+
import '@luzmo/lucero/swatch';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
const _c0 = ["*"];
|
|
5
|
+
/**
|
|
6
|
+
* Angular wrapper component for <luzmo-swatch-group>
|
|
7
|
+
*
|
|
8
|
+
* @slot (default) - Swatch elements to manage as a group
|
|
9
|
+
*/
|
|
10
|
+
export class LuzmoSwatchGroup {
|
|
11
|
+
elementRef = inject(ElementRef);
|
|
12
|
+
renderer = inject(Renderer2);
|
|
13
|
+
destroyRef = inject(DestroyRef);
|
|
14
|
+
host = this.elementRef.nativeElement;
|
|
15
|
+
listenerCleanup = [];
|
|
16
|
+
/** The underlying custom element instance. Use to call imperative methods. */
|
|
17
|
+
get nativeElement() {
|
|
18
|
+
return this.host;
|
|
19
|
+
}
|
|
20
|
+
border;
|
|
21
|
+
density;
|
|
22
|
+
rounding;
|
|
23
|
+
selected;
|
|
24
|
+
selects;
|
|
25
|
+
shape;
|
|
26
|
+
swatches;
|
|
27
|
+
rovingTabindexController;
|
|
28
|
+
changeEvent = output({ alias: 'change' });
|
|
29
|
+
constructor() {
|
|
30
|
+
this.bindEvents();
|
|
31
|
+
this.destroyRef.onDestroy(() => {
|
|
32
|
+
for (const cleanup of this.listenerCleanup) {
|
|
33
|
+
cleanup();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
ngOnChanges(changes) {
|
|
38
|
+
for (const key of Object.keys(changes)) {
|
|
39
|
+
switch (key) {
|
|
40
|
+
case 'border':
|
|
41
|
+
this.setHostProperty('border', changes['border'].currentValue);
|
|
42
|
+
break;
|
|
43
|
+
case 'density':
|
|
44
|
+
this.setHostProperty('density', changes['density'].currentValue);
|
|
45
|
+
break;
|
|
46
|
+
case 'rounding':
|
|
47
|
+
this.setHostProperty('rounding', changes['rounding'].currentValue);
|
|
48
|
+
break;
|
|
49
|
+
case 'selected':
|
|
50
|
+
this.setHostProperty('selected', changes['selected'].currentValue);
|
|
51
|
+
break;
|
|
52
|
+
case 'selects':
|
|
53
|
+
this.setHostProperty('selects', changes['selects'].currentValue);
|
|
54
|
+
break;
|
|
55
|
+
case 'shape':
|
|
56
|
+
this.setHostProperty('shape', changes['shape'].currentValue);
|
|
57
|
+
break;
|
|
58
|
+
case 'swatches':
|
|
59
|
+
this.setHostProperty('swatches', changes['swatches'].currentValue);
|
|
60
|
+
break;
|
|
61
|
+
case 'rovingTabindexController':
|
|
62
|
+
this.setHostProperty('rovingTabindexController', changes['rovingTabindexController'].currentValue);
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Forward a wrapper @Input to the underlying host element via Renderer2 so
|
|
71
|
+
* the wrapper stays compatible with non-DOM Angular platforms (SSR, tests).
|
|
72
|
+
* Unlike a "skip undefined" guard, this lets consumers reset values back to
|
|
73
|
+
* undefined / null by clearing their bindings.
|
|
74
|
+
*/
|
|
75
|
+
setHostProperty(key, value) {
|
|
76
|
+
this.renderer.setProperty(this.host, key, value);
|
|
77
|
+
}
|
|
78
|
+
bindEvents() {
|
|
79
|
+
this.listenerCleanup.push(this.renderer.listen(this.host, 'change', (event) => {
|
|
80
|
+
this.changeEvent.emit(event);
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
focus(options) {
|
|
84
|
+
return this.host.focus(options);
|
|
85
|
+
}
|
|
86
|
+
static ɵfac = function LuzmoSwatchGroup_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LuzmoSwatchGroup)(); };
|
|
87
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: LuzmoSwatchGroup, selectors: [["luzmo-swatch-group"]], inputs: { border: "border", density: "density", rounding: "rounding", selected: "selected", selects: "selects", shape: "shape", swatches: "swatches", rovingTabindexController: [0, "roving-tabindex-controller", "rovingTabindexController"] }, outputs: { changeEvent: "change" }, exportAs: ["luzmoSwatchGroup"], features: [i0.ɵɵNgOnChangesFeature], ngContentSelectors: _c0, decls: 1, vars: 0, template: function LuzmoSwatchGroup_Template(rf, ctx) { if (rf & 1) {
|
|
88
|
+
i0.ɵɵprojectionDef();
|
|
89
|
+
i0.ɵɵprojection(0);
|
|
90
|
+
} }, encapsulation: 2, changeDetection: 0 });
|
|
91
|
+
}
|
|
92
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LuzmoSwatchGroup, [{
|
|
93
|
+
type: Component,
|
|
94
|
+
args: [{
|
|
95
|
+
selector: 'luzmo-swatch-group',
|
|
96
|
+
exportAs: 'luzmoSwatchGroup',
|
|
97
|
+
standalone: true,
|
|
98
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
99
|
+
template: '<ng-content />'
|
|
100
|
+
}]
|
|
101
|
+
}], () => [], { border: [{
|
|
102
|
+
type: Input,
|
|
103
|
+
args: [{ alias: 'border' }]
|
|
104
|
+
}], density: [{
|
|
105
|
+
type: Input,
|
|
106
|
+
args: [{ alias: 'density' }]
|
|
107
|
+
}], rounding: [{
|
|
108
|
+
type: Input,
|
|
109
|
+
args: [{ alias: 'rounding' }]
|
|
110
|
+
}], selected: [{
|
|
111
|
+
type: Input,
|
|
112
|
+
args: [{ alias: 'selected' }]
|
|
113
|
+
}], selects: [{
|
|
114
|
+
type: Input,
|
|
115
|
+
args: [{ alias: 'selects' }]
|
|
116
|
+
}], shape: [{
|
|
117
|
+
type: Input,
|
|
118
|
+
args: [{ alias: 'shape' }]
|
|
119
|
+
}], swatches: [{
|
|
120
|
+
type: Input,
|
|
121
|
+
args: [{ alias: 'swatches' }]
|
|
122
|
+
}], rovingTabindexController: [{
|
|
123
|
+
type: Input,
|
|
124
|
+
args: [{ alias: 'roving-tabindex-controller' }]
|
|
125
|
+
}], changeEvent: [{ type: i0.Output, args: ["change"] }] }); })();
|
|
126
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(LuzmoSwatchGroup, { className: "LuzmoSwatchGroup", filePath: "components/swatch-group.ts", lineNumber: 17 }); })();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import '@luzmo/lucero/swatch';
|
|
4
|
+
import type { LuzmoSwatch as LuzmoSwatchHostElement } from '@luzmo/lucero/swatch';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class LuzmoSwatch implements OnChanges, ControlValueAccessor {
|
|
7
|
+
private readonly elementRef;
|
|
8
|
+
private readonly renderer;
|
|
9
|
+
private readonly destroyRef;
|
|
10
|
+
private readonly host;
|
|
11
|
+
private readonly listenerCleanup;
|
|
12
|
+
/** The underlying custom element instance. Use to call imperative methods. */
|
|
13
|
+
get nativeElement(): LuzmoSwatchHostElement;
|
|
14
|
+
border?: ('none' | 'light' | undefined);
|
|
15
|
+
color?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
mixedValue?: boolean;
|
|
18
|
+
nothing?: boolean;
|
|
19
|
+
role?: string;
|
|
20
|
+
rounding?: ('none' | 'full' | undefined);
|
|
21
|
+
selected?: string[];
|
|
22
|
+
readonly?: boolean;
|
|
23
|
+
shape?: ('rectangle' | undefined);
|
|
24
|
+
value?: string;
|
|
25
|
+
readonly changeEvent: import("@angular/core").OutputEmitterRef<Event>;
|
|
26
|
+
constructor();
|
|
27
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
28
|
+
/**
|
|
29
|
+
* Forward a wrapper @Input to the underlying host element via Renderer2 so
|
|
30
|
+
* the wrapper stays compatible with non-DOM Angular platforms (SSR, tests).
|
|
31
|
+
* Unlike a "skip undefined" guard, this lets consumers reset values back to
|
|
32
|
+
* undefined / null by clearing their bindings.
|
|
33
|
+
*/
|
|
34
|
+
private setHostProperty;
|
|
35
|
+
private bindEvents;
|
|
36
|
+
private onChange;
|
|
37
|
+
private onTouched;
|
|
38
|
+
private isWritingValue;
|
|
39
|
+
private lastCvaValue;
|
|
40
|
+
writeValue(value: string): void;
|
|
41
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
42
|
+
registerOnTouched(fn: () => void): void;
|
|
43
|
+
setDisabledState(isDisabled: boolean): void;
|
|
44
|
+
toggle(force?: boolean): void;
|
|
45
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LuzmoSwatch, never>;
|
|
46
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LuzmoSwatch, "luzmo-swatch", ["luzmoSwatch"], { "border": { "alias": "border"; "required": false; }; "color": { "alias": "color"; "required": false; }; "label": { "alias": "label"; "required": false; }; "mixedValue": { "alias": "mixed-value"; "required": false; }; "nothing": { "alias": "nothing"; "required": false; }; "role": { "alias": "role"; "required": false; }; "rounding": { "alias": "rounding"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "shape": { "alias": "shape"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "changeEvent": "change"; }, never, ["*"], true, never>;
|
|
47
|
+
}
|
|
48
|
+
/** The underlying custom element type for LuzmoSwatch */
|
|
49
|
+
export type LuzmoSwatchElement = LuzmoSwatchHostElement;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, forwardRef, inject, Input, output, Renderer2 } from '@angular/core';
|
|
2
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import '@luzmo/lucero/swatch';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
const _c0 = ["*"];
|
|
6
|
+
/**
|
|
7
|
+
* Angular wrapper component for <luzmo-swatch>
|
|
8
|
+
*/
|
|
9
|
+
export class LuzmoSwatch {
|
|
10
|
+
elementRef = inject(ElementRef);
|
|
11
|
+
renderer = inject(Renderer2);
|
|
12
|
+
destroyRef = inject(DestroyRef);
|
|
13
|
+
host = this.elementRef.nativeElement;
|
|
14
|
+
listenerCleanup = [];
|
|
15
|
+
/** The underlying custom element instance. Use to call imperative methods. */
|
|
16
|
+
get nativeElement() {
|
|
17
|
+
return this.host;
|
|
18
|
+
}
|
|
19
|
+
border;
|
|
20
|
+
color;
|
|
21
|
+
label;
|
|
22
|
+
mixedValue;
|
|
23
|
+
nothing;
|
|
24
|
+
role;
|
|
25
|
+
rounding;
|
|
26
|
+
selected;
|
|
27
|
+
readonly;
|
|
28
|
+
shape;
|
|
29
|
+
value;
|
|
30
|
+
changeEvent = output({ alias: 'change' });
|
|
31
|
+
constructor() {
|
|
32
|
+
this.bindEvents();
|
|
33
|
+
this.destroyRef.onDestroy(() => {
|
|
34
|
+
for (const cleanup of this.listenerCleanup) {
|
|
35
|
+
cleanup();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
ngOnChanges(changes) {
|
|
40
|
+
for (const key of Object.keys(changes)) {
|
|
41
|
+
switch (key) {
|
|
42
|
+
case 'border':
|
|
43
|
+
this.setHostProperty('border', changes['border'].currentValue);
|
|
44
|
+
break;
|
|
45
|
+
case 'color':
|
|
46
|
+
this.setHostProperty('color', changes['color'].currentValue);
|
|
47
|
+
break;
|
|
48
|
+
case 'label':
|
|
49
|
+
this.setHostProperty('label', changes['label'].currentValue);
|
|
50
|
+
break;
|
|
51
|
+
case 'mixedValue':
|
|
52
|
+
this.setHostProperty('mixedValue', changes['mixedValue'].currentValue);
|
|
53
|
+
break;
|
|
54
|
+
case 'nothing':
|
|
55
|
+
this.setHostProperty('nothing', changes['nothing'].currentValue);
|
|
56
|
+
break;
|
|
57
|
+
case 'role':
|
|
58
|
+
this.setHostProperty('role', changes['role'].currentValue);
|
|
59
|
+
break;
|
|
60
|
+
case 'rounding':
|
|
61
|
+
this.setHostProperty('rounding', changes['rounding'].currentValue);
|
|
62
|
+
break;
|
|
63
|
+
case 'selected':
|
|
64
|
+
this.setHostProperty('selected', changes['selected'].currentValue);
|
|
65
|
+
break;
|
|
66
|
+
case 'readonly':
|
|
67
|
+
this.setHostProperty('readonly', changes['readonly'].currentValue);
|
|
68
|
+
break;
|
|
69
|
+
case 'shape':
|
|
70
|
+
this.setHostProperty('shape', changes['shape'].currentValue);
|
|
71
|
+
break;
|
|
72
|
+
case 'value':
|
|
73
|
+
this.setHostProperty('value', changes['value'].currentValue);
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Forward a wrapper @Input to the underlying host element via Renderer2 so
|
|
82
|
+
* the wrapper stays compatible with non-DOM Angular platforms (SSR, tests).
|
|
83
|
+
* Unlike a "skip undefined" guard, this lets consumers reset values back to
|
|
84
|
+
* undefined / null by clearing their bindings.
|
|
85
|
+
*/
|
|
86
|
+
setHostProperty(key, value) {
|
|
87
|
+
this.renderer.setProperty(this.host, key, value);
|
|
88
|
+
}
|
|
89
|
+
bindEvents() {
|
|
90
|
+
this.listenerCleanup.push(this.renderer.listen(this.host, 'change', (event) => {
|
|
91
|
+
this.changeEvent.emit(event);
|
|
92
|
+
if (!this.isWritingValue) {
|
|
93
|
+
const eventWithDetail = event;
|
|
94
|
+
const eventTarget = event.target;
|
|
95
|
+
const detail = 'detail' in eventWithDetail ? eventWithDetail.detail : undefined;
|
|
96
|
+
const hostRecord = this.host;
|
|
97
|
+
const nextValue = (detail
|
|
98
|
+
?? eventTarget?.['value']
|
|
99
|
+
?? hostRecord['value']);
|
|
100
|
+
if (Object.is(this.lastCvaValue, nextValue)) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.lastCvaValue = nextValue;
|
|
104
|
+
this.setHostProperty('value', nextValue);
|
|
105
|
+
this.onChange(nextValue);
|
|
106
|
+
}
|
|
107
|
+
}));
|
|
108
|
+
this.listenerCleanup.push(this.renderer.listen(this.host, 'blur', () => {
|
|
109
|
+
this.onTouched();
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
onChange = () => { };
|
|
113
|
+
onTouched = () => { };
|
|
114
|
+
isWritingValue = false;
|
|
115
|
+
lastCvaValue;
|
|
116
|
+
writeValue(value) {
|
|
117
|
+
this.isWritingValue = true;
|
|
118
|
+
this.lastCvaValue = value;
|
|
119
|
+
this.setHostProperty('value', value);
|
|
120
|
+
this.isWritingValue = false;
|
|
121
|
+
}
|
|
122
|
+
registerOnChange(fn) {
|
|
123
|
+
this.onChange = fn;
|
|
124
|
+
}
|
|
125
|
+
registerOnTouched(fn) {
|
|
126
|
+
this.onTouched = fn;
|
|
127
|
+
}
|
|
128
|
+
setDisabledState(isDisabled) {
|
|
129
|
+
// Underlying element does not declare a 'disabled' field; nothing to do.
|
|
130
|
+
void isDisabled;
|
|
131
|
+
}
|
|
132
|
+
toggle(force) {
|
|
133
|
+
return this.host.toggle(force);
|
|
134
|
+
}
|
|
135
|
+
static ɵfac = function LuzmoSwatch_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || LuzmoSwatch)(); };
|
|
136
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: LuzmoSwatch, selectors: [["luzmo-swatch"]], inputs: { border: "border", color: "color", label: "label", mixedValue: [0, "mixed-value", "mixedValue"], nothing: "nothing", role: "role", rounding: "rounding", selected: "selected", readonly: "readonly", shape: "shape", value: "value" }, outputs: { changeEvent: "change" }, exportAs: ["luzmoSwatch"], features: [i0.ɵɵProvidersFeature([
|
|
137
|
+
{
|
|
138
|
+
provide: NG_VALUE_ACCESSOR,
|
|
139
|
+
useExisting: forwardRef(() => LuzmoSwatch),
|
|
140
|
+
multi: true
|
|
141
|
+
}
|
|
142
|
+
]), i0.ɵɵNgOnChangesFeature], ngContentSelectors: _c0, decls: 1, vars: 0, template: function LuzmoSwatch_Template(rf, ctx) { if (rf & 1) {
|
|
143
|
+
i0.ɵɵprojectionDef();
|
|
144
|
+
i0.ɵɵprojection(0);
|
|
145
|
+
} }, encapsulation: 2, changeDetection: 0 });
|
|
146
|
+
}
|
|
147
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LuzmoSwatch, [{
|
|
148
|
+
type: Component,
|
|
149
|
+
args: [{
|
|
150
|
+
selector: 'luzmo-swatch',
|
|
151
|
+
exportAs: 'luzmoSwatch',
|
|
152
|
+
standalone: true,
|
|
153
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
154
|
+
template: '<ng-content />',
|
|
155
|
+
providers: [
|
|
156
|
+
{
|
|
157
|
+
provide: NG_VALUE_ACCESSOR,
|
|
158
|
+
useExisting: forwardRef(() => LuzmoSwatch),
|
|
159
|
+
multi: true
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
}]
|
|
163
|
+
}], () => [], { border: [{
|
|
164
|
+
type: Input,
|
|
165
|
+
args: [{ alias: 'border' }]
|
|
166
|
+
}], color: [{
|
|
167
|
+
type: Input,
|
|
168
|
+
args: [{ alias: 'color' }]
|
|
169
|
+
}], label: [{
|
|
170
|
+
type: Input,
|
|
171
|
+
args: [{ alias: 'label' }]
|
|
172
|
+
}], mixedValue: [{
|
|
173
|
+
type: Input,
|
|
174
|
+
args: [{ alias: 'mixed-value' }]
|
|
175
|
+
}], nothing: [{
|
|
176
|
+
type: Input,
|
|
177
|
+
args: [{ alias: 'nothing' }]
|
|
178
|
+
}], role: [{
|
|
179
|
+
type: Input,
|
|
180
|
+
args: [{ alias: 'role' }]
|
|
181
|
+
}], rounding: [{
|
|
182
|
+
type: Input,
|
|
183
|
+
args: [{ alias: 'rounding' }]
|
|
184
|
+
}], selected: [{
|
|
185
|
+
type: Input,
|
|
186
|
+
args: [{ alias: 'selected' }]
|
|
187
|
+
}], readonly: [{
|
|
188
|
+
type: Input,
|
|
189
|
+
args: [{ alias: 'readonly' }]
|
|
190
|
+
}], shape: [{
|
|
191
|
+
type: Input,
|
|
192
|
+
args: [{ alias: 'shape' }]
|
|
193
|
+
}], value: [{
|
|
194
|
+
type: Input,
|
|
195
|
+
args: [{ alias: 'value' }]
|
|
196
|
+
}], changeEvent: [{ type: i0.Output, args: ["change"] }] }); })();
|
|
197
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(LuzmoSwatch, { className: "LuzmoSwatch", filePath: "components/swatch.ts", lineNumber: 23 }); })();
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import '@luzmo/lucero/switch';
|
|
4
|
+
import type { LuzmoSwitch as LuzmoSwitchHostElement } from '@luzmo/lucero/switch';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class LuzmoSwitch implements OnChanges, ControlValueAccessor {
|
|
7
|
+
private readonly elementRef;
|
|
8
|
+
private readonly renderer;
|
|
9
|
+
private readonly destroyRef;
|
|
10
|
+
private readonly host;
|
|
11
|
+
private readonly listenerCleanup;
|
|
12
|
+
/** The underlying custom element instance. Use to call imperative methods. */
|
|
13
|
+
get nativeElement(): LuzmoSwitchHostElement;
|
|
14
|
+
/** Deliver the Switch with additional visual emphasis. */
|
|
15
|
+
emphasized?: boolean;
|
|
16
|
+
/** Whether the thumb is within the Switch or overflows it. */
|
|
17
|
+
thumb?: 'overflow' | 'within';
|
|
18
|
+
/** The `checked` attribute reflects the state of the element */
|
|
19
|
+
checked?: boolean;
|
|
20
|
+
/** The name attribute of the element */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** Whether the element is read-only */
|
|
23
|
+
readonly?: boolean;
|
|
24
|
+
/** Announces a change in the `checked` property of a Switch */
|
|
25
|
+
readonly changeEvent: import("@angular/core").OutputEmitterRef<CustomEvent<unknown>>;
|
|
26
|
+
constructor();
|
|
27
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
28
|
+
/**
|
|
29
|
+
* Forward a wrapper @Input to the underlying host element via Renderer2 so
|
|
30
|
+
* the wrapper stays compatible with non-DOM Angular platforms (SSR, tests).
|
|
31
|
+
* Unlike a "skip undefined" guard, this lets consumers reset values back to
|
|
32
|
+
* undefined / null by clearing their bindings.
|
|
33
|
+
*/
|
|
34
|
+
private setHostProperty;
|
|
35
|
+
private bindEvents;
|
|
36
|
+
private onChange;
|
|
37
|
+
private onTouched;
|
|
38
|
+
private isWritingValue;
|
|
39
|
+
private lastCvaValue;
|
|
40
|
+
writeValue(value: boolean): void;
|
|
41
|
+
registerOnChange(fn: (value: boolean) => void): void;
|
|
42
|
+
registerOnTouched(fn: () => void): void;
|
|
43
|
+
setDisabledState(isDisabled: boolean): void;
|
|
44
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LuzmoSwitch, never>;
|
|
45
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LuzmoSwitch, "luzmo-switch", ["luzmoSwitch"], { "emphasized": { "alias": "emphasized"; "required": false; }; "thumb": { "alias": "thumb"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "name": { "alias": "name"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; }, { "changeEvent": "change"; }, never, ["*"], true, never>;
|
|
46
|
+
}
|
|
47
|
+
/** The underlying custom element type for LuzmoSwitch */
|
|
48
|
+
export type LuzmoSwitchElement = LuzmoSwitchHostElement;
|