@nanahoshi/mona-ui 0.24.10 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/chart/README.md +223 -77
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +11 -10
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +37 -20
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +239 -47
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +184 -31
- package/fesm2022/nanahoshi-mona-ui-button.mjs +47 -11
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +17 -13
- package/fesm2022/nanahoshi-mona-ui-card.mjs +54 -30
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +1909 -666
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +112 -31
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +131 -89
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +59 -19
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +118 -41
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +243 -212
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +155 -86
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +161 -131
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +12 -11
- package/fesm2022/nanahoshi-mona-ui-common.mjs +18 -1
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +25 -24
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +202 -33
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +31 -10
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +1 -1
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs → nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs → nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs} +7 -7
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs} +27 -29
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +146 -5
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +7 -7
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +183 -47
- package/fesm2022/nanahoshi-mona-ui-label.mjs +111 -15
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +111 -5
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +103 -5
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +103 -5
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +100 -6
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +90 -5
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +103 -5
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +90 -5
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +90 -5
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +103 -5
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +105 -5
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +103 -5
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +90 -5
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +90 -5
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +14 -13
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +13 -12
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +192 -56
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +3 -1
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +60 -29
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +334 -37
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +84 -30
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +274 -108
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +127 -37
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +595 -170
- package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +3 -2
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +323 -166
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +167 -82
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +3 -3
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +273 -165
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +219 -132
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +84 -32
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +337 -116
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +10 -12
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +21 -8
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +444 -88
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +15 -14
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +17 -3
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1 -1
- package/i18n/catalogs/en-US.messages.json +90 -5
- package/locales/ar-sa/ar-sa.messages.json +90 -5
- package/locales/de-de/de-de.messages.json +90 -5
- package/locales/es-es/es-es.messages.json +90 -5
- package/locales/fr-fr/fr-fr.messages.json +91 -6
- package/locales/id-id/id-id.messages.json +90 -5
- package/locales/it-it/it-it.messages.json +90 -5
- package/locales/ja-jp/ja-jp.messages.json +90 -5
- package/locales/ko-kr/ko-kr.messages.json +90 -5
- package/locales/pt-br/pt-br.messages.json +90 -5
- package/locales/ru-ru/ru-ru.messages.json +90 -5
- package/locales/tr-tr/tr-tr.messages.json +90 -5
- package/locales/zh-cn/zh-cn.messages.json +90 -5
- package/locales/zh-tw/zh-tw.messages.json +90 -5
- package/package.json +2 -1
- package/styles.css +156 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +18 -11
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +62 -14
- package/types/nanahoshi-mona-ui-button-group.d.ts +86 -16
- package/types/nanahoshi-mona-ui-button.d.ts +26 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +1 -0
- package/types/nanahoshi-mona-ui-card.d.ts +22 -6
- package/types/nanahoshi-mona-ui-chart.d.ts +519 -527
- package/types/nanahoshi-mona-ui-check-box.d.ts +54 -13
- package/types/nanahoshi-mona-ui-chip.d.ts +31 -18
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +21 -5
- package/types/nanahoshi-mona-ui-collapsible.d.ts +20 -11
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +62 -36
- package/types/nanahoshi-mona-ui-color-palette.d.ts +65 -27
- package/types/nanahoshi-mona-ui-color-picker.d.ts +64 -23
- package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-common.d.ts +28 -2
- package/types/nanahoshi-mona-ui-date-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +1 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +51 -7
- package/types/nanahoshi-mona-ui-fieldset.d.ts +18 -4
- package/types/nanahoshi-mona-ui-grid.d.ts +0 -1
- package/types/nanahoshi-mona-ui-i18n.d.ts +130 -3
- package/types/nanahoshi-mona-ui-internal.d.ts +95 -14
- package/types/nanahoshi-mona-ui-label.d.ts +17 -2
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +85 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +1 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-otp-input.d.ts +49 -12
- package/types/nanahoshi-mona-ui-placeholder.d.ts +2 -1
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +21 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +165 -20
- package/types/nanahoshi-mona-ui-rating.d.ts +21 -6
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +59 -27
- package/types/nanahoshi-mona-ui-segmented.d.ts +52 -24
- package/types/nanahoshi-mona-ui-sidebar.d.ts +104 -41
- package/types/nanahoshi-mona-ui-skeleton.d.ts +1 -1
- package/types/nanahoshi-mona-ui-slider.d.ts +99 -35
- package/types/nanahoshi-mona-ui-spinner.d.ts +9 -5
- package/types/nanahoshi-mona-ui-splitter.d.ts +31 -10
- package/types/nanahoshi-mona-ui-stepper.d.ts +58 -12
- package/types/nanahoshi-mona-ui-switch.d.ts +32 -10
- package/types/nanahoshi-mona-ui-tabs.d.ts +75 -20
- package/types/nanahoshi-mona-ui-text-area.d.ts +7 -7
- package/types/nanahoshi-mona-ui-text-box.d.ts +2 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +392 -15
- package/types/nanahoshi-mona-ui-time-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +1 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +7 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { Directive, inject, DestroyRef, ElementRef, computed, contentChild, TemplateRef, input, output, model, afterNextRender, Component } from '@angular/core';
|
|
3
|
+
import { Directive, inject, DestroyRef, ElementRef, computed, viewChild, contentChild, TemplateRef, input, output, booleanAttribute, model, afterNextRender, isDevMode, Component } from '@angular/core';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
5
|
import { RouterLink } from '@angular/router';
|
|
6
6
|
import { LucideCircleX } from '@lucide/angular';
|
|
7
7
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
8
8
|
import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
|
|
9
|
-
import { fromEvent
|
|
9
|
+
import { fromEvent } from 'rxjs';
|
|
10
10
|
import { twMerge } from 'tailwind-merge';
|
|
11
11
|
import { cva } from 'class-variance-authority';
|
|
12
12
|
import { themeRaisedSurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
@@ -32,11 +32,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
32
32
|
}]
|
|
33
33
|
}] });
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* The removable, interactive chip's own control, beside the remove button. Its focus ring stays off that button.
|
|
37
|
+
*/
|
|
38
|
+
const CHIP_BODY_CONTROL_CLASSES = `
|
|
39
|
+
inline-flex items-center gap-1.5 [border-radius:inherit]
|
|
40
|
+
focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-indicator
|
|
41
|
+
`;
|
|
35
42
|
const chipThemeVariants = cva(`
|
|
36
|
-
inline-flex shrink-0 items-center justify-between gap-1.5
|
|
43
|
+
relative inline-flex shrink-0 items-center justify-between gap-1.5
|
|
37
44
|
text-xs font-medium
|
|
38
|
-
shadow-(--shadow-control)
|
|
39
|
-
transition-colors duration-(--mona-motion-fast) ease-in-out
|
|
45
|
+
shadow-(--shadow-control)
|
|
46
|
+
transition-colors duration-(--mona-motion-fast) ease-in-out motion-reduce:transition-none
|
|
47
|
+
[&_button[data-chip-remove='true']]:relative
|
|
48
|
+
[&_button[data-chip-remove='true']]:before:absolute
|
|
40
49
|
`, {
|
|
41
50
|
variants: {
|
|
42
51
|
disabled: {
|
|
@@ -44,7 +53,10 @@ const chipThemeVariants = cva(`
|
|
|
44
53
|
false: ""
|
|
45
54
|
},
|
|
46
55
|
interactive: {
|
|
47
|
-
true:
|
|
56
|
+
true: `
|
|
57
|
+
cursor-pointer
|
|
58
|
+
focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-indicator
|
|
59
|
+
`,
|
|
48
60
|
false: ""
|
|
49
61
|
},
|
|
50
62
|
look: {
|
|
@@ -57,7 +69,7 @@ const chipThemeVariants = cva(`
|
|
|
57
69
|
error: "bg-error text-error-foreground",
|
|
58
70
|
warning: "bg-warning text-warning-foreground",
|
|
59
71
|
info: "bg-info text-info-foreground",
|
|
60
|
-
outline: "bg-transparent text-foreground border border-
|
|
72
|
+
outline: "bg-transparent text-foreground border border-border",
|
|
61
73
|
secondary: "bg-secondary text-secondary-foreground",
|
|
62
74
|
ghost: "bg-transparent text-foreground shadow-none"
|
|
63
75
|
},
|
|
@@ -73,20 +85,27 @@ const chipThemeVariants = cva(`
|
|
|
73
85
|
px-1 py-0.5
|
|
74
86
|
[&_button[data-chip-remove='true']]:w-3
|
|
75
87
|
[&_button[data-chip-remove='true']]:h-3
|
|
88
|
+
[&_button[data-chip-remove='true']]:before:-inset-1.5
|
|
76
89
|
`,
|
|
77
90
|
medium: `
|
|
78
91
|
px-1.5 py-1
|
|
79
92
|
[&_button[data-chip-remove='true']]:w-4
|
|
80
93
|
[&_button[data-chip-remove='true']]:h-4
|
|
94
|
+
[&_button[data-chip-remove='true']]:before:-inset-1
|
|
81
95
|
`,
|
|
82
96
|
large: `
|
|
83
97
|
px-2 py-1.5
|
|
84
98
|
[&_button[data-chip-remove='true']]:w-5
|
|
85
99
|
[&_button[data-chip-remove='true']]:h-5
|
|
100
|
+
[&_button[data-chip-remove='true']]:before:-inset-0.5
|
|
86
101
|
`
|
|
87
102
|
},
|
|
88
103
|
selected: {
|
|
89
|
-
|
|
104
|
+
// A border in the text's color, so selected doesn't rest on the background alone, and forced colors keep it.
|
|
105
|
+
true: `
|
|
106
|
+
after:pointer-events-none after:absolute after:inset-0
|
|
107
|
+
after:rounded-[inherit] after:border-2 after:border-current
|
|
108
|
+
`,
|
|
90
109
|
false: ""
|
|
91
110
|
}
|
|
92
111
|
},
|
|
@@ -143,7 +162,6 @@ const chipThemeVariants = cva(`
|
|
|
143
162
|
class: `
|
|
144
163
|
hover:bg-hover hover:text-foreground
|
|
145
164
|
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
146
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
147
165
|
`
|
|
148
166
|
},
|
|
149
167
|
{
|
|
@@ -153,7 +171,6 @@ const chipThemeVariants = cva(`
|
|
|
153
171
|
class: `
|
|
154
172
|
hover:bg-primary-hover hover:text-primary-foreground
|
|
155
173
|
active:bg-primary-active active:text-primary-foreground
|
|
156
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
157
174
|
`
|
|
158
175
|
},
|
|
159
176
|
{
|
|
@@ -163,7 +180,6 @@ const chipThemeVariants = cva(`
|
|
|
163
180
|
class: `
|
|
164
181
|
hover:bg-secondary-hover hover:text-secondary-foreground
|
|
165
182
|
active:bg-secondary-active active:text-secondary-foreground
|
|
166
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
167
183
|
`
|
|
168
184
|
},
|
|
169
185
|
{
|
|
@@ -173,7 +189,6 @@ const chipThemeVariants = cva(`
|
|
|
173
189
|
class: `
|
|
174
190
|
hover:bg-success-hover hover:text-success-foreground
|
|
175
191
|
active:bg-success-active active:text-success-foreground
|
|
176
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
177
192
|
`
|
|
178
193
|
},
|
|
179
194
|
{
|
|
@@ -183,7 +198,6 @@ const chipThemeVariants = cva(`
|
|
|
183
198
|
class: `
|
|
184
199
|
hover:bg-error-hover hover:text-error-foreground
|
|
185
200
|
active:bg-error-active active:text-error-foreground
|
|
186
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
187
201
|
`
|
|
188
202
|
},
|
|
189
203
|
{
|
|
@@ -193,7 +207,6 @@ const chipThemeVariants = cva(`
|
|
|
193
207
|
class: `
|
|
194
208
|
hover:bg-warning-hover hover:text-warning-foreground
|
|
195
209
|
active:bg-warning-active active:text-warning-foreground
|
|
196
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
197
210
|
`
|
|
198
211
|
},
|
|
199
212
|
{
|
|
@@ -203,7 +216,6 @@ const chipThemeVariants = cva(`
|
|
|
203
216
|
class: `
|
|
204
217
|
hover:bg-info-hover hover:text-info-foreground
|
|
205
218
|
active:bg-info-active active:text-info-foreground
|
|
206
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
207
219
|
`
|
|
208
220
|
},
|
|
209
221
|
{
|
|
@@ -213,7 +225,6 @@ const chipThemeVariants = cva(`
|
|
|
213
225
|
class: `
|
|
214
226
|
hover:bg-hover hover:text-foreground
|
|
215
227
|
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
216
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
217
228
|
`
|
|
218
229
|
},
|
|
219
230
|
{
|
|
@@ -223,7 +234,6 @@ const chipThemeVariants = cva(`
|
|
|
223
234
|
class: `
|
|
224
235
|
hover:bg-hover hover:text-foreground
|
|
225
236
|
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
226
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
227
237
|
`
|
|
228
238
|
},
|
|
229
239
|
{
|
|
@@ -233,7 +243,6 @@ const chipThemeVariants = cva(`
|
|
|
233
243
|
class: `
|
|
234
244
|
hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground)
|
|
235
245
|
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
236
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
237
246
|
`
|
|
238
247
|
},
|
|
239
248
|
{
|
|
@@ -243,7 +252,6 @@ const chipThemeVariants = cva(`
|
|
|
243
252
|
class: `
|
|
244
253
|
hover:bg-primary-selected/95 hover:text-primary-foreground
|
|
245
254
|
active:bg-primary-selected/100 active:text-primary-foreground
|
|
246
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
247
255
|
`
|
|
248
256
|
},
|
|
249
257
|
{
|
|
@@ -253,7 +261,6 @@ const chipThemeVariants = cva(`
|
|
|
253
261
|
class: `
|
|
254
262
|
hover:bg-secondary-selected/95 hover:text-secondary-foreground
|
|
255
263
|
active:bg-secondary-selected/100 active:text-secondary-foreground
|
|
256
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
257
264
|
`
|
|
258
265
|
},
|
|
259
266
|
{
|
|
@@ -263,7 +270,6 @@ const chipThemeVariants = cva(`
|
|
|
263
270
|
class: `
|
|
264
271
|
hover:bg-success-selected/95 hover:text-success-foreground
|
|
265
272
|
active:bg-success-selected/100 active:text-success-foreground
|
|
266
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
267
273
|
`
|
|
268
274
|
},
|
|
269
275
|
{
|
|
@@ -273,7 +279,6 @@ const chipThemeVariants = cva(`
|
|
|
273
279
|
class: `
|
|
274
280
|
hover:bg-error-selected/95 hover:text-error-foreground
|
|
275
281
|
active:bg-error-selected/100 active:text-error-foreground
|
|
276
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
277
282
|
`
|
|
278
283
|
},
|
|
279
284
|
{
|
|
@@ -283,7 +288,6 @@ const chipThemeVariants = cva(`
|
|
|
283
288
|
class: `
|
|
284
289
|
hover:bg-warning-selected/95 hover:text-warning-foreground
|
|
285
290
|
active:bg-warning-selected/100 active:text-warning-foreground
|
|
286
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
287
291
|
`
|
|
288
292
|
},
|
|
289
293
|
{
|
|
@@ -293,7 +297,6 @@ const chipThemeVariants = cva(`
|
|
|
293
297
|
class: `
|
|
294
298
|
hover:bg-info-selected/95 hover:text-info-foreground
|
|
295
299
|
active:bg-info-selected/100 active:text-info-foreground
|
|
296
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
297
300
|
`
|
|
298
301
|
},
|
|
299
302
|
{
|
|
@@ -303,7 +306,6 @@ const chipThemeVariants = cva(`
|
|
|
303
306
|
class: `
|
|
304
307
|
hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground)
|
|
305
308
|
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
306
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
307
309
|
`
|
|
308
310
|
},
|
|
309
311
|
{
|
|
@@ -313,7 +315,6 @@ const chipThemeVariants = cva(`
|
|
|
313
315
|
class: `
|
|
314
316
|
hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground)
|
|
315
317
|
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
316
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
317
318
|
`
|
|
318
319
|
}
|
|
319
320
|
],
|
|
@@ -324,6 +325,8 @@ const chipThemeVariants = cva(`
|
|
|
324
325
|
}
|
|
325
326
|
});
|
|
326
327
|
|
|
328
|
+
/** Projected controls keep their own clicks and keys. */
|
|
329
|
+
const PROJECTED_CONTROL_SELECTOR = "a[href], button, input, select, textarea, [role='button'], [role='link'], [tabindex]";
|
|
327
330
|
class ChipComponent {
|
|
328
331
|
#destroyRef;
|
|
329
332
|
#elementRef;
|
|
@@ -353,34 +356,36 @@ class ChipComponent {
|
|
|
353
356
|
return twMerge(variantClasses, userClass);
|
|
354
357
|
}, /* @ts-ignore */
|
|
355
358
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
359
|
+
this.bodyClasses = computed(() => (this.split() ? CHIP_BODY_CONTROL_CLASSES : "contents"), /* @ts-ignore */
|
|
360
|
+
...(ngDevMode ? [{ debugName: "bodyClasses" }] : /* istanbul ignore next */ []));
|
|
361
|
+
this.bodyElement = viewChild.required("body", /* @ts-ignore */
|
|
362
|
+
...(ngDevMode ? [{ debugName: "bodyElement" }] : /* istanbul ignore next */ []));
|
|
356
363
|
this.bodyInteractive = computed(() => !this.disabled() && (this.toggleable() || this.isLink()), /* @ts-ignore */
|
|
357
364
|
...(ngDevMode ? [{ debugName: "bodyInteractive" }] : /* istanbul ignore next */ []));
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
if (
|
|
361
|
-
return
|
|
362
|
-
}
|
|
363
|
-
const label = this.label();
|
|
364
|
-
if (label) {
|
|
365
|
-
return label;
|
|
365
|
+
/** The role of the chip's own control, wherever it ends up. */
|
|
366
|
+
this.controlRole = computed(() => {
|
|
367
|
+
if (this.toggleable()) {
|
|
368
|
+
return "checkbox";
|
|
366
369
|
}
|
|
367
|
-
return
|
|
370
|
+
return this.isLink() ? "link" : null;
|
|
368
371
|
}, /* @ts-ignore */
|
|
369
|
-
...(ngDevMode ? [{ debugName: "
|
|
372
|
+
...(ngDevMode ? [{ debugName: "controlRole" }] : /* istanbul ignore next */ []));
|
|
370
373
|
this.effectiveTabIndex = computed(() => {
|
|
371
|
-
if (this.disabled()) {
|
|
372
|
-
return -1;
|
|
373
|
-
}
|
|
374
374
|
const explicitTabindex = this.tabindex();
|
|
375
|
-
if (explicitTabindex
|
|
376
|
-
return
|
|
375
|
+
if (!this.controlRole() && explicitTabindex == null) {
|
|
376
|
+
return null;
|
|
377
377
|
}
|
|
378
|
-
|
|
379
|
-
return 0;
|
|
380
|
-
}
|
|
381
|
-
return -1;
|
|
378
|
+
return this.disabled() ? -1 : (explicitTabindex ?? 0);
|
|
382
379
|
}, /* @ts-ignore */
|
|
383
380
|
...(ngDevMode ? [{ debugName: "effectiveTabIndex" }] : /* istanbul ignore next */ []));
|
|
381
|
+
/** A name needs a role to land on, and an interactive host can't hold a remove button. */
|
|
382
|
+
this.hostRole = computed(() => {
|
|
383
|
+
if (this.split()) {
|
|
384
|
+
return "group";
|
|
385
|
+
}
|
|
386
|
+
return this.controlRole() ?? (this.ariaLabel() ? "group" : null);
|
|
387
|
+
}, /* @ts-ignore */
|
|
388
|
+
...(ngDevMode ? [{ debugName: "hostRole" }] : /* istanbul ignore next */ []));
|
|
384
389
|
this.iconSize = computed(() => {
|
|
385
390
|
const size = this.size();
|
|
386
391
|
switch (size) {
|
|
@@ -399,16 +404,15 @@ class ChipComponent {
|
|
|
399
404
|
...(ngDevMode ? [{ debugName: "isLink" }] : /* istanbul ignore next */ []));
|
|
400
405
|
this.messages = this.#i18n.componentMessages("chip", CHIP_DEFAULT_MESSAGES);
|
|
401
406
|
this.prefixTemplate = contentChild(ChipPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
402
|
-
this.role = computed(() => {
|
|
403
|
-
if (this.toggleable()) {
|
|
404
|
-
return "checkbox";
|
|
405
|
-
}
|
|
406
|
-
return undefined;
|
|
407
|
-
}, /* @ts-ignore */
|
|
408
|
-
...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
|
|
409
407
|
/**
|
|
410
|
-
*
|
|
411
|
-
*
|
|
408
|
+
* An interactive role makes its children presentational, which would hide the remove button, so a chip with both
|
|
409
|
+
* keeps its control on an inner element.
|
|
410
|
+
*/
|
|
411
|
+
this.split = computed(() => this.removable() && !!this.controlRole(), /* @ts-ignore */
|
|
412
|
+
...(ngDevMode ? [{ debugName: "split" }] : /* istanbul ignore next */ []));
|
|
413
|
+
/**
|
|
414
|
+
* @description Accessible name of the chip, for one whose text doesn't describe it, such as an icon. On a chip with no
|
|
415
|
+
* other role, it makes the chip a named group.
|
|
412
416
|
* @default ""
|
|
413
417
|
*/
|
|
414
418
|
this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
@@ -421,8 +425,7 @@ class ChipComponent {
|
|
|
421
425
|
* @description Renders the chip with reduced visual emphasis and removes pointer interaction.
|
|
422
426
|
* @default false
|
|
423
427
|
*/
|
|
424
|
-
this.disabled = input(false, /*
|
|
425
|
-
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
428
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
426
429
|
/**
|
|
427
430
|
* @description Text label displayed inside the chip. When non-empty, takes precedence over projected content.
|
|
428
431
|
* @default ""
|
|
@@ -439,23 +442,23 @@ class ChipComponent {
|
|
|
439
442
|
* @description Renders a remove button inside the chip. When activated, emits the `remove` output.
|
|
440
443
|
* @default false
|
|
441
444
|
*/
|
|
442
|
-
this.removable = input(false, /*
|
|
443
|
-
...(ngDevMode ? [{ debugName: "removable" }] : /* istanbul ignore next */ []));
|
|
445
|
+
this.removable = input(false, { ...(ngDevMode ? { debugName: "removable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
444
446
|
/**
|
|
445
|
-
* @description Emitted when the remove button is clicked
|
|
446
|
-
* Emits the originating `Event`.
|
|
447
|
+
* @description Emitted when the remove button is clicked, or Delete or Backspace is pressed on the chip. Only fires
|
|
448
|
+
* when `removable` is `true`. Emits the originating `Event`. The chip can't keep focus once its parent destroys it, so
|
|
449
|
+
* move focus to the next chip or the list here.
|
|
447
450
|
*/
|
|
448
451
|
this.remove = output();
|
|
449
452
|
/**
|
|
450
453
|
* @description Accessible label for the remove button, overriding the auto-computed `"Remove, <label>"` fallback.
|
|
451
|
-
*
|
|
454
|
+
* A chip with only projected content needs this or `aria-label`, or it warns in development.
|
|
452
455
|
* @default undefined
|
|
453
456
|
*/
|
|
454
457
|
this.removeLabel = input(/* @ts-ignore */
|
|
455
458
|
...(ngDevMode ? [undefined, { debugName: "removeLabel" }] : /* istanbul ignore next */ []));
|
|
456
459
|
/**
|
|
457
460
|
* @description Tab index for the remove button, independent of the chip host's own tabindex.
|
|
458
|
-
* Set to `-1` to exclude the remove button from tab order
|
|
461
|
+
* Set to `-1` to exclude the remove button from tab order, since Delete and Backspace on the chip also remove it.
|
|
459
462
|
* @default 0
|
|
460
463
|
*/
|
|
461
464
|
this.removeTabIndex = input(0, /* @ts-ignore */
|
|
@@ -468,7 +471,8 @@ class ChipComponent {
|
|
|
468
471
|
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
469
472
|
/**
|
|
470
473
|
* @description Whether the chip is selected. When `toggleable` is `true`, each activation flips this value.
|
|
471
|
-
* Supports two-way binding via `[(selected)]`.
|
|
474
|
+
* Supports two-way binding via `[(selected)]`. Without `toggleable`, it's only a look, with no state for assistive
|
|
475
|
+
* technology.
|
|
472
476
|
* @default false
|
|
473
477
|
*/
|
|
474
478
|
this.selected = model(false, /* @ts-ignore */
|
|
@@ -481,32 +485,36 @@ class ChipComponent {
|
|
|
481
485
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
482
486
|
/**
|
|
483
487
|
* @description Tab index override for the chip host element. When not set, computed automatically:
|
|
484
|
-
* `0` when `toggleable` is `true` or functioning as a link,
|
|
488
|
+
* `0` when `toggleable` is `true` or functioning as a link, not focusable otherwise. Overridden to `-1` when `disabled`
|
|
489
|
+
* is `true`.
|
|
485
490
|
* @default undefined
|
|
486
491
|
*/
|
|
487
492
|
this.tabindex = input(/* @ts-ignore */
|
|
488
493
|
...(ngDevMode ? [undefined, { debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
489
494
|
/**
|
|
490
495
|
* @description Enables toggle behavior. When `true`, each activation flips `selected`
|
|
491
|
-
* and the host receives `role="checkbox"` with `aria-checked`.
|
|
496
|
+
* and the host receives `role="checkbox"` with `aria-checked`. With `removable`, the host is a `group` instead, and an
|
|
497
|
+
* inner element is the checkbox, beside the remove button.
|
|
492
498
|
* @default false
|
|
493
499
|
*/
|
|
494
|
-
this.toggleable = input(false, /*
|
|
495
|
-
...(ngDevMode ? [{ debugName: "toggleable" }] : /* istanbul ignore next */ []));
|
|
500
|
+
this.toggleable = input(false, { ...(ngDevMode ? { debugName: "toggleable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
496
501
|
/**
|
|
497
502
|
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
498
503
|
* @default ""
|
|
499
504
|
*/
|
|
500
505
|
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
501
506
|
/**
|
|
502
|
-
* @description Arbitrary value associated with this chip.
|
|
503
|
-
*
|
|
507
|
+
* @description Arbitrary value associated with this chip. The chip doesn't use it or emit it, so to tell which chip was
|
|
508
|
+
* removed, pass the item in your `(remove)` handler.
|
|
504
509
|
* @default undefined
|
|
505
510
|
*/
|
|
506
511
|
this.value = input(/* @ts-ignore */
|
|
507
512
|
...(ngDevMode ? [undefined, { debugName: "value" }] : /* istanbul ignore next */ []));
|
|
508
513
|
afterNextRender({
|
|
509
|
-
read: () =>
|
|
514
|
+
read: () => {
|
|
515
|
+
this.#setSubscriptions();
|
|
516
|
+
this.#warnIfRemoveHasNoName();
|
|
517
|
+
}
|
|
510
518
|
});
|
|
511
519
|
}
|
|
512
520
|
onRemoveClick(event) {
|
|
@@ -523,38 +531,72 @@ class ChipComponent {
|
|
|
523
531
|
this.selected.set(!this.selected());
|
|
524
532
|
this.contentClick.emit();
|
|
525
533
|
}
|
|
534
|
+
#handleKeydown(event) {
|
|
535
|
+
const target = event.target;
|
|
536
|
+
const onControl = target === this.#elementRef.nativeElement || target === this.bodyElement().nativeElement;
|
|
537
|
+
if (this.disabled()) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (event.key === "Delete" || event.key === "Backspace") {
|
|
541
|
+
if (this.removable() && (onControl || target.closest("button[data-chip-remove]"))) {
|
|
542
|
+
event.preventDefault();
|
|
543
|
+
this.remove.emit(event);
|
|
544
|
+
}
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
if (!onControl) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
if (event.key === "Enter" && this.isLink()) {
|
|
551
|
+
event.preventDefault();
|
|
552
|
+
if (!event.repeat) {
|
|
553
|
+
this.#elementRef.nativeElement.click();
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
else if ((event.key === "Enter" || event.key === " ") && this.toggleable()) {
|
|
557
|
+
event.preventDefault();
|
|
558
|
+
if (!event.repeat) {
|
|
559
|
+
this.#handleActivation();
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
#isOnProjectedControl(event) {
|
|
564
|
+
const control = event.target.closest?.(PROJECTED_CONTROL_SELECTOR);
|
|
565
|
+
return !!control && control !== this.#elementRef.nativeElement && control !== this.bodyElement().nativeElement;
|
|
566
|
+
}
|
|
526
567
|
#setSubscriptions() {
|
|
527
568
|
const element = this.#elementRef.nativeElement;
|
|
528
569
|
fromEvent(element, "keydown")
|
|
529
|
-
.pipe(
|
|
570
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
571
|
+
.subscribe(event => this.#handleKeydown(event));
|
|
572
|
+
fromEvent(element, "click")
|
|
573
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
530
574
|
.subscribe(event => {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
return;
|
|
575
|
+
if (!this.#isOnProjectedControl(event)) {
|
|
576
|
+
this.#handleActivation();
|
|
534
577
|
}
|
|
535
|
-
event.preventDefault();
|
|
536
|
-
this.#handleActivation();
|
|
537
|
-
});
|
|
538
|
-
fromEvent(element, "click")
|
|
539
|
-
.pipe(filter(() => !this.disabled() && this.toggleable()), takeUntilDestroyed(this.#destroyRef))
|
|
540
|
-
.subscribe(() => {
|
|
541
|
-
this.#handleActivation();
|
|
542
578
|
});
|
|
543
579
|
}
|
|
580
|
+
#warnIfRemoveHasNoName() {
|
|
581
|
+
if (isDevMode() && this.removable() && !this.label() && !this.ariaLabel() && !this.removeLabel()) {
|
|
582
|
+
console.warn("[Mona Chip] A removable chip with projected content needs removeLabel or aria-label, or its remove button " +
|
|
583
|
+
"reads as a generic item.", this.#elementRef.nativeElement);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
544
586
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
545
|
-
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' :
|
|
587
|
+
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": "split() ? null : effectiveTabIndex()", "attr.aria-disabled": "hostRole() && disabled() ? 'true' : null", "attr.role": "hostRole()", "attr.aria-checked": "split() ? null : ariaChecked()", "attr.aria-label": "split() ? null : ariaLabel() || null" } }, queries: [{ propertyName: "prefixTemplate", first: true, predicate: ChipPrefixTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "bodyElement", first: true, predicate: ["body"], descendants: true, isSignal: true }], ngImport: i0, template: "<span\n #body\n [class]=\"bodyClasses()\"\n [attr.aria-checked]=\"split() ? ariaChecked() : null\"\n [attr.aria-disabled]=\"split() && disabled() ? 'true' : null\"\n [attr.aria-label]=\"split() ? ariaLabel() || null : null\"\n [attr.role]=\"split() ? controlRole() : null\"\n [attr.tabindex]=\"split() ? effectiveTabIndex() : null\">\n @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</span>\n\n@if (removable()) {\n @let removeAriaLabel = removeLabel() || messages().removeLabel(label() || ariaLabel());\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", "type", "class", "value"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideCircleX, selector: "svg[lucideCircleX], svg[lucideXCircle]" }] }); }
|
|
546
588
|
}
|
|
547
589
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ChipComponent, decorators: [{
|
|
548
590
|
type: Component,
|
|
549
591
|
args: [{ selector: "mona-chip", imports: [ButtonDirective, NgTemplateOutlet, LucideCircleX], host: {
|
|
550
592
|
"[class]": "baseClass()",
|
|
551
|
-
"[attr.tabindex]": "effectiveTabIndex()",
|
|
552
|
-
"[attr.aria-disabled]": "disabled() ? 'true' :
|
|
553
|
-
"[attr.role]": "
|
|
554
|
-
"[attr.aria-checked]": "ariaChecked()",
|
|
555
|
-
"[attr.aria-label]": "
|
|
556
|
-
}, template: "@if (prefixTemplate()) {\n
|
|
557
|
-
}], 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 }] }] } });
|
|
593
|
+
"[attr.tabindex]": "split() ? null : effectiveTabIndex()",
|
|
594
|
+
"[attr.aria-disabled]": "hostRole() && disabled() ? 'true' : null",
|
|
595
|
+
"[attr.role]": "hostRole()",
|
|
596
|
+
"[attr.aria-checked]": "split() ? null : ariaChecked()",
|
|
597
|
+
"[attr.aria-label]": "split() ? null : ariaLabel() || null"
|
|
598
|
+
}, template: "<span\n #body\n [class]=\"bodyClasses()\"\n [attr.aria-checked]=\"split() ? ariaChecked() : null\"\n [attr.aria-disabled]=\"split() && disabled() ? 'true' : null\"\n [attr.aria-label]=\"split() ? ariaLabel() || null : null\"\n [attr.role]=\"split() ? controlRole() : null\"\n [attr.tabindex]=\"split() ? effectiveTabIndex() : null\">\n @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</span>\n\n@if (removable()) {\n @let removeAriaLabel = removeLabel() || messages().removeLabel(label() || ariaLabel());\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" }]
|
|
599
|
+
}], ctorParameters: () => [], propDecorators: { bodyElement: [{ type: i0.ViewChild, args: ["body", { isSignal: true }] }], 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 }] }] } });
|
|
558
600
|
|
|
559
601
|
/*
|
|
560
602
|
* Public API Surface of @nanahoshi/mona-ui/chip
|