@nanahoshi/mona-ui 0.34.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) 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 +3 -3
  8. package/docs/api/i18n.md +71 -5
  9. package/docs/api/locales.md +14 -14
  10. package/docs/api/masked-text-box.md +137 -0
  11. package/docs/api/multi-select.md +3 -0
  12. package/docs/api/separator.md +23 -0
  13. package/docs/api/toolbar.md +81 -0
  14. package/docs/avatar.md +108 -6
  15. package/docs/badge.md +181 -0
  16. package/docs/masked-textbox.md +334 -0
  17. package/docs/multi-select.md +120 -0
  18. package/docs/separator.md +147 -0
  19. package/docs/sidebar-menus.md +1 -1
  20. package/docs/toolbar.md +327 -0
  21. package/fesm2022/nanahoshi-mona-ui-alert.mjs +422 -0
  22. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +182 -3
  23. package/fesm2022/nanahoshi-mona-ui-badge.mjs +273 -0
  24. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +20 -1
  25. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +54 -15
  26. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +13 -1
  27. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +13 -1
  28. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +13 -1
  29. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +13 -1
  30. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +13 -1
  31. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +13 -1
  32. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +13 -1
  33. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +13 -1
  34. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +13 -1
  35. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +13 -1
  36. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +13 -1
  37. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +13 -1
  38. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +13 -1
  39. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +13 -1
  40. package/fesm2022/nanahoshi-mona-ui-masked-text-box.mjs +1302 -0
  41. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +112 -3
  42. package/fesm2022/nanahoshi-mona-ui-separator.mjs +165 -0
  43. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +3 -3
  44. package/fesm2022/nanahoshi-mona-ui-toolbar.mjs +536 -0
  45. package/i18n/catalogs/en-US.messages.json +19 -1
  46. package/llms.txt +13 -3
  47. package/locales/ar-sa/ar-sa.messages.json +19 -1
  48. package/locales/de-de/de-de.messages.json +19 -1
  49. package/locales/es-es/es-es.messages.json +19 -1
  50. package/locales/fr-fr/fr-fr.messages.json +19 -1
  51. package/locales/id-id/id-id.messages.json +19 -1
  52. package/locales/it-it/it-it.messages.json +19 -1
  53. package/locales/ja-jp/ja-jp.messages.json +19 -1
  54. package/locales/ko-kr/ko-kr.messages.json +19 -1
  55. package/locales/pl-pl/pl-pl.messages.json +19 -1
  56. package/locales/pt-br/pt-br.messages.json +19 -1
  57. package/locales/ru-ru/ru-ru.messages.json +19 -1
  58. package/locales/tr-tr/tr-tr.messages.json +19 -1
  59. package/locales/zh-cn/zh-cn.messages.json +19 -1
  60. package/locales/zh-tw/zh-tw.messages.json +19 -1
  61. package/masked-text-box/package.json +4 -0
  62. package/package.json +21 -1
  63. package/separator/package.json +4 -0
  64. package/toolbar/package.json +4 -0
  65. package/types/nanahoshi-mona-ui-alert.d.ts +144 -0
  66. package/types/nanahoshi-mona-ui-avatar.d.ts +66 -0
  67. package/types/nanahoshi-mona-ui-badge.d.ts +82 -0
  68. package/types/nanahoshi-mona-ui-i18n.d.ts +44 -0
  69. package/types/nanahoshi-mona-ui-internal-list.d.ts +12 -0
  70. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +18 -0
  71. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +18 -0
  72. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +18 -0
  73. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +18 -0
  74. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +18 -0
  75. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +18 -0
  76. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +18 -0
  77. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +18 -0
  78. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +18 -0
  79. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +18 -0
  80. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +18 -0
  81. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +18 -0
  82. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +18 -0
  83. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +18 -0
  84. package/types/nanahoshi-mona-ui-masked-text-box.d.ts +391 -0
  85. package/types/nanahoshi-mona-ui-multi-select.d.ts +38 -0
  86. package/types/nanahoshi-mona-ui-separator.d.ts +66 -0
  87. package/types/nanahoshi-mona-ui-toolbar.d.ts +183 -0
