@nanahoshi/mona-ui 0.34.0 → 0.35.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.
Files changed (80) hide show
  1. package/alert/package.json +4 -0
  2. package/badge/package.json +4 -0
  3. package/docs/alert.md +219 -0
  4. package/docs/api/alert.md +78 -0
  5. package/docs/api/avatar.md +25 -0
  6. package/docs/api/badge.md +24 -0
  7. package/docs/api/common.md +2 -2
  8. package/docs/api/i18n.md +45 -0
  9. package/docs/api/locales.md +14 -14
  10. package/docs/api/multi-select.md +2 -0
  11. package/docs/api/separator.md +23 -0
  12. package/docs/api/toolbar.md +81 -0
  13. package/docs/avatar.md +108 -6
  14. package/docs/badge.md +181 -0
  15. package/docs/multi-select.md +54 -0
  16. package/docs/separator.md +147 -0
  17. package/docs/sidebar-menus.md +1 -1
  18. package/docs/toolbar.md +327 -0
  19. package/fesm2022/nanahoshi-mona-ui-alert.mjs +422 -0
  20. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +182 -3
  21. package/fesm2022/nanahoshi-mona-ui-badge.mjs +273 -0
  22. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  23. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +3 -0
  24. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +3 -0
  25. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +3 -0
  26. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +3 -0
  27. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +3 -0
  28. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +3 -0
  29. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +3 -0
  30. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +3 -0
  31. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +3 -0
  32. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +3 -0
  33. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +3 -0
  34. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +3 -0
  35. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +3 -0
  36. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +3 -0
  37. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +83 -2
  38. package/fesm2022/nanahoshi-mona-ui-separator.mjs +165 -0
  39. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +3 -3
  40. package/fesm2022/nanahoshi-mona-ui-toolbar.mjs +536 -0
  41. package/i18n/catalogs/en-US.messages.json +9 -0
  42. package/llms.txt +11 -3
  43. package/locales/ar-sa/ar-sa.messages.json +9 -0
  44. package/locales/de-de/de-de.messages.json +9 -0
  45. package/locales/es-es/es-es.messages.json +9 -0
  46. package/locales/fr-fr/fr-fr.messages.json +9 -0
  47. package/locales/id-id/id-id.messages.json +9 -0
  48. package/locales/it-it/it-it.messages.json +9 -0
  49. package/locales/ja-jp/ja-jp.messages.json +9 -0
  50. package/locales/ko-kr/ko-kr.messages.json +9 -0
  51. package/locales/pl-pl/pl-pl.messages.json +9 -0
  52. package/locales/pt-br/pt-br.messages.json +9 -0
  53. package/locales/ru-ru/ru-ru.messages.json +9 -0
  54. package/locales/tr-tr/tr-tr.messages.json +9 -0
  55. package/locales/zh-cn/zh-cn.messages.json +9 -0
  56. package/locales/zh-tw/zh-tw.messages.json +9 -0
  57. package/package.json +17 -1
  58. package/separator/package.json +4 -0
  59. package/toolbar/package.json +4 -0
  60. package/types/nanahoshi-mona-ui-alert.d.ts +144 -0
  61. package/types/nanahoshi-mona-ui-avatar.d.ts +66 -0
  62. package/types/nanahoshi-mona-ui-badge.d.ts +82 -0
  63. package/types/nanahoshi-mona-ui-i18n.d.ts +24 -0
  64. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +9 -0
  65. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +9 -0
  66. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +9 -0
  67. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +9 -0
  68. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +9 -0
  69. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +9 -0
  70. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +9 -0
  71. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +9 -0
  72. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +9 -0
  73. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +9 -0
  74. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +9 -0
  75. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +9 -0
  76. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +9 -0
  77. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +9 -0
  78. package/types/nanahoshi-mona-ui-multi-select.d.ts +27 -0
  79. package/types/nanahoshi-mona-ui-separator.d.ts +66 -0
  80. package/types/nanahoshi-mona-ui-toolbar.d.ts +183 -0
