@nanahoshi/mona-ui 0.25.0 → 0.26.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 +2 -0
- package/command/package.json +4 -0
- package/docs/auto-complete.md +733 -0
- package/docs/avatar.md +220 -0
- package/docs/breadcrumb.md +320 -0
- package/docs/button-group.md +392 -0
- package/docs/button.md +256 -0
- package/docs/calendar.md +515 -0
- package/docs/card.md +292 -0
- package/docs/chart.md +4058 -0
- package/docs/checkbox.md +374 -0
- package/docs/chip.md +339 -0
- package/docs/circular-progress-bar.md +287 -0
- package/docs/collapsible.md +308 -0
- package/docs/color-gradient.md +336 -0
- package/docs/color-palette.md +317 -0
- package/docs/color-picker.md +387 -0
- package/docs/combo-box.md +764 -0
- package/docs/command.md +582 -0
- package/docs/contextmenu.md +530 -0
- package/docs/date-picker.md +251 -0
- package/docs/datetime-picker.md +284 -0
- package/docs/decimal-textbox.md +260 -0
- package/docs/dialog.md +822 -0
- package/docs/dropdown-button.md +507 -0
- package/docs/dropdown-list.md +779 -0
- package/docs/editor.md +374 -0
- package/docs/expansion-panel.md +348 -0
- package/docs/fieldset.md +217 -0
- package/docs/forms.md +162 -0
- package/docs/grid.md +2053 -0
- package/docs/input.md +197 -0
- package/docs/installation.md +54 -0
- package/docs/introduction.md +46 -0
- package/docs/label.md +340 -0
- package/docs/list-box.md +637 -0
- package/docs/list-view.md +584 -0
- package/docs/menubar.md +559 -0
- package/docs/multi-select.md +765 -0
- package/docs/notification.md +460 -0
- package/docs/numeric-textbox.md +301 -0
- package/docs/otp-input.md +539 -0
- package/docs/pager.md +513 -0
- package/docs/placeholder.md +176 -0
- package/docs/popover.md +423 -0
- package/docs/popup-menu.md +658 -0
- package/docs/popup.md +617 -0
- package/docs/progress-bar.md +368 -0
- package/docs/radio-button.md +451 -0
- package/docs/range-slider.md +367 -0
- package/docs/rating.md +518 -0
- package/docs/scroll-view.md +375 -0
- package/docs/segmented.md +434 -0
- package/docs/sheet.md +348 -0
- package/docs/sidebar.md +1126 -0
- package/docs/skeleton.md +181 -0
- package/docs/slider.md +423 -0
- package/docs/spinner.md +370 -0
- package/docs/split-button.md +522 -0
- package/docs/splitter.md +342 -0
- package/docs/stepper.md +539 -0
- package/docs/switch.md +340 -0
- package/docs/tabs.md +542 -0
- package/docs/textarea.md +196 -0
- package/docs/textbox.md +332 -0
- package/docs/theming.md +403 -0
- package/docs/time-picker.md +254 -0
- package/docs/tooltip-directive.md +340 -0
- package/docs/tooltip.md +321 -0
- package/docs/tree-view.md +1018 -0
- package/docs/window.md +663 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-button.mjs +14 -2
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +108 -22
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
- package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +7 -3
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +8 -3
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +10 -7
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +53 -21
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
- package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
- package/i18n/catalogs/en-US.messages.json +10 -0
- package/internal/popup-menu/package.json +4 -0
- package/llms.txt +123 -0
- package/locales/ar-sa/ar-sa.messages.json +10 -0
- package/locales/de-de/de-de.messages.json +10 -0
- package/locales/es-es/es-es.messages.json +10 -0
- package/locales/fr-fr/fr-fr.messages.json +10 -0
- package/locales/id-id/id-id.messages.json +10 -0
- package/locales/it-it/it-it.messages.json +10 -0
- package/locales/ja-jp/ja-jp.messages.json +10 -0
- package/locales/ko-kr/ko-kr.messages.json +10 -0
- package/locales/pt-br/pt-br.messages.json +10 -0
- package/locales/ru-ru/ru-ru.messages.json +10 -0
- package/locales/tr-tr/tr-tr.messages.json +10 -0
- package/locales/zh-cn/zh-cn.messages.json +10 -0
- package/locales/zh-tw/zh-tw.messages.json +10 -0
- package/package.json +9 -1
- package/styles.css +12 -2
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
- package/types/nanahoshi-mona-ui-button.d.ts +12 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
- package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-command.d.ts +253 -0
- package/types/nanahoshi-mona-ui-common.d.ts +17 -1
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
- package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
- package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
- package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
- package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
- package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
- package/types/nanahoshi-mona-ui-label.d.ts +1 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
- package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
- package/types/nanahoshi-mona-ui-list.d.ts +1 -1
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
- package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
- package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
- package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
- package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
- package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
- package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
- package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
- package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
- package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
- package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
- package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
- package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
- package/types/nanahoshi-mona-ui-window.d.ts +66 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { isSignal, inject, DestroyRef, DOCUMENT, ElementRef, computed, signal, afterNextRender, effect, untracked, Component, contentChild, contentChildren, input, output, model, forwardRef, TemplateRef, Directive } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { PreventableEvent, classInputToClass } from '@nanahoshi/mona-ui/common';
|
|
5
5
|
import { createElementControlId, themeOverlaySurfaceClasses, isNavigationKey, isTypeaheadKey, setupTypeahead, rxTimeout, toCssValue } from '@nanahoshi/mona-ui/internal';
|
|
6
6
|
import { PopupDataInjectionToken, PopupService } from '@nanahoshi/mona-ui/popup';
|
|
7
|
-
import {
|
|
7
|
+
import { select, selectMany, any } from '@mirei/ts-collections';
|
|
8
8
|
import { Subject, take, fromEvent, tap, takeUntil, filter } from 'rxjs';
|
|
9
|
+
import { PopupMenuItemClickEvent, PopupMenuGroupTemplateToken, PopupMenuIconTemplateToken, PopupMenuToken, PopupMenuShortcutTemplateToken, PopupMenuTextTemplateToken, preparePopupMenuItems, PopupMenuOrigin, PopupMenuItemType, PopupMenuRadioItemToken, PopupMenuTemplateOrigin, PopupMenuTemplateType } from '@nanahoshi/mona-ui/internal/popup-menu';
|
|
10
|
+
export { PopupMenuItemClickEvent } from '@nanahoshi/mona-ui/internal/popup-menu';
|
|
9
11
|
import { NgTemplateOutlet } from '@angular/common';
|
|
10
12
|
import { LucideChevronRight, LucideCheck } from '@lucide/angular';
|
|
11
13
|
import { injectComponentDirection } from '@nanahoshi/mona-ui/i18n';
|
|
@@ -18,111 +20,6 @@ class PopupMenuCloseEvent extends PreventableEvent {
|
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
/* eslint-disable @typescript-eslint/naming-convention -- exported token names; renaming them would break consumers. */
|
|
22
|
-
const PopupMenuToken = new InjectionToken("MONA_POPUP_MENU");
|
|
23
|
-
const PopupMenuRadioItemToken = new InjectionToken("MONA_POPUP_MENU_RADIO_ITEM");
|
|
24
|
-
const PopupMenuGroupTemplateToken = new InjectionToken("MONA_POPUP_MENU_GROUP_TEMPLATE");
|
|
25
|
-
const PopupMenuIconTemplateToken = new InjectionToken("MONA_POPUP_MENU_ICON_TEMPLATE");
|
|
26
|
-
const PopupMenuShortcutTemplateToken = new InjectionToken("MONA_POPUP_MENU_SHORTCUT_TEMPLATE");
|
|
27
|
-
const PopupMenuTextTemplateToken = new InjectionToken("MONA_POPUP_MENU_TEXT_TEMPLATE");
|
|
28
|
-
var PopupMenuOrigin;
|
|
29
|
-
(function (PopupMenuOrigin) {
|
|
30
|
-
PopupMenuOrigin[PopupMenuOrigin["Popup"] = 1] = "Popup";
|
|
31
|
-
PopupMenuOrigin[PopupMenuOrigin["ContextMenu"] = 2] = "ContextMenu";
|
|
32
|
-
PopupMenuOrigin[PopupMenuOrigin["DropdownButton"] = 3] = "DropdownButton";
|
|
33
|
-
PopupMenuOrigin[PopupMenuOrigin["SplitButton"] = 4] = "SplitButton";
|
|
34
|
-
PopupMenuOrigin[PopupMenuOrigin["MenubarMenu"] = 5] = "MenubarMenu";
|
|
35
|
-
})(PopupMenuOrigin || (PopupMenuOrigin = {}));
|
|
36
|
-
var PopupMenuItemType;
|
|
37
|
-
(function (PopupMenuItemType) {
|
|
38
|
-
PopupMenuItemType[PopupMenuItemType["CheckboxMenuItem"] = 1] = "CheckboxMenuItem";
|
|
39
|
-
PopupMenuItemType[PopupMenuItemType["MenuItem"] = 2] = "MenuItem";
|
|
40
|
-
PopupMenuItemType[PopupMenuItemType["MenuGroup"] = 3] = "MenuGroup";
|
|
41
|
-
PopupMenuItemType[PopupMenuItemType["RadioGroup"] = 4] = "RadioGroup";
|
|
42
|
-
PopupMenuItemType[PopupMenuItemType["RadioItem"] = 5] = "RadioItem";
|
|
43
|
-
PopupMenuItemType[PopupMenuItemType["Separator"] = 6] = "Separator";
|
|
44
|
-
})(PopupMenuItemType || (PopupMenuItemType = {}));
|
|
45
|
-
var PopupMenuTemplateOrigin;
|
|
46
|
-
(function (PopupMenuTemplateOrigin) {
|
|
47
|
-
PopupMenuTemplateOrigin[PopupMenuTemplateOrigin["Popup"] = 1] = "Popup";
|
|
48
|
-
PopupMenuTemplateOrigin[PopupMenuTemplateOrigin["ContextMenu"] = 2] = "ContextMenu";
|
|
49
|
-
PopupMenuTemplateOrigin[PopupMenuTemplateOrigin["DropdownButton"] = 3] = "DropdownButton";
|
|
50
|
-
PopupMenuTemplateOrigin[PopupMenuTemplateOrigin["SplitButton"] = 4] = "SplitButton";
|
|
51
|
-
PopupMenuTemplateOrigin[PopupMenuTemplateOrigin["MenubarMenu"] = 5] = "MenubarMenu";
|
|
52
|
-
})(PopupMenuTemplateOrigin || (PopupMenuTemplateOrigin = {}));
|
|
53
|
-
var PopupMenuTemplateType;
|
|
54
|
-
(function (PopupMenuTemplateType) {
|
|
55
|
-
PopupMenuTemplateType[PopupMenuTemplateType["Group"] = 1] = "Group";
|
|
56
|
-
PopupMenuTemplateType[PopupMenuTemplateType["Icon"] = 2] = "Icon";
|
|
57
|
-
PopupMenuTemplateType[PopupMenuTemplateType["Shortcut"] = 3] = "Shortcut";
|
|
58
|
-
PopupMenuTemplateType[PopupMenuTemplateType["Text"] = 4] = "Text";
|
|
59
|
-
})(PopupMenuTemplateType || (PopupMenuTemplateType = {}));
|
|
60
|
-
|
|
61
|
-
const itemTypeMap = {
|
|
62
|
-
[PopupMenuItemType.CheckboxMenuItem]: "checkbox",
|
|
63
|
-
[PopupMenuItemType.MenuGroup]: "group",
|
|
64
|
-
[PopupMenuItemType.MenuItem]: "item",
|
|
65
|
-
[PopupMenuItemType.RadioGroup]: "radio-group",
|
|
66
|
-
[PopupMenuItemType.RadioItem]: "radio",
|
|
67
|
-
[PopupMenuItemType.Separator]: "separator"
|
|
68
|
-
};
|
|
69
|
-
const templateItemTypeMap = {
|
|
70
|
-
[PopupMenuTemplateType.Group]: "group",
|
|
71
|
-
[PopupMenuTemplateType.Icon]: "icon",
|
|
72
|
-
[PopupMenuTemplateType.Shortcut]: "shortcut",
|
|
73
|
-
[PopupMenuTemplateType.Text]: "text"
|
|
74
|
-
};
|
|
75
|
-
const ensurePopupComponentTypes = (params) => {
|
|
76
|
-
forEach(params.components, item => {
|
|
77
|
-
if (item.origin !== params.origin) {
|
|
78
|
-
const type = item.type;
|
|
79
|
-
const expectedItemType = itemTypeMap[type];
|
|
80
|
-
const expectedComponentType = params.componentTypeMap[type];
|
|
81
|
-
throw new Error(`${params.prefix}: The ${expectedItemType} must be defined with ${expectedComponentType}.`);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
const ensurePopupTemplateTypes = (params) => {
|
|
86
|
-
forEach(params.templates, item => {
|
|
87
|
-
if (item.origin !== params.origin) {
|
|
88
|
-
const type = item.type;
|
|
89
|
-
const expectedTemplateType = params.templateTypeMap[type];
|
|
90
|
-
throw new Error(`${params.prefix}: The ${templateItemTypeMap[type]} template must be defined with ${expectedTemplateType}.`);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
// One id per `MenuItem` object, so a menu rebuilt from the same objects keeps track of its items.
|
|
95
|
-
const menuItemUids = new WeakMap();
|
|
96
|
-
const menuItemUid = (item) => {
|
|
97
|
-
let uid = menuItemUids.get(item);
|
|
98
|
-
if (!uid) {
|
|
99
|
-
uid = createElementControlId();
|
|
100
|
-
menuItemUids.set(item, uid);
|
|
101
|
-
}
|
|
102
|
-
return uid;
|
|
103
|
-
};
|
|
104
|
-
const preparePopupMenuItems = (items) => {
|
|
105
|
-
return select(items, item => {
|
|
106
|
-
const popupItem = {
|
|
107
|
-
checkable: item.checkable ?? false,
|
|
108
|
-
checked: signal(item.checked ?? false),
|
|
109
|
-
click$: new Subject(),
|
|
110
|
-
disabled: item.disabled ?? false,
|
|
111
|
-
// An ungrouped item gets a key of its own, so it never joins another item's group.
|
|
112
|
-
group: item.group ?? Symbol(),
|
|
113
|
-
groupTemplate: null,
|
|
114
|
-
iconTemplate: null,
|
|
115
|
-
items: preparePopupMenuItems(item.items ?? []),
|
|
116
|
-
label: item.label ?? "",
|
|
117
|
-
separator: item.separator ?? false,
|
|
118
|
-
shortcutTemplate: null,
|
|
119
|
-
textTemplate: null,
|
|
120
|
-
uid: menuItemUid(item),
|
|
121
|
-
value: signal(item.value)
|
|
122
|
-
};
|
|
123
|
-
return popupItem;
|
|
124
|
-
}).toArray();
|
|
125
|
-
};
|
|
126
23
|
const convertToMenuItem = (item) => {
|
|
127
24
|
return {
|
|
128
25
|
checkable: item.checkable,
|
|
@@ -163,47 +60,6 @@ const isMenuOwnedCheckState = (item) => {
|
|
|
163
60
|
return item.checkable === true && isSignal(item.checked) && "set" in item.checked;
|
|
164
61
|
};
|
|
165
62
|
|
|
166
|
-
/**
|
|
167
|
-
* Emitted when a menu item is activated by a click, Enter or Space. Preventing it keeps the menu open and leaves a
|
|
168
|
-
* checkbox or radio item's state unchanged.
|
|
169
|
-
*/
|
|
170
|
-
class PopupMenuItemClickEvent extends PreventableEvent {
|
|
171
|
-
#checked;
|
|
172
|
-
#item;
|
|
173
|
-
constructor(item, originalEvent) {
|
|
174
|
-
super("popupMenuItemClick", originalEvent);
|
|
175
|
-
this.#item = item;
|
|
176
|
-
if (item.checkable) {
|
|
177
|
-
this.#checked = !(item.checked?.() ?? false);
|
|
178
|
-
}
|
|
179
|
-
else if (item.radio) {
|
|
180
|
-
this.#checked = true;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* For a checkbox or radio item, the state the item has once the click is applied (if it isn't prevented).
|
|
185
|
-
* `undefined` for other items.
|
|
186
|
-
*/
|
|
187
|
-
get checked() {
|
|
188
|
-
return this.#checked;
|
|
189
|
-
}
|
|
190
|
-
get item() {
|
|
191
|
-
return this.#item;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* The item's label.
|
|
195
|
-
*/
|
|
196
|
-
get label() {
|
|
197
|
-
return this.#item.label;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* The item's `value`: the `value` input of the item component, or the `value` of a `MenuItem`.
|
|
201
|
-
*/
|
|
202
|
-
get value() {
|
|
203
|
-
return this.#item.value?.();
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
63
|
const popupMenuBaseThemeVariants = cva(`h-full w-full overflow-hidden`, {
|
|
208
64
|
variants: {
|
|
209
65
|
rounded: {
|
|
@@ -853,28 +709,26 @@ class PopupMenuComponent {
|
|
|
853
709
|
}, /* @ts-ignore */
|
|
854
710
|
...(ngDevMode ? [{ debugName: "menuItems" }] : /* istanbul ignore next */ []));
|
|
855
711
|
/**
|
|
856
|
-
* @description The
|
|
857
|
-
*
|
|
712
|
+
* @description The element to position the menu against, when it isn't the `target`.
|
|
713
|
+
* Ignored when `openAtPointer` is set.
|
|
858
714
|
*/
|
|
859
715
|
this.anchor = input(/* @ts-ignore */
|
|
860
716
|
...(ngDevMode ? [undefined, { debugName: "anchor" }] : /* istanbul ignore next */ []));
|
|
861
717
|
/**
|
|
862
|
-
* @description The
|
|
863
|
-
*
|
|
718
|
+
* @description The point on the anchor that the menu attaches to.
|
|
719
|
+
* Ignored when `openAtPointer` is set.
|
|
864
720
|
*/
|
|
865
721
|
this.anchorConnectionPoint = input(/* @ts-ignore */
|
|
866
722
|
...(ngDevMode ? [undefined, { debugName: "anchorConnectionPoint" }] : /* istanbul ignore next */ []));
|
|
867
723
|
/**
|
|
868
|
-
* @description The accessible name of the root menu. Takes precedence over `
|
|
724
|
+
* @description The accessible name of the root menu. Takes precedence over `aria-labelledby`.
|
|
869
725
|
*/
|
|
870
|
-
this.ariaLabel = input("", /*
|
|
871
|
-
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
726
|
+
this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
872
727
|
/**
|
|
873
|
-
* @description The ids of the elements that name the root menu. When neither this nor `
|
|
728
|
+
* @description The ids of the elements that name the root menu. When neither this nor `aria-label` is set, the
|
|
874
729
|
* menu is named by the target element if it has an id.
|
|
875
730
|
*/
|
|
876
|
-
this.ariaLabelledBy = input("", /*
|
|
877
|
-
...(ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []));
|
|
731
|
+
this.ariaLabelledBy = input("", { ...(ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {}), alias: "aria-labelledby" });
|
|
878
732
|
/**
|
|
879
733
|
* @description The event that is emitted when the popup menu is closed.
|
|
880
734
|
*/
|
|
@@ -901,12 +755,11 @@ class PopupMenuComponent {
|
|
|
901
755
|
this.minWidth = input(/* @ts-ignore */
|
|
902
756
|
...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
|
|
903
757
|
/**
|
|
904
|
-
* @description
|
|
905
|
-
* This is used to handle keyboard navigation within the popup menu.
|
|
758
|
+
* @description Emitted when an arrow key moves through the menu, or tries to leave it.
|
|
906
759
|
*/
|
|
907
760
|
this.navigate = output();
|
|
908
761
|
/**
|
|
909
|
-
* @description The
|
|
762
|
+
* @description The distance between the menu and its anchor.
|
|
910
763
|
*/
|
|
911
764
|
this.offset = input(/* @ts-ignore */
|
|
912
765
|
...(ngDevMode ? [undefined, { debugName: "offset" }] : /* istanbul ignore next */ []));
|
|
@@ -915,18 +768,17 @@ class PopupMenuComponent {
|
|
|
915
768
|
*/
|
|
916
769
|
this.open = output();
|
|
917
770
|
/**
|
|
918
|
-
* @description
|
|
919
|
-
*
|
|
771
|
+
* @description Opens the menu where the pointer is, instead of against the `anchor` or `target`. Opened from the
|
|
772
|
+
* keyboard, it opens at the center of the target.
|
|
920
773
|
*/
|
|
921
|
-
this.
|
|
922
|
-
...(ngDevMode ? [
|
|
774
|
+
this.openAtPointer = input(false, /* @ts-ignore */
|
|
775
|
+
...(ngDevMode ? [{ debugName: "openAtPointer" }] : /* istanbul ignore next */ []));
|
|
923
776
|
/**
|
|
924
|
-
* @description
|
|
925
|
-
*
|
|
926
|
-
* If false, it will be positioned at the target element. If an anchor is provided, it will be anchored to that element.
|
|
777
|
+
* @description The point on the menu that attaches to the anchor.
|
|
778
|
+
* Ignored when `openAtPointer` is set.
|
|
927
779
|
*/
|
|
928
|
-
this.
|
|
929
|
-
...(ngDevMode ? [{ debugName: "
|
|
780
|
+
this.popupConnectionPoint = input(/* @ts-ignore */
|
|
781
|
+
...(ngDevMode ? [undefined, { debugName: "popupConnectionPoint" }] : /* istanbul ignore next */ []));
|
|
930
782
|
/**
|
|
931
783
|
* @description Sets the border radius of the popup menu.
|
|
932
784
|
* This will be applied to the root menu and all submenus.
|
|
@@ -940,15 +792,19 @@ class PopupMenuComponent {
|
|
|
940
792
|
this.size = input("medium", /* @ts-ignore */
|
|
941
793
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
942
794
|
/**
|
|
943
|
-
* @description The
|
|
795
|
+
* @description The element that opens the menu. The menu is positioned against it unless `anchor` is set.
|
|
944
796
|
*/
|
|
945
797
|
this.target = input.required(/* @ts-ignore */
|
|
946
798
|
...(ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []));
|
|
947
799
|
/**
|
|
948
|
-
* @description
|
|
800
|
+
* @description What opens the menu: a click on the target, a right-click on it, or `"none"` to open it only
|
|
801
|
+
* through `openMenu()`.
|
|
949
802
|
*/
|
|
950
803
|
this.trigger = input("click", /* @ts-ignore */
|
|
951
804
|
...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
805
|
+
/**
|
|
806
|
+
* @description Extra classes for the menu's popup.
|
|
807
|
+
*/
|
|
952
808
|
this.userClass = input(undefined, { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class",
|
|
953
809
|
transform: value => classInputToClass(value) });
|
|
954
810
|
/**
|
|
@@ -994,14 +850,18 @@ class PopupMenuComponent {
|
|
|
994
850
|
closeMenu() {
|
|
995
851
|
this.#open?.ref?.close();
|
|
996
852
|
}
|
|
997
|
-
|
|
853
|
+
/**
|
|
854
|
+
* @description Opens the menu, as if the target had been clicked.
|
|
855
|
+
* @param viaContextMenuKey Whether the menu opens from the ContextMenu key or Shift+F10.
|
|
856
|
+
*/
|
|
857
|
+
openMenu(viaContextMenuKey = false) {
|
|
998
858
|
const targetElement = this.#element(this.target());
|
|
999
859
|
if (!targetElement) {
|
|
1000
860
|
return;
|
|
1001
861
|
}
|
|
1002
862
|
const center = targetElement.getBoundingClientRect();
|
|
1003
863
|
// Create a fake event to pass the center of the target element as the mouse position.
|
|
1004
|
-
// This is useful when
|
|
864
|
+
// This is useful when openAtPointer is true, but we want to open the menu via keyboard
|
|
1005
865
|
// or some other non-mouse event.
|
|
1006
866
|
if (viaContextMenuKey) {
|
|
1007
867
|
const contextMenuEvent = new MouseEvent("contextmenu", {
|
|
@@ -1075,7 +935,7 @@ class PopupMenuComponent {
|
|
|
1075
935
|
}
|
|
1076
936
|
createMenu(event, state) {
|
|
1077
937
|
const anchor = this.getPopupAnchor(event);
|
|
1078
|
-
const anchorConnectionPoint = this.
|
|
938
|
+
const anchorConnectionPoint = this.openAtPointer() ? undefined : this.anchorConnectionPoint();
|
|
1079
939
|
const targetId = this.#element(this.target())?.id ?? "";
|
|
1080
940
|
const data = {
|
|
1081
941
|
ariaLabel: this.ariaLabel(),
|
|
@@ -1107,7 +967,7 @@ class PopupMenuComponent {
|
|
|
1107
967
|
minWidth: toCssValue(this.minWidth()),
|
|
1108
968
|
offset: this.offset(),
|
|
1109
969
|
popupClass: this.userClass(),
|
|
1110
|
-
popupConnectionPoint: this.
|
|
970
|
+
popupConnectionPoint: this.openAtPointer() ? undefined : this.popupConnectionPoint(),
|
|
1111
971
|
restoreFocus: false,
|
|
1112
972
|
width: toCssValue(this.width())
|
|
1113
973
|
});
|
|
@@ -1116,10 +976,10 @@ class PopupMenuComponent {
|
|
|
1116
976
|
const anchorElement = this.anchor();
|
|
1117
977
|
const targetElement = this.target();
|
|
1118
978
|
const targetInput = anchorElement ?? targetElement;
|
|
1119
|
-
const
|
|
979
|
+
const atPointer = this.openAtPointer();
|
|
1120
980
|
const actualTargetElement = targetInput instanceof ElementRef ? targetInput.nativeElement : targetInput;
|
|
1121
981
|
let anchor;
|
|
1122
|
-
if (
|
|
982
|
+
if (atPointer) {
|
|
1123
983
|
if (event.button < 0) {
|
|
1124
984
|
const rect = actualTargetElement.getBoundingClientRect();
|
|
1125
985
|
anchor = { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
|
|
@@ -1230,7 +1090,7 @@ class PopupMenuComponent {
|
|
|
1230
1090
|
}
|
|
1231
1091
|
const open = this.#open;
|
|
1232
1092
|
if (open) {
|
|
1233
|
-
if (trigger !== "contextmenu" && !this.
|
|
1093
|
+
if (trigger !== "contextmenu" && !this.openAtPointer()) {
|
|
1234
1094
|
// The trigger toggles the menu.
|
|
1235
1095
|
open.ref?.close();
|
|
1236
1096
|
return;
|
|
@@ -1247,13 +1107,18 @@ class PopupMenuComponent {
|
|
|
1247
1107
|
});
|
|
1248
1108
|
}
|
|
1249
1109
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1250
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: PopupMenuComponent, isStandalone: true, selector: "mona-popup-menu", inputs: { anchor: { classPropertyName: "anchor", publicName: "anchor", isSignal: true, isRequired: false, transformFunction: null }, anchorConnectionPoint: { classPropertyName: "anchorConnectionPoint", publicName: "anchorConnectionPoint", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "
|
|
1110
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: PopupMenuComponent, isStandalone: true, selector: "mona-popup-menu", inputs: { anchor: { classPropertyName: "anchor", publicName: "anchor", isSignal: true, isRequired: false, transformFunction: null }, anchorConnectionPoint: { classPropertyName: "anchorConnectionPoint", publicName: "anchorConnectionPoint", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, menuId: { classPropertyName: "menuId", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, openAtPointer: { classPropertyName: "openAtPointer", publicName: "openAtPointer", isSignal: true, isRequired: false, transformFunction: null }, popupConnectionPoint: { classPropertyName: "popupConnectionPoint", publicName: "popupConnectionPoint", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: true, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", menuClick: "menuClick", navigate: "navigate", open: "open" }, host: { properties: { "attr.aria-label": "null", "attr.aria-labelledby": "null" } }, queries: [{ propertyName: "groupTemplateConfig", first: true, predicate: PopupMenuGroupTemplateToken, isSignal: true }, { propertyName: "iconTemplateConfig", first: true, predicate: PopupMenuIconTemplateToken, isSignal: true }, { propertyName: "nestedComponents", predicate: PopupMenuToken, isSignal: true }, { propertyName: "shortcutTemplateConfig", first: true, predicate: PopupMenuShortcutTemplateToken, isSignal: true }, { propertyName: "textTemplateConfig", first: true, predicate: PopupMenuTextTemplateToken, isSignal: true }], ngImport: i0, template: "", isInline: true }); }
|
|
1251
1111
|
}
|
|
1252
1112
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopupMenuComponent, decorators: [{
|
|
1253
1113
|
type: Component,
|
|
1254
1114
|
args: [{
|
|
1255
1115
|
selector: "mona-popup-menu",
|
|
1256
|
-
template: ""
|
|
1116
|
+
template: "",
|
|
1117
|
+
host: {
|
|
1118
|
+
// The name goes to the menu when it opens. The host has no role, which may not carry one.
|
|
1119
|
+
"[attr.aria-label]": "null",
|
|
1120
|
+
"[attr.aria-labelledby]": "null"
|
|
1121
|
+
}
|
|
1257
1122
|
}]
|
|
1258
1123
|
}], ctorParameters: () => [], propDecorators: { groupTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuGroupTemplateToken), { ...{
|
|
1259
1124
|
descendants: false
|
|
@@ -1263,7 +1128,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
1263
1128
|
descendants: false
|
|
1264
1129
|
}, isSignal: true }] }], textTemplateConfig: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PopupMenuTextTemplateToken), { ...{
|
|
1265
1130
|
descendants: false
|
|
1266
|
-
}, isSignal: true }] }], anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchor", required: false }] }], anchorConnectionPoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchorConnectionPoint", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "
|
|
1131
|
+
}, isSignal: true }] }], anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchor", required: false }] }], anchorConnectionPoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchorConnectionPoint", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], menuClick: [{ type: i0.Output, args: ["menuClick"] }], menuId: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], navigate: [{ type: i0.Output, args: ["navigate"] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], open: [{ type: i0.Output, args: ["open"] }], openAtPointer: [{ type: i0.Input, args: [{ isSignal: true, alias: "openAtPointer", required: false }] }], popupConnectionPoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupConnectionPoint", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: true }] }], trigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "trigger", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
|
|
1267
1132
|
|
|
1268
1133
|
class PopupMenuCheckboxItemComponent {
|
|
1269
1134
|
constructor() {
|
|
@@ -1849,5 +1714,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
1849
1714
|
* Generated bundle index. Do not edit.
|
|
1850
1715
|
*/
|
|
1851
1716
|
|
|
1852
|
-
export { PopupMenuCheckboxItemComponent, PopupMenuCloseEvent, PopupMenuComponent, PopupMenuGroupComponent, PopupMenuGroupTemplateDirective,
|
|
1717
|
+
export { PopupMenuCheckboxItemComponent, PopupMenuCloseEvent, PopupMenuComponent, PopupMenuGroupComponent, PopupMenuGroupTemplateDirective, PopupMenuIconTemplateDirective, PopupMenuItemComponent, PopupMenuRadioGroupComponent, PopupMenuRadioItemComponent, PopupMenuSeparatorComponent, PopupMenuShortcutTemplateDirective, PopupMenuTextTemplateDirective };
|
|
1853
1718
|
//# sourceMappingURL=nanahoshi-mona-ui-popup-menu.mjs.map
|
|
@@ -17,9 +17,11 @@ class PopupCloseEvent extends PreventableEvent {
|
|
|
17
17
|
super(options?.type ?? "popupClose", options?.originalEvent);
|
|
18
18
|
this.#options = options;
|
|
19
19
|
}
|
|
20
|
+
/** The result value passed to `close()`, if any. */
|
|
20
21
|
get result() {
|
|
21
22
|
return this.#options?.result;
|
|
22
23
|
}
|
|
24
|
+
/** The source of the close. */
|
|
23
25
|
get via() {
|
|
24
26
|
return this.#options?.via;
|
|
25
27
|
}
|
|
@@ -28,12 +30,19 @@ var PopupCloseSource;
|
|
|
28
30
|
(function (PopupCloseSource) {
|
|
29
31
|
/** A dialog action button, such as OK or Cancel. */
|
|
30
32
|
PopupCloseSource["Action"] = "action";
|
|
33
|
+
/** A click on the backdrop, when `closeOnBackdropClick` allows it. */
|
|
31
34
|
PopupCloseSource["BackdropClick"] = "backdropClick";
|
|
35
|
+
/** The close button of a dialog, window or sheet. */
|
|
32
36
|
PopupCloseSource["CloseButton"] = "closeButton";
|
|
37
|
+
/** The Escape key. */
|
|
33
38
|
PopupCloseSource["Escape"] = "escape";
|
|
39
|
+
/** The pointer leaving the anchor, when `closeOnMouseLeave` is set. */
|
|
34
40
|
PopupCloseSource["MouseLeave"] = "mouseLeave";
|
|
41
|
+
/** A `close()` call from code, with no user interaction behind it. */
|
|
35
42
|
PopupCloseSource["Programmatic"] = "programmatic";
|
|
43
|
+
/** A pointer press outside the popup and its anchor. */
|
|
36
44
|
PopupCloseSource["OutsideClick"] = "outsideClick";
|
|
45
|
+
/** The anchor scrolling away, when `closeOnScroll` is set. */
|
|
37
46
|
PopupCloseSource["Scroll"] = "scroll";
|
|
38
47
|
})(PopupCloseSource || (PopupCloseSource = {}));
|
|
39
48
|
|
|
@@ -227,6 +236,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
227
236
|
}, template: "@if (visible()) {\n <div\n #animationElement\n class=\"w-full h-full origin-center\"\n [animate.enter]=\"enterAnimationClasses()\"\n [animate.leave]=\"leaveAnimationClasses()\"\n (animationend)=\"onNativeLeaveComplete($event)\"\n (transitionend)=\"onNativeLeaveComplete($event)\">\n @if (templateRef()) {\n <ng-container [ngTemplateOutlet]=\"templateRef()\"></ng-container>\n }\n <ng-container #componentOutlet></ng-container>\n </div>\n}\n", styles: [":host{display:block}:host(.mona-popup-constrain-height){min-height:0;max-height:inherit;overflow:clip}:host(.mona-popup-constrain-height)>div{display:flex;min-height:0;max-height:inherit;overflow:clip}.mona-popup-enter{animation:mona-popup-scale-in .15s cubic-bezier(.4,0,.2,1)}.mona-popup-leave{animation:mona-popup-scale-out .15s cubic-bezier(.4,0,.2,1)}.mona-dropdown-popup-enter{animation:mona-dropdown-popup-scale-in .15s cubic-bezier(.4,0,.2,1);transform-origin:top center}.mona-dropdown-popup-leave{animation:mona-dropdown-popup-scale-out .15s cubic-bezier(.4,0,.2,1);transform-origin:top center}.mona-popup-fade-enter{animation:mona-popup-fade-in 50ms ease-in}.mona-popup-fade-leave{animation:mona-popup-fade-out .15s ease-out}.mona-popup-slide-from-right-enter,.mona-popup-slide-from-left-enter,.mona-popup-slide-from-top-enter,.mona-popup-slide-from-bottom-enter,.mona-popup-slide-to-right-leave,.mona-popup-slide-to-left-leave,.mona-popup-slide-to-top-leave,.mona-popup-slide-to-bottom-leave{animation-fill-mode:both;backface-visibility:hidden;will-change:transform}.mona-popup-slide-from-right-enter,.mona-popup-slide-from-left-enter,.mona-popup-slide-from-top-enter,.mona-popup-slide-from-bottom-enter{animation-duration:.32s;animation-timing-function:cubic-bezier(.25,.46,.45,.94)}.mona-popup-slide-to-right-leave,.mona-popup-slide-to-left-leave,.mona-popup-slide-to-top-leave,.mona-popup-slide-to-bottom-leave{animation-duration:.24s;animation-timing-function:cubic-bezier(.4,0,1,1)}.mona-popup-slide-from-right-enter{animation-name:mona-popup-slide-from-right}.mona-popup-slide-to-right-leave{animation-name:mona-popup-slide-to-right}.mona-popup-slide-from-left-enter{animation-name:mona-popup-slide-from-left}.mona-popup-slide-to-left-leave{animation-name:mona-popup-slide-to-left}.mona-popup-slide-from-top-enter{animation-name:mona-popup-slide-from-top}.mona-popup-slide-to-top-leave{animation-name:mona-popup-slide-to-top}.mona-popup-slide-from-bottom-enter{animation-name:mona-popup-slide-from-bottom}.mona-popup-slide-to-bottom-leave{animation-name:mona-popup-slide-to-bottom}@keyframes mona-popup-scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes mona-popup-scale-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}@keyframes mona-dropdown-popup-scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes mona-dropdown-popup-scale-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)}}@keyframes mona-popup-fade-in{0%{opacity:0}to{opacity:1}}@keyframes mona-popup-fade-out{0%{opacity:1}to{opacity:0}}@keyframes mona-popup-slide-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes mona-popup-slide-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}@keyframes mona-popup-slide-from-left{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes mona-popup-slide-to-left{0%{transform:translate(0)}to{transform:translate(-100%)}}@keyframes mona-popup-slide-from-top{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes mona-popup-slide-to-top{0%{transform:translateY(0)}to{transform:translateY(-100%)}}@keyframes mona-popup-slide-from-bottom{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes mona-popup-slide-to-bottom{0%{transform:translateY(0)}to{transform:translateY(100%)}}@media(prefers-reduced-motion:reduce){.mona-popup-enter,.mona-popup-leave,.mona-dropdown-popup-enter,.mona-dropdown-popup-leave,.mona-popup-fade-enter,.mona-popup-fade-leave,.mona-popup-slide-from-right-enter,.mona-popup-slide-to-right-leave,.mona-popup-slide-from-left-enter,.mona-popup-slide-to-left-leave,.mona-popup-slide-from-top-enter,.mona-popup-slide-to-top-leave,.mona-popup-slide-from-bottom-enter,.mona-popup-slide-to-bottom-leave{animation-duration:1ms}}\n"] }]
|
|
228
237
|
}], ctorParameters: () => [], propDecorators: { animationElement: [{ type: i0.ViewChild, args: ["animationElement", { isSignal: true }] }], componentOutlet: [{ type: i0.ViewChild, args: ["componentOutlet", { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
229
238
|
|
|
239
|
+
/** Returned by `PopupService.create()` and emitted via `PopupComponent`'s `open` output. */
|
|
230
240
|
class PopupRef {
|
|
231
241
|
#options;
|
|
232
242
|
constructor(options) {
|
|
@@ -581,6 +591,11 @@ class PopupService {
|
|
|
581
591
|
#scrollDispatcher = inject(ScrollDispatcher);
|
|
582
592
|
#escapeSubscription = null;
|
|
583
593
|
#escapeTarget = null;
|
|
594
|
+
/**
|
|
595
|
+
* Opens a popup and returns its `PopupRef`. If `settings.anchor` is a CSS selector string, creates a
|
|
596
|
+
* hover-triggered popup for every matching element (see Multi-element popups); otherwise creates a single popup
|
|
597
|
+
* attached to the given element, `ElementRef`, or point.
|
|
598
|
+
*/
|
|
584
599
|
create(settings) {
|
|
585
600
|
if (typeof settings.anchor === "string") {
|
|
586
601
|
return this.createMultiElementPopup(settings);
|
|
@@ -1332,6 +1347,7 @@ class PopupComponent {
|
|
|
1332
1347
|
this.withScrollTracking = input(true, { ...(ngDevMode ? { debugName: "withScrollTracking" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1333
1348
|
effect(() => this.setupEventListeners());
|
|
1334
1349
|
}
|
|
1350
|
+
/** Closes the popup if one is currently open. */
|
|
1335
1351
|
closePopup() {
|
|
1336
1352
|
this.popupRef?.close();
|
|
1337
1353
|
}
|
|
@@ -6,6 +6,10 @@ import { injectComponentDirection, MonaI18nService, formatNumber } from '@nanaho
|
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Structural template directive that replaces the default percentage label. The template is hidden when `indeterminate`
|
|
11
|
+
* is `true`.
|
|
12
|
+
*/
|
|
9
13
|
class ProgressBarLabelTemplateDirective {
|
|
10
14
|
constructor() {
|
|
11
15
|
this.templateRef = inject(TemplateRef);
|
|
@@ -510,9 +510,11 @@ class RatingComponent {
|
|
|
510
510
|
}
|
|
511
511
|
});
|
|
512
512
|
}
|
|
513
|
+
/** Blurs the inner slider control if focused. */
|
|
513
514
|
blur() {
|
|
514
515
|
this.controlElement().nativeElement.blur();
|
|
515
516
|
}
|
|
517
|
+
/** Focuses the inner slider control. Does nothing while disabled. */
|
|
516
518
|
focus(options) {
|
|
517
519
|
if (!this.effectiveDisabled()) {
|
|
518
520
|
this.controlElement().nativeElement.focus(options);
|
|
@@ -35,11 +35,15 @@ const scrollViewArrowThemeVariants = cva(`
|
|
|
35
35
|
absolute top-0 bottom-0 flex items-center justify-center
|
|
36
36
|
px-1
|
|
37
37
|
cursor-pointer select-none
|
|
38
|
-
bg-
|
|
39
|
-
|
|
40
|
-
hover:bg-hover/90 active:bg-active/90
|
|
38
|
+
bg-transparent text-foreground
|
|
39
|
+
forced-colors:bg-[Canvas]
|
|
41
40
|
focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus-indicator
|
|
42
41
|
[&_svg]:stroke-current
|
|
42
|
+
[&_svg]:drop-shadow-[0_0_1px_var(--color-surface),0_0_4px_var(--color-surface)]
|
|
43
|
+
[&_svg]:opacity-70
|
|
44
|
+
[&_svg]:transition-opacity [&_svg]:duration-(--mona-motion-standard) [&_svg]:ease-out
|
|
45
|
+
hover:[&_svg]:opacity-100 active:[&_svg]:opacity-100 focus-visible:[&_svg]:opacity-100
|
|
46
|
+
contrast-more:[&_svg]:opacity-100 forced-colors:[&_svg]:opacity-100
|
|
43
47
|
`, {
|
|
44
48
|
variants: {
|
|
45
49
|
hidden: {
|
|
@@ -12,6 +12,7 @@ import { cva } from 'class-variance-authority';
|
|
|
12
12
|
*/
|
|
13
13
|
class SegmentedItemTemplateDirective {
|
|
14
14
|
constructor() {
|
|
15
|
+
/** @description The options, to type `let-option` from them. It changes nothing else. */
|
|
15
16
|
this.options = input(undefined, { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), alias: "monaSegmentedItemTemplate" });
|
|
16
17
|
this.templateRef = inject(TemplateRef);
|
|
17
18
|
}
|
|
@@ -31,7 +32,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
31
32
|
const segmentedContainerThemeVariants = cva(`
|
|
32
33
|
relative inline-flex items-center gap-0.5
|
|
33
34
|
${themeControlSurfaceClasses}
|
|
34
|
-
border border-border
|
|
35
|
+
border border-input-border
|
|
35
36
|
p-1
|
|
36
37
|
data-[invalid='true']:border-error
|
|
37
38
|
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
@@ -119,8 +119,7 @@ class SheetComponent {
|
|
|
119
119
|
...(ngDevMode ? [{ debugName: "titleClass" }] : /* istanbul ignore next */ []));
|
|
120
120
|
this.titleId = createElementControlId();
|
|
121
121
|
/** @description Accessible name used when no visible title is provided. */
|
|
122
|
-
this.ariaLabel = input(/*
|
|
123
|
-
...(ngDevMode ? [undefined, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
122
|
+
this.ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
124
123
|
/** @description Whether the close button is displayed. @default true */
|
|
125
124
|
this.closable = input(true, /* @ts-ignore */
|
|
126
125
|
...(ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []));
|
|
@@ -183,7 +182,7 @@ class SheetComponent {
|
|
|
183
182
|
this.#openedSide = side;
|
|
184
183
|
this.#horizontal = side === "left" || side === "right";
|
|
185
184
|
if (isDevMode() && !this.title() && !this.ariaLabel()) {
|
|
186
|
-
console.warn("[Mona Sheet] A sheet needs an accessible name. Set title or
|
|
185
|
+
console.warn("[Mona Sheet] A sheet needs an accessible name. Set a title or aria-label.");
|
|
187
186
|
}
|
|
188
187
|
this.#popupRef = this.#popupService.create({
|
|
189
188
|
anchor,
|
|
@@ -280,14 +279,15 @@ class SheetComponent {
|
|
|
280
279
|
});
|
|
281
280
|
}
|
|
282
281
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
283
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SheetComponent, isStandalone: true, selector: "mona-sheet", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "
|
|
282
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SheetComponent, isStandalone: true, selector: "mona-sheet", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed" }, host: { properties: { "attr.aria-label": "null" }, classAttribute: "hidden" }, viewQueries: [{ propertyName: "sheetTemplate", first: true, predicate: ["sheetTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #sheetTemplate>\n <section\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n [class]=\"baseClass()\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"title() ? titleId : null\"\n [attr.aria-describedby]=\"description() ? descriptionId : null\"\n [attr.aria-label]=\"!title() ? ariaLabel() : null\">\n @if (title() || description() || closable()) {\n <header [class]=\"headerClass()\">\n <div class=\"min-w-0 flex-1\">\n @if (title()) {\n <h2 [id]=\"titleId\" [class]=\"titleClass()\">{{ title() }}</h2>\n }\n @if (description()) {\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ description() }}</p>\n }\n </div>\n @if (closable()) {\n <button\n monaButton\n type=\"button\"\n look=\"ghost\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"resolvedMessages().closeSheet\"\n size=\"small\"\n [class]=\"closeButtonClass()\"\n (click)=\"closeSheet()\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n }\n </header>\n }\n <div [class]=\"contentClass()\">\n <ng-content></ng-content>\n </div>\n </section>\n</ng-template>\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class", "value"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }] }); }
|
|
284
283
|
}
|
|
285
284
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SheetComponent, decorators: [{
|
|
286
285
|
type: Component,
|
|
287
286
|
args: [{ selector: "mona-sheet", imports: [ButtonDirective, CdkTrapFocus, LucideX], host: {
|
|
287
|
+
"[attr.aria-label]": "null",
|
|
288
288
|
class: "hidden"
|
|
289
289
|
}, template: "<ng-template #sheetTemplate>\n <section\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n [class]=\"baseClass()\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"title() ? titleId : null\"\n [attr.aria-describedby]=\"description() ? descriptionId : null\"\n [attr.aria-label]=\"!title() ? ariaLabel() : null\">\n @if (title() || description() || closable()) {\n <header [class]=\"headerClass()\">\n <div class=\"min-w-0 flex-1\">\n @if (title()) {\n <h2 [id]=\"titleId\" [class]=\"titleClass()\">{{ title() }}</h2>\n }\n @if (description()) {\n <p [id]=\"descriptionId\" [class]=\"descriptionClass()\">{{ description() }}</p>\n }\n </div>\n @if (closable()) {\n <button\n monaButton\n type=\"button\"\n look=\"ghost\"\n [iconOnly]=\"true\"\n [attr.aria-label]=\"resolvedMessages().closeSheet\"\n size=\"small\"\n [class]=\"closeButtonClass()\"\n (click)=\"closeSheet()\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n }\n </header>\n }\n <div [class]=\"contentClass()\">\n <ng-content></ng-content>\n </div>\n </section>\n</ng-template>\n" }]
|
|
290
|
-
}], ctorParameters: () => [], propDecorators: { sheetTemplate: [{ type: i0.ViewChild, args: ["sheetTemplate", { isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "
|
|
290
|
+
}], ctorParameters: () => [], propDecorators: { sheetTemplate: [{ type: i0.ViewChild, args: ["sheetTemplate", { isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], closeOnBackdropClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnBackdropClick", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], messages: [{ type: i0.Input, args: [{ isSignal: true, alias: "messages", required: false }] }], side: [{ type: i0.Input, args: [{ isSignal: true, alias: "side", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
|
|
291
291
|
|
|
292
292
|
/*
|
|
293
293
|
* Public API Surface of @nanahoshi/mona-ui/sheet
|
|
@@ -1268,7 +1268,7 @@ class SidebarComponent {
|
|
|
1268
1268
|
[position]="railOpensToward()">
|
|
1269
1269
|
<ng-content></ng-content>
|
|
1270
1270
|
</div>
|
|
1271
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: TooltipDirective, selector: "[monaTooltip]", inputs: ["contentOf", "disabled", "filter", "hideDelay", "mode", "monaTooltip", "position", "tooltipRounded", "showDelay"], outputs: ["hidden", "shown"] }] }); }
|
|
1271
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: TooltipDirective, selector: "[monaTooltip]", inputs: ["contentOf", "disabled", "filter", "hideDelay", "mode", "monaTooltip", "position", "tooltipRounded", "showDelay", "tooltipDisabled"], outputs: ["hidden", "shown"] }] }); }
|
|
1272
1272
|
}
|
|
1273
1273
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SidebarComponent, decorators: [{
|
|
1274
1274
|
type: Component,
|