@@ -0,0 +1,273 @@
1
+ import * as i0 from "@angular/core";
2
+ import { Directive, computed, input } from "@angular/core";
3
+ import { classInputToClass } from "@nanahoshi/mona-ui/common";
4
+ import { twMerge } from "tailwind-merge";
5
+ import { cva } from "class-variance-authority";
6
+ const BADGE_BASE_CLASSES = `
7
+ inline-flex w-fit shrink-0 items-center justify-center gap-1 whitespace-nowrap
8
+ border border-transparent font-medium tabular-nums
9
+ forced-colors:border-[CanvasText]
10
+ [&>svg]:pointer-events-none [&>svg]:shrink-0
11
+ `;
12
+ const badgeThemeVariants = cva(BADGE_BASE_CLASSES, {
13
+ variants: {
14
+ fill: {
15
+ outline: "bg-transparent",
16
+ solid: "",
17
+ subtle: ""
18
+ },
19
+ look: {
20
+ error: "",
21
+ info: "",
22
+ primary: "",
23
+ secondary: "",
24
+ success: "",
25
+ warning: ""
26
+ },
27
+ rounded: {
28
+ full: "rounded-full",
29
+ large: "rounded-lg",
30
+ medium: "rounded-md",
31
+ none: "rounded-none",
32
+ small: "rounded-sm"
33
+ },
34
+ size: {
35
+ small: "h-4 min-w-4 px-1 text-[0.625rem] leading-none [&>svg]:size-2.5",
36
+ medium: "h-5 min-w-5 px-1.5 text-xs [&>svg]:size-3",
37
+ large: "h-6 min-w-6 px-2 text-sm [&>svg]:size-3.5"
38
+ }
39
+ },
40
+ compoundVariants: [
41
+ {
42
+ fill: "solid",
43
+ look: "primary",
44
+ class: "bg-primary text-primary-foreground"
45
+ },
46
+ {
47
+ fill: "solid",
48
+ look: "secondary",
49
+ class: "bg-secondary text-secondary-foreground"
50
+ },
51
+ {
52
+ fill: "solid",
53
+ look: "success",
54
+ class: "bg-success text-success-foreground"
55
+ },
56
+ {
57
+ fill: "solid",
58
+ look: "warning",
59
+ class: "bg-warning text-warning-foreground"
60
+ },
61
+ {
62
+ fill: "solid",
63
+ look: "error",
64
+ class: "bg-error text-error-foreground"
65
+ },
66
+ {
67
+ fill: "solid",
68
+ look: "info",
69
+ class: "bg-info text-info-foreground"
70
+ },
71
+ {
72
+ fill: "subtle",
73
+ look: "primary",
74
+ class: "bg-primary-subtle text-primary-subtle-foreground"
75
+ },
76
+ {
77
+ fill: "subtle",
78
+ look: "secondary",
79
+ class: "bg-secondary-subtle text-secondary-subtle-foreground"
80
+ },
81
+ {
82
+ fill: "subtle",
83
+ look: "success",
84
+ class: "bg-success-subtle text-success-subtle-foreground"
85
+ },
86
+ {
87
+ fill: "subtle",
88
+ look: "warning",
89
+ class: "bg-warning-subtle text-warning-subtle-foreground"
90
+ },
91
+ {
92
+ fill: "subtle",
93
+ look: "error",
94
+ class: "bg-error-subtle text-error-subtle-foreground"
95
+ },
96
+ {
97
+ fill: "subtle",
98
+ look: "info",
99
+ class: "bg-info-subtle text-info-subtle-foreground"
100
+ },
101
+ {
102
+ fill: "outline",
103
+ look: "primary",
104
+ class: "border-primary-border text-foreground"
105
+ },
106
+ {
107
+ fill: "outline",
108
+ look: "secondary",
109
+ class: "border-border text-foreground"
110
+ },
111
+ {
112
+ fill: "outline",
113
+ look: "success",
114
+ class: "border-success-border text-foreground"
115
+ },
116
+ {
117
+ fill: "outline",
118
+ look: "warning",
119
+ class: "border-warning-border text-foreground"
120
+ },
121
+ {
122
+ fill: "outline",
123
+ look: "error",
124
+ class: "border-error-border text-foreground"
125
+ },
126
+ {
127
+ fill: "outline",
128
+ look: "info",
129
+ class: "border-info-border text-foreground"
130
+ }
131
+ ],
132
+ defaultVariants: {
133
+ fill: "solid",
134
+ look: "secondary",
135
+ rounded: "medium",
136
+ size: "medium"
137
+ }
138
+ });
139
+ var BadgeDirective = class BadgeDirective {
140
+ constructor() {
141
+ this.baseClass = computed(() => twMerge(badgeThemeVariants({
142
+ fill: this.fill(),
143
+ look: this.look(),
144
+ rounded: this.rounded(),
145
+ size: this.size()
146
+ }), this.userClass()), ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
147
+ this.fill = input("solid", ...ngDevMode ? [{ debugName: "fill" }] : /* istanbul ignore next */ []);
148
+ this.look = input("secondary", ...ngDevMode ? [{ debugName: "look" }] : /* istanbul ignore next */ []);
149
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
150
+ this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
151
+ this.userClass = input("", {
152
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
153
+ alias: "class",
154
+ transform: (value) => classInputToClass(value)
155
+ });
156
+ }
157
+ static {
158
+ this.ɵfac = i0.ɵɵngDeclareFactory({
159
+ minVersion: "12.0.0",
160
+ version: "22.2.6",
161
+ ngImport: i0,
162
+ type: BadgeDirective,
163
+ deps: [],
164
+ target: i0.ɵɵFactoryTarget.Directive
165
+ });
166
+ }
167
+ static {
168
+ this.ɵdir = i0.ɵɵngDeclareDirective({
169
+ minVersion: "17.1.0",
170
+ version: "22.2.6",
171
+ type: BadgeDirective,
172
+ isStandalone: true,
173
+ selector: "[monaBadge]",
174
+ inputs: {
175
+ fill: {
176
+ classPropertyName: "fill",
177
+ publicName: "fill",
178
+ isSignal: true,
179
+ isRequired: false,
180
+ transformFunction: null
181
+ },
182
+ look: {
183
+ classPropertyName: "look",
184
+ publicName: "look",
185
+ isSignal: true,
186
+ isRequired: false,
187
+ transformFunction: null
188
+ },
189
+ rounded: {
190
+ classPropertyName: "rounded",
191
+ publicName: "rounded",
192
+ isSignal: true,
193
+ isRequired: false,
194
+ transformFunction: null
195
+ },
196
+ size: {
197
+ classPropertyName: "size",
198
+ publicName: "size",
199
+ isSignal: true,
200
+ isRequired: false,
201
+ transformFunction: null
202
+ },
203
+ userClass: {
204
+ classPropertyName: "userClass",
205
+ publicName: "class",
206
+ isSignal: true,
207
+ isRequired: false,
208
+ transformFunction: null
209
+ }
210
+ },
211
+ host: { properties: { "class": "baseClass()" } },
212
+ ngImport: i0
213
+ });
214
+ }
215
+ };
216
+ i0.ɵɵngDeclareClassMetadata({
217
+ minVersion: "12.0.0",
218
+ version: "22.2.6",
219
+ ngImport: i0,
220
+ type: BadgeDirective,
221
+ decorators: [{
222
+ type: Directive,
223
+ args: [{
224
+ selector: "[monaBadge]",
225
+ host: { "[class]": "baseClass()" }
226
+ }]
227
+ }],
228
+ propDecorators: {
229
+ fill: [{
230
+ type: i0.Input,
231
+ args: [{
232
+ isSignal: true,
233
+ alias: "fill",
234
+ required: false
235
+ }]
236
+ }],
237
+ look: [{
238
+ type: i0.Input,
239
+ args: [{
240
+ isSignal: true,
241
+ alias: "look",
242
+ required: false
243
+ }]
244
+ }],
245
+ rounded: [{
246
+ type: i0.Input,
247
+ args: [{
248
+ isSignal: true,
249
+ alias: "rounded",
250
+ required: false
251
+ }]
252
+ }],
253
+ size: [{
254
+ type: i0.Input,
255
+ args: [{
256
+ isSignal: true,
257
+ alias: "size",
258
+ required: false
259
+ }]
260
+ }],
261
+ userClass: [{
262
+ type: i0.Input,
263
+ args: [{
264
+ isSignal: true,
265
+ alias: "class",
266
+ required: false
267
+ }]
268
+ }]
269
+ }
270
+ });
271
+ export { BADGE_BASE_CLASSES, BadgeDirective };
272
+
273
+ //# sourceMappingURL=nanahoshi-mona-ui-badge.mjs.map
@@ -1,7 +1,16 @@
1
1
  import { isDevMode } from "@angular/core";
2
2
  import { MONA_FALLBACK_LOCALE_ID, canonicalizeLocaleId, formatNumber, tryCanonicalizeLocaleId } from "@nanahoshi/mona-ui/i18n";
3
3
  const MONA_MESSAGE_PARAMETERS = {
4
+ alert: { dismissLabel: [{
5
+ name: "title",
6
+ optional: true,
7
+ type: "string"
8
+ }] },
4
9
  autoComplete: { clear: null },
10
+ avatar: { moreLabel: [{
11
+ name: "count",
12
+ type: "number"
13
+ }] },
5
14
  breadcrumb: {
6
15
  breadcrumb: null,
7
16
  showFullPath: null
@@ -907,6 +916,14 @@ const MONA_MESSAGE_PARAMETERS = {
907
916
  type: "string"
908
917
  }]
909
918
  },
919
+ maskedTextBox: {
920
+ characterNotAllowed: null,
921
+ clear: null,
922
+ digitOnly: null,
923
+ digitOrSignOnly: null,
924
+ letterOnly: null,
925
+ letterOrDigitOnly: null
926
+ },
910
927
  multiSelect: {
911
928
  clear: null,
912
929
  itemsCount: [{
@@ -916,7 +933,8 @@ const MONA_MESSAGE_PARAMETERS = {
916
933
  removeMoreItems: [{
917
934
  name: "count",
918
935
  type: "number"
919
- }]
936
+ }],
937
+ selectAll: null
920
938
  },
921
939
  notification: {
922
940
  close: null,
@@ -1088,6 +1106,7 @@ const MONA_MESSAGE_PARAMETERS = {
1088
1106
  set: null,
1089
1107
  timeSelector: null
1090
1108
  },
1109
+ toolbar: { moreLabel: null },
1091
1110
  treeView: {
1092
1111
  collapse: null,
1093
1112
  expand: null,
@@ -177,9 +177,10 @@ function formatGroupHeader(value, formatters) {
177
177
  if (typeof value === "number") return Number.isNaN(value) ? "" : formatters.number.format(value);
178
178
  return String(value);
179
179
  }
180
+ const SELECT_ALL_KEY = Symbol("selectAll");
180
181
  var ListService = class ListService {
181
182
  constructor() {
182
- this.#arrangedItems = computed(() => {
183
+ this.#arrangedDataItems = computed(() => {
183
184
  const listItems = this.#listItems();
184
185
  const filterText = this.filterText();
185
186
  const groupableOptions = this.groupableOptions();
@@ -217,6 +218,10 @@ var ListService = class ListService {
217
218
  }).toImmutableSet();
218
219
  this.#groupHeaders = headers;
219
220
  return items;
221
+ }, ...ngDevMode ? [{ debugName: "#arrangedDataItems" }] : /* istanbul ignore next */ []);
222
+ this.#arrangedItems = computed(() => {
223
+ const items = this.#arrangedDataItems();
224
+ return this.#selectAllShown() ? toImmutableSet([this.selectAllItem, ...items]) : items;
220
225
  }, ...ngDevMode ? [{ debugName: "#arrangedItems" }] : /* istanbul ignore next */ []);
221
226
  this.#data = signal(ImmutableList.create(), ...ngDevMode ? [{ debugName: "#data" }] : /* istanbul ignore next */ []);
222
227
  this.#i18n = inject(MonaI18nService);
@@ -261,6 +266,11 @@ var ListService = class ListService {
261
266
  return toImmutableSet(items);
262
267
  }
263
268
  });