@@ -0,0 +1,183 @@
1
+ import { MonaToolbarMessages } from "@nanahoshi/mona-ui/i18n";
2
+ import * as i0 from "@angular/core";
3
+ import { ElementRef } from "@angular/core";
4
+ import { ClassInputType, PreventableEvent } from "@nanahoshi/mona-ui/common";
5
+ import { MenuItem, PopupMenuItemClickEvent } from "@nanahoshi/mona-ui/popup-menu";
6
+ import { VariantProps } from "class-variance-authority";
7
+ export declare const TOOLBAR_DEFAULT_MESSAGES: MonaToolbarMessages;
8
+ /** Whether a toolbar item moves into the More menu when there's no room for it (`auto`) or stays (`never`). */
9
+ type ToolbarItemOverflow = "auto" | "never";
10
+ /**
11
+ * @description Marks a control directly inside `<mona-toolbar>` as one that moves into the toolbar's More menu when
12
+ * there's no room for it, last ones first. In the menu it's an item with the control's text, disabled with it and
13
+ * checked while it's pressed, and choosing it clicks the control.
14
+ */
15
+ export declare class ToolbarItemDirective {
16
+ #private;
17
+ /** @hidden */
18
+ readonly element: HTMLElement;
19
+ /**
20
+ * Whether the item is in the More menu rather than in the toolbar.
21
+ * @hidden
22
+ */
23
+ readonly hidden: import("@angular/core").Signal<boolean>;
24
+ /**
25
+ * @description Whether the item can move into the More menu: `auto` when there's no room for it, `never` to keep it in
26
+ * the toolbar, such as a search box.
27
+ * @default "auto"
28
+ */
29
+ readonly overflow: import("@angular/core").InputSignalWithTransform<ToolbarItemOverflow, "" | ToolbarItemOverflow | null | undefined>;
30
+ /**
31
+ * @description Emitted when the item is chosen from the More menu. Unless it's prevented, the toolbar then clicks the
32
+ * control, which suits a button. Handle it for a control a click doesn't operate, or keep that control in the toolbar
33
+ * with `overflow="never"`.
34
+ */
35
+ readonly overflowActivate: import("@angular/core").OutputEmitterRef<PreventableEvent<Event>>;
36
+ /**
37
+ * @description The item's text in the More menu. Without it, the menu uses the control's `aria-label`, then its text.
38
+ * @default ""
39
+ */
40
+ readonly overflowText: import("@angular/core").InputSignal<string>;
41
+ /**
42
+ * Runs the item's action for its menu item: `overflowActivate`, then a click unless that's prevented.
43
+ * @hidden
44
+ */
45
+ activate(originalEvent?: Event): void;
46
+ /**
47
+ * The item's text in the More menu.
48
+ * @hidden
49
+ */
50
+ getMenuText(): string;
51
+ /**
52
+ * Whether the control can't be operated, so its menu item can't either.
53
+ * @hidden
54
+ */
55
+ isDisabled(): boolean;
56
+ /**
57
+ * Whether the item is a divider, which the menu draws as its own.
58
+ * @hidden
59
+ */
60
+ isSeparator(): boolean;
61
+ /**
62
+ * The control's pressed state, or `null` for a control that isn't a toggle.
63
+ * @hidden
64
+ */
65
+ pressed(): boolean | null;
66
+ /**
67
+ * Shows or hides the item in the toolbar at once, so the toolbar can measure what fits in the same frame.
68
+ * @hidden
69
+ */
70
+ setHidden(hidden: boolean): void;
71
+ static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarItemDirective, never>;
72
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ToolbarItemDirective, "[monaToolbarItem]", never, {
73
+ "overflow": {
74
+ "alias": "monaToolbarItem";
75
+ "required": false;
76
+ "isSignal": true;
77
+ };
78
+ "overflowText": {
79
+ "alias": "overflowText";
80
+ "required": false;
81
+ "isSignal": true;
82
+ };
83
+ }, {
84
+ "overflowActivate": "overflowActivate";
85
+ }, never, never, true, never>;
86
+ }
87
+ /** What a toolbar does with items that don't fit: moves them into a More menu, or wraps them onto more rows. */
88
+ type ToolbarOverflow = "menu" | "wrap";
89
+ /**
90
+ * A row of controls, such as formatting buttons, that's one Tab stop: the arrow keys move between its controls. Items
91
+ * marked `monaToolbarItem` that don't fit move into a More menu at the end, last ones first, and come back as the row
92
+ * widens.
93
+ */
94
+ export declare class ToolbarComponent {
95
+ #private;
96
+ protected readonly baseClass: import("@angular/core").Signal<string>;
97
+ protected readonly items: import("@angular/core").Signal<readonly ToolbarItemDirective[]>;
98
+ protected readonly menuId: string;
99
+ /** The More menu, read from the hidden controls each time it opens, so their text and states are current. */
100
+ protected readonly menuItems: import("@angular/core").WritableSignal<MenuItem[]>;
101
+ protected readonly menuOpen: import("@angular/core").WritableSignal<boolean>;
102
+ protected readonly messages: import("@angular/core").Signal<import("@nanahoshi/mona-ui/i18n").MonaToolbarMessages>;
103
+ protected readonly moreButton: import("@angular/core").Signal<ElementRef<HTMLButtonElement> | undefined>;
104
+ protected readonly moreButtonId: string;
105
+ protected readonly rightToLeft: import("@angular/core").WritableSignal<boolean>;
106
+ /**
107
+ * @description Accessible name of the toolbar, such as "Formatting". A toolbar needs a name, from this or
108
+ * `aria-labelledby`, since assistive technology announces it on the way in.
109
+ * @default ""
110
+ */
111
+ readonly ariaLabel: import("@angular/core").InputSignal<string>;
112
+ /**
113
+ * @description ID of the element whose text names the toolbar, such as a visible heading.
114
+ * @default ""
115
+ */
116
+ readonly ariaLabelledBy: import("@angular/core").InputSignal<string>;
117
+ /**
118
+ * @description Name of the More button, in place of the localized "More".
119
+ * @default ""
120
+ */
121
+ readonly moreLabel: import("@angular/core").InputSignal<string>;
122
+ /**
123
+ * @description What happens to items that don't fit: `menu` moves the `monaToolbarItem`s into a More menu at the end,
124
+ * last ones first, and `wrap` puts the controls on more rows.
125
+ * @default "menu"
126
+ */
127
+ readonly overflow: import("@angular/core").InputSignal<ToolbarOverflow>;
128
+ /**
129
+ * @description The space between controls and the size of the More button. Match it to the controls' size.
130
+ * @default "medium"
131
+ */
132
+ readonly size: import("@angular/core").InputSignal<NonNullable<"small" | "medium" | "large" | null | undefined>>;
133
+ /**
134
+ * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
135
+ * @default ""
136
+ */
137
+ readonly userClass: import("@angular/core").InputSignalWithTransform<string, ClassInputType>;
138
+ constructor();
139
+ protected onFocusIn(event: FocusEvent): void;
140
+ protected onKeydown(event: KeyboardEvent): void;
141
+ protected onMenuClick(event: PopupMenuItemClickEvent): void;
142
+ protected onMenuOpen(): void;
143
+ static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarComponent, never>;
144
+ static ɵcmp: i0.ɵɵComponentDeclaration<ToolbarComponent, "mona-toolbar", never, {
145
+ "ariaLabel": {
146
+ "alias": "aria-label";
147
+ "required": false;
148
+ "isSignal": true;
149
+ };
150
+ "ariaLabelledBy": {
151
+ "alias": "aria-labelledby";
152
+ "required": false;
153
+ "isSignal": true;
154
+ };
155
+ "moreLabel": {
156
+ "alias": "moreLabel";
157
+ "required": false;
158
+ "isSignal": true;
159
+ };
160
+ "overflow": {
161
+ "alias": "overflow";
162
+ "required": false;
163
+ "isSignal": true;
164
+ };
165
+ "size": {
166
+ "alias": "size";
167
+ "required": false;
168
+ "isSignal": true;
169
+ };
170
+ "userClass": {
171
+ "alias": "class";
172
+ "required": false;
173
+ "isSignal": true;
174
+ };
175
+ }, {}, ["items"], ["*"], true, never>;
176
+ }
177
+ /** Children keep their width, so what doesn't fit overflows and can be measured, instead of squeezing. */
178
+ declare const toolbarThemeVariants: (props?: ({
179
+ overflow?: "menu" | "wrap" | null | undefined;
180
+ size?: "small" | "medium" | "large" | null | undefined;
181
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
182
+ type ToolbarVariantProps = VariantProps<typeof toolbarThemeVariants>;
183
+ export type { ToolbarItemOverflow, ToolbarOverflow, ToolbarVariantProps };