@nanahoshi/mona-ui 0.1.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 (134) hide show
  1. package/README.md +25 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
  3. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
  4. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
  5. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
  6. package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
  7. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
  8. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
  9. package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
  10. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
  11. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
  12. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
  13. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
  14. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
  15. package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
  16. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
  17. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
  18. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
  19. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
  20. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
  21. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
  22. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
  23. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
  24. package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
  25. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
  26. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
  28. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
  29. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
  30. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
  31. package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
  32. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
  33. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
  34. package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
  35. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
  36. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
  39. package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
  40. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
  41. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
  42. package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
  43. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
  44. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
  45. package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
  46. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
  47. package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
  48. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
  49. package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
  50. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
  51. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
  52. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
  53. package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
  54. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
  55. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
  56. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
  57. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
  58. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
  59. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
  60. package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
  61. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
  62. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
  63. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
  64. package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
  65. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
  66. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
  67. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
  68. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
  69. package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
  70. package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
  71. package/package.json +289 -0
  72. package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
  73. package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
  74. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
  75. package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
  76. package/types/nanahoshi-mona-ui-button.d.ts +111 -0
  77. package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
  78. package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
  79. package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
  80. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
  81. package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
  82. package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
  83. package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
  84. package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
  85. package/types/nanahoshi-mona-ui-common.d.ts +386 -0
  86. package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
  87. package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
  88. package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
  89. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
  90. package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
  91. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
  92. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
  93. package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
  94. package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
  95. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
  96. package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
  97. package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
  98. package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
  99. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
  100. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
  101. package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
  102. package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
  103. package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
  104. package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
  105. package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
  106. package/types/nanahoshi-mona-ui-list.d.ts +1 -0
  107. package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
  108. package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
  109. package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
  110. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
  111. package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
  112. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
  113. package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
  114. package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
  115. package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
  116. package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
  117. package/types/nanahoshi-mona-ui-query.d.ts +89 -0
  118. package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
  119. package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
  120. package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
  121. package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
  122. package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
  123. package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
  124. package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
  125. package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
  126. package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
  127. package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
  128. package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
  129. package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
  130. package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
  131. package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
  132. package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
  133. package/types/nanahoshi-mona-ui-window.d.ts +295 -0
  134. package/types/nanahoshi-mona-ui.d.ts +2 -0