269
+ this.#selectAllKeys = computed(() => this.#arrangedDataItems().where((item) => !item.isHeader && !this.isDisabled(item)).select((item) => this.getSelectionKey(item)).toArray(), ...ngDevMode ? [{ debugName: "#selectAllKeys" }] : /* istanbul ignore next */ []);
270
+ this.#selectAllShown = computed(() => {
271
+ const options = this.selectableOptions();
272
+ return this.selectAllEnabled() && options.enabled && options.mode === "multiple" && this.#selectAllKeys().length > 0;
273
+ }, ...ngDevMode ? [{ debugName: "#selectAllShown" }] : /* istanbul ignore next */ []);
264
274
  this.#groupHeaders = /* @__PURE__ */ new Map();
265
275
  this.disabledBy = signal("", ...ngDevMode ? [{ debugName: "disabledBy" }] : /* istanbul ignore next */ []);
266
276
  this.filterChange$ = new Subject();
@@ -300,6 +310,7 @@ var ListService = class ListService {
300
310
  computation: (_, previous) => {
301
311
  const highlighted = previous?.value;
302
312
  if (!highlighted || highlighted.isHeader) return null;
313
+ if (highlighted === this.selectAllItem) return highlighted;
303
314
  return this.#itemsByUid().get(highlighted.uid) ?? null;
304
315
  }
305
316
  });
