@nanahoshi/mona-ui 0.24.8 → 0.24.9

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.
Files changed (81) hide show
  1. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +37 -9
  2. package/fesm2022/nanahoshi-mona-ui-button.mjs +8 -2
  3. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +4 -3
  4. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +101 -47
  5. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +339 -101
  6. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +119 -69
  7. package/fesm2022/nanahoshi-mona-ui-editor.mjs +2 -2
  8. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-DdyHnUIr.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs} +2 -2
  9. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-B6gq7Hu3.mjs → nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs} +4 -4
  10. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-DdUY3I7P.mjs → nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs} +2 -3
  11. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DG8Bu4Dy.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs} +4 -4
  12. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CVqpbMcb.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs} +9 -9
  13. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  14. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +4 -0
  15. package/fesm2022/nanahoshi-mona-ui-internal.mjs +438 -22
  16. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +4 -0
  17. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +4 -0
  18. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +4 -0
  19. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +4 -0
  20. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +4 -0
  21. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +4 -0
  22. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +4 -0
  23. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +4 -0
  24. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +4 -0
  25. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +4 -0
  26. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +4 -0
  27. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +4 -0
  28. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +4 -0
  29. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +127 -133
  30. package/fesm2022/nanahoshi-mona-ui-notification.mjs +473 -240
  31. package/fesm2022/nanahoshi-mona-ui-popover.mjs +202 -90
  32. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +609 -256
  33. package/fesm2022/nanahoshi-mona-ui-popup.mjs +2 -0
  34. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +45 -10
  35. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +102 -58
  36. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +286 -443
  37. package/fesm2022/nanahoshi-mona-ui-window.mjs +591 -310
  38. package/i18n/catalogs/en-US.messages.json +4 -0
  39. package/locales/ar-sa/ar-sa.messages.json +4 -0
  40. package/locales/de-de/de-de.messages.json +4 -0
  41. package/locales/es-es/es-es.messages.json +4 -0
  42. package/locales/fr-fr/fr-fr.messages.json +4 -0
  43. package/locales/id-id/id-id.messages.json +4 -0
  44. package/locales/it-it/it-it.messages.json +4 -0
  45. package/locales/ja-jp/ja-jp.messages.json +4 -0
  46. package/locales/ko-kr/ko-kr.messages.json +4 -0
  47. package/locales/pt-br/pt-br.messages.json +4 -0
  48. package/locales/ru-ru/ru-ru.messages.json +4 -0
  49. package/locales/tr-tr/tr-tr.messages.json +4 -0
  50. package/locales/zh-cn/zh-cn.messages.json +4 -0
  51. package/locales/zh-tw/zh-tw.messages.json +4 -0
  52. package/package.json +1 -1
  53. package/types/nanahoshi-mona-ui-button-group.d.ts +13 -3
  54. package/types/nanahoshi-mona-ui-button.d.ts +20 -3
  55. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -6
  56. package/types/nanahoshi-mona-ui-dialog.d.ts +131 -20
  57. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +75 -56
  58. package/types/nanahoshi-mona-ui-i18n.d.ts +19 -0
  59. package/types/nanahoshi-mona-ui-internal.d.ts +119 -15
  60. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +4 -0
  61. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +4 -0
  62. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +4 -0
  63. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +4 -0
  64. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +4 -0
  65. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +4 -0
  66. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +4 -0
  67. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +4 -0
  68. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +4 -0
  69. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +4 -0
  70. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +4 -0
  71. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +4 -0
  72. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +4 -0
  73. package/types/nanahoshi-mona-ui-menubar.d.ts +65 -62
  74. package/types/nanahoshi-mona-ui-notification.d.ts +76 -16
  75. package/types/nanahoshi-mona-ui-popover.d.ts +44 -17
  76. package/types/nanahoshi-mona-ui-popup-menu.d.ts +110 -32
  77. package/types/nanahoshi-mona-ui-popup.d.ts +2 -0
  78. package/types/nanahoshi-mona-ui-sheet.d.ts +16 -5
  79. package/types/nanahoshi-mona-ui-split-button.d.ts +29 -7
  80. package/types/nanahoshi-mona-ui-tooltip.d.ts +43 -20
  81. package/types/nanahoshi-mona-ui-window.d.ts +103 -14
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, DestroyRef, computed, contentChildren, input, model, effect, untracked, afterNextRender, Component } from '@angular/core';
3
3
  import { outputFromObservable, takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
4
- import { ButtonService, ButtonDirective } from '@nanahoshi/mona-ui/button';
4
+ import { ButtonService, ButtonDirective, BUTTON_GROUP_MEMBER } from '@nanahoshi/mona-ui/button';
5
5
  import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
6
6
  import { map, pairwise } from 'rxjs';
7
7
  import { twMerge } from 'tailwind-merge';
@@ -18,16 +18,22 @@ const buttonGroupThemeVariants = cva(`
18
18
  border border-input-border
19
19
  [&>button]:border-0
20
20
  [&>button]:shadow-none
21
- [&>button:not(:last-child)]:border-e
22
- [&>button:not(:last-child)]:border-border-subtle
21
+ [&>*:not(:last-child)]:border-e
22
+ [&>*:not(:last-child)]:border-border-subtle
23
23
  [&>button]:rounded-none
24
24
  [&>button]:focus-visible:z-10
25
+ [&>*>button]:border-0
26
+ [&>*>button]:shadow-none
27
+ [&>*>button]:rounded-none!
28
+ [&>*>button]:focus-visible:z-10
29
+ [&>*>button:not(:last-of-type)]:border-e
30
+ [&>*>button:not(:last-of-type)]:border-border-subtle
25
31
  `, {
26
32
  variants: {
27
33
  look: {
28
34
  default: "",
29
35
  error: "border-transparent",
30
- ghost: "border-transparent [&>button:not(:last-child)]:border-e-0",
36
+ ghost: "border-transparent [&>*:not(:last-child)]:border-e-0 [&>*>button:not(:last-of-type)]:border-e-0",
31
37
  info: "border-transparent",
32
38
  outline: "",
33
39
  primary: "border-transparent",
@@ -40,16 +46,22 @@ const buttonGroupThemeVariants = cva(`
40
46
  rounded-full
41
47
  [&>button]:first:rounded-ss-full [&>button]:first:rounded-es-full
42
48
  [&>button]:last:rounded-se-full [&>button]:last:rounded-ee-full
49
+ [&>*:first-child>button:first-of-type]:rounded-ss-full! [&>*:first-child>button:first-of-type]:rounded-es-full!
50
+ [&>*:last-child>button:last-of-type]:rounded-se-full! [&>*:last-child>button:last-of-type]:rounded-ee-full!
43
51
  `,
44
52
  large: `
45
53
  rounded-lg
46
54
  [&>button]:first:rounded-ss-lg [&>button]:first:rounded-es-lg
47
55
  [&>button]:last:rounded-se-lg [&>button]:last:rounded-ee-lg
56
+ [&>*:first-child>button:first-of-type]:rounded-ss-lg! [&>*:first-child>button:first-of-type]:rounded-es-lg!
57
+ [&>*:last-child>button:last-of-type]:rounded-se-lg! [&>*:last-child>button:last-of-type]:rounded-ee-lg!
48
58
  `,
49
59
  medium: `
50
60
  rounded-md
51
61
  [&>button]:first:rounded-ss-md [&>button]:first:rounded-es-md
52
62
  [&>button]:last:rounded-se-md [&>button]:last:rounded-ee-md
63
+ [&>*:first-child>button:first-of-type]:rounded-ss-md! [&>*:first-child>button:first-of-type]:rounded-es-md!
64
+ [&>*:last-child>button:last-of-type]:rounded-se-md! [&>*:last-child>button:last-of-type]:rounded-ee-md!
53
65
  `,
54
66
  none: `
55
67
  rounded-none
@@ -58,6 +70,8 @@ const buttonGroupThemeVariants = cva(`
58
70
  rounded-sm
59
71
  [&>button]:first:rounded-ss-sm [&>button]:first:rounded-es-sm
60
72
  [&>button]:last:rounded-se-sm [&>button]:last:rounded-ee-sm
73
+ [&>*:first-child>button:first-of-type]:rounded-ss-sm! [&>*:first-child>button:first-of-type]:rounded-es-sm!
74
+ [&>*:last-child>button:last-of-type]:rounded-se-sm! [&>*:last-child>button:last-of-type]:rounded-ee-sm!
61
75
  `
62
76
  },
63
77
  size: {
@@ -89,11 +103,25 @@ class ButtonGroupComponent {
89
103
  return twMerge(variantClasses, userClass);
90
104
  }, /* @ts-ignore */
91
105
  ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
106
+ /**
107
+ * The group's own buttons: they follow its look, size, rounding and disabled state, and its selection.
108
+ */
92
109
  this.buttons = contentChildren(ButtonDirective, /* @ts-ignore */
93
110
  ...(ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []));
94
- this.messages = this.#i18n.componentMessages("buttonGroup", BUTTON_GROUP_DEFAULT_MESSAGES);
111
+ /**
112
+ * Dropdown and split buttons placed in the group. Their buttons follow the group's look, size, rounding and
113
+ * disabled state, but not its selection.
114
+ */
115
+ this.components = contentChildren(BUTTON_GROUP_MEMBER, /* @ts-ignore */
116
+ ...(ngDevMode ? [{ debugName: "components" }] : /* istanbul ignore next */ []));
95
117
  this.effectiveAriaLabel = computed(() => this.ariaLabel() ?? this.messages().buttonGroup, /* @ts-ignore */
96
118
  ...(ngDevMode ? [{ debugName: "effectiveAriaLabel" }] : /* istanbul ignore next */ []));
119
+ this.members = computed(() => [
120
+ ...this.buttons(),
121
+ ...this.components().flatMap(component => component.groupButtons())
122
+ ], /* @ts-ignore */
123
+ ...(ngDevMode ? [{ debugName: "members" }] : /* istanbul ignore next */ []));
124
+ this.messages = this.#i18n.componentMessages("buttonGroup", BUTTON_GROUP_DEFAULT_MESSAGES);
97
125
  /**
98
126
  * @description When `false` and `selection` is `"single"`, at least one button must remain selected;
99
127
  * the active button cannot be deselected. Has no effect in `"multiple"` mode.
@@ -148,7 +176,7 @@ class ButtonGroupComponent {
148
176
  * @default ""
149
177
  */
150
178
  this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
151
- this.#buttonService.setMembers(this.buttons);
179
+ this.#buttonService.setMembers(this.members);
152
180
  effect(() => {
153
181
  const disabled = this.disabled();
154
182
  untracked(() => this.#buttonService.groupDisabled.set(disabled));
@@ -202,7 +230,7 @@ class ButtonGroupComponent {
202
230
  });
203
231
  }
204
232
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ButtonGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
205
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: ButtonGroupComponent, isStandalone: true, selector: "mona-button-group", inputs: { allowEmpty: { classPropertyName: "allowEmpty", publicName: "allowEmpty", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { buttonClick: "buttonClick", disabled: "disabledChange", selection: "selectionChange" }, host: { attributes: { "role": "group" }, properties: { "attr.aria-label": "effectiveAriaLabel()", "class": "baseClass()" } }, providers: [ButtonService], queries: [{ propertyName: "buttons", predicate: ButtonDirective, isSignal: true }], ngImport: i0, template: "<ng-content select=\"[monaButton]\"></ng-content>\n" }); }
233
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: ButtonGroupComponent, isStandalone: true, selector: "mona-button-group", inputs: { allowEmpty: { classPropertyName: "allowEmpty", publicName: "allowEmpty", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { buttonClick: "buttonClick", disabled: "disabledChange", selection: "selectionChange" }, host: { attributes: { "role": "group" }, properties: { "attr.aria-label": "effectiveAriaLabel()", "class": "baseClass()" } }, providers: [ButtonService], queries: [{ propertyName: "buttons", predicate: ButtonDirective, isSignal: true }, { propertyName: "components", predicate: BUTTON_GROUP_MEMBER, isSignal: true }], ngImport: i0, template: "<ng-content select=\"[monaButton], mona-dropdown-button, mona-split-button\"></ng-content>\n" }); }
206
234
  }
207
235
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ButtonGroupComponent, decorators: [{
208
236
  type: Component,
@@ -210,8 +238,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
210
238
  "[attr.aria-label]": "effectiveAriaLabel()",
211
239
  "[class]": "baseClass()",
212
240
  role: "group"
213
- }, template: "<ng-content select=\"[monaButton]\"></ng-content>\n" }]
214
- }], ctorParameters: () => [], propDecorators: { buttons: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ButtonDirective), { isSignal: true }] }], allowEmpty: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowEmpty", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], buttonClick: [{ type: i0.Output, args: ["buttonClick"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], look: [{ type: i0.Input, args: [{ isSignal: true, alias: "look", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
241
+ }, template: "<ng-content select=\"[monaButton], mona-dropdown-button, mona-split-button\"></ng-content>\n" }]
242
+ }], ctorParameters: () => [], propDecorators: { buttons: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ButtonDirective), { isSignal: true }] }], components: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => BUTTON_GROUP_MEMBER), { isSignal: true }] }], allowEmpty: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowEmpty", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], buttonClick: [{ type: i0.Output, args: ["buttonClick"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], look: [{ type: i0.Input, args: [{ isSignal: true, alias: "look", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
215
243
 
216
244
  /*
217
245
  * Public API Surface of @nanahoshi/mona-ui/button-group
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, computed, Injectable, inject, ApplicationRef, DestroyRef, ElementRef, Injector, Renderer2, input, booleanAttribute, model, numberAttribute, effect, untracked, afterNextRender, isDevMode, createComponent, afterRenderEffect, Directive } from '@angular/core';
2
+ import { signal, computed, Injectable, inject, ApplicationRef, DestroyRef, ElementRef, Injector, Renderer2, input, booleanAttribute, model, numberAttribute, effect, untracked, afterNextRender, isDevMode, createComponent, afterRenderEffect, Directive, InjectionToken } from '@angular/core';
3
3
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
4
  import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
5
5
  import { Subject, fromEvent, takeWhile } from 'rxjs';
@@ -554,6 +554,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
554
554
  }]
555
555
  }], ctorParameters: () => [], propDecorators: { ariaHasPopup: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-haspopup", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], iconOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconOnly", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], look: [{ type: i0.Input, args: [{ isSignal: true, alias: "look", required: false }] }, { type: i0.Output, args: ["lookChange"] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], toggleable: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleable", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
556
556
 
557
+ /**
558
+ * Provided by a component that implements {@link ButtonGroupMember}, so a `mona-button-group` can find it among its
559
+ * content children.
560
+ */
561
+ const BUTTON_GROUP_MEMBER = new InjectionToken("BUTTON_GROUP_MEMBER");
562
+
557
563
  /*
558
564
  * Public API Surface of @nanahoshi/mona-ui/button
559
565
  */
@@ -562,5 +568,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
562
568
  * Generated bundle index. Do not edit.
563
569
  */
564
570
 
565
- export { ButtonDirective, ButtonService };
571
+ export { BUTTON_GROUP_MEMBER, ButtonDirective, ButtonService };
566
572
  //# sourceMappingURL=nanahoshi-mona-ui-button.mjs.map
@@ -6,7 +6,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
6
  import { LucideDropletOff, LucideChevronsUpDown, LucideCopy } from '@lucide/angular';
7
7
  import { ButtonDirective } from '@nanahoshi/mona-ui/button';
8
8
  import { rgba2hex, hsva2rgba, isValidHex, hex2rgba, rgba2hsva, rgba2hsla, isValidHsla, isValidRgb, string2rgba, string2Hsla, hsla2hsva } from '@nanahoshi/mona-ui/internal';
9
- import { DropdownButtonComponent, DropdownButtonItemComponent } from '@nanahoshi/mona-ui/dropdown-button';
9
+ import { DropdownButtonComponent, DropdownButtonItemComponent, DropdownButtonTextTemplateDirective } from '@nanahoshi/mona-ui/dropdown-button';
10
10
  import { NumericTextBoxComponent, NumericTextBoxPrefixTemplateDirective } from '@nanahoshi/mona-ui/numeric-text-box';
11
11
  import { SliderComponent } from '@nanahoshi/mona-ui/slider';
12
12
  import { TextBoxComponent, TextBoxPrefixTemplateDirective, TextBoxSuffixTemplateDirective } from '@nanahoshi/mona-ui/text-box';
@@ -789,7 +789,7 @@ class ColorGradientComponent {
789
789
  }
790
790
  }
791
791
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorGradientComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
792
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorGradientComponent, isStandalone: true, selector: "mona-color-gradient", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showButtons: { classPropertyName: "showButtons", publicName: "showButtons", isSignal: true, isRequired: false, transformFunction: null }, showHexInput: { classPropertyName: "showHexInput", publicName: "showHexInput", isSignal: true, isRequired: false, transformFunction: null }, showColorInputs: { classPropertyName: "showColorInputs", publicName: "showColorInputs", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { apply: "apply", cancel: "cancel", touch: "touch", value: "valueChange" }, host: { properties: { "class": "baseClasses()", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.aria-invalid": "invalidState() ? 'true' : null" } }, viewQueries: [{ propertyName: "hsvHandle", first: true, predicate: ["hsvPointer"], descendants: true, isSignal: true }, { propertyName: "hsvRectangle", first: true, predicate: ["hsvRectangle"], descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.px]=\"hsvHandleLeft()\"\n [style.top.px]=\"hsvHandleTop()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"messages().saturationAndValue\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-valuenow]=\"hsv().s\"\n [attr.aria-valuetext]=\"messages().saturationAndValueText(hsv().s ?? 0, hsv().v ?? 0)\"\n [attr.aria-disabled]=\"disabled() || null\"\n (keydown)=\"onHsvHandleKeyDown($event)\"\n (blur)=\"onHsvHandleBlur()\"\n #hsvPointer></div>\n</div>\n<div class=\"flex items-center gap-2\">\n <div class=\"flex flex-1 flex-col gap-1 me-2\">\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"360\"\n [trackBackground]=\"'linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)'\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"hsv().h ?? 0\"\n (valueChange)=\"hueValue$.next($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n @if (opacity()) {\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"255\"\n [trackBackground]=\"alphaSliderBackground()\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"alpha()\"\n (valueChange)=\"onAlphaChange($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n }\n </div>\n @for (preview of colorPreviews(); track preview.type) {\n <div\n [class]=\"colorPreviewClasses()\"\n [class.cursor-pointer]=\"$index === 1\"\n [style.background-color]=\"preview.color\"\n [attr.title]=\"$index === 1 ? preview.title : null\"\n [attr.aria-label]=\"$index === 1 ? preview.title : null\"\n [attr.aria-hidden]=\"$index === 0 ? 'true' : null\"\n [attr.role]=\"$index === 1 ? 'button' : null\"\n [attr.tabindex]=\"$index === 1 ? 0 : null\"\n (click)=\"preview.onClick?.()\"\n (keydown)=\"onPreviousColorKeyDown($event, preview.onClick)\"></div>\n }\n <button monaButton look=\"ghost\" size=\"small\" [attr.aria-label]=\"messages().clearColor\" (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n</div>\n<div class=\"flex flex-col gap-2\">\n @if (showColorInputs()) {\n <div class=\"flex gap-2\">\n <div class=\"flex gap-1\">\n @for (input of colorInputs(); track input.key) {\n <mona-numeric-text-box\n [value]=\"input.value\"\n [minValue]=\"input.min\"\n [maxValue]=\"input.max\"\n [decimals]=\"0\"\n [spinners]=\"false\"\n [nullable]=\"false\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n class=\"w-18\"\n (valueChange)=\"input.change($event)\"\n (inputBlur)=\"onNumericInputBlur()\">\n <ng-template monaNumericTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: input.label }\"></ng-container>\n </ng-template>\n </mona-numeric-text-box>\n }\n </div>\n <div class=\"flex flex-1 items-center justify-end\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n size=\"small\"\n [attr.aria-label]=\"messages().switchColorMode\"\n (click)=\"onSwitchColorModeClick()\">\n <svg lucideChevronsUpDown [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n </div>\n }\n @if (showHexInput()) {\n <mona-text-box\n [rounded]=\"rounded()\"\n [value]=\"hex()\"\n (valueChange)=\"onHexChange($event)\"\n (inputBlur)=\"onHexInputBlur()\"\n (inputFocus)=\"onHexInputFocus()\"\n class=\"w-full\">\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: 'HEX', classes: 'w-auto px-2' }\"></ng-container>\n </ng-template>\n <ng-template monaTextBoxSuffixTemplate>\n <mona-dropdown-button look=\"ghost\" [attr.aria-label]=\"messages().copyColor\" class=\"h-full\">\n <svg lucideCopy [size]=\"12\"></svg>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsHex\"\n (menuClick)=\"onCopyColorSelect('hex')\"></mona-dropdown-button-item>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsRgb\"\n (menuClick)=\"onCopyColorSelect('rgb')\"></mona-dropdown-button-item>\n </mona-dropdown-button>\n </ng-template>\n </mona-text-box>\n }\n @if (showButtons()) {\n <div class=\"flex items-center justify-end gap-2\">\n <button monaButton [rounded]=\"rounded()\" look=\"primary\" (click)=\"onApply()\">{{ messages().apply }}</button>\n <button monaButton [rounded]=\"rounded()\" (click)=\"onCancel()\">{{ messages().cancel }}</button>\n </div>\n }\n</div>\n\n<ng-template #numericInputPrefixTemplate let-text let-classes=\"classes\">\n <span\n [class]=\"classes\"\n class=\"inline-flex items-center justify-center select-none w-7.5 [background-color:var(--mona-input-addon-background,var(--color-secondary))] h-full text-foreground text-xs font-semibold border-e border-e-input-border\"\n >{{ text }}</span\n >\n</ng-template>\n", dependencies: [{ kind: "component", type: LucideDropletOff, selector: "svg[lucideDropletOff]" }, { kind: "component", type: LucideChevronsUpDown, selector: "svg[lucideChevronsUpDown]" }, { kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["formatter", "maxValue", "minValue", "step", "value"], outputs: ["valueChange"] }, { kind: "directive", type: NumericTextBoxPrefixTemplateDirective, selector: "ng-template[monaNumericTextBoxPrefixTemplate]" }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class"], outputs: ["lookChange", "selectedChange"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "clearButton", "disabled", "inputAttributes", "inputClass", "inputId", "inputStyle", "invalid", "maxLength", "minLength", "name", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "directive", type: TextBoxPrefixTemplateDirective, selector: "ng-template[monaTextBoxPrefixTemplate]" }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "ng-template[monaTextBoxSuffixTemplate]" }, { kind: "component", type: SliderComponent, selector: "mona-slider", inputs: ["aria-label", "aria-labelledby", "value"], outputs: ["valueChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: DropdownButtonComponent, selector: "mona-dropdown-button", inputs: ["aria-label", "aria-labelledby", "iconOnly", "disabled", "loading", "look", "rounded", "size", "text", "class"], outputs: ["menuItemClick"] }, { kind: "component", type: DropdownButtonItemComponent, selector: "mona-dropdown-button-item" }, { kind: "component", type: LucideCopy, selector: "svg[lucideCopy]" }] }); }
792
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorGradientComponent, isStandalone: true, selector: "mona-color-gradient", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showButtons: { classPropertyName: "showButtons", publicName: "showButtons", isSignal: true, isRequired: false, transformFunction: null }, showHexInput: { classPropertyName: "showHexInput", publicName: "showHexInput", isSignal: true, isRequired: false, transformFunction: null }, showColorInputs: { classPropertyName: "showColorInputs", publicName: "showColorInputs", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { apply: "apply", cancel: "cancel", touch: "touch", value: "valueChange" }, host: { properties: { "class": "baseClasses()", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.aria-invalid": "invalidState() ? 'true' : null" } }, viewQueries: [{ propertyName: "hsvHandle", first: true, predicate: ["hsvPointer"], descendants: true, isSignal: true }, { propertyName: "hsvRectangle", first: true, predicate: ["hsvRectangle"], descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.px]=\"hsvHandleLeft()\"\n [style.top.px]=\"hsvHandleTop()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"messages().saturationAndValue\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-valuenow]=\"hsv().s\"\n [attr.aria-valuetext]=\"messages().saturationAndValueText(hsv().s ?? 0, hsv().v ?? 0)\"\n [attr.aria-disabled]=\"disabled() || null\"\n (keydown)=\"onHsvHandleKeyDown($event)\"\n (blur)=\"onHsvHandleBlur()\"\n #hsvPointer></div>\n</div>\n<div class=\"flex items-center gap-2\">\n <div class=\"flex flex-1 flex-col gap-1 me-2\">\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"360\"\n [trackBackground]=\"'linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)'\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"hsv().h ?? 0\"\n (valueChange)=\"hueValue$.next($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n @if (opacity()) {\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"255\"\n [trackBackground]=\"alphaSliderBackground()\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"alpha()\"\n (valueChange)=\"onAlphaChange($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n }\n </div>\n @for (preview of colorPreviews(); track preview.type) {\n <div\n [class]=\"colorPreviewClasses()\"\n [class.cursor-pointer]=\"$index === 1\"\n [style.background-color]=\"preview.color\"\n [attr.title]=\"$index === 1 ? preview.title : null\"\n [attr.aria-label]=\"$index === 1 ? preview.title : null\"\n [attr.aria-hidden]=\"$index === 0 ? 'true' : null\"\n [attr.role]=\"$index === 1 ? 'button' : null\"\n [attr.tabindex]=\"$index === 1 ? 0 : null\"\n (click)=\"preview.onClick?.()\"\n (keydown)=\"onPreviousColorKeyDown($event, preview.onClick)\"></div>\n }\n <button monaButton look=\"ghost\" size=\"small\" [attr.aria-label]=\"messages().clearColor\" (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n</div>\n<div class=\"flex flex-col gap-2\">\n @if (showColorInputs()) {\n <div class=\"flex gap-2\">\n <div class=\"flex gap-1\">\n @for (input of colorInputs(); track input.key) {\n <mona-numeric-text-box\n [value]=\"input.value\"\n [minValue]=\"input.min\"\n [maxValue]=\"input.max\"\n [decimals]=\"0\"\n [spinners]=\"false\"\n [nullable]=\"false\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n class=\"w-18\"\n (valueChange)=\"input.change($event)\"\n (inputBlur)=\"onNumericInputBlur()\">\n <ng-template monaNumericTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: input.label }\"></ng-container>\n </ng-template>\n </mona-numeric-text-box>\n }\n </div>\n <div class=\"flex flex-1 items-center justify-end\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n size=\"small\"\n [attr.aria-label]=\"messages().switchColorMode\"\n (click)=\"onSwitchColorModeClick()\">\n <svg lucideChevronsUpDown [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n </div>\n }\n @if (showHexInput()) {\n <mona-text-box\n [rounded]=\"rounded()\"\n [value]=\"hex()\"\n (valueChange)=\"onHexChange($event)\"\n (inputBlur)=\"onHexInputBlur()\"\n (inputFocus)=\"onHexInputFocus()\"\n class=\"w-full\">\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: 'HEX', classes: 'w-auto px-2' }\"></ng-container>\n </ng-template>\n <ng-template monaTextBoxSuffixTemplate>\n <mona-dropdown-button look=\"ghost\" [iconOnly]=\"true\" [aria-label]=\"messages().copyColor\" class=\"h-full\">\n <ng-template monaDropdownButtonTextTemplate>\n <svg lucideCopy [size]=\"12\"></svg>\n </ng-template>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsHex\"\n (menuClick)=\"onCopyColorSelect('hex')\"></mona-dropdown-button-item>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsRgb\"\n (menuClick)=\"onCopyColorSelect('rgb')\"></mona-dropdown-button-item>\n </mona-dropdown-button>\n </ng-template>\n </mona-text-box>\n }\n @if (showButtons()) {\n <div class=\"flex items-center justify-end gap-2\">\n <button monaButton [rounded]=\"rounded()\" look=\"primary\" (click)=\"onApply()\">{{ messages().apply }}</button>\n <button monaButton [rounded]=\"rounded()\" (click)=\"onCancel()\">{{ messages().cancel }}</button>\n </div>\n }\n</div>\n\n<ng-template #numericInputPrefixTemplate let-text let-classes=\"classes\">\n <span\n [class]=\"classes\"\n class=\"inline-flex items-center justify-center select-none w-7.5 [background-color:var(--mona-input-addon-background,var(--color-secondary))] h-full text-foreground text-xs font-semibold border-e border-e-input-border\"\n >{{ text }}</span\n >\n</ng-template>\n", dependencies: [{ kind: "component", type: LucideDropletOff, selector: "svg[lucideDropletOff]" }, { kind: "component", type: LucideChevronsUpDown, selector: "svg[lucideChevronsUpDown]" }, { kind: "component", type: NumericTextBoxComponent, selector: "mona-numeric-text-box", inputs: ["formatter", "maxValue", "minValue", "step", "value"], outputs: ["valueChange"] }, { kind: "directive", type: NumericTextBoxPrefixTemplateDirective, selector: "ng-template[monaNumericTextBoxPrefixTemplate]" }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class"], outputs: ["lookChange", "selectedChange"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["aria-describedby", "aria-label", "aria-labelledby", "clearButton", "disabled", "inputAttributes", "inputClass", "inputId", "inputStyle", "invalid", "maxLength", "minLength", "name", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "directive", type: TextBoxPrefixTemplateDirective, selector: "ng-template[monaTextBoxPrefixTemplate]" }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "ng-template[monaTextBoxSuffixTemplate]" }, { kind: "component", type: SliderComponent, selector: "mona-slider", inputs: ["aria-label", "aria-labelledby", "value"], outputs: ["valueChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: DropdownButtonComponent, selector: "mona-dropdown-button", inputs: ["aria-label", "aria-labelledby", "disabled", "iconOnly", "loading", "look", "popupWidth", "rounded", "showArrow", "size", "text", "class"], outputs: ["menuItemClick"] }, { kind: "component", type: DropdownButtonItemComponent, selector: "mona-dropdown-button-item" }, { kind: "directive", type: DropdownButtonTextTemplateDirective, selector: "ng-template[monaDropdownButtonTextTemplate]" }, { kind: "component", type: LucideCopy, selector: "svg[lucideCopy]" }] }); }
793
793
  }
794
794
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorGradientComponent, decorators: [{
795
795
  type: Component,
@@ -806,13 +806,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
806
806
  NgTemplateOutlet,
807
807
  DropdownButtonComponent,
808
808
  DropdownButtonItemComponent,
809
+ DropdownButtonTextTemplateDirective,
809
810
  LucideCopy
810
811
  ], host: {
811
812
  "[class]": "baseClasses()",
812
813
  "[attr.data-disabled]": "disabled()",
813
814
  "[attr.data-invalid]": "invalidState() || null",
814
815
  "[attr.aria-invalid]": "invalidState() ? 'true' : null"
815
- }, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.px]=\"hsvHandleLeft()\"\n [style.top.px]=\"hsvHandleTop()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"messages().saturationAndValue\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-valuenow]=\"hsv().s\"\n [attr.aria-valuetext]=\"messages().saturationAndValueText(hsv().s ?? 0, hsv().v ?? 0)\"\n [attr.aria-disabled]=\"disabled() || null\"\n (keydown)=\"onHsvHandleKeyDown($event)\"\n (blur)=\"onHsvHandleBlur()\"\n #hsvPointer></div>\n</div>\n<div class=\"flex items-center gap-2\">\n <div class=\"flex flex-1 flex-col gap-1 me-2\">\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"360\"\n [trackBackground]=\"'linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)'\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"hsv().h ?? 0\"\n (valueChange)=\"hueValue$.next($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n @if (opacity()) {\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"255\"\n [trackBackground]=\"alphaSliderBackground()\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"alpha()\"\n (valueChange)=\"onAlphaChange($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n }\n </div>\n @for (preview of colorPreviews(); track preview.type) {\n <div\n [class]=\"colorPreviewClasses()\"\n [class.cursor-pointer]=\"$index === 1\"\n [style.background-color]=\"preview.color\"\n [attr.title]=\"$index === 1 ? preview.title : null\"\n [attr.aria-label]=\"$index === 1 ? preview.title : null\"\n [attr.aria-hidden]=\"$index === 0 ? 'true' : null\"\n [attr.role]=\"$index === 1 ? 'button' : null\"\n [attr.tabindex]=\"$index === 1 ? 0 : null\"\n (click)=\"preview.onClick?.()\"\n (keydown)=\"onPreviousColorKeyDown($event, preview.onClick)\"></div>\n }\n <button monaButton look=\"ghost\" size=\"small\" [attr.aria-label]=\"messages().clearColor\" (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n</div>\n<div class=\"flex flex-col gap-2\">\n @if (showColorInputs()) {\n <div class=\"flex gap-2\">\n <div class=\"flex gap-1\">\n @for (input of colorInputs(); track input.key) {\n <mona-numeric-text-box\n [value]=\"input.value\"\n [minValue]=\"input.min\"\n [maxValue]=\"input.max\"\n [decimals]=\"0\"\n [spinners]=\"false\"\n [nullable]=\"false\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n class=\"w-18\"\n (valueChange)=\"input.change($event)\"\n (inputBlur)=\"onNumericInputBlur()\">\n <ng-template monaNumericTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: input.label }\"></ng-container>\n </ng-template>\n </mona-numeric-text-box>\n }\n </div>\n <div class=\"flex flex-1 items-center justify-end\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n size=\"small\"\n [attr.aria-label]=\"messages().switchColorMode\"\n (click)=\"onSwitchColorModeClick()\">\n <svg lucideChevronsUpDown [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n </div>\n }\n @if (showHexInput()) {\n <mona-text-box\n [rounded]=\"rounded()\"\n [value]=\"hex()\"\n (valueChange)=\"onHexChange($event)\"\n (inputBlur)=\"onHexInputBlur()\"\n (inputFocus)=\"onHexInputFocus()\"\n class=\"w-full\">\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: 'HEX', classes: 'w-auto px-2' }\"></ng-container>\n </ng-template>\n <ng-template monaTextBoxSuffixTemplate>\n <mona-dropdown-button look=\"ghost\" [attr.aria-label]=\"messages().copyColor\" class=\"h-full\">\n <svg lucideCopy [size]=\"12\"></svg>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsHex\"\n (menuClick)=\"onCopyColorSelect('hex')\"></mona-dropdown-button-item>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsRgb\"\n (menuClick)=\"onCopyColorSelect('rgb')\"></mona-dropdown-button-item>\n </mona-dropdown-button>\n </ng-template>\n </mona-text-box>\n }\n @if (showButtons()) {\n <div class=\"flex items-center justify-end gap-2\">\n <button monaButton [rounded]=\"rounded()\" look=\"primary\" (click)=\"onApply()\">{{ messages().apply }}</button>\n <button monaButton [rounded]=\"rounded()\" (click)=\"onCancel()\">{{ messages().cancel }}</button>\n </div>\n }\n</div>\n\n<ng-template #numericInputPrefixTemplate let-text let-classes=\"classes\">\n <span\n [class]=\"classes\"\n class=\"inline-flex items-center justify-center select-none w-7.5 [background-color:var(--mona-input-addon-background,var(--color-secondary))] h-full text-foreground text-xs font-semibold border-e border-e-input-border\"\n >{{ text }}</span\n >\n</ng-template>\n" }]
816
+ }, template: "<div [class]=\"hsvRectangleClasses()\" [style.background-color]=\"hsvRectangleBackground()\" #hsvRectangle>\n <div\n [class]=\"hsvRectangleHandleClasses()\"\n [style.left.px]=\"hsvHandleLeft()\"\n [style.top.px]=\"hsvHandleTop()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.role]=\"'slider'\"\n [attr.aria-label]=\"messages().saturationAndValue\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-valuenow]=\"hsv().s\"\n [attr.aria-valuetext]=\"messages().saturationAndValueText(hsv().s ?? 0, hsv().v ?? 0)\"\n [attr.aria-disabled]=\"disabled() || null\"\n (keydown)=\"onHsvHandleKeyDown($event)\"\n (blur)=\"onHsvHandleBlur()\"\n #hsvPointer></div>\n</div>\n<div class=\"flex items-center gap-2\">\n <div class=\"flex flex-1 flex-col gap-1 me-2\">\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"360\"\n [trackBackground]=\"'linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)'\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"hsv().h ?? 0\"\n (valueChange)=\"hueValue$.next($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n @if (opacity()) {\n <mona-slider\n [minValue]=\"0\"\n [maxValue]=\"255\"\n [trackBackground]=\"alphaSliderBackground()\"\n [selectionBackground]=\"'transparent'\"\n [handleClasses]=\"sliderHandleClasses()\"\n [trackSize]=\"sliderHeight\"\n [rounded]=\"rounded()\"\n [value]=\"alpha()\"\n (valueChange)=\"onAlphaChange($event)\"\n (touch)=\"onSliderBlur()\"></mona-slider>\n }\n </div>\n @for (preview of colorPreviews(); track preview.type) {\n <div\n [class]=\"colorPreviewClasses()\"\n [class.cursor-pointer]=\"$index === 1\"\n [style.background-color]=\"preview.color\"\n [attr.title]=\"$index === 1 ? preview.title : null\"\n [attr.aria-label]=\"$index === 1 ? preview.title : null\"\n [attr.aria-hidden]=\"$index === 0 ? 'true' : null\"\n [attr.role]=\"$index === 1 ? 'button' : null\"\n [attr.tabindex]=\"$index === 1 ? 0 : null\"\n (click)=\"preview.onClick?.()\"\n (keydown)=\"onPreviousColorKeyDown($event, preview.onClick)\"></div>\n }\n <button monaButton look=\"ghost\" size=\"small\" [attr.aria-label]=\"messages().clearColor\" (click)=\"onClearClick()\">\n <svg lucideDropletOff [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n</div>\n<div class=\"flex flex-col gap-2\">\n @if (showColorInputs()) {\n <div class=\"flex gap-2\">\n <div class=\"flex gap-1\">\n @for (input of colorInputs(); track input.key) {\n <mona-numeric-text-box\n [value]=\"input.value\"\n [minValue]=\"input.min\"\n [maxValue]=\"input.max\"\n [decimals]=\"0\"\n [spinners]=\"false\"\n [nullable]=\"false\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n class=\"w-18\"\n (valueChange)=\"input.change($event)\"\n (inputBlur)=\"onNumericInputBlur()\">\n <ng-template monaNumericTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: input.label }\"></ng-container>\n </ng-template>\n </mona-numeric-text-box>\n }\n </div>\n <div class=\"flex flex-1 items-center justify-end\">\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n size=\"small\"\n [attr.aria-label]=\"messages().switchColorMode\"\n (click)=\"onSwitchColorModeClick()\">\n <svg lucideChevronsUpDown [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n </div>\n </div>\n }\n @if (showHexInput()) {\n <mona-text-box\n [rounded]=\"rounded()\"\n [value]=\"hex()\"\n (valueChange)=\"onHexChange($event)\"\n (inputBlur)=\"onHexInputBlur()\"\n (inputFocus)=\"onHexInputFocus()\"\n class=\"w-full\">\n <ng-template monaTextBoxPrefixTemplate>\n <ng-container\n [ngTemplateOutlet]=\"numericInputPrefixTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: 'HEX', classes: 'w-auto px-2' }\"></ng-container>\n </ng-template>\n <ng-template monaTextBoxSuffixTemplate>\n <mona-dropdown-button look=\"ghost\" [iconOnly]=\"true\" [aria-label]=\"messages().copyColor\" class=\"h-full\">\n <ng-template monaDropdownButtonTextTemplate>\n <svg lucideCopy [size]=\"12\"></svg>\n </ng-template>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsHex\"\n (menuClick)=\"onCopyColorSelect('hex')\"></mona-dropdown-button-item>\n <mona-dropdown-button-item\n [label]=\"messages().copyAsRgb\"\n (menuClick)=\"onCopyColorSelect('rgb')\"></mona-dropdown-button-item>\n </mona-dropdown-button>\n </ng-template>\n </mona-text-box>\n }\n @if (showButtons()) {\n <div class=\"flex items-center justify-end gap-2\">\n <button monaButton [rounded]=\"rounded()\" look=\"primary\" (click)=\"onApply()\">{{ messages().apply }}</button>\n <button monaButton [rounded]=\"rounded()\" (click)=\"onCancel()\">{{ messages().cancel }}</button>\n </div>\n }\n</div>\n\n<ng-template #numericInputPrefixTemplate let-text let-classes=\"classes\">\n <span\n [class]=\"classes\"\n class=\"inline-flex items-center justify-center select-none w-7.5 [background-color:var(--mona-input-addon-background,var(--color-secondary))] h-full text-foreground text-xs font-semibold border-e border-e-input-border\"\n >{{ text }}</span\n >\n</ng-template>\n" }]
816
817
  }], ctorParameters: () => [], propDecorators: { hsvHandle: [{ type: i0.ViewChild, args: ["hsvPointer", { isSignal: true }] }], hsvRectangle: [{ type: i0.ViewChild, args: ["hsvRectangle", { isSignal: true }] }], apply: [{ type: i0.Output, args: ["apply"] }], cancel: [{ type: i0.Output, args: ["cancel"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showButtons: [{ type: i0.Input, args: [{ isSignal: true, alias: "showButtons", required: false }] }], showHexInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHexInput", required: false }] }], showColorInputs: [{ type: i0.Input, args: [{ isSignal: true, alias: "showColorInputs", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
817
818
 
818
819
  /*
@@ -1,11 +1,9 @@
1
1
  import { NgTemplateOutlet } from '@angular/common';
2
2
  import * as i0 from '@angular/core';
3
- import { forwardRef, Directive, inject, DestroyRef, signal, contentChildren, contentChild, TemplateRef, computed, viewChild, input, output, effect, afterNextRender, ElementRef, Component } from '@angular/core';
4
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3
+ import { forwardRef, Directive, signal, inject, DOCUMENT, contentChildren, contentChild, TemplateRef, computed, viewChild, input, output, effect, afterRenderEffect, ElementRef, untracked, Component } from '@angular/core';
5
4
  import { PopupMenuGroupTemplateDirective, PopupMenuTemplateOrigin, PopupMenuGroupTemplateToken, PopupMenuIconTemplateDirective, PopupMenuIconTemplateToken, PopupMenuShortcutTemplateDirective, PopupMenuShortcutTemplateToken, PopupMenuTextTemplateDirective, PopupMenuTextTemplateToken, PopupMenuItemType, PopupMenuTemplateType, ensurePopupComponentTypes, PopupMenuOrigin, ensurePopupTemplateTypes, PopupMenuToken, PopupMenuComponent, PopupMenuGroupComponent, PopupMenuCheckboxItemComponent, PopupMenuItemComponent, PopupMenuRadioGroupComponent, PopupMenuRadioItemComponent, PopupMenuRadioItemToken, PopupMenuSeparatorComponent } from '@nanahoshi/mona-ui/popup-menu';
6
5
  import { createElementControlId } from '@nanahoshi/mona-ui/internal';
7
6
  import { any } from '@mirei/ts-collections';
8
- import { fromEvent } from 'rxjs';
9
7
 
10
8
  class ContextMenuGroupTemplateDirective extends PopupMenuGroupTemplateDirective {
11
9
  constructor() {
@@ -142,11 +140,39 @@ const ensureContextMenuTemplateTypes = (templates) => {
142
140
  });
143
141
  };
144
142
 
143
+ /**
144
+ * Roles that allow both `aria-haspopup` and `aria-expanded`. On any other target (a `div`, a `section`, a table row)
145
+ * the attributes are invalid, so the menu leaves them off: context menus are found through the ContextMenu key and
146
+ * Shift+F10, not through `aria-haspopup`.
147
+ */
148
+ const POPUP_ROLES = new Set(["button", "gridcell", "link", "menuitem", "tab", "treeitem"]);
149
+ const MANAGED_ATTRIBUTES = ["aria-controls", "aria-expanded", "aria-haspopup"];
150
+ const roleOf = (element) => {
151
+ const explicit = element.getAttribute("role")?.trim().split(/\s+/)[0];
152
+ if (explicit) {
153
+ return explicit;
154
+ }
155
+ if (element instanceof HTMLButtonElement) {
156
+ return "button";
157
+ }
158
+ if (element instanceof HTMLAnchorElement && element.hasAttribute("href")) {
159
+ return "link";
160
+ }
161
+ if (element instanceof HTMLInputElement && ["button", "image", "reset", "submit"].includes(element.type)) {
162
+ return "button";
163
+ }
164
+ return null;
165
+ };
145
166
  class ContextMenuComponent {
146
- #destroyRef;
167
+ /** The target, while it has a role that allows the popup attributes. */
168
+ #ariaTarget;
169
+ #document;
147
170
  #isMenuOpen;
148
171
  constructor() {
149
- this.#destroyRef = inject(DestroyRef);
172
+ /** The target, while it has a role that allows the popup attributes. */
173
+ this.#ariaTarget = signal(null, /* @ts-ignore */
174
+ ...(ngDevMode ? [{ debugName: "#ariaTarget" }] : /* istanbul ignore next */ []));
175
+ this.#document = inject(DOCUMENT);
150
176
  this.#isMenuOpen = signal(false, /* @ts-ignore */
151
177
  ...(ngDevMode ? [{ debugName: "#isMenuOpen" }] : /* istanbul ignore next */ []));
152
178
  this.menuItemComponents = contentChildren(PopupMenuToken, { ...(ngDevMode ? { debugName: "menuItemComponents" } : /* istanbul ignore next */ {}), descendants: false });
@@ -171,8 +197,7 @@ class ContextMenuComponent {
171
197
  this.textTemplate = contentChild(ContextMenuTextTemplateDirective, { ...(ngDevMode ? { debugName: "textTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef,
172
198
  descendants: false });
173
199
  /**
174
- * @description Reserved for an ARIA label on the context menu.
175
- * Not currently applied to the target element or the rendered menu.
200
+ * @description Accessible name for the menu. When empty, the menu is named by the target if it has an `id`.
176
201
  */
177
202
  this.ariaLabel = input("", /* @ts-ignore */
178
203
  ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
@@ -203,7 +228,10 @@ class ContextMenuComponent {
203
228
  this.size = input("medium", /* @ts-ignore */
204
229
  ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
205
230
  /**
206
- * @description The target element that will be used to trigger the context menu.
231
+ * @description The target element that will be used to trigger the context menu. It can change: the menu, its
232
+ * keyboard shortcuts and its ARIA attributes follow. `aria-haspopup`, `aria-expanded` and `aria-controls` are set
233
+ * only on targets whose role allows them (button, link, gridcell, menuitem, tab, treeitem), and are put back
234
+ * when the target changes or the menu is destroyed.
207
235
  */
208
236
  this.target = input.required(/* @ts-ignore */
209
237
  ...(ngDevMode ? [{ debugName: "target" }] : /* istanbul ignore next */ []));
@@ -214,62 +242,88 @@ class ContextMenuComponent {
214
242
  this.width = input(/* @ts-ignore */
215
243
  ...(ngDevMode ? [undefined, { debugName: "width" }] : /* istanbul ignore next */ []));
216
244
  effect(() => ensureContextMenuComponentTypes(this.menuItemComponents()));
217
- afterNextRender({
218
- read: () => {
219
- this.setTargetAriaAttributes();
220
- this.setKeyboardEvents();
245
+ // After render, so the target's own host bindings (a monaButton's aria-haspopup) have run and don't undo it.
246
+ afterRenderEffect(onCleanup => {
247
+ const target = this.target();
248
+ const element = target instanceof ElementRef ? target.nativeElement : target;
249
+ if (!element) {
250
+ return;
221
251
  }
252
+ onCleanup(untracked(() => this.#attachTo(element)));
253
+ });
254
+ effect(() => {
255
+ const element = this.#ariaTarget();
256
+ const open = this.#isMenuOpen();
257
+ if (!element) {
258
+ return;
259
+ }
260
+ element.setAttribute("aria-expanded", String(open));
261
+ if (open) {
262
+ element.setAttribute("aria-controls", this.menuId);
263
+ }
264
+ else {
265
+ element.removeAttribute("aria-controls");
266
+ }
267
+ });
268
+ effect(onCleanup => {
269
+ const view = this.#document.defaultView;
270
+ if (!this.#isMenuOpen() || !view) {
271
+ return;
272
+ }
273
+ // Like a native context menu, it closes when the window loses focus.
274
+ const close = () => this.popupMenuRef()?.closeMenu();
275
+ view.addEventListener("blur", close);
276
+ onCleanup(() => view.removeEventListener("blur", close));
222
277
  });
223
278
  }
224
279
  onMenuClose() {
225
280
  this.#isMenuOpen.set(false);
226
- this.updateTargetAriaAttributes();
227
281
  }
228
282
  onMenuOpen() {
229
283
  this.#isMenuOpen.set(true);
230
- this.updateTargetAriaAttributes();
231
284
  }
232
- openMenuViaKeyboard() {
233
- const popupMenu = this.popupMenuRef();
234
- if (popupMenu && !this.#isMenuOpen()) {
235
- popupMenu.openMenuViaKeyboard(true);
236
- }
237
- }
238
- setKeyboardEvents() {
239
- const target = this.target();
240
- const targetElement = target instanceof ElementRef ? target.nativeElement : target;
241
- if (!targetElement) {
242
- return;
243
- }
244
- fromEvent(targetElement, "keydown")
245
- .pipe(takeUntilDestroyed(this.#destroyRef))
246
- .subscribe(event => {
285
+ /**
286
+ * Listens for the keyboard shortcuts on the target and, when its role allows them, sets the popup attributes.
287
+ * Returns the cleanup that undoes both.
288
+ */
289
+ #attachTo(element) {
290
+ const onKeydown = (event) => {
247
291
  if (event.key === "ContextMenu" || (event.key === "F10" && event.shiftKey)) {
248
292
  event.preventDefault();
249
293
  this.openMenuViaKeyboard();
250
294
  }
251
- });
252
- }
253
- setTargetAriaAttributes() {
254
- const target = this.target();
255
- const targetElement = target instanceof ElementRef ? target.nativeElement : target;
256
- if (!targetElement) {
257
- return;
295
+ };
296
+ element.addEventListener("keydown", onKeydown);
297
+ const role = roleOf(element);
298
+ const managed = role !== null && POPUP_ROLES.has(role);
299
+ const previous = MANAGED_ATTRIBUTES.map(name => [name, element.getAttribute(name)]);
300
+ if (managed) {
301
+ element.setAttribute("aria-haspopup", "menu");
302
+ this.#ariaTarget.set(element);
258
303
  }
259
- targetElement.setAttribute("aria-haspopup", "menu");
260
- targetElement.setAttribute("aria-controls", this.menuId);
261
- this.updateTargetAriaAttributes();
304
+ return () => {
305
+ element.removeEventListener("keydown", onKeydown);
306
+ if (managed) {
307
+ this.#ariaTarget.set(null);
308
+ for (const [name, value] of previous) {
309
+ if (value === null) {
310
+ element.removeAttribute(name);
311
+ }
312
+ else {
313
+ element.setAttribute(name, value);
314
+ }
315
+ }
316
+ }
317
+ };
262
318
  }
263
- updateTargetAriaAttributes() {
264
- const target = this.target();
265
- const targetElement = target instanceof ElementRef ? target.nativeElement : target;
266
- if (!targetElement) {
267
- return;
319
+ openMenuViaKeyboard() {
320
+ const popupMenu = this.popupMenuRef();
321
+ if (popupMenu && !this.#isMenuOpen()) {
322
+ popupMenu.openMenuViaKeyboard(true);
268
323
  }
269
- targetElement.setAttribute("aria-expanded", this.#isMenuOpen().toString());
270
324
  }
271
325
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ContextMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
272
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ContextMenuComponent, isStandalone: true, selector: "mona-contextmenu", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", 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 }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { menuClick: "menuClick" }, queries: [{ propertyName: "menuItemComponents", predicate: PopupMenuToken, isSignal: true }, { propertyName: "groupTemplate", first: true, predicate: ContextMenuGroupTemplateDirective, read: TemplateRef, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: ContextMenuIconTemplateDirective, read: TemplateRef, isSignal: true }, { propertyName: "shortcutTemplate", first: true, predicate: ContextMenuShortcutTemplateDirective, read: TemplateRef, isSignal: true }, { propertyName: "textTemplate", first: true, predicate: ContextMenuTextTemplateDirective, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupMenuRef", first: true, predicate: ["popupMenu"], descendants: true, isSignal: true }], ngImport: i0, template: "<mona-popup-menu\n [target]=\"target()\"\n [trigger]=\"'contextmenu'\"\n [items]=\"menuItems()\"\n [minWidth]=\"minWidth()\"\n [width]=\"width()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [precise]=\"true\"\n (menuClick)=\"menuClick.emit($event)\"\n (open)=\"onMenuOpen()\"\n (close)=\"onMenuClose()\"\n [id]=\"menuId\"\n #popupMenu>\n @if (groupTemplate()) {\n <ng-template monaPopupMenuGroupTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (iconTemplate()) {\n <ng-template monaPopupMenuIconTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n @if (shortcutTemplate()) {\n <ng-template monaPopupMenuShortcutTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"shortcutTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n @if (textTemplate()) {\n <ng-template monaPopupMenuTextTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"textTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n</mona-popup-menu>\n", dependencies: [{ kind: "component", type: PopupMenuComponent, selector: "mona-popup-menu", inputs: ["anchor", "anchorConnectionPoint", "items", "id", "minWidth", "offset", "popupConnectionPoint", "precise", "rounded", "size", "target", "trigger", "width", "class"], outputs: ["close", "menuClick", "navigate", "open"] }, { kind: "directive", type: PopupMenuTextTemplateDirective, selector: "ng-template[monaPopupMenuTextTemplate]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: PopupMenuIconTemplateDirective, selector: "ng-template[monaPopupMenuIconTemplate]" }, { kind: "directive", type: PopupMenuShortcutTemplateDirective, selector: "ng-template[monaPopupMenuShortcutTemplate]" }, { kind: "directive", type: PopupMenuGroupTemplateDirective, selector: "ng-template[monaPopupMenuGroupTemplate]" }] }); }
326
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ContextMenuComponent, isStandalone: true, selector: "mona-contextmenu", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", 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 }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { menuClick: "menuClick" }, queries: [{ propertyName: "menuItemComponents", predicate: PopupMenuToken, isSignal: true }, { propertyName: "groupTemplate", first: true, predicate: ContextMenuGroupTemplateDirective, read: TemplateRef, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: ContextMenuIconTemplateDirective, read: TemplateRef, isSignal: true }, { propertyName: "shortcutTemplate", first: true, predicate: ContextMenuShortcutTemplateDirective, read: TemplateRef, isSignal: true }, { propertyName: "textTemplate", first: true, predicate: ContextMenuTextTemplateDirective, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupMenuRef", first: true, predicate: ["popupMenu"], descendants: true, isSignal: true }], ngImport: i0, template: "<mona-popup-menu\n [target]=\"target()\"\n [ariaLabel]=\"ariaLabel()\"\n [trigger]=\"'contextmenu'\"\n [items]=\"menuItems()\"\n [minWidth]=\"minWidth()\"\n [width]=\"width()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [precise]=\"true\"\n (menuClick)=\"menuClick.emit($event)\"\n (open)=\"onMenuOpen()\"\n (close)=\"onMenuClose()\"\n [id]=\"menuId\"\n #popupMenu>\n @if (groupTemplate()) {\n <ng-template monaPopupMenuGroupTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (iconTemplate()) {\n <ng-template monaPopupMenuIconTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n @if (shortcutTemplate()) {\n <ng-template monaPopupMenuShortcutTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"shortcutTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n @if (textTemplate()) {\n <ng-template monaPopupMenuTextTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"textTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n</mona-popup-menu>\n", dependencies: [{ kind: "component", type: PopupMenuComponent, selector: "mona-popup-menu", inputs: ["anchor", "anchorConnectionPoint", "ariaLabel", "ariaLabelledBy", "items", "id", "minWidth", "offset", "popupConnectionPoint", "precise", "rounded", "size", "target", "trigger", "class", "width"], outputs: ["close", "menuClick", "navigate", "open"] }, { kind: "directive", type: PopupMenuTextTemplateDirective, selector: "ng-template[monaPopupMenuTextTemplate]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: PopupMenuIconTemplateDirective, selector: "ng-template[monaPopupMenuIconTemplate]" }, { kind: "directive", type: PopupMenuShortcutTemplateDirective, selector: "ng-template[monaPopupMenuShortcutTemplate]" }, { kind: "directive", type: PopupMenuGroupTemplateDirective, selector: "ng-template[monaPopupMenuGroupTemplate]" }] }); }
273
327
  }
274
328
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ContextMenuComponent, decorators: [{
275
329
  type: Component,
@@ -280,7 +334,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
280
334
  PopupMenuIconTemplateDirective,
281
335
  PopupMenuShortcutTemplateDirective,
282
336
  PopupMenuGroupTemplateDirective
283
- ], template: "<mona-popup-menu\n [target]=\"target()\"\n [trigger]=\"'contextmenu'\"\n [items]=\"menuItems()\"\n [minWidth]=\"minWidth()\"\n [width]=\"width()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [precise]=\"true\"\n (menuClick)=\"menuClick.emit($event)\"\n (open)=\"onMenuOpen()\"\n (close)=\"onMenuClose()\"\n [id]=\"menuId\"\n #popupMenu>\n @if (groupTemplate()) {\n <ng-template monaPopupMenuGroupTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (iconTemplate()) {\n <ng-template monaPopupMenuIconTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n @if (shortcutTemplate()) {\n <ng-template monaPopupMenuShortcutTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"shortcutTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n @if (textTemplate()) {\n <ng-template monaPopupMenuTextTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"textTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n</mona-popup-menu>\n" }]
337
+ ], template: "<mona-popup-menu\n [target]=\"target()\"\n [ariaLabel]=\"ariaLabel()\"\n [trigger]=\"'contextmenu'\"\n [items]=\"menuItems()\"\n [minWidth]=\"minWidth()\"\n [width]=\"width()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [precise]=\"true\"\n (menuClick)=\"menuClick.emit($event)\"\n (open)=\"onMenuOpen()\"\n (close)=\"onMenuClose()\"\n [id]=\"menuId\"\n #popupMenu>\n @if (groupTemplate()) {\n <ng-template monaPopupMenuGroupTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (iconTemplate()) {\n <ng-template monaPopupMenuIconTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"iconTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n @if (shortcutTemplate()) {\n <ng-template monaPopupMenuShortcutTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"shortcutTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n @if (textTemplate()) {\n <ng-template monaPopupMenuTextTemplate let-item>\n <ng-container\n [ngTemplateOutlet]=\"textTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"></ng-container>\n </ng-template>\n }\n</mona-popup-menu>\n" }]
284
338
  }], ctorParameters: () => [], propDecorators: { menuItemComponents: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PopupMenuToken), { ...{ descendants: false }, isSignal: true }] }], groupTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ContextMenuGroupTemplateDirective), { ...{
285
339
  read: TemplateRef,
286
340
  descendants: false