@@ -0,0 +1,453 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { Directive, inject, DestroyRef, ElementRef, computed, contentChild, TemplateRef, input, output, model, afterNextRender, Component } from '@angular/core';
4
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
+ import { LucideCircleX } from '@lucide/angular';
6
+ import { ButtonDirective } from '@nanahoshi/mona-ui/button';
7
+ import { ThemeService } from '@nanahoshi/mona-ui/theme';
8
+ import { fromEvent, filter } from 'rxjs';
9
+ import { twMerge } from 'tailwind-merge';
10
+ import { cva } from 'class-variance-authority';
11
+
12
+ /**
13
+ * @description Apply to an `<ng-template>` directly inside `<mona-chip>` to render prefix content
14
+ * (e.g., an avatar or icon) before the chip label or projected content. The template receives no context.
15
+ */
16
+ class ChipPrefixTemplateDirective {
17
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ChipPrefixTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
18
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ChipPrefixTemplateDirective, isStandalone: true, selector: "ng-template[monaChipPrefixTemplate]", ngImport: i0 }); }
19
+ }
20
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ChipPrefixTemplateDirective, decorators: [{
21
+ type: Directive,
22
+ args: [{
23
+ selector: "ng-template[monaChipPrefixTemplate]"
24
+ }]
25
+ }] });
26
+
27
+ const chipVariants = cva(`
28
+ inline-flex items-center justify-between gap-1.5
29
+ text-xs font-medium cursor-pointer shrink-0
30
+ outline-none shadow-xs
31
+ transition-colors duration-200 ease-in-out
32
+ `, {
33
+ variants: {
34
+ disabled: {
35
+ true: "pointer-events-none opacity-50 cursor-not-allowed select-none",
36
+ false: ""
37
+ },
38
+ look: {
39
+ default: `
40
+ bg-background text-foreground
41
+ border border-border
42
+ hover:bg-hover hover:text-accent-foreground
43
+ active:bg-active active:text-accent-foreground
44
+ focus-visible:ring-2 focus-visible:ring-primary/40
45
+ `,
46
+ primary: `
47
+ bg-primary text-primary-foreground
48
+ hover:bg-primary-hover hover:text-primary-foreground
49
+ active:bg-primary-active active:text-primary-foreground
50
+ focus-visible:ring-2 focus-visible:ring-primary/40
51
+ `,
52
+ success: `
53
+ bg-success text-success-foreground
54
+ hover:bg-success-hover hover:text-success-foreground
55
+ active:bg-success-active active:text-success-foreground
56
+ focus-visible:ring-2 focus-visible:ring-success/40
57
+ `,
58
+ error: `
59
+ bg-error text-error-foreground
60
+ hover:bg-error-hover hover:text-error-foreground
61
+ active:bg-error-active active:text-error-foreground
62
+ focus-visible:ring-2 focus-visible:ring-error/40
63
+ `,
64
+ warning: `
65
+ bg-warning text-warning-foreground
66
+ hover:bg-warning-hover hover:text-warning-foreground
67
+ active:bg-warning-active active:text-warning-foreground
68
+ focus-visible:ring-2 focus-visible:ring-warning/40
69
+ `,
70
+ info: `
71
+ bg-info text-info-foreground
72
+ hover:bg-info-hover hover:text-info-foreground
73
+ active:bg-info-active active:text-info-foreground
74
+ focus-visible:ring-2 focus-visible:ring-info/40
75
+ `,
76
+ outline: `
77
+ border border-border
78
+ hover:bg-accent hover:text-accent-foreground
79
+ active:bg-accent-dark active:text-accent-foreground
80
+ focus-visible:ring-2 focus-visible:ring-primary/40
81
+ `,
82
+ secondary: `
83
+ bg-secondary text-secondary-foreground
84
+ hover:bg-secondary-hover hover:text-secondary-foreground
85
+ active:bg-secondary-active active:text-secondary-foreground
86
+ focus-visible:ring-2 focus-visible:ring-primary/40
87
+ `,
88
+ ghost: `
89
+ hover:bg-secondary-hover hover:text-secondary-foreground
90
+ active:bg-secondary-active active:text-secondary-foreground
91
+ focus-visible:ring-2 focus-visible:ring-primary/40
92
+ `
93
+ },
94
+ rounded: {
95
+ full: "rounded-full",
96
+ large: "rounded-lg",
97
+ medium: "rounded-md",
98
+ none: "rounded-none",
99
+ small: "rounded-sm"
100
+ },
101
+ size: {
102
+ small: `
103
+ ps-1 pe-1 py-0.5
104
+ [&_button[data-chip-remove='true']]:w-3
105
+ [&_button[data-chip-remove='true']]:h-3
106
+ `,
107
+ medium: `
108
+ ps-1.5 pe-1.5 py-1
109
+ [&_button[data-chip-remove='true']]:w-4
110
+ [&_button[data-chip-remove='true']]:h-4
111
+ `,
112
+ large: `
113
+ ps-2 pe-2 py-1.5
114
+ [&_button[data-chip-remove='true']]:w-5
115
+ [&_button[data-chip-remove='true']]:h-5
116
+ `
117
+ },
118
+ selected: {
119
+ true: "",
120
+ false: ""
121
+ }
122
+ },
123
+ compoundVariants: [
124
+ {
125
+ look: "default",
126
+ selected: true,
127
+ class: `
128
+ bg-selected text-foreground
129
+ hover:bg-selected/95 hover:text-foreground
130
+ active:bg-selected/100 active:text-foreground
131
+ `
132
+ },
133
+ {
134
+ look: "primary",
135
+ selected: true,
136
+ class: `
137
+ bg-primary-selected text-primary-foreground
138
+ hover:bg-primary-selected/95 hover:text-primary-foreground
139
+ active:bg-primary-selected/100 active:text-primary-foreground
140
+ `
141
+ },
142
+ {
143
+ look: "secondary",
144
+ selected: true,
145
+ class: `
146
+ bg-secondary-selected text-secondary-foreground
147
+ hover:bg-secondary-selected/95 hover:text-secondary-foreground
148
+ active:bg-secondary-selected/100 active:text-secondary-foreground
149
+ `
150
+ },
151
+ {
152
+ look: "success",
153
+ selected: true,
154
+ class: `
155
+ bg-success-selected text-success-foreground
156
+ hover:bg-success-selected/95 hover:text-success-foreground
157
+ active:bg-success-selected/100 active:text-success-foreground
158
+ `
159
+ },
160
+ {
161
+ look: "error",
162
+ selected: true,
163
+ class: `
164
+ bg-error-selected text-error-foreground
165
+ hover:bg-error-selected/95 hover:text-error-foreground
166
+ active:bg-error-selected/100 active:text-error-foreground
167
+ `
168
+ },
169
+ {
170
+ look: "warning",
171
+ selected: true,
172
+ class: `
173
+ bg-warning-selected text-warning-foreground
174
+ hover:bg-warning-selected/95 hover:text-warning-foreground
175
+ active:bg-warning-selected/100 active:text-warning-foreground
176
+ `
177
+ },
178
+ {
179
+ look: "info",
180
+ selected: true,
181
+ class: `
182
+ bg-info-selected text-info-foreground
183
+ hover:bg-info-selected/95 hover:text-info-foreground
184
+ active:bg-info-selected/100 active:text-info-foreground
185
+ `
186
+ },
187
+ {
188
+ look: "outline",
189
+ selected: true,
190
+ class: `
191
+ bg-primary-selected text-primary-foreground
192
+ hover:bg-primary-selected/95 hover:text-primary-foreground
193
+ active:bg-primary-selected/100 active:text-primary-foreground
194
+ `
195
+ },
196
+ {
197
+ look: "ghost",
198
+ selected: true,
199
+ class: `
200
+ bg-secondary-selected text-secondary-foreground
201
+ hover:bg-secondary-selected/95 hover:text-secondary-foreground
202
+ active:bg-secondary-selected/100 active:text-secondary-foreground
203
+ `
204
+ }
205
+ ],
206
+ defaultVariants: {
207
+ selected: false
208
+ }
209
+ });
210
+
211
+ const chipThemeVariants = (theme) => {
212
+ switch (theme) {
213
+ case "mona":
214
+ return chipVariants;
215
+ default:
216
+ return chipVariants;
217
+ }
218
+ };
219
+
220
+ class ChipComponent {
221
+ #destroyRef;
222
+ #elementRef;
223
+ #themeService;
224
+ constructor() {
225
+ this.#destroyRef = inject(DestroyRef);
226
+ this.#elementRef = inject(ElementRef);
227
+ this.#themeService = inject(ThemeService);
228
+ this.ariaChecked = computed(() => {
229
+ if (!this.toggleable()) {
230
+ return undefined;
231
+ }
232
+ return this.selected() ? "true" : "false";
233
+ }, /* @ts-ignore */
234
+ ...(ngDevMode ? [{ debugName: "ariaChecked" }] : /* istanbul ignore next */ []));
235
+ this.baseClass = computed(() => {
236
+ const theme = this.#themeService.theme();
237
+ const disabled = this.disabled();
238
+ const look = this.look();
239
+ const rounded = this.rounded();
240
+ const size = this.size();
241
+ const selected = this.selected();
242
+ const userClass = this.userClass();
243
+ const variantClasses = chipThemeVariants(theme)({ disabled, look, rounded, size, selected });
244
+ return twMerge(variantClasses, userClass);
245
+ }, /* @ts-ignore */
246
+ ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
247
+ this.effectiveAriaLabel = computed(() => {
248
+ const explicitLabel = this.ariaLabel();
249
+ if (explicitLabel) {
250
+ return explicitLabel;
251
+ }
252
+ const label = this.label();
253
+ if (label) {
254
+ return label;
255
+ }
256
+ return undefined;
257
+ }, /* @ts-ignore */
258
+ ...(ngDevMode ? [{ debugName: "effectiveAriaLabel" }] : /* istanbul ignore next */ []));
259
+ this.effectiveTabIndex = computed(() => {
260
+ if (this.disabled()) {
261
+ return -1;
262
+ }
263
+ const explicitTabindex = this.tabindex();
264
+ if (explicitTabindex != null) {
265
+ return explicitTabindex;
266
+ }
267
+ if (this.toggleable() || this.removable()) {
268
+ return 0;
269
+ }
270
+ return -1;
271
+ }, /* @ts-ignore */
272
+ ...(ngDevMode ? [{ debugName: "effectiveTabIndex" }] : /* istanbul ignore next */ []));
273
+ this.iconSize = computed(() => {
274
+ const size = this.size();
275
+ switch (size) {
276
+ case "small":
277
+ return 13;
278
+ case "medium":
279
+ return 14;
280
+ case "large":
281
+ return 16;
282
+ default:
283
+ return 14;
284
+ }
285
+ }, /* @ts-ignore */
286
+ ...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
287
+ this.prefixTemplate = contentChild(ChipPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
288
+ this.role = computed(() => {
289
+ if (this.toggleable()) {
290
+ return "checkbox";
291
+ }
292
+ return undefined;
293
+ }, /* @ts-ignore */
294
+ ...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
295
+ /**
296
+ * @description Accessible name for the host element. Describe what the chip represents.
297
+ * When empty, assistive technology announces the role without a label.
298
+ * @default ""
299
+ */
300
+ this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
301
+ /**
302
+ * @description Emitted when the chip body is clicked or activated via Enter or Space.
303
+ * Not emitted when the remove button is activated.
304
+ */
305
+ this.contentClick = output();
306
+ /**
307
+ * @description Renders the chip with reduced visual emphasis and removes pointer interaction.
308
+ * @default false
309
+ */
310
+ this.disabled = input(false, /* @ts-ignore */
311
+ ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
312
+ /**
313
+ * @description Text label displayed inside the chip. When non-empty, takes precedence over projected content.
314
+ * @default ""
315
+ */
316
+ this.label = input("", /* @ts-ignore */
317
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
318
+ /**
319
+ * @description Visual style variant controlling the chip's background color, border, and interaction states.
320
+ * @default "default"
321
+ */
322
+ this.look = input("default", /* @ts-ignore */
323
+ ...(ngDevMode ? [{ debugName: "look" }] : /* istanbul ignore next */ []));
324
+ /**
325
+ * @description Renders a remove button inside the chip. When activated, emits the `remove` output.
326
+ * @default false
327
+ */
328
+ this.removable = input(false, /* @ts-ignore */
329
+ ...(ngDevMode ? [{ debugName: "removable" }] : /* istanbul ignore next */ []));
330
+ /**
331
+ * @description Emitted when the remove button is clicked. Only fires when `removable` is `true`.
332
+ * Emits the originating `Event`.
333
+ */
334
+ this.remove = output();
335
+ /**
336
+ * @description Accessible label for the remove button, overriding the auto-computed `"Remove, <label>"` fallback.
337
+ * Use when the chip shows only projected content and the default label is not descriptive enough.
338
+ * @default undefined
339
+ */
340
+ this.removeLabel = input(/* @ts-ignore */
341
+ ...(ngDevMode ? [undefined, { debugName: "removeLabel" }] : /* istanbul ignore next */ []));
342
+ /**
343
+ * @description Tab index for the remove button, independent of the chip host's own tabindex.
344
+ * Set to `-1` to exclude the remove button from tab order when an equivalent keyboard path exists elsewhere.
345
+ * @default 0
346
+ */
347
+ this.removeTabIndex = input(0, /* @ts-ignore */
348
+ ...(ngDevMode ? [{ debugName: "removeTabIndex" }] : /* istanbul ignore next */ []));
349
+ /**
350
+ * @description Border-radius preset applied to the chip.
351
+ * @default "full"
352
+ */
353
+ this.rounded = input("full", /* @ts-ignore */
354
+ ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
355
+ /**
356
+ * @description Whether the chip is selected. When `toggleable` is `true`, each activation flips this value.
357
+ * Supports two-way binding via `[(selected)]`.
358
+ * @default false
359
+ */
360
+ this.selected = model(false, /* @ts-ignore */
361
+ ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
362
+ /**
363
+ * @description Size preset controlling the chip's padding and remove button dimensions.
364
+ * @default "medium"
365
+ */
366
+ this.size = input("medium", /* @ts-ignore */
367
+ ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
368
+ /**
369
+ * @description Tab index override for the chip host element. When not set, computed automatically:
370
+ * `0` when `toggleable` or `removable` is `true`, `-1` otherwise. Overridden to `-1` when `disabled` is `true`.
371
+ * @default undefined
372
+ */
373
+ this.tabindex = input(/* @ts-ignore */
374
+ ...(ngDevMode ? [undefined, { debugName: "tabindex" }] : /* istanbul ignore next */ []));
375
+ /**
376
+ * @description Enables toggle behavior. When `true`, each activation flips `selected`
377
+ * and the host receives `role="checkbox"` with `aria-checked`.
378
+ * @default false
379
+ */
380
+ this.toggleable = input(false, /* @ts-ignore */
381
+ ...(ngDevMode ? [{ debugName: "toggleable" }] : /* istanbul ignore next */ []));
382
+ /**
383
+ * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
384
+ * @default ""
385
+ */
386
+ this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
387
+ /**
388
+ * @description Arbitrary value associated with this chip.
389
+ * Useful for identifying which chip was selected or removed in a collection.
390
+ * @default undefined
391
+ */
392
+ this.value = input(/* @ts-ignore */
393
+ ...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
394
+ afterNextRender({
395
+ read: () => this.#setSubscriptions()
396
+ });
397
+ }
398
+ onRemoveClick(event) {
399
+ if (this.disabled()) {
400
+ return;
401
+ }
402
+ event.stopPropagation();
403
+ this.remove.emit(event);
404
+ }
405
+ #handleActivation() {
406
+ if (this.toggleable()) {
407
+ this.selected.set(!this.selected());
408
+ }
409
+ this.contentClick.emit();
410
+ }
411
+ #setSubscriptions() {
412
+ const element = this.#elementRef.nativeElement;
413
+ fromEvent(element, "keydown")
414
+ .pipe(filter(event => !this.disabled() && (event.key === "Enter" || event.key === " ")), takeUntilDestroyed(this.#destroyRef))
415
+ .subscribe(event => {
416
+ const target = event.target;
417
+ if (target.closest("button[data-chip-remove]")) {
418
+ return;
419
+ }
420
+ event.preventDefault();
421
+ this.#handleActivation();
422
+ });
423
+ fromEvent(element, "click")
424
+ .pipe(filter(() => !this.disabled()), takeUntilDestroyed(this.#destroyRef))
425
+ .subscribe(() => {
426
+ this.#handleActivation();
427
+ });
428
+ }
429
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
430
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ChipComponent, isStandalone: true, selector: "mona-chip", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, removeLabel: { classPropertyName: "removeLabel", publicName: "removeLabel", isSignal: true, isRequired: false, transformFunction: null }, removeTabIndex: { classPropertyName: "removeTabIndex", publicName: "removeTabIndex", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, toggleable: { classPropertyName: "toggleable", publicName: "toggleable", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { contentClick: "contentClick", remove: "remove", selected: "selectedChange" }, host: { properties: { "class": "baseClass()", "attr.tabindex": "effectiveTabIndex()", "attr.aria-disabled": "disabled() ? 'true' : undefined", "attr.role": "role()", "attr.aria-checked": "ariaChecked()", "attr.aria-label": "effectiveAriaLabel()" } }, queries: [{ propertyName: "prefixTemplate", first: true, predicate: ChipPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "@if (prefixTemplate()) {\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n}\n\n@if (label()) {\n <span>{{ label() }}</span>\n} @else {\n <ng-content></ng-content>\n}\n\n@if (removable()) {\n @let removeAriaLabel = removeLabel() ?? \"Remove, \" + (label() || \"item\");\n <button\n monaButton\n look=\"link\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [attr.aria-label]=\"removeAriaLabel\"\n [tabindex]=\"removeTabIndex()\"\n [disabled]=\"disabled()\"\n (click)=\"onRemoveClick($event)\"\n [attr.data-chip-remove]=\"true\">\n <svg lucideCircleX [size]=\"iconSize()\"></svg>\n </button>\n}\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideCircleX, selector: "svg[lucideCircleX], svg[lucideXCircle]" }] }); }
431
+ }
432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ChipComponent, decorators: [{
433
+ type: Component,
434
+ args: [{ selector: "mona-chip", imports: [ButtonDirective, NgTemplateOutlet, LucideCircleX], host: {
435
+ "[class]": "baseClass()",
436
+ "[attr.tabindex]": "effectiveTabIndex()",
437
+ "[attr.aria-disabled]": "disabled() ? 'true' : undefined",
438
+ "[attr.role]": "role()",
439
+ "[attr.aria-checked]": "ariaChecked()",
440
+ "[attr.aria-label]": "effectiveAriaLabel()"
441
+ }, template: "@if (prefixTemplate()) {\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n}\n\n@if (label()) {\n <span>{{ label() }}</span>\n} @else {\n <ng-content></ng-content>\n}\n\n@if (removable()) {\n @let removeAriaLabel = removeLabel() ?? \"Remove, \" + (label() || \"item\");\n <button\n monaButton\n look=\"link\"\n [iconOnly]=\"true\"\n [size]=\"'small'\"\n [attr.aria-label]=\"removeAriaLabel\"\n [tabindex]=\"removeTabIndex()\"\n [disabled]=\"disabled()\"\n (click)=\"onRemoveClick($event)\"\n [attr.data-chip-remove]=\"true\">\n <svg lucideCircleX [size]=\"iconSize()\"></svg>\n </button>\n}\n" }]
442
+ }], ctorParameters: () => [], propDecorators: { prefixTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ChipPrefixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], contentClick: [{ type: i0.Output, args: ["contentClick"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], look: [{ type: i0.Input, args: [{ isSignal: true, alias: "look", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], remove: [{ type: i0.Output, args: ["remove"] }], removeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeLabel", required: false }] }], removeTabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeTabIndex", required: false }] }], 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 }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }] } });
443
+
444
+ /*
445
+ * Public API Surface of @nanahoshi/mona-ui/chip
446
+ */
447
+
448
+ /**
449
+ * Generated bundle index. Do not edit.
450
+ */
451
+
452
+ export { ChipComponent, ChipPrefixTemplateDirective };
453
+ //# sourceMappingURL=nanahoshi-mona-ui-chip.mjs.map