@@ -338,6 +349,16 @@ var ListService = class ListService {
338
349
  }, ...ngDevMode ? [{ debugName: "pageableOptions" }] : /* istanbul ignore next */ []);
339
350
  this.role = signal("listbox", ...ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []);
340
351
  this.scrollToItem$ = new ReplaySubject(1);
352
+ this.selectAllEnabled = signal(false, ...ngDevMode ? [{ debugName: "selectAllEnabled" }] : /* istanbul ignore next */ []);
353
+ this.selectAllItem = new ListItem({ data: null });
354
+ this.selectAllLabel = signal("", ...ngDevMode ? [{ debugName: "selectAllLabel" }] : /* istanbul ignore next */ []);
355
+ this.selectAllState = computed(() => {
356
+ const keys = this.#selectAllKeys();
357
+ const selectedKeys = this.selectedKeys();
358
+ const selected = keys.filter((key) => selectedKeys.contains(key)).length;
359
+ if (selected === 0) return "none";
360
+ return selected === keys.length ? "all" : "some";
361
+ }, ...ngDevMode ? [{ debugName: "selectAllState" }] : /* istanbul ignore next */ []);
341
362
  this.selectableOptions = signal({
342
363
  checkboxes: false,
343
364
  enabled: false,
@@ -366,12 +387,15 @@ var ListService = class ListService {
366
387
  height: 28
367
388
  }, ...ngDevMode ? [{ debugName: "virtualScrollOptions" }] : /* istanbul ignore next */ []);
368
389
  }
390
+ #arrangedDataItems;
369
391
  #arrangedItems;
370
392
  #data;
371
393
  #i18n;
372
394
  #itemsByKey;
373
395
  #itemsByUid;
374
396
  #listItems;
397
+ #selectAllKeys;
398
+ #selectAllShown;
375
399
  #groupHeaders;
