@lilydesignsystem/angular-text-size-picker 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/fesm2022/lilydesignsystem-angular-text-size-picker.mjs +542 -301
- package/fesm2022/lilydesignsystem-angular-text-size-picker.mjs.map +1 -1
- package/package.json +1 -1
- package/types/lilydesignsystem-angular-text-size-picker.d.ts +136 -79
- package/types/lilydesignsystem-angular-text-size-picker.d.ts.map +1 -1
|
@@ -1,283 +1,336 @@
|
|
|
1
|
-
import { NgTemplateOutlet } from
|
|
2
|
-
import * as i0 from
|
|
3
|
-
import {
|
|
4
|
-
import { IconButton, Listbox } from
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Resolve a size slug to its display label: each hyphen-separated word
|
|
8
|
-
* title-cased, so a slug like "x-large" renders as "X Large". Mirrors
|
|
9
|
-
* `themeName` in theme-picker and `localeName` in locale-picker.
|
|
10
|
-
*/
|
|
1
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Directive, TemplateRef, computed, contentChild, effect, inject, input, model, output, signal, viewChild } from "@angular/core";
|
|
4
|
+
import { IconButton, Listbox } from "@lilydesignsystem/angular-headless";
|
|
11
5
|
function sizeName(size) {
|
|
12
|
-
|
|
13
|
-
.split("-")
|
|
14
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
15
|
-
.join(" ");
|
|
6
|
+
return size.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
16
7
|
}
|
|
17
8
|
let uid = 0;
|
|
18
|
-
/** Stable per-instance id prefix; SSR-safe (no Math.random / Date.now). */
|
|
19
9
|
function nextTextSizePickerId() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Optional marker for the projected icon template. Gives consumers typed
|
|
25
|
-
* `let-` variables:
|
|
26
|
-
*
|
|
27
|
-
* ```html
|
|
28
|
-
* <lily-text-size-picker ...>
|
|
29
|
-
* <ng-template lilyTextSizePickerIcon let-args>{{ args.labelFor(args.value) }}</ng-template>
|
|
30
|
-
* </lily-text-size-picker>
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* The component queries any projected `<ng-template>`, so the marker is
|
|
34
|
-
* for type-checking and readability, not for matching.
|
|
35
|
-
*/
|
|
36
|
-
class TextSizePickerIcon {
|
|
37
|
-
static ngTemplateContextGuard(_dir, _ctx) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TextSizePickerIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
41
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: TextSizePickerIcon, isStandalone: true, selector: "ng-template[lilyTextSizePickerIcon]", ngImport: i0 }); }
|
|
10
|
+
uid += 1;
|
|
11
|
+
return `text-size-picker-${uid}`;
|
|
42
12
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
13
|
+
var TextSizePickerIcon = class TextSizePickerIcon {
|
|
14
|
+
static ngTemplateContextGuard(_dir, _ctx) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
static {
|
|
18
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
19
|
+
minVersion: "12.0.0",
|
|
20
|
+
version: "22.2.1",
|
|
21
|
+
ngImport: i0,
|
|
22
|
+
type: TextSizePickerIcon,
|
|
23
|
+
deps: [],
|
|
24
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
static {
|
|
28
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
29
|
+
minVersion: "14.0.0",
|
|
30
|
+
version: "22.2.1",
|
|
31
|
+
type: TextSizePickerIcon,
|
|
32
|
+
isStandalone: true,
|
|
33
|
+
selector: "ng-template[lilyTextSizePickerIcon]",
|
|
34
|
+
ngImport: i0
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
39
|
+
minVersion: "12.0.0",
|
|
40
|
+
version: "22.2.1",
|
|
41
|
+
ngImport: i0,
|
|
42
|
+
type: TextSizePickerIcon,
|
|
43
|
+
decorators: [{
|
|
44
|
+
type: Directive,
|
|
45
|
+
args: [{
|
|
46
|
+
selector: "ng-template[lilyTextSizePickerIcon]",
|
|
47
|
+
standalone: true
|
|
48
|
+
}]
|
|
49
|
+
}]
|
|
50
|
+
});
|
|
51
|
+
var TextSizePicker = class TextSizePicker {
|
|
52
|
+
onTooltipButtonEnter() {
|
|
53
|
+
this.hoverButton.set(true);
|
|
54
|
+
this.dismissed.set(false);
|
|
55
|
+
}
|
|
56
|
+
onTooltipButtonFocusIn() {
|
|
57
|
+
try {
|
|
58
|
+
this.focusButton.set(this.buttonRef().element?.matches(":focus-visible") ?? false);
|
|
59
|
+
} catch {
|
|
60
|
+
this.focusButton.set(true);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
onTooltipButtonFocusOut() {
|
|
64
|
+
this.focusButton.set(false);
|
|
65
|
+
this.dismissed.set(false);
|
|
66
|
+
}
|
|
67
|
+
onTooltipKeydown(event) {
|
|
68
|
+
if (event.key === "Escape" && this.tooltipVisible()) this.dismissed.set(true);
|
|
69
|
+
}
|
|
70
|
+
constructor() {
|
|
71
|
+
this.label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
72
|
+
this.sizes = input.required(...ngDevMode ? [{ debugName: "sizes" }] : /* istanbul ignore next */ []);
|
|
73
|
+
this.value = model("", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
74
|
+
this.defaultValue = input("", ...ngDevMode ? [{ debugName: "defaultValue" }] : /* istanbul ignore next */ []);
|
|
75
|
+
this.storageKey = input("", ...ngDevMode ? [{ debugName: "storageKey" }] : /* istanbul ignore next */ []);
|
|
76
|
+
this.name = input("text-size", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
|
|
77
|
+
this.target = input(null, ...ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []);
|
|
78
|
+
this.sizeLabels = input({}, ...ngDevMode ? [{ debugName: "sizeLabels" }] : /* istanbul ignore next */ []);
|
|
79
|
+
this.className = input("", ...ngDevMode ? [{ debugName: "className" }] : /* istanbul ignore next */ []);
|
|
80
|
+
this.sizeChange = output();
|
|
81
|
+
this.iconTemplate = contentChild(TemplateRef, ...ngDevMode ? [{ debugName: "iconTemplate" }] : /* istanbul ignore next */ []);
|
|
82
|
+
this.rootRef = viewChild.required("rootEl", ...ngDevMode ? [{ debugName: "rootRef" }] : /* istanbul ignore next */ []);
|
|
83
|
+
this.buttonRef = viewChild.required("buttonEl", ...ngDevMode ? [{ debugName: "buttonRef" }] : /* istanbul ignore next */ []);
|
|
84
|
+
this.listRef = viewChild.required("listEl", ...ngDevMode ? [{ debugName: "listRef" }] : /* istanbul ignore next */ []);
|
|
85
|
+
this.baseId = nextTextSizePickerId();
|
|
86
|
+
this.listId = `${this.baseId}-list`;
|
|
87
|
+
this.open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
88
|
+
this.tooltipId = `${this.baseId}-tooltip`;
|
|
89
|
+
this.hoverButton = signal(false, ...ngDevMode ? [{ debugName: "hoverButton" }] : /* istanbul ignore next */ []);
|
|
90
|
+
this.hoverTooltip = signal(false, ...ngDevMode ? [{ debugName: "hoverTooltip" }] : /* istanbul ignore next */ []);
|
|
91
|
+
this.focusButton = signal(false, ...ngDevMode ? [{ debugName: "focusButton" }] : /* istanbul ignore next */ []);
|
|
92
|
+
this.dismissed = signal(false, ...ngDevMode ? [{ debugName: "dismissed" }] : /* istanbul ignore next */ []);
|
|
93
|
+
this.tooltipVisible = computed(() => !this.open() && !this.dismissed() && (this.hoverButton() || this.hoverTooltip() || this.focusButton()), ...ngDevMode ? [{ debugName: "tooltipVisible" }] : /* istanbul ignore next */ []);
|
|
94
|
+
this.tooltipEscapeListener = effect((onCleanup) => {
|
|
95
|
+
if (!this.tooltipVisible() || typeof document === "undefined") return;
|
|
96
|
+
const onKey = (event) => {
|
|
97
|
+
if (event.key === "Escape") this.dismissed.set(true);
|
|
98
|
+
};
|
|
99
|
+
document.addEventListener("keydown", onKey);
|
|
100
|
+
onCleanup(() => document.removeEventListener("keydown", onKey));
|
|
101
|
+
}, ...ngDevMode ? [{ debugName: "tooltipEscapeListener" }] : /* istanbul ignore next */ []);
|
|
102
|
+
this.activeIndex = signal(-1, ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
|
|
103
|
+
this.childContext = computed(() => {
|
|
104
|
+
const args = {
|
|
105
|
+
value: this.value(),
|
|
106
|
+
open: this.open(),
|
|
107
|
+
labelFor: (size) => this.labelFor(size)
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
$implicit: args,
|
|
111
|
+
...args
|
|
112
|
+
};
|
|
113
|
+
}, ...ngDevMode ? [{ debugName: "childContext" }] : /* istanbul ignore next */ []);
|
|
114
|
+
this.initialised = false;
|
|
115
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
116
|
+
this.scrollOnActiveIndexChange = effect(() => {
|
|
117
|
+
this.activeIndex();
|
|
118
|
+
this.scrollActiveIntoView();
|
|
119
|
+
}, ...ngDevMode ? [{ debugName: "scrollOnActiveIndexChange" }] : /* istanbul ignore next */ []);
|
|
120
|
+
effect(() => {
|
|
121
|
+
const current = this.value();
|
|
122
|
+
if (!this.initialised) {
|
|
123
|
+
this.initialised = true;
|
|
124
|
+
let initial = current;
|
|
125
|
+
const sk = this.storageKey();
|
|
126
|
+
if (!initial && sk) try {
|
|
127
|
+
initial = (typeof localStorage !== "undefined" ? localStorage.getItem(sk) : null) ?? "";
|
|
128
|
+
} catch {}
|
|
129
|
+
if (!initial) {
|
|
130
|
+
const sizes = this.sizes();
|
|
131
|
+
initial = this.defaultValue() || (sizes.includes("medium") ? "medium" : sizes[0]) || "";
|
|
132
|
+
}
|
|
133
|
+
if (initial && initial !== current) {
|
|
134
|
+
this.value.set(initial);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (current) this.applySize(current);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
optionId(index) {
|
|
142
|
+
return `${this.baseId}-option-${index}`;
|
|
143
|
+
}
|
|
144
|
+
labelFor(size) {
|
|
145
|
+
const labels = this.sizeLabels();
|
|
146
|
+
if (size in labels) return labels[size];
|
|
147
|
+
return sizeName(size);
|
|
148
|
+
}
|
|
149
|
+
toggle() {
|
|
150
|
+
if (this.open()) this.closeList();
|
|
151
|
+
else this.openList();
|
|
152
|
+
}
|
|
153
|
+
openList(startIndex) {
|
|
154
|
+
const selected = this.sizes().indexOf(this.value());
|
|
155
|
+
this.activeIndex.set(this.sizes().length === 0 ? -1 : startIndex ?? (selected >= 0 ? selected : 0));
|
|
156
|
+
this.open.set(true);
|
|
157
|
+
this.cdr.detectChanges();
|
|
158
|
+
queueMicrotask(() => {
|
|
159
|
+
this.listRef().focus({ preventScroll: true });
|
|
160
|
+
this.scrollActiveIntoView();
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
closeList(refocus = true) {
|
|
164
|
+
if (!this.open()) return;
|
|
165
|
+
this.open.set(false);
|
|
166
|
+
this.activeIndex.set(-1);
|
|
167
|
+
if (refocus) queueMicrotask(() => this.buttonRef().focus({ preventScroll: true }));
|
|
168
|
+
}
|
|
169
|
+
choose(index) {
|
|
170
|
+
const slug = this.sizes()[index];
|
|
171
|
+
if (slug) this.value.set(slug);
|
|
172
|
+
this.closeList();
|
|
173
|
+
}
|
|
174
|
+
scrollActiveIntoView() {
|
|
175
|
+
const i = this.activeIndex();
|
|
176
|
+
if (i < 0) return;
|
|
177
|
+
document.getElementById(this.optionId(i))?.scrollIntoView?.({ block: "nearest" });
|
|
178
|
+
}
|
|
179
|
+
onButtonKeydown(event) {
|
|
180
|
+
switch (event.key) {
|
|
181
|
+
case "ArrowDown":
|
|
182
|
+
case "Enter":
|
|
183
|
+
case " ":
|
|
184
|
+
event.preventDefault();
|
|
185
|
+
this.openList();
|
|
186
|
+
break;
|
|
187
|
+
case "ArrowUp":
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
this.openList(this.sizes().length - 1);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
onListTabOut() {
|
|
193
|
+
this.buttonRef().focus({ preventScroll: true });
|
|
194
|
+
this.closeList(false);
|
|
195
|
+
}
|
|
196
|
+
onRootFocusOut(event) {
|
|
197
|
+
const next = event.relatedTarget;
|
|
198
|
+
if (next && this.rootRef().nativeElement.contains(next)) return;
|
|
199
|
+
this.closeList(false);
|
|
200
|
+
}
|
|
201
|
+
onDocumentClick(event) {
|
|
202
|
+
if (!this.open()) return;
|
|
203
|
+
const t = event.target;
|
|
204
|
+
if (t && !this.rootRef().nativeElement.contains(t)) this.closeList(false);
|
|
205
|
+
}
|
|
206
|
+
applySize(slug) {
|
|
207
|
+
if (typeof document === "undefined" || !slug) return;
|
|
208
|
+
(this.target() ?? document.documentElement).setAttribute("data-text-size", slug);
|
|
209
|
+
const sk = this.storageKey();
|
|
210
|
+
if (sk) try {
|
|
211
|
+
localStorage.setItem(sk, slug);
|
|
212
|
+
} catch {}
|
|
213
|
+
this.sizeChange.emit(slug);
|
|
214
|
+
}
|
|
215
|
+
static {
|
|
216
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
217
|
+
minVersion: "12.0.0",
|
|
218
|
+
version: "22.2.1",
|
|
219
|
+
ngImport: i0,
|
|
220
|
+
type: TextSizePicker,
|
|
221
|
+
deps: [],
|
|
222
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
static {
|
|
226
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
227
|
+
minVersion: "17.0.0",
|
|
228
|
+
version: "22.2.1",
|
|
229
|
+
type: TextSizePicker,
|
|
230
|
+
isStandalone: true,
|
|
231
|
+
selector: "lily-text-size-picker",
|
|
232
|
+
inputs: {
|
|
233
|
+
label: {
|
|
234
|
+
classPropertyName: "label",
|
|
235
|
+
publicName: "label",
|
|
236
|
+
isSignal: true,
|
|
237
|
+
isRequired: true,
|
|
238
|
+
transformFunction: null
|
|
239
|
+
},
|
|
240
|
+
sizes: {
|
|
241
|
+
classPropertyName: "sizes",
|
|
242
|
+
publicName: "sizes",
|
|
243
|
+
isSignal: true,
|
|
244
|
+
isRequired: true,
|
|
245
|
+
transformFunction: null
|
|
246
|
+
},
|
|
247
|
+
value: {
|
|
248
|
+
classPropertyName: "value",
|
|
249
|
+
publicName: "value",
|
|
250
|
+
isSignal: true,
|
|
251
|
+
isRequired: false,
|
|
252
|
+
transformFunction: null
|
|
253
|
+
},
|
|
254
|
+
defaultValue: {
|
|
255
|
+
classPropertyName: "defaultValue",
|
|
256
|
+
publicName: "defaultValue",
|
|
257
|
+
isSignal: true,
|
|
258
|
+
isRequired: false,
|
|
259
|
+
transformFunction: null
|
|
260
|
+
},
|
|
261
|
+
storageKey: {
|
|
262
|
+
classPropertyName: "storageKey",
|
|
263
|
+
publicName: "storageKey",
|
|
264
|
+
isSignal: true,
|
|
265
|
+
isRequired: false,
|
|
266
|
+
transformFunction: null
|
|
267
|
+
},
|
|
268
|
+
name: {
|
|
269
|
+
classPropertyName: "name",
|
|
270
|
+
publicName: "name",
|
|
271
|
+
isSignal: true,
|
|
272
|
+
isRequired: false,
|
|
273
|
+
transformFunction: null
|
|
274
|
+
},
|
|
275
|
+
target: {
|
|
276
|
+
classPropertyName: "target",
|
|
277
|
+
publicName: "target",
|
|
278
|
+
isSignal: true,
|
|
279
|
+
isRequired: false,
|
|
280
|
+
transformFunction: null
|
|
281
|
+
},
|
|
282
|
+
sizeLabels: {
|
|
283
|
+
classPropertyName: "sizeLabels",
|
|
284
|
+
publicName: "sizeLabels",
|
|
285
|
+
isSignal: true,
|
|
286
|
+
isRequired: false,
|
|
287
|
+
transformFunction: null
|
|
288
|
+
},
|
|
289
|
+
className: {
|
|
290
|
+
classPropertyName: "className",
|
|
291
|
+
publicName: "className",
|
|
292
|
+
isSignal: true,
|
|
293
|
+
isRequired: false,
|
|
294
|
+
transformFunction: null
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
outputs: {
|
|
298
|
+
value: "valueChange",
|
|
299
|
+
sizeChange: "sizeChange"
|
|
300
|
+
},
|
|
301
|
+
host: { listeners: { "document:click": "onDocumentClick($event)" } },
|
|
302
|
+
queries: [{
|
|
303
|
+
propertyName: "iconTemplate",
|
|
304
|
+
first: true,
|
|
305
|
+
predicate: TemplateRef,
|
|
306
|
+
descendants: true,
|
|
307
|
+
isSignal: true
|
|
308
|
+
}],
|
|
309
|
+
viewQueries: [
|
|
310
|
+
{
|
|
311
|
+
propertyName: "rootRef",
|
|
312
|
+
first: true,
|
|
313
|
+
predicate: ["rootEl"],
|
|
314
|
+
descendants: true,
|
|
315
|
+
isSignal: true
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
propertyName: "buttonRef",
|
|
319
|
+
first: true,
|
|
320
|
+
predicate: ["buttonEl"],
|
|
321
|
+
descendants: true,
|
|
322
|
+
isSignal: true
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
propertyName: "listRef",
|
|
326
|
+
first: true,
|
|
327
|
+
predicate: ["listEl"],
|
|
328
|
+
descendants: true,
|
|
329
|
+
isSignal: true
|
|
330
|
+
}
|
|
331
|
+
],
|
|
332
|
+
ngImport: i0,
|
|
333
|
+
template: `
|
|
281
334
|
<div
|
|
282
335
|
#rootEl
|
|
283
336
|
class="text-size-picker {{ className() }}"
|
|
@@ -292,8 +345,12 @@ class TextSizePicker {
|
|
|
292
345
|
ariaHaspopup="listbox"
|
|
293
346
|
[ariaExpanded]="open()"
|
|
294
347
|
[ariaControls]="listId"
|
|
295
|
-
(click)="toggle()"
|
|
296
|
-
(
|
|
348
|
+
(click)="toggle(); hoverButton.set(false)"
|
|
349
|
+
(mouseenter)="onTooltipButtonEnter()"
|
|
350
|
+
(mouseleave)="hoverButton.set(false)"
|
|
351
|
+
(focusin)="onTooltipButtonFocusIn()"
|
|
352
|
+
(focusout)="onTooltipButtonFocusOut()"
|
|
353
|
+
(keydown)="onButtonKeydown($event); onTooltipKeydown($event)"
|
|
297
354
|
>
|
|
298
355
|
@if (iconTemplate(); as tpl) {
|
|
299
356
|
<ng-container
|
|
@@ -318,6 +375,18 @@ class TextSizePicker {
|
|
|
318
375
|
}
|
|
319
376
|
</lily-icon-button>
|
|
320
377
|
|
|
378
|
+
<!-- Purely visual: the same text is already the button's aria-label,
|
|
379
|
+
so it is not wired with aria-describedby (that would announce
|
|
380
|
+
the name twice). -->
|
|
381
|
+
<div
|
|
382
|
+
class="text-size-picker-tooltip"
|
|
383
|
+
role="tooltip"
|
|
384
|
+
[id]="tooltipId"
|
|
385
|
+
[attr.hidden]="tooltipVisible() ? null : ''"
|
|
386
|
+
(mouseenter)="hoverTooltip.set(true)"
|
|
387
|
+
(mouseleave)="hoverTooltip.set(false)"
|
|
388
|
+
>{{ label() }}</div>
|
|
389
|
+
|
|
321
390
|
<lily-listbox
|
|
322
391
|
#listEl
|
|
323
392
|
[label]="label()"
|
|
@@ -347,19 +416,80 @@ class TextSizePicker {
|
|
|
347
416
|
}
|
|
348
417
|
</lily-listbox>
|
|
349
418
|
</div>
|
|
350
|
-
`,
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
419
|
+
`,
|
|
420
|
+
isInline: true,
|
|
421
|
+
dependencies: [
|
|
422
|
+
{
|
|
423
|
+
kind: "directive",
|
|
424
|
+
type: NgTemplateOutlet,
|
|
425
|
+
selector: "[ngTemplateOutlet]",
|
|
426
|
+
inputs: [
|
|
427
|
+
"ngTemplateOutletContext",
|
|
428
|
+
"ngTemplateOutlet",
|
|
429
|
+
"ngTemplateOutletInjector"
|
|
430
|
+
]
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
kind: "component",
|
|
434
|
+
type: IconButton,
|
|
435
|
+
selector: "lily-icon-button",
|
|
436
|
+
inputs: [
|
|
437
|
+
"label",
|
|
438
|
+
"className",
|
|
439
|
+
"baseClass",
|
|
440
|
+
"ariaHaspopup",
|
|
441
|
+
"ariaExpanded",
|
|
442
|
+
"ariaControls",
|
|
443
|
+
"tabIndex",
|
|
444
|
+
"disabled"
|
|
445
|
+
]
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
kind: "component",
|
|
449
|
+
type: Listbox,
|
|
450
|
+
selector: "lily-listbox",
|
|
451
|
+
inputs: [
|
|
452
|
+
"label",
|
|
453
|
+
"className",
|
|
454
|
+
"baseClass",
|
|
455
|
+
"elementId",
|
|
456
|
+
"hidden",
|
|
457
|
+
"navigation",
|
|
458
|
+
"clamp",
|
|
459
|
+
"typeahead",
|
|
460
|
+
"pageSize",
|
|
461
|
+
"activeIndex"
|
|
462
|
+
],
|
|
463
|
+
outputs: [
|
|
464
|
+
"activeIndexChange",
|
|
465
|
+
"activate",
|
|
466
|
+
"escape",
|
|
467
|
+
"tabOut"
|
|
468
|
+
]
|
|
469
|
+
}
|
|
470
|
+
],
|
|
471
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
476
|
+
minVersion: "12.0.0",
|
|
477
|
+
version: "22.2.1",
|
|
478
|
+
ngImport: i0,
|
|
479
|
+
type: TextSizePicker,
|
|
480
|
+
decorators: [{
|
|
481
|
+
type: Component,
|
|
482
|
+
args: [{
|
|
483
|
+
selector: "lily-text-size-picker",
|
|
484
|
+
standalone: true,
|
|
485
|
+
imports: [
|
|
486
|
+
NgTemplateOutlet,
|
|
487
|
+
IconButton,
|
|
488
|
+
Listbox
|
|
489
|
+
],
|
|
490
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
491
|
+
host: { "(document:click)": "onDocumentClick($event)" },
|
|
492
|
+
template: `
|
|
363
493
|
<div
|
|
364
494
|
#rootEl
|
|
365
495
|
class="text-size-picker {{ className() }}"
|
|
@@ -374,8 +504,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
374
504
|
ariaHaspopup="listbox"
|
|
375
505
|
[ariaExpanded]="open()"
|
|
376
506
|
[ariaControls]="listId"
|
|
377
|
-
(click)="toggle()"
|
|
378
|
-
(
|
|
507
|
+
(click)="toggle(); hoverButton.set(false)"
|
|
508
|
+
(mouseenter)="onTooltipButtonEnter()"
|
|
509
|
+
(mouseleave)="hoverButton.set(false)"
|
|
510
|
+
(focusin)="onTooltipButtonFocusIn()"
|
|
511
|
+
(focusout)="onTooltipButtonFocusOut()"
|
|
512
|
+
(keydown)="onButtonKeydown($event); onTooltipKeydown($event)"
|
|
379
513
|
>
|
|
380
514
|
@if (iconTemplate(); as tpl) {
|
|
381
515
|
<ng-container
|
|
@@ -400,6 +534,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
400
534
|
}
|
|
401
535
|
</lily-icon-button>
|
|
402
536
|
|
|
537
|
+
<!-- Purely visual: the same text is already the button's aria-label,
|
|
538
|
+
so it is not wired with aria-describedby (that would announce
|
|
539
|
+
the name twice). -->
|
|
540
|
+
<div
|
|
541
|
+
class="text-size-picker-tooltip"
|
|
542
|
+
role="tooltip"
|
|
543
|
+
[id]="tooltipId"
|
|
544
|
+
[attr.hidden]="tooltipVisible() ? null : ''"
|
|
545
|
+
(mouseenter)="hoverTooltip.set(true)"
|
|
546
|
+
(mouseleave)="hoverTooltip.set(false)"
|
|
547
|
+
>{{ label() }}</div>
|
|
548
|
+
|
|
403
549
|
<lily-listbox
|
|
404
550
|
#listEl
|
|
405
551
|
[label]="label()"
|
|
@@ -429,13 +575,108 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
429
575
|
}
|
|
430
576
|
</lily-listbox>
|
|
431
577
|
</div>
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
578
|
+
`
|
|
579
|
+
}]
|
|
580
|
+
}],
|
|
581
|
+
ctorParameters: () => [],
|
|
582
|
+
propDecorators: {
|
|
583
|
+
label: [{
|
|
584
|
+
type: i0.Input,
|
|
585
|
+
args: [{
|
|
586
|
+
isSignal: true,
|
|
587
|
+
alias: "label",
|
|
588
|
+
required: true
|
|
589
|
+
}]
|
|
590
|
+
}],
|
|
591
|
+
sizes: [{
|
|
592
|
+
type: i0.Input,
|
|
593
|
+
args: [{
|
|
594
|
+
isSignal: true,
|
|
595
|
+
alias: "sizes",
|
|
596
|
+
required: true
|
|
597
|
+
}]
|
|
598
|
+
}],
|
|
599
|
+
value: [{
|
|
600
|
+
type: i0.Input,
|
|
601
|
+
args: [{
|
|
602
|
+
isSignal: true,
|
|
603
|
+
alias: "value",
|
|
604
|
+
required: false
|
|
605
|
+
}]
|
|
606
|
+
}, {
|
|
607
|
+
type: i0.Output,
|
|
608
|
+
args: ["valueChange"]
|
|
609
|
+
}],
|
|
610
|
+
defaultValue: [{
|
|
611
|
+
type: i0.Input,
|
|
612
|
+
args: [{
|
|
613
|
+
isSignal: true,
|
|
614
|
+
alias: "defaultValue",
|
|
615
|
+
required: false
|
|
616
|
+
}]
|
|
617
|
+
}],
|
|
618
|
+
storageKey: [{
|
|
619
|
+
type: i0.Input,
|
|
620
|
+
args: [{
|
|
621
|
+
isSignal: true,
|
|
622
|
+
alias: "storageKey",
|
|
623
|
+
required: false
|
|
624
|
+
}]
|
|
625
|
+
}],
|
|
626
|
+
name: [{
|
|
627
|
+
type: i0.Input,
|
|
628
|
+
args: [{
|
|
629
|
+
isSignal: true,
|
|
630
|
+
alias: "name",
|
|
631
|
+
required: false
|
|
632
|
+
}]
|
|
633
|
+
}],
|
|
634
|
+
target: [{
|
|
635
|
+
type: i0.Input,
|
|
636
|
+
args: [{
|
|
637
|
+
isSignal: true,
|
|
638
|
+
alias: "target",
|
|
639
|
+
required: false
|
|
640
|
+
}]
|
|
641
|
+
}],
|
|
642
|
+
sizeLabels: [{
|
|
643
|
+
type: i0.Input,
|
|
644
|
+
args: [{
|
|
645
|
+
isSignal: true,
|
|
646
|
+
alias: "sizeLabels",
|
|
647
|
+
required: false
|
|
648
|
+
}]
|
|
649
|
+
}],
|
|
650
|
+
className: [{
|
|
651
|
+
type: i0.Input,
|
|
652
|
+
args: [{
|
|
653
|
+
isSignal: true,
|
|
654
|
+
alias: "className",
|
|
655
|
+
required: false
|
|
656
|
+
}]
|
|
657
|
+
}],
|
|
658
|
+
sizeChange: [{
|
|
659
|
+
type: i0.Output,
|
|
660
|
+
args: ["sizeChange"]
|
|
661
|
+
}],
|
|
662
|
+
iconTemplate: [{
|
|
663
|
+
type: i0.ContentChild,
|
|
664
|
+
args: [i0.forwardRef(() => TemplateRef), { isSignal: true }]
|
|
665
|
+
}],
|
|
666
|
+
rootRef: [{
|
|
667
|
+
type: i0.ViewChild,
|
|
668
|
+
args: ["rootEl", { isSignal: true }]
|
|
669
|
+
}],
|
|
670
|
+
buttonRef: [{
|
|
671
|
+
type: i0.ViewChild,
|
|
672
|
+
args: ["buttonEl", { isSignal: true }]
|
|
673
|
+
}],
|
|
674
|
+
listRef: [{
|
|
675
|
+
type: i0.ViewChild,
|
|
676
|
+
args: ["listEl", { isSignal: true }]
|
|
677
|
+
}]
|
|
678
|
+
}
|
|
679
|
+
});
|
|
440
680
|
export { TextSizePicker, TextSizePickerIcon, nextTextSizePickerId, sizeName };
|
|
441
|
-
|
|
681
|
+
|
|
682
|
+
//# sourceMappingURL=lilydesignsystem-angular-text-size-picker.mjs.map
|