@nanahoshi/mona-ui 0.34.0 → 0.36.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/alert/package.json +4 -0
- package/badge/package.json +4 -0
- package/docs/alert.md +219 -0
- package/docs/api/alert.md +78 -0
- package/docs/api/avatar.md +25 -0
- package/docs/api/badge.md +24 -0
- package/docs/api/common.md +3 -3
- package/docs/api/i18n.md +71 -5
- package/docs/api/locales.md +14 -14
- package/docs/api/masked-text-box.md +137 -0
- package/docs/api/multi-select.md +3 -0
- package/docs/api/separator.md +23 -0
- package/docs/api/toolbar.md +81 -0
- package/docs/avatar.md +108 -6
- package/docs/badge.md +181 -0
- package/docs/masked-textbox.md +334 -0
- package/docs/multi-select.md +120 -0
- package/docs/separator.md +147 -0
- package/docs/sidebar-menus.md +1 -1
- package/docs/toolbar.md +327 -0
- package/fesm2022/nanahoshi-mona-ui-alert.mjs +422 -0
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +182 -3
- package/fesm2022/nanahoshi-mona-ui-badge.mjs +273 -0
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +20 -1
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +54 -15
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-masked-text-box.mjs +1302 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +112 -3
- package/fesm2022/nanahoshi-mona-ui-separator.mjs +165 -0
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +3 -3
- package/fesm2022/nanahoshi-mona-ui-toolbar.mjs +536 -0
- package/i18n/catalogs/en-US.messages.json +19 -1
- package/llms.txt +13 -3
- package/locales/ar-sa/ar-sa.messages.json +19 -1
- package/locales/de-de/de-de.messages.json +19 -1
- package/locales/es-es/es-es.messages.json +19 -1
- package/locales/fr-fr/fr-fr.messages.json +19 -1
- package/locales/id-id/id-id.messages.json +19 -1
- package/locales/it-it/it-it.messages.json +19 -1
- package/locales/ja-jp/ja-jp.messages.json +19 -1
- package/locales/ko-kr/ko-kr.messages.json +19 -1
- package/locales/pl-pl/pl-pl.messages.json +19 -1
- package/locales/pt-br/pt-br.messages.json +19 -1
- package/locales/ru-ru/ru-ru.messages.json +19 -1
- package/locales/tr-tr/tr-tr.messages.json +19 -1
- package/locales/zh-cn/zh-cn.messages.json +19 -1
- package/locales/zh-tw/zh-tw.messages.json +19 -1
- package/masked-text-box/package.json +4 -0
- package/package.json +21 -1
- package/separator/package.json +4 -0
- package/toolbar/package.json +4 -0
- package/types/nanahoshi-mona-ui-alert.d.ts +144 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +66 -0
- package/types/nanahoshi-mona-ui-badge.d.ts +82 -0
- package/types/nanahoshi-mona-ui-i18n.d.ts +44 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +12 -0
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +18 -0
- package/types/nanahoshi-mona-ui-masked-text-box.d.ts +391 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +38 -0
- package/types/nanahoshi-mona-ui-separator.d.ts +66 -0
- package/types/nanahoshi-mona-ui-toolbar.d.ts +183 -0
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, DestroyRef, Directive, ElementRef, afterEveryRender, afterNextRender, computed, contentChildren, effect, inject, input, isDevMode, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { LucideEllipsis } from "@lucide/angular";
|
|
4
|
+
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
5
|
+
import { PreventableEvent, classInputToClass } from "@nanahoshi/mona-ui/common";
|
|
6
|
+
import { MonaI18nService } from "@nanahoshi/mona-ui/i18n";
|
|
7
|
+
import { RovingToolbar, createElementControlId } from "@nanahoshi/mona-ui/internal";
|
|
8
|
+
import { PopupMenuComponent } from "@nanahoshi/mona-ui/popup-menu";
|
|
9
|
+
import { twMerge } from "tailwind-merge";
|
|
10
|
+
import { cva } from "class-variance-authority";
|
|
11
|
+
const TOOLBAR_DEFAULT_MESSAGES = { moreLabel: "More" };
|
|
12
|
+
var ToolbarItemDirective = class ToolbarItemDirective {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.#hidden = signal(false, ...ngDevMode ? [{ debugName: "#hidden" }] : /* istanbul ignore next */ []);
|
|
15
|
+
this.element = inject(ElementRef).nativeElement;
|
|
16
|
+
this.hidden = this.#hidden.asReadonly();
|
|
17
|
+
this.overflow = input("auto", {
|
|
18
|
+
...ngDevMode ? { debugName: "overflow" } : /* istanbul ignore next */ {},
|
|
19
|
+
alias: "monaToolbarItem",
|
|
20
|
+
transform: toOverflow
|
|
21
|
+
});
|
|
22
|
+
this.overflowActivate = output();
|
|
23
|
+
this.overflowText = input("", ...ngDevMode ? [{ debugName: "overflowText" }] : /* istanbul ignore next */ []);
|
|
24
|
+
}
|
|
25
|
+
#hidden;
|
|
26
|
+
activate(originalEvent) {
|
|
27
|
+
const event = new PreventableEvent("toolbarItemOverflowActivate", originalEvent);
|
|
28
|
+
this.overflowActivate.emit(event);
|
|
29
|
+
if (!event.isDefaultPrevented()) this.element.click();
|
|
30
|
+
}
|
|
31
|
+
getMenuText() {
|
|
32
|
+
return (this.overflowText() || this.element.getAttribute("aria-label") || this.element.textContent)?.replace(/\s+/g, " ").trim() ?? "";
|
|
33
|
+
}
|
|
34
|
+
isDisabled() {
|
|
35
|
+
return this.element.disabled === true || this.element.getAttribute("aria-disabled") === "true";
|
|
36
|
+
}
|
|
37
|
+
isSeparator() {
|
|
38
|
+
return this.element.getAttribute("role") === "separator" || this.element.tagName === "MONA-SEPARATOR";
|
|
39
|
+
}
|
|
40
|
+
pressed() {
|
|
41
|
+
const pressed = this.element.getAttribute("aria-pressed");
|
|
42
|
+
return pressed == null ? null : pressed === "true";
|
|
43
|
+
}
|
|
44
|
+
setHidden(hidden) {
|
|
45
|
+
if (this.element.hidden !== hidden) this.element.hidden = hidden;
|
|
46
|
+
const display = hidden ? "none" : "";
|
|
47
|
+
if (this.element.style.display !== display) this.element.style.display = display;
|
|
48
|
+
this.#hidden.set(hidden);
|
|
49
|
+
}
|
|
50
|
+
static {
|
|
51
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
52
|
+
minVersion: "12.0.0",
|
|
53
|
+
version: "22.2.6",
|
|
54
|
+
ngImport: i0,
|
|
55
|
+
type: ToolbarItemDirective,
|
|
56
|
+
deps: [],
|
|
57
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
static {
|
|
61
|
+
this.ɵdir = i0.ɵɵngDeclareDirective({
|
|
62
|
+
minVersion: "17.1.0",
|
|
63
|
+
version: "22.2.6",
|
|
64
|
+
type: ToolbarItemDirective,
|
|
65
|
+
isStandalone: true,
|
|
66
|
+
selector: "[monaToolbarItem]",
|
|
67
|
+
inputs: {
|
|
68
|
+
overflow: {
|
|
69
|
+
classPropertyName: "overflow",
|
|
70
|
+
publicName: "monaToolbarItem",
|
|
71
|
+
isSignal: true,
|
|
72
|
+
isRequired: false,
|
|
73
|
+
transformFunction: null
|
|
74
|
+
},
|
|
75
|
+
overflowText: {
|
|
76
|
+
classPropertyName: "overflowText",
|
|
77
|
+
publicName: "overflowText",
|
|
78
|
+
isSignal: true,
|
|
79
|
+
isRequired: false,
|
|
80
|
+
transformFunction: null
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
outputs: { overflowActivate: "overflowActivate" },
|
|
84
|
+
ngImport: i0
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
89
|
+
minVersion: "12.0.0",
|
|
90
|
+
version: "22.2.6",
|
|
91
|
+
ngImport: i0,
|
|
92
|
+
type: ToolbarItemDirective,
|
|
93
|
+
decorators: [{
|
|
94
|
+
type: Directive,
|
|
95
|
+
args: [{ selector: "[monaToolbarItem]" }]
|
|
96
|
+
}],
|
|
97
|
+
propDecorators: {
|
|
98
|
+
overflow: [{
|
|
99
|
+
type: i0.Input,
|
|
100
|
+
args: [{
|
|
101
|
+
isSignal: true,
|
|
102
|
+
alias: "monaToolbarItem",
|
|
103
|
+
required: false
|
|
104
|
+
}]
|
|
105
|
+
}],
|
|
106
|
+
overflowActivate: [{
|
|
107
|
+
type: i0.Output,
|
|
108
|
+
args: ["overflowActivate"]
|
|
109
|
+
}],
|
|
110
|
+
overflowText: [{
|
|
111
|
+
type: i0.Input,
|
|
112
|
+
args: [{
|
|
113
|
+
isSignal: true,
|
|
114
|
+
alias: "overflowText",
|
|
115
|
+
required: false
|
|
116
|
+
}]
|
|
117
|
+
}]
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
function toOverflow(value) {
|
|
121
|
+
return value === "never" ? "never" : "auto";
|
|
122
|
+
}
|
|
123
|
+
const toolbarThemeVariants = cva("flex w-full min-w-0 items-center [&>*]:shrink-0", {
|
|
124
|
+
variants: {
|
|
125
|
+
overflow: {
|
|
126
|
+
menu: "flex-nowrap",
|
|
127
|
+
wrap: "flex-wrap"
|
|
128
|
+
},
|
|
129
|
+
size: {
|
|
130
|
+
small: "gap-0.5",
|
|
131
|
+
medium: "gap-1",
|
|
132
|
+
large: "gap-1.5"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
defaultVariants: {
|
|
136
|
+
overflow: "menu",
|
|
137
|
+
size: "medium"
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
var ToolbarComponent = class ToolbarComponent {
|
|
141
|
+
#destroyRef;
|
|
142
|
+
#hostElement;
|
|
143
|
+
#i18n;
|
|
144
|
+
#overflowed;
|
|
145
|
+
#roving;
|
|
146
|
+
#layoutFrame;
|
|
147
|
+
#moreWidth;
|
|
148
|
+
#resizeObserver;
|
|
149
|
+
constructor() {
|
|
150
|
+
this.#destroyRef = inject(DestroyRef);
|
|
151
|
+
this.#hostElement = inject(ElementRef).nativeElement;
|
|
152
|
+
this.#i18n = inject(MonaI18nService);
|
|
153
|
+
this.#overflowed = signal([], ...ngDevMode ? [{ debugName: "#overflowed" }] : /* istanbul ignore next */ []);
|
|
154
|
+
this.#roving = new RovingToolbar(() => this.#hostElement);
|
|
155
|
+
this.#layoutFrame = null;
|
|
156
|
+
this.#moreWidth = null;
|
|
157
|
+
this.#resizeObserver = null;
|
|
158
|
+
this.baseClass = computed(() => twMerge(toolbarThemeVariants({
|
|
159
|
+
overflow: this.overflow(),
|
|
160
|
+
size: this.size()
|
|
161
|
+
}), this.userClass()), ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
162
|
+
this.items = contentChildren(ToolbarItemDirective, ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
|
|
163
|
+
this.menuId = createElementControlId();
|
|
164
|
+
this.menuItems = signal([], ...ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []);
|
|
165
|
+
this.menuOpen = signal(false, ...ngDevMode ? [{ debugName: "menuOpen" }] : /* istanbul ignore next */ []);
|
|
166
|
+
this.messages = this.#i18n.componentMessages("toolbar", TOOLBAR_DEFAULT_MESSAGES);
|
|
167
|
+
this.moreButton = viewChild("moreButton", ...ngDevMode ? [{ debugName: "moreButton" }] : /* istanbul ignore next */ []);
|
|
168
|
+
this.moreButtonId = createElementControlId();
|
|
169
|
+
this.rightToLeft = signal(false, ...ngDevMode ? [{ debugName: "rightToLeft" }] : /* istanbul ignore next */ []);
|
|
170
|
+
this.ariaLabel = input("", {
|
|
171
|
+
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
172
|
+
alias: "aria-label"
|
|
173
|
+
});
|
|
174
|
+
this.ariaLabelledBy = input("", {
|
|
175
|
+
...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
|
|
176
|
+
alias: "aria-labelledby"
|
|
177
|
+
});
|
|
178
|
+
this.moreLabel = input("", ...ngDevMode ? [{ debugName: "moreLabel" }] : /* istanbul ignore next */ []);
|
|
179
|
+
this.overflow = input("menu", ...ngDevMode ? [{ debugName: "overflow" }] : /* istanbul ignore next */ []);
|
|
180
|
+
this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
181
|
+
this.userClass = input("", {
|
|
182
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
183
|
+
alias: "class",
|
|
184
|
+
transform: (value) => classInputToClass(value)
|
|
185
|
+
});
|
|
186
|
+
afterNextRender({ read: () => this.#warnIfUnnamed() });
|
|
187
|
+
afterEveryRender({ write: () => this.#roving.sync() });
|
|
188
|
+
effect(() => {
|
|
189
|
+
this.items();
|
|
190
|
+
this.overflow();
|
|
191
|
+
this.size();
|
|
192
|
+
untracked(() => this.#observe());
|
|
193
|
+
});
|
|
194
|
+
this.#destroyRef.onDestroy(() => {
|
|
195
|
+
this.#resizeObserver?.disconnect();
|
|
196
|
+
if (this.#layoutFrame != null) cancelAnimationFrame(this.#layoutFrame);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
onFocusIn(event) {
|
|
200
|
+
this.#roving.onFocusIn(event);
|
|
201
|
+
}
|
|
202
|
+
onKeydown(event) {
|
|
203
|
+
this.#roving.onKeydown(event);
|
|
204
|
+
}
|
|
205
|
+
onMenuClick(event) {
|
|
206
|
+
this.#overflowed()[event.value]?.activate(event.originalEvent);
|
|
207
|
+
}
|
|
208
|
+
onMenuOpen() {
|
|
209
|
+
this.menuItems.set(this.#createMenuItems());
|
|
210
|
+
this.menuOpen.set(true);
|
|
211
|
+
}
|
|
212
|
+
#createMenuItems() {
|
|
213
|
+
const menuItems = [];
|
|
214
|
+
for (const [index, item] of this.#overflowed().entries()) {
|
|
215
|
+
if (item.isSeparator()) {
|
|
216
|
+
if (menuItems.length > 0 && !menuItems[menuItems.length - 1].separator) menuItems.push({
|
|
217
|
+
label: "",
|
|
218
|
+
separator: true
|
|
219
|
+
});
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
const pressed = item.pressed();
|
|
223
|
+
menuItems.push({
|
|
224
|
+
checkable: pressed != null,
|
|
225
|
+
checked: pressed ?? void 0,
|
|
226
|
+
disabled: item.isDisabled(),
|
|
227
|
+
label: item.getMenuText(),
|
|
228
|
+
value: index
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
if (menuItems.length > 0 && menuItems[menuItems.length - 1].separator) menuItems.pop();
|
|
232
|
+
return menuItems;
|
|
233
|
+
}
|
|
234
|
+
#layout() {
|
|
235
|
+
this.#layoutFrame = null;
|
|
236
|
+
const host = this.#hostElement;
|
|
237
|
+
const items = this.items();
|
|
238
|
+
const moreButton = this.moreButton()?.nativeElement;
|
|
239
|
+
this.rightToLeft.set(host.ownerDocument.defaultView?.getComputedStyle(host).direction === "rtl");
|
|
240
|
+
if (this.overflow() !== "menu" || moreButton == null) {
|
|
241
|
+
items.forEach((item) => item.setHidden(false));
|
|
242
|
+
this.#overflowed.set([]);
|
|
243
|
+
this.#roving.sync();
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const focused = host.ownerDocument.activeElement;
|
|
247
|
+
const gap = parseFloat(host.ownerDocument.defaultView?.getComputedStyle(host).columnGap ?? "") || 0;
|
|
248
|
+
const moreShown = !moreButton.hidden;
|
|
249
|
+
if (moreShown) this.#moreWidth = moreButton.getBoundingClientRect().width + gap;
|
|
250
|
+
else if (this.#moreWidth == null) {
|
|
251
|
+
moreButton.hidden = false;
|
|
252
|
+
this.#moreWidth = moreButton.getBoundingClientRect().width + gap;
|
|
253
|
+
moreButton.hidden = true;
|
|
254
|
+
}
|
|
255
|
+
const moreWidth = this.#moreWidth;
|
|
256
|
+
items.forEach((item) => item.setHidden(false));
|
|
257
|
+
let excess = host.scrollWidth - host.clientWidth - (moreShown ? moreWidth : 0);
|
|
258
|
+
const overflowed = [];
|
|
259
|
+
if (excess > 0) {
|
|
260
|
+
excess += moreWidth;
|
|
261
|
+
const candidates = items.filter((item) => item.overflow() === "auto");
|
|
262
|
+
for (let index = candidates.length - 1; index >= 0 && excess > 0; index--) {
|
|
263
|
+
const item = candidates[index];
|
|
264
|
+
excess -= item.element.getBoundingClientRect().width + gap;
|
|
265
|
+
overflowed.unshift(item);
|
|
266
|
+
}
|
|
267
|
+
const visible = candidates.filter((item) => !overflowed.includes(item));
|
|
268
|
+
for (let index = visible.length - 1; index >= 0 && visible[index].isSeparator(); index--) overflowed.unshift(visible[index]);
|
|
269
|
+
overflowed.sort((a, b) => items.indexOf(a) - items.indexOf(b));
|
|
270
|
+
overflowed.forEach((item) => item.setHidden(true));
|
|
271
|
+
}
|
|
272
|
+
const showMore = overflowed.length > 0;
|
|
273
|
+
if (moreButton.hidden === showMore) moreButton.hidden = !showMore;
|
|
274
|
+
this.#overflowed.set(overflowed);
|
|
275
|
+
this.#roving.sync();
|
|
276
|
+
if (!(focused instanceof HTMLElement)) return;
|
|
277
|
+
if (overflowed.some((item) => item.element.contains(focused))) moreButton.focus();
|
|
278
|
+
else if (focused === moreButton && !showMore) {
|
|
279
|
+
const controls = items.filter((item) => !item.isSeparator());
|
|
280
|
+
controls[controls.length - 1]?.element.focus();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
#observe() {
|
|
284
|
+
this.#moreWidth = null;
|
|
285
|
+
if (typeof ResizeObserver === "undefined") {
|
|
286
|
+
this.#scheduleLayout();
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
this.#resizeObserver?.disconnect();
|
|
290
|
+
this.#resizeObserver = new ResizeObserver(() => this.#scheduleLayout());
|
|
291
|
+
this.#resizeObserver.observe(this.#hostElement);
|
|
292
|
+
for (const item of this.items()) this.#resizeObserver.observe(item.element);
|
|
293
|
+
this.#scheduleLayout();
|
|
294
|
+
}
|
|
295
|
+
#scheduleLayout() {
|
|
296
|
+
if (this.#layoutFrame != null) return;
|
|
297
|
+
this.#layoutFrame = requestAnimationFrame(() => this.#layout());
|
|
298
|
+
}
|
|
299
|
+
#warnIfUnnamed() {
|
|
300
|
+
if (isDevMode() && !this.ariaLabel() && !this.ariaLabelledBy()) console.warn("[Mona Toolbar] A toolbar needs aria-label or aria-labelledby, so assistive technology can say what it's for.", this.#hostElement);
|
|
301
|
+
}
|
|
302
|
+
static {
|
|
303
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
304
|
+
minVersion: "12.0.0",
|
|
305
|
+
version: "22.2.6",
|
|
306
|
+
ngImport: i0,
|
|
307
|
+
type: ToolbarComponent,
|
|
308
|
+
deps: [],
|
|
309
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
static {
|
|
313
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
314
|
+
minVersion: "17.0.0",
|
|
315
|
+
version: "22.2.6",
|
|
316
|
+
type: ToolbarComponent,
|
|
317
|
+
isStandalone: true,
|
|
318
|
+
selector: "mona-toolbar",
|
|
319
|
+
inputs: {
|
|
320
|
+
ariaLabel: {
|
|
321
|
+
classPropertyName: "ariaLabel",
|
|
322
|
+
publicName: "aria-label",
|
|
323
|
+
isSignal: true,
|
|
324
|
+
isRequired: false,
|
|
325
|
+
transformFunction: null
|
|
326
|
+
},
|
|
327
|
+
ariaLabelledBy: {
|
|
328
|
+
classPropertyName: "ariaLabelledBy",
|
|
329
|
+
publicName: "aria-labelledby",
|
|
330
|
+
isSignal: true,
|
|
331
|
+
isRequired: false,
|
|
332
|
+
transformFunction: null
|
|
333
|
+
},
|
|
334
|
+
moreLabel: {
|
|
335
|
+
classPropertyName: "moreLabel",
|
|
336
|
+
publicName: "moreLabel",
|
|
337
|
+
isSignal: true,
|
|
338
|
+
isRequired: false,
|
|
339
|
+
transformFunction: null
|
|
340
|
+
},
|
|
341
|
+
overflow: {
|
|
342
|
+
classPropertyName: "overflow",
|
|
343
|
+
publicName: "overflow",
|
|
344
|
+
isSignal: true,
|
|
345
|
+
isRequired: false,
|
|
346
|
+
transformFunction: null
|
|
347
|
+
},
|
|
348
|
+
size: {
|
|
349
|
+
classPropertyName: "size",
|
|
350
|
+
publicName: "size",
|
|
351
|
+
isSignal: true,
|
|
352
|
+
isRequired: false,
|
|
353
|
+
transformFunction: null
|
|
354
|
+
},
|
|
355
|
+
userClass: {
|
|
356
|
+
classPropertyName: "userClass",
|
|
357
|
+
publicName: "class",
|
|
358
|
+
isSignal: true,
|
|
359
|
+
isRequired: false,
|
|
360
|
+
transformFunction: null
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
host: {
|
|
364
|
+
attributes: { "role": "toolbar" },
|
|
365
|
+
listeners: {
|
|
366
|
+
"focusin": "onFocusIn($event)",
|
|
367
|
+
"keydown": "onKeydown($event)"
|
|
368
|
+
},
|
|
369
|
+
properties: {
|
|
370
|
+
"attr.aria-label": "ariaLabel() || null",
|
|
371
|
+
"attr.aria-labelledby": "ariaLabelledBy() || null",
|
|
372
|
+
"class": "baseClass()"
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
queries: [{
|
|
376
|
+
propertyName: "items",
|
|
377
|
+
predicate: ToolbarItemDirective,
|
|
378
|
+
isSignal: true
|
|
379
|
+
}],
|
|
380
|
+
viewQueries: [{
|
|
381
|
+
propertyName: "moreButton",
|
|
382
|
+
first: true,
|
|
383
|
+
predicate: ["moreButton"],
|
|
384
|
+
descendants: true,
|
|
385
|
+
isSignal: true
|
|
386
|
+
}],
|
|
387
|
+
ngImport: i0,
|
|
388
|
+
template: "<ng-content></ng-content>\n\n@if (overflow() === \"menu\") {\n <button\n #moreButton\n monaButton\n type=\"button\"\n look=\"ghost\"\n hidden\n aria-haspopup=\"menu\"\n [id]=\"moreButtonId\"\n [size]=\"size()\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"moreLabel() || messages().moreLabel\"\n [attr.aria-expanded]=\"menuOpen()\"\n [attr.aria-controls]=\"menuOpen() ? menuId : null\">\n <svg lucideEllipsis [size]=\"16\"></svg>\n </button>\n <mona-popup-menu\n trigger=\"click\"\n [anchorConnectionPoint]=\"rightToLeft() ? 'bottomleft' : 'bottomright'\"\n [popupConnectionPoint]=\"rightToLeft() ? 'topleft' : 'topright'\"\n [id]=\"menuId\"\n [items]=\"menuItems()\"\n [offset]=\"{ horizontal: 0, vertical: 2 }\"\n [size]=\"size()\"\n [target]=\"moreButton\"\n (close)=\"menuOpen.set(false)\"\n (menuClick)=\"onMenuClick($event)\"\n (open)=\"onMenuOpen()\"></mona-popup-menu>\n}\n",
|
|
389
|
+
dependencies: [
|
|
390
|
+
{
|
|
391
|
+
kind: "directive",
|
|
392
|
+
type: ButtonDirective,
|
|
393
|
+
selector: "button[monaButton]",
|
|
394
|
+
inputs: [
|
|
395
|
+
"aria-haspopup",
|
|
396
|
+
"disabled",
|
|
397
|
+
"iconOnly",
|
|
398
|
+
"loading",
|
|
399
|
+
"look",
|
|
400
|
+
"rounded",
|
|
401
|
+
"selected",
|
|
402
|
+
"size",
|
|
403
|
+
"tabindex",
|
|
404
|
+
"toggleable",
|
|
405
|
+
"type",
|
|
406
|
+
"class",
|
|
407
|
+
"value"
|
|
408
|
+
],
|
|
409
|
+
outputs: ["lookChange", "selectedChange"]
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
kind: "component",
|
|
413
|
+
type: LucideEllipsis,
|
|
414
|
+
selector: "svg[lucideEllipsis], svg[lucideMoreHorizontal]"
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
kind: "component",
|
|
418
|
+
type: PopupMenuComponent,
|
|
419
|
+
selector: "mona-popup-menu",
|
|
420
|
+
inputs: [
|
|
421
|
+
"anchor",
|
|
422
|
+
"anchorConnectionPoint",
|
|
423
|
+
"aria-label",
|
|
424
|
+
"aria-labelledby",
|
|
425
|
+
"items",
|
|
426
|
+
"id",
|
|
427
|
+
"minWidth",
|
|
428
|
+
"offset",
|
|
429
|
+
"openAtPointer",
|
|
430
|
+
"popupConnectionPoint",
|
|
431
|
+
"rounded",
|
|
432
|
+
"size",
|
|
433
|
+
"target",
|
|
434
|
+
"trigger",
|
|
435
|
+
"class",
|
|
436
|
+
"width"
|
|
437
|
+
],
|
|
438
|
+
outputs: [
|
|
439
|
+
"close",
|
|
440
|
+
"menuClick",
|
|
441
|
+
"navigate",
|
|
442
|
+
"open"
|
|
443
|
+
]
|
|
444
|
+
}
|
|
445
|
+
]
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
450
|
+
minVersion: "12.0.0",
|
|
451
|
+
version: "22.2.6",
|
|
452
|
+
ngImport: i0,
|
|
453
|
+
type: ToolbarComponent,
|
|
454
|
+
decorators: [{
|
|
455
|
+
type: Component,
|
|
456
|
+
args: [{
|
|
457
|
+
selector: "mona-toolbar",
|
|
458
|
+
imports: [
|
|
459
|
+
ButtonDirective,
|
|
460
|
+
LucideEllipsis,
|
|
461
|
+
PopupMenuComponent
|
|
462
|
+
],
|
|
463
|
+
host: {
|
|
464
|
+
"[attr.aria-label]": "ariaLabel() || null",
|
|
465
|
+
"[attr.aria-labelledby]": "ariaLabelledBy() || null",
|
|
466
|
+
"[class]": "baseClass()",
|
|
467
|
+
role: "toolbar",
|
|
468
|
+
"(focusin)": "onFocusIn($event)",
|
|
469
|
+
"(keydown)": "onKeydown($event)"
|
|
470
|
+
},
|
|
471
|
+
template: "<ng-content></ng-content>\n\n@if (overflow() === \"menu\") {\n <button\n #moreButton\n monaButton\n type=\"button\"\n look=\"ghost\"\n hidden\n aria-haspopup=\"menu\"\n [id]=\"moreButtonId\"\n [size]=\"size()\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"moreLabel() || messages().moreLabel\"\n [attr.aria-expanded]=\"menuOpen()\"\n [attr.aria-controls]=\"menuOpen() ? menuId : null\">\n <svg lucideEllipsis [size]=\"16\"></svg>\n </button>\n <mona-popup-menu\n trigger=\"click\"\n [anchorConnectionPoint]=\"rightToLeft() ? 'bottomleft' : 'bottomright'\"\n [popupConnectionPoint]=\"rightToLeft() ? 'topleft' : 'topright'\"\n [id]=\"menuId\"\n [items]=\"menuItems()\"\n [offset]=\"{ horizontal: 0, vertical: 2 }\"\n [size]=\"size()\"\n [target]=\"moreButton\"\n (close)=\"menuOpen.set(false)\"\n (menuClick)=\"onMenuClick($event)\"\n (open)=\"onMenuOpen()\"></mona-popup-menu>\n}\n"
|
|
472
|
+
}]
|
|
473
|
+
}],
|
|
474
|
+
ctorParameters: () => [],
|
|
475
|
+
propDecorators: {
|
|
476
|
+
items: [{
|
|
477
|
+
type: i0.ContentChildren,
|
|
478
|
+
args: [i0.forwardRef(() => ToolbarItemDirective), { isSignal: true }]
|
|
479
|
+
}],
|
|
480
|
+
moreButton: [{
|
|
481
|
+
type: i0.ViewChild,
|
|
482
|
+
args: ["moreButton", { isSignal: true }]
|
|
483
|
+
}],
|
|
484
|
+
ariaLabel: [{
|
|
485
|
+
type: i0.Input,
|
|
486
|
+
args: [{
|
|
487
|
+
isSignal: true,
|
|
488
|
+
alias: "aria-label",
|
|
489
|
+
required: false
|
|
490
|
+
}]
|
|
491
|
+
}],
|
|
492
|
+
ariaLabelledBy: [{
|
|
493
|
+
type: i0.Input,
|
|
494
|
+
args: [{
|
|
495
|
+
isSignal: true,
|
|
496
|
+
alias: "aria-labelledby",
|
|
497
|
+
required: false
|
|
498
|
+
}]
|
|
499
|
+
}],
|
|
500
|
+
moreLabel: [{
|
|
501
|
+
type: i0.Input,
|
|
502
|
+
args: [{
|
|
503
|
+
isSignal: true,
|
|
504
|
+
alias: "moreLabel",
|
|
505
|
+
required: false
|
|
506
|
+
}]
|
|
507
|
+
}],
|
|
508
|
+
overflow: [{
|
|
509
|
+
type: i0.Input,
|
|
510
|
+
args: [{
|
|
511
|
+
isSignal: true,
|
|
512
|
+
alias: "overflow",
|
|
513
|
+
required: false
|
|
514
|
+
}]
|
|
515
|
+
}],
|
|
516
|
+
size: [{
|
|
517
|
+
type: i0.Input,
|
|
518
|
+
args: [{
|
|
519
|
+
isSignal: true,
|
|
520
|
+
alias: "size",
|
|
521
|
+
required: false
|
|
522
|
+
}]
|
|
523
|
+
}],
|
|
524
|
+
userClass: [{
|
|
525
|
+
type: i0.Input,
|
|
526
|
+
args: [{
|
|
527
|
+
isSignal: true,
|
|
528
|
+
alias: "class",
|
|
529
|
+
required: false
|
|
530
|
+
}]
|
|
531
|
+
}]
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
export { TOOLBAR_DEFAULT_MESSAGES, ToolbarComponent, ToolbarItemDirective };
|
|
535
|
+
|
|
536
|
+
//# sourceMappingURL=nanahoshi-mona-ui-toolbar.mjs.map
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
+
"alert": {
|
|
3
|
+
"dismissLabel": "{title, select, undefined {Dismiss} other {Dismiss, {title}}}"
|
|
4
|
+
},
|
|
2
5
|
"autoComplete": {
|
|
3
6
|
"clear": "Clear"
|
|
4
7
|
},
|
|
8
|
+
"avatar": {
|
|
9
|
+
"moreLabel": "{count} more"
|
|
10
|
+
},
|
|
5
11
|
"breadcrumb": {
|
|
6
12
|
"breadcrumb": "Breadcrumb",
|
|
7
13
|
"showFullPath": "Show full path"
|
|
@@ -439,10 +445,19 @@
|
|
|
439
445
|
"transferTo": "Transfer to the other list",
|
|
440
446
|
"transferToList": "Transfer to {list}"
|
|
441
447
|
},
|
|
448
|
+
"maskedTextBox": {
|
|
449
|
+
"characterNotAllowed": "That character doesn't fit here",
|
|
450
|
+
"clear": "Clear",
|
|
451
|
+
"digitOnly": "Only a digit fits here",
|
|
452
|
+
"digitOrSignOnly": "Only a digit, plus or minus fits here",
|
|
453
|
+
"letterOnly": "Only a letter fits here",
|
|
454
|
+
"letterOrDigitOnly": "Only a letter or a digit fits here"
|
|
455
|
+
},
|
|
442
456
|
"multiSelect": {
|
|
443
457
|
"clear": "Clear",
|
|
444
458
|
"itemsCount": "{count, plural, =1 {+ # item} other {+ # items}}",
|
|
445
|
-
"removeMoreItems": "{count, plural, =1 {Remove # more item} other {Remove # more items}}"
|
|
459
|
+
"removeMoreItems": "{count, plural, =1 {Remove # more item} other {Remove # more items}}",
|
|
460
|
+
"selectAll": "Select all"
|
|
446
461
|
},
|
|
447
462
|
"notification": {
|
|
448
463
|
"close": "Close",
|
|
@@ -560,6 +575,9 @@
|
|
|
560
575
|
"set": "Set",
|
|
561
576
|
"timeSelector": "Time selector"
|
|
562
577
|
},
|
|
578
|
+
"toolbar": {
|
|
579
|
+
"moreLabel": "More"
|
|
580
|
+
},
|
|
563
581
|
"treeView": {
|
|
564
582
|
"collapse": "Collapse",
|
|
565
583
|
"expand": "Expand",
|
package/llms.txt
CHANGED
|
@@ -37,6 +37,7 @@ Mona UI is an Angular component library styled with Tailwind CSS 4. Its componen
|
|
|
37
37
|
- [Button Group](docs/button-group.md): Joins related buttons into one control with a shared look and size.
|
|
38
38
|
- [Dropdown Button](docs/dropdown-button.md): A single button that opens a menu of actions.
|
|
39
39
|
- [Split Button](docs/split-button.md): A primary action button paired with a menu of secondary actions.
|
|
40
|
+
- [Toolbar](docs/toolbar.md): A row of controls that is one Tab stop, moving what doesn't fit into a More menu.
|
|
40
41
|
|
|
41
42
|
## Form Fields
|
|
42
43
|
|
|
@@ -47,6 +48,7 @@ Mona UI is an Angular component library styled with Tailwind CSS 4. Its componen
|
|
|
47
48
|
- [Form Field](docs/form-field.md): Labels one form control, describes it with a hint and shows its validation errors.
|
|
48
49
|
- [Input](docs/input.md): Styles a native input element and keeps its browser behavior.
|
|
49
50
|
- [Label](docs/label.md): Styled, accessible labels associated with form controls.
|
|
51
|
+
- [Masked Text Box](docs/masked-textbox.md): A text input for values in a fixed format, such as phone numbers, that fills in the format as you type.
|
|
50
52
|
- [Numeric Text Box](docs/numeric-textbox.md): A number input with spinner buttons, bounds and decimal formatting.
|
|
51
53
|
- [OTP Input](docs/otp-input.md): A segmented input for one-time passwords and verification codes.
|
|
52
54
|
- [Text Area](docs/textarea.md): Styles a native textarea element and keeps its browser behavior.
|
|
@@ -79,7 +81,8 @@ Mona UI is an Angular component library styled with Tailwind CSS 4. Its componen
|
|
|
79
81
|
|
|
80
82
|
## Data
|
|
81
83
|
|
|
82
|
-
- [Avatar](docs/avatar.md): Shows a person or entity as an image, text label or projected content.
|
|
84
|
+
- [Avatar](docs/avatar.md): Shows a person or entity as an image, text label or projected content, alone or stacked in a group.
|
|
85
|
+
- [Badge](docs/badge.md): A small filled or outlined label for a count or a status.
|
|
83
86
|
- [Chip](docs/chip.md): A compact label that can be selected, removed or given a prefix.
|
|
84
87
|
- [List Box](docs/list-box.md): A selectable list with a toolbar for moving items and transferring them between lists.
|
|
85
88
|
- [List View](docs/list-view.md): Renders a collection as a list, with optional selection, grouping and paging.
|
|
@@ -142,10 +145,12 @@ Mona UI is an Angular component library styled with Tailwind CSS 4. Its componen
|
|
|
142
145
|
- [Collapsible](docs/collapsible.md): A headless disclosure primitive for expandable regions.
|
|
143
146
|
- [Expansion Panel](docs/expansion-panel.md): A header that shows and hides its content, designed to stack with other panels.
|
|
144
147
|
- [Scroll View](docs/scroll-view.md): A fixed-size carousel that pages through a collection one item at a time.
|
|
148
|
+
- [Separator](docs/separator.md): A thin line between groups of content, across or down, with an optional label.
|
|
145
149
|
- [Splitter](docs/splitter.md): Lays out panes in a row or column that can be resized and collapsed.
|
|
146
150
|
|
|
147
151
|
## Feedback
|
|
148
152
|
|
|
153
|
+
- [Alert](docs/alert.md): A message that stays on the page, tinted for what it means, with optional actions and dismissal.
|
|
149
154
|
- [Circular Progress Bar](docs/circular-progress-bar.md): A circular progress indicator with an optional custom label.
|
|
150
155
|
- [Notification](docs/notification.md): Transient toast notifications with optional auto-dismiss.
|
|
151
156
|
- [Placeholder](docs/placeholder.md): Fills an empty area with a muted label or projected content.
|
|
@@ -155,8 +160,10 @@ Mona UI is an Angular component library styled with Tailwind CSS 4. Its componen
|
|
|
155
160
|
|
|
156
161
|
## API Reference
|
|
157
162
|
|
|
163
|
+
- [`@nanahoshi/mona-ui/alert`](docs/api/alert.md): 5 exports, in full.
|
|
158
164
|
- [`@nanahoshi/mona-ui/auto-complete`](docs/api/auto-complete.md): 2 exports, in full.
|
|
159
|
-
- [`@nanahoshi/mona-ui/avatar`](docs/api/avatar.md):
|
|
165
|
+
- [`@nanahoshi/mona-ui/avatar`](docs/api/avatar.md): 3 exports, in full.
|
|
166
|
+
- [`@nanahoshi/mona-ui/badge`](docs/api/badge.md): 1 export, in full.
|
|
160
167
|
- [`@nanahoshi/mona-ui/breadcrumb`](docs/api/breadcrumb.md): 5 exports, in full.
|
|
161
168
|
- [`@nanahoshi/mona-ui/button`](docs/api/button.md): 4 exports, in full.
|
|
162
169
|
- [`@nanahoshi/mona-ui/button-group`](docs/api/button-group.md): 3 exports, in full.
|
|
@@ -189,12 +196,13 @@ Mona UI is an Angular component library styled with Tailwind CSS 4. Its componen
|
|
|
189
196
|
- [`@nanahoshi/mona-ui/filter`](docs/api/filter.md): 7 exports, in full.
|
|
190
197
|
- [`@nanahoshi/mona-ui/form-field`](docs/api/form-field.md): 6 exports, in full.
|
|
191
198
|
- [`@nanahoshi/mona-ui/grid`](docs/api/grid.md): 87 exports, in full.
|
|
192
|
-
- [`@nanahoshi/mona-ui/i18n`](docs/api/i18n.md):
|
|
199
|
+
- [`@nanahoshi/mona-ui/i18n`](docs/api/i18n.md): 116 exports, in full.
|
|
193
200
|
- [`@nanahoshi/mona-ui/label`](docs/api/label.md): 4 exports, in full.
|
|
194
201
|
- [`@nanahoshi/mona-ui/list`](docs/api/list.md): 10 exports, in full.
|
|
195
202
|
- [`@nanahoshi/mona-ui/list-box`](docs/api/list-box.md): 16 exports, in full.
|
|
196
203
|
- [`@nanahoshi/mona-ui/list-view`](docs/api/list-view.md): 20 exports, in full.
|
|
197
204
|
- [`@nanahoshi/mona-ui/locales`](docs/api/locales.md): 16 exports, in full.
|
|
205
|
+
- [`@nanahoshi/mona-ui/masked-text-box`](docs/api/masked-text-box.md): 8 exports, in full.
|
|
198
206
|
- [`@nanahoshi/mona-ui/menubar`](docs/api/menubar.md): 15 exports, in full.
|
|
199
207
|
- [`@nanahoshi/mona-ui/multi-select`](docs/api/multi-select.md): 5 exports, in full.
|
|
200
208
|
- [`@nanahoshi/mona-ui/notification`](docs/api/notification.md): 12 exports, in full.
|
|
@@ -212,6 +220,7 @@ Mona UI is an Angular component library styled with Tailwind CSS 4. Its componen
|
|
|
212
220
|
- [`@nanahoshi/mona-ui/rating`](docs/api/rating.md): 10 exports, in full.
|
|
213
221
|
- [`@nanahoshi/mona-ui/scroll-view`](docs/api/scroll-view.md): 5 exports, in full.
|
|
214
222
|
- [`@nanahoshi/mona-ui/segmented`](docs/api/segmented.md): 5 exports, in full.
|
|
223
|
+
- [`@nanahoshi/mona-ui/separator`](docs/api/separator.md): 1 export, in full.
|
|
215
224
|
- [`@nanahoshi/mona-ui/sheet`](docs/api/sheet.md): 4 exports, in full.
|
|
216
225
|
- [`@nanahoshi/mona-ui/sidebar`](docs/api/sidebar.md): 36 exports, in full.
|
|
217
226
|
- [`@nanahoshi/mona-ui/skeleton`](docs/api/skeleton.md): 1 export, in full.
|
|
@@ -227,6 +236,7 @@ Mona UI is an Angular component library styled with Tailwind CSS 4. Its componen
|
|
|
227
236
|
- [`@nanahoshi/mona-ui/theme`](docs/api/theme.md): 53 exports, in full.
|
|
228
237
|
- [`@nanahoshi/mona-ui/time-picker`](docs/api/time-picker.md): 2 exports, in full.
|
|
229
238
|
- [`@nanahoshi/mona-ui/time-selector`](docs/api/time-selector.md): 2 exports, in full.
|
|
239
|
+
- [`@nanahoshi/mona-ui/toolbar`](docs/api/toolbar.md): 5 exports, in full.
|
|
230
240
|
- [`@nanahoshi/mona-ui/tooltip`](docs/api/tooltip.md): 7 exports, in full.
|
|
231
241
|
- [`@nanahoshi/mona-ui/tree-view`](docs/api/tree-view.md): 37 exports, in full.
|
|
232
242
|
- [`@nanahoshi/mona-ui/window`](docs/api/window.md): 14 exports, in full.
|