376
400
  clearFilter() {
377
401
  this.filterText.set("");
@@ -387,12 +411,14 @@ var ListService = class ListService {
387
411
  const activeItem = this.highlightedItem() || this.selectedListItems().lastOrDefault();
388
412
  const prefix = buffer.toLowerCase();
389
413
  return cycleThroughMatchedItems(this.viewItems(), activeItem ?? null, (item) => {
390
- if (item.isHeader || this.isDisabled(item)) return false;
414
+ if (item.isHeader || item === this.selectAllItem || this.isDisabled(item)) return false;
391
415
  return this.getItemText(item).toLowerCase().startsWith(prefix);
392
416
  }, prefix.length > 1);
393
417
  }
394
418
  deselectItems(item) {
395
- const keys = from(item).select((i) => this.getSelectionKey(i)).toImmutableSet();
419
+ const items = from(item);
420
+ const selectAllKeys = items.contains(this.selectAllItem) ? this.#selectAllKeys() : [];
421
+ const keys = items.where((i) => i !== this.selectAllItem).select((i) => this.getSelectionKey(i)).concat(selectAllKeys).toImmutableSet();
396
422
  this.selectedKeys.update((set) => set.removeAll(keys));
397
423
  }
398
424
  getDataItemValue(dataItem) {
@@ -418,6 +444,7 @@ var ListService = class ListService {
418
444
  return this.itemPositions().get(item.uid) ?? null;
419
445
  }
420
446
  getItemText(item) {
447
+ if (item === this.selectAllItem) return this.selectAllLabel();
421
448
  const textField = this.textField();
422
449
  let text;
423
450
  if (!textField) text = item.data;
@@ -428,7 +455,7 @@ var ListService = class ListService {
428
455
  getMatchingFilteredItem(text) {
429
456
  const filterableOptions = this.filterableOptions();
430
457
  const caseSensitive = filterableOptions.enabled ? filterableOptions.caseSensitive : false;
431
- const candidates = this.viewItems().where((i) => !i.isHeader && !this.isDisabled(i));
458
+ const candidates = this.viewItems().where((i) => !i.isHeader && i !== this.selectAllItem && !this.isDisabled(i));
432
459
  const fullMatchingItem = candidates.firstOrDefault((i) => {
433
460
  const itemText = this.getItemText(i);
434
461
  return caseSensitive ? itemText === text : itemText.toLowerCase() === text.toLowerCase();
@@ -442,7 +469,7 @@ var ListService = class ListService {
442
469
  return disabledBy(dataItem);
443
470
  }
444
471
  isDisabled(item) {
445
- return !item.isHeader && this.isDataItemDisabled(item.data);
472
+ return !item.isHeader && item !== this.selectAllItem && this.isDataItemDisabled(item.data);
446
473
  }
447
474
  isFilteringEnabled() {
448
475
  return this.filterableOptions().enabled;
@@ -452,6 +479,7 @@ var ListService = class ListService {
452
479
  }
453
480
  isSelected(item) {
454
481
  if (!this.selectableOptions().enabled) return false;
482
+ if (item === this.selectAllItem) return this.selectAllState() === "all";
455
483
  const selectedKeys = this.selectedKeys();
456
484
  const key = this.getSelectionKey(item);
457
485
  return selectedKeys.contains(key);
@@ -486,13 +514,18 @@ var ListService = class ListService {
486
514
  selectAllItems() {
487
515
  const options = this.selectableOptions();
488
516
  if (!options.enabled || options.mode !== "multiple") return false;
489
- const keys = this.viewItems().where((i) => !i.isHeader && !this.isDisabled(i)).select((i) => this.getSelectionKey(i)).toArray();
517
+ const keys = this.viewItems().where((i) => !i.isHeader && i !== this.selectAllItem && !this.isDisabled(i)).select((i) => this.getSelectionKey(i)).toArray();
490
518
  const selectedKeys = this.selectedKeys();
491
519
  if (keys.every((key) => selectedKeys.contains(key))) return false;
492
520
  this.selectedKeys.update((set) => set.addAll(keys));
493
521
  return true;
494
522
  }
495
523
  selectItem(item, scroll = false, focus = false) {
524
+ if (item === this.selectAllItem) {
525
+ this.toggleSelectAll();
526
+ if (scroll) this.scrollToItem(item, focus);
527
+ return;
528
+ }
496
529
  const key = this.getSelectionKey(item);
497
530
  const options = this.selectableOptions();
498
531
  if (options.mode === "single") {
@@ -572,6 +605,11 @@ var ListService = class ListService {
572
605
  ...options
573
606
  }));
574
607
  }
608
+ toggleSelectAll() {
609
+ const keys = this.#selectAllKeys();
610
+ if (this.selectAllState() === "all") this.selectedKeys.update((set) => set.removeAll(keys));
611
+ else this.selectedKeys.update((set) => set.addAll(keys));
612
+ }
575
613
  filterItem(item, filterText) {
576
614
  if (filterText === "") return true;
577
615
  const options = this.filterableOptions();
@@ -608,7 +646,7 @@ var ListService = class ListService {
608
646
  return prevItem;
609
647
  }
610
648
  getSelectionKey(item) {
611
- return this.getDataItemValue(item.data);
649
+ return item === this.selectAllItem ? SELECT_ALL_KEY : this.getDataItemValue(item.data);
612
650
  }
613
651
  navigateFirstForSingleSelection(viewItems, mode) {
614
652
  const firstItem = viewItems.first();
@@ -781,6 +819,7 @@ const listGroupHeaderTextThemeVariants = cva(`select-none text-muted-foreground`
781
819
  false: "w-full px-3 py-1 font-[var(--mona-list-group-font-weight)]"
782
820
  } } });
783
821
  const listItemBaseThemeVariants = cva(`flex h-full w-full items-center gap-2`);
822
+ const LIST_SELECT_ALL_ITEM_CLASSES = "mb-0.5 border-b border-border";
784
823
  const listItemContentThemeVariants = cva(`relative flex cursor-default select-none items-center px-3 py-1 text-foreground outline-none focus-visible:outline-hidden focus-visible:inset-ring-2 focus-visible:inset-ring-focus-indicator`, {
785
824
  variants: {
786
825
  checkboxes: {
@@ -849,15 +888,15 @@ var ListItemDirective = class ListItemDirective {
849
888
  const highlighted = this.highlighted();
850
889
  const selected = this.selected();
851
890
  const selectableOptions = this.#listService.selectableOptions();
852
- const checkboxes = selectableOptions.checkboxes;
891
+ const selectAll = this.item() === this.#listService.selectAllItem;
853
892
  const classes = listItemContentThemeVariants({
854
893
  disabled,
855
894
  highlighted,
856
895
  selected,
857
- checkboxes,
896
+ checkboxes: selectableOptions.checkboxes || selectAll,
858
897
  selectable: selectableOptions.enabled
859
898
  });
860
- return twMerge(classes);
899
+ return twMerge(classes, selectAll ? LIST_SELECT_ALL_ITEM_CLASSES : "");
861
900
  }, ...ngDevMode ? [{ debugName: "textClasses" }] : /* istanbul ignore next */ []);
862
901
  this.item = input.required(...ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []);
863
902
  fromEvent(inject(ElementRef).nativeElement, "focusout").pipe(takeUntilDestroyed()).subscribe(() => this.#listService.itemFocusOut$.next(this.item()));
@@ -988,12 +1027,12 @@ var ListItemComponent = class ListItemComponent {
988
1027
  if (this.isHeader()) return ``;
989
1028
  return listItemBaseThemeVariants();
990
1029
  }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
991
- this.checkboxes = computed(() => {
992
- return this.listService.selectableOptions().checkboxes && !this.isHeader();
993
- }, ...ngDevMode ? [{ debugName: "checkboxes" }] : /* istanbul ignore next */ []);
1030
+ this.checkboxes = computed(() => (this.listService.selectableOptions().checkboxes || this.isSelectAll()) && !this.isHeader(), ...ngDevMode ? [{ debugName: "checkboxes" }] : /* istanbul ignore next */ []);
994
1031
  this.dataItem = computed(() => this.item()?.data ?? null, ...ngDevMode ? [{ debugName: "dataItem" }] : /* istanbul ignore next */ []);
995
1032
  this.isHeader = computed(() => this.item()?.isHeader ?? false, ...ngDevMode ? [{ debugName: "isHeader" }] : /* istanbul ignore next */ []);
1033
+ this.isSelectAll = computed(() => this.item() === this.listService.selectAllItem, ...ngDevMode ? [{ debugName: "isSelectAll" }] : /* istanbul ignore next */ []);
996
1034
  this.itemChecked = computed(() => this.listService.isSelected(this.item()), ...ngDevMode ? [{ debugName: "itemChecked" }] : /* istanbul ignore next */ []);
1035
+ this.itemIndeterminate = computed(() => this.isSelectAll() && this.listService.selectAllState() === "some", ...ngDevMode ? [{ debugName: "itemIndeterminate" }] : /* istanbul ignore next */ []);
997
1036
  this.itemText = computed(() => {
998
1037
  const item = this.item();
999
1038
  if (item == null) return "";
@@ -1047,7 +1086,7 @@ var ListItemComponent = class ListItemComponent {
1047
1086
  },
1048
1087
  host: { properties: { "class": "baseClass()" } },
1049
1088
  ngImport: i0,
1050
- template: "@if (checkboxes()) {\n <!-- Visual only: the option row owns selection, so the checkbox is inert (not focusable, clicks reach the row). -->\n <input type=\"checkbox\" [checked]=\"itemChecked()\" monaCheckbox class=\"aspect-square\" inert aria-hidden=\"true\" />\n}\n\n@if (template()) {\n <ng-container [ngTemplateOutlet]=\"template()\" [ngTemplateOutletContext]=\"{ $implicit: dataItem() }\"></ng-container>\n} @else {\n <span [class]=\"textClasses()\">{{ itemText() }}</span>\n}\n",
1089
+ template: "@if (checkboxes()) {\n <!-- Visual only: the option row owns selection, so the checkbox is inert (not focusable, clicks reach the row). -->\n <input\n type=\"checkbox\"\n [checked]=\"itemChecked()\"\n [indeterminate]=\"itemIndeterminate()\"\n monaCheckbox\n class=\"aspect-square\"\n inert\n aria-hidden=\"true\" />\n}\n\n@if (template() && !isSelectAll()) {\n <ng-container [ngTemplateOutlet]=\"template()\" [ngTemplateOutletContext]=\"{ $implicit: dataItem() }\"></ng-container>\n} @else {\n <span [class]=\"textClasses()\">{{ itemText() }}</span>\n}\n",
1051
1090
  dependencies: [{
1052
1091
  kind: "directive",
1053
1092
  type: NgTemplateOutlet,
@@ -1082,7 +1121,7 @@ i0.ɵɵngDeclareClassMetadata({
1082
1121
  selector: "mona-list-item",
1083
1122
  imports: [NgTemplateOutlet, CheckboxDirective],
1084
1123
  host: { "[class]": "baseClass()" },
1085
- template: "@if (checkboxes()) {\n <!-- Visual only: the option row owns selection, so the checkbox is inert (not focusable, clicks reach the row). -->\n <input type=\"checkbox\" [checked]=\"itemChecked()\" monaCheckbox class=\"aspect-square\" inert aria-hidden=\"true\" />\n}\n\n@if (template()) {\n <ng-container [ngTemplateOutlet]=\"template()\" [ngTemplateOutletContext]=\"{ $implicit: dataItem() }\"></ng-container>\n} @else {\n <span [class]=\"textClasses()\">{{ itemText() }}</span>\n}\n"
1124
+ template: "@if (checkboxes()) {\n <!-- Visual only: the option row owns selection, so the checkbox is inert (not focusable, clicks reach the row). -->\n <input\n type=\"checkbox\"\n [checked]=\"itemChecked()\"\n [indeterminate]=\"itemIndeterminate()\"\n monaCheckbox\n class=\"aspect-square\"\n inert\n aria-hidden=\"true\" />\n}\n\n@if (template() && !isSelectAll()) {\n <ng-container [ngTemplateOutlet]=\"template()\" [ngTemplateOutletContext]=\"{ $implicit: dataItem() }\"></ng-container>\n} @else {\n <span [class]=\"textClasses()\">{{ itemText() }}</span>\n}\n"
1086
1125
  }]
1087
1126
  }],
1088
1127
  propDecorators: {
@@ -10,7 +10,9 @@ const MONA_AR_SA_LOCALE = {
10
10
  direction: "rtl",
11
11
  id: "ar-SA",
12
12
  messages: {
13
+ alert: { dismissLabel: (title) => title ? `إغلاق ${title}` : "إغلاق التنبيه" },
13
14
  autoComplete: { clear: "مسح" },
15
+ avatar: { moreLabel: (count) => `و${localizeNumber(count)} آخرون` },
14
16
  breadcrumb: {
15
17
  breadcrumb: "مسار التنقل",
16
18
  showFullPath: "إظهار المسار الكامل"
@@ -499,10 +501,19 @@ const MONA_AR_SA_LOCALE = {
499
501
  transferTo: "نقل إلى القائمة الأخرى",
500
502
  transferToList: (list) => `نقل إلى ${list}`
501
503
  },
504
+ maskedTextBox: {
505
+ characterNotAllowed: "لا يمكن إدخال هذا الحرف هنا",
506
+ clear: "مسح",
507
+ digitOnly: "يمكن إدخال رقم فقط هنا",
508
+ digitOrSignOnly: "يمكن إدخال رقم أو علامة زائد أو ناقص فقط هنا",
509
+ letterOnly: "يمكن إدخال حرف فقط هنا",
510
+ letterOrDigitOnly: "يمكن إدخال حرف أو رقم فقط هنا"
511
+ },
502
512
  multiSelect: {
503
513
  clear: "مسح",
504
514
  itemsCount: (count) => `+ ${localizeNumber(count)}`,
505
- removeMoreItems: (count) => `حذف العناصر الإضافية (${localizeNumber(count)})`
515
+ removeMoreItems: (count) => `حذف العناصر الإضافية (${localizeNumber(count)})`,
516
+ selectAll: "تحديد الكل"
506
517
  },
507
518
  notification: {
508
519
  close: "إغلاق",
@@ -624,6 +635,7 @@ const MONA_AR_SA_LOCALE = {
624
635
  set: "تعيين",
625
636
  timeSelector: "منتقي الوقت"
626
637
  },
638
+ toolbar: { moreLabel: "المزيد" },
627
639
  treeView: {
628
640
  collapse: "طي",
629
641
  expand: "توسيع",
@@ -10,7 +10,9 @@ const MONA_DE_DE_LOCALE = {
10
10
  direction: "ltr",
11
11
  id: "de-DE",
12
12
  messages: {
13
+ alert: { dismissLabel: (title) => title ? `${title} schließen` : "Hinweis schließen" },
13
14
  autoComplete: { clear: "Leeren" },
15
+ avatar: { moreLabel: (count) => `${localizeNumber(count)} weitere` },
14
16
  breadcrumb: {
15
17
  breadcrumb: "Breadcrumb-Navigation",
16
18
  showFullPath: "Vollständigen Pfad anzeigen"
@@ -457,10 +459,19 @@ const MONA_DE_DE_LOCALE = {
457
459
  transferTo: "In die andere Liste übertragen",
458
460
  transferToList: (list) => `In ${list} übertragen`
459
461
  },
462
+ maskedTextBox: {
463
+ characterNotAllowed: "Dieses Zeichen passt hier nicht",
464
+ clear: "Leeren",
465
+ digitOnly: "Hier passt nur eine Ziffer",
466
+ digitOrSignOnly: "Hier passt nur eine Ziffer, Plus oder Minus",
467
+ letterOnly: "Hier passt nur ein Buchstabe",
468
+ letterOrDigitOnly: "Hier passt nur ein Buchstabe oder eine Ziffer"
469
+ },
460
470
  multiSelect: {
461
471
  clear: "Leeren",
462
472
  itemsCount: (count) => count === 1 ? `+ ${localizeNumber(count)} Element` : `+ ${localizeNumber(count)} Elemente`,
463
- removeMoreItems: (count) => count === 1 ? `${localizeNumber(count)} weiteres Element entfernen` : `${localizeNumber(count)} weitere Elemente entfernen`
473
+ removeMoreItems: (count) => count === 1 ? `${localizeNumber(count)} weiteres Element entfernen` : `${localizeNumber(count)} weitere Elemente entfernen`,
474
+ selectAll: "Alle auswählen"
464
475
  },
465
476
  notification: {
466
477
  close: "Schließen",
@@ -568,6 +579,7 @@ const MONA_DE_DE_LOCALE = {
568
579
  set: "Übernehmen",
569
580
  timeSelector: "Zeitauswahl"
570
581
  },
582
+ toolbar: { moreLabel: "Mehr" },
571
583
  treeView: {
572
584
  collapse: "Einklappen",
573
585
  expand: "Erweitern",
@@ -10,7 +10,9 @@ const MONA_ES_ES_LOCALE = {
10
10
  direction: "ltr",
11
11
  id: "es-ES",
12
12
  messages: {
13
+ alert: { dismissLabel: (title) => title ? `Descartar ${title}` : "Descartar aviso" },
13
14
  autoComplete: { clear: "Limpiar" },
15
+ avatar: { moreLabel: (count) => `${localizeNumber(count)} más` },
14
16
  breadcrumb: {
15
17
  breadcrumb: "Ruta de navegación",
16
18
  showFullPath: "Mostrar la ruta completa"
@@ -463,10 +465,19 @@ const MONA_ES_ES_LOCALE = {
463
465
  transferTo: "Transferir a la otra lista",
464
466
  transferToList: (list) => `Transferir a ${list}`
465
467
  },
468
+ maskedTextBox: {
469
+ characterNotAllowed: "Ese carácter no cabe aquí",
470
+ clear: "Limpiar",
471
+ digitOnly: "Aquí solo cabe un dígito",
472
+ digitOrSignOnly: "Aquí solo cabe un dígito, más o menos",
473
+ letterOnly: "Aquí solo cabe una letra",
474
+ letterOrDigitOnly: "Aquí solo cabe una letra o un dígito"
475
+ },
466
476
  multiSelect: {
467
477
  clear: "Limpiar",
468
478
  itemsCount: (count) => count === 1 ? `+ ${localizeNumber(count)} elemento` : `+ ${localizeNumber(count)} elementos`,
469
- removeMoreItems: (count) => count === 1 ? `Quitar ${localizeNumber(count)} elemento más` : `Quitar ${localizeNumber(count)} elementos más`
479
+ removeMoreItems: (count) => count === 1 ? `Quitar ${localizeNumber(count)} elemento más` : `Quitar ${localizeNumber(count)} elementos más`,
480
+ selectAll: "Seleccionar todo"
470
481
  },
471
482
  notification: {
472
483
  close: "Cerrar",
@@ -574,6 +585,7 @@ const MONA_ES_ES_LOCALE = {
574
585
  set: "Establecer",
575
586
  timeSelector: "Selector de hora"
576
587
  },
588
+ toolbar: { moreLabel: "Más" },
577
589
  treeView: {
578
590
  collapse: "Contraer",
579
591
  expand: "Expandir",