@nanahoshi/mona-ui 0.18.5 → 0.19.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 +71 -13
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +11 -3
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +17 -9
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +16 -7
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +122 -48
- package/fesm2022/nanahoshi-mona-ui-card.mjs +22 -14
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +78 -18
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +199 -77
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +1 -2
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +23 -5
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +49 -28
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +42 -26
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +11 -3
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +28 -16
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +74 -51
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +57 -25
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +13 -5
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +17 -6
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +178 -59
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +137 -54
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-WEDbZ5vy.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-Bg7rckst.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-ibH5osCg.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-BSSpaCLL.mjs} +2 -2
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-D9AwQFDV.mjs +145 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-hc-LeIb0.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Byb9iTes.mjs} +21 -17
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DYajpOb9.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CBmdtrXm.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-Pm8Fbp6M.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-DPmJmCap.mjs} +90 -42
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +1168 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +12 -4
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +48 -21
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +33 -18
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +10 -10
- package/fesm2022/nanahoshi-mona-ui-list.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +29 -16
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +12 -3
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +23 -18
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +211 -106
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +14 -6
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +46 -19
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +57 -46
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +35 -15
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +38 -17
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +25 -7
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +431 -101
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +26 -8
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +222 -28
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +91 -36
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +34 -15
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +39 -23
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +50 -25
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +32 -14
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +9 -9
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +74 -56
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +16 -8
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +33 -19
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +66 -27
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +23 -15
- package/fesm2022/nanahoshi-mona-ui-window.mjs +71 -40
- package/i18n/package.json +4 -0
- package/package.json +5 -1
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -1
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +9 -3
- package/types/nanahoshi-mona-ui-button-group.d.ts +9 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +13 -3
- package/types/nanahoshi-mona-ui-card.d.ts +8 -2
- package/types/nanahoshi-mona-ui-chart.d.ts +10 -1
- package/types/nanahoshi-mona-ui-chip.d.ts +14 -5
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +6 -1
- package/types/nanahoshi-mona-ui-color-palette.d.ts +21 -10
- package/types/nanahoshi-mona-ui-color-picker.d.ts +30 -20
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -1
- package/types/nanahoshi-mona-ui-date-picker.d.ts +7 -2
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +33 -8
- package/types/nanahoshi-mona-ui-dialog.d.ts +16 -7
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -1
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +4 -1
- package/types/nanahoshi-mona-ui-editor.d.ts +6 -1
- package/types/nanahoshi-mona-ui-filter.d.ts +16 -10
- package/types/nanahoshi-mona-ui-grid.d.ts +38 -1
- package/types/nanahoshi-mona-ui-i18n.d.ts +633 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +7 -2
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +7 -3
- package/types/nanahoshi-mona-ui-list-box.d.ts +9 -4
- package/types/nanahoshi-mona-ui-list-view.d.ts +6 -6
- package/types/nanahoshi-mona-ui-list.d.ts +1 -1
- package/types/nanahoshi-mona-ui-menubar.d.ts +59 -58
- package/types/nanahoshi-mona-ui-multi-select.d.ts +6 -1
- package/types/nanahoshi-mona-ui-notification.d.ts +11 -5
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +24 -15
- package/types/nanahoshi-mona-ui-otp-input.d.ts +9 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +19 -6
- package/types/nanahoshi-mona-ui-popup.d.ts +2 -1
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +9 -7
- package/types/nanahoshi-mona-ui-rating.d.ts +19 -12
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +34 -28
- package/types/nanahoshi-mona-ui-sheet.d.ts +8 -2
- package/types/nanahoshi-mona-ui-sidebar.d.ts +3 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +44 -26
- package/types/nanahoshi-mona-ui-spinner.d.ts +13 -4
- package/types/nanahoshi-mona-ui-split-button.d.ts +62 -56
- package/types/nanahoshi-mona-ui-splitter.d.ts +9 -6
- package/types/nanahoshi-mona-ui-stepper.d.ts +9 -3
- package/types/nanahoshi-mona-ui-switch.d.ts +1 -1
- package/types/nanahoshi-mona-ui-tabs.d.ts +96 -35
- package/types/nanahoshi-mona-ui-text-box.d.ts +11 -5
- package/types/nanahoshi-mona-ui-time-picker.d.ts +7 -2
- package/types/nanahoshi-mona-ui-time-selector.d.ts +16 -5
- package/types/nanahoshi-mona-ui-tree-view.d.ts +15 -10
- package/types/nanahoshi-mona-ui-window.d.ts +26 -20
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ZM3CneJ0.mjs +0 -145
|
@@ -8,7 +8,7 @@ import { themeControlSurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
|
8
8
|
const checkboxInputThemeVariants = cva(`sr-only appearance-none outline-none peer`);
|
|
9
9
|
const checkmarkThemeVariants = cva(`
|
|
10
10
|
flex items-center justify-center
|
|
11
|
-
h-4.5 w-4.5
|
|
11
|
+
h-4.5 w-4.5 ps-0.25
|
|
12
12
|
cursor-pointer overflow-hidden
|
|
13
13
|
${themeControlSurfaceClasses}
|
|
14
14
|
border border-input-border
|
|
@@ -2,13 +2,19 @@ import { NgTemplateOutlet } from '@angular/common';
|
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { Directive, inject, DestroyRef, ElementRef, computed, contentChild, TemplateRef, input, output, model, afterNextRender, Component } from '@angular/core';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
+
import { RouterLink } from '@angular/router';
|
|
5
6
|
import { LucideCircleX } from '@lucide/angular';
|
|
6
7
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
8
|
+
import { MonaI18nService } from '@nanahoshi/mona-ui/i18n';
|
|
7
9
|
import { fromEvent, filter } from 'rxjs';
|
|
8
10
|
import { twMerge } from 'tailwind-merge';
|
|
9
11
|
import { cva } from 'class-variance-authority';
|
|
10
12
|
import { themeRaisedSurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
11
13
|
|
|
14
|
+
const CHIP_DEFAULT_MESSAGES = {
|
|
15
|
+
removeLabel: (label) => (label ? `Remove, ${label}` : "Remove, item")
|
|
16
|
+
};
|
|
17
|
+
|
|
12
18
|
/**
|
|
13
19
|
* @description Apply to an `<ng-template>` directly inside `<mona-chip>` to render prefix content
|
|
14
20
|
* (e.g., an avatar or icon) before the chip label or projected content. The template receives no context.
|
|
@@ -26,7 +32,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
26
32
|
|
|
27
33
|
const chipThemeVariants = cva(`
|
|
28
34
|
inline-flex shrink-0 items-center justify-between gap-1.5
|
|
29
|
-
|
|
35
|
+
text-xs font-medium
|
|
30
36
|
shadow-(--shadow-control) outline-none
|
|
31
37
|
transition-colors duration-(--mona-motion-fast) ease-in-out
|
|
32
38
|
`, {
|
|
@@ -35,63 +41,23 @@ const chipThemeVariants = cva(`
|
|
|
35
41
|
true: "pointer-events-none opacity-50 cursor-not-allowed select-none",
|
|
36
42
|
false: ""
|
|
37
43
|
},
|
|
44
|
+
interactive: {
|
|
45
|
+
true: "cursor-pointer",
|
|
46
|
+
false: ""
|
|
47
|
+
},
|
|
38
48
|
look: {
|
|
39
49
|
default: `
|
|
40
50
|
${themeRaisedSurfaceClasses} text-foreground
|
|
41
51
|
border border-border
|
|
42
|
-
hover:bg-hover hover:text-foreground
|
|
43
|
-
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
44
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
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-focus-indicator/35
|
|
51
52
|
`,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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-focus-indicator/35
|
|
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-focus-indicator/35
|
|
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-focus-indicator/35
|
|
75
|
-
`,
|
|
76
|
-
outline: `
|
|
77
|
-
bg-transparent text-foreground
|
|
78
|
-
border border-input-border
|
|
79
|
-
hover:bg-hover hover:text-foreground
|
|
80
|
-
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
81
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
82
|
-
`,
|
|
83
|
-
secondary: `
|
|
84
|
-
bg-secondary text-secondary-foreground
|
|
85
|
-
hover:bg-secondary-hover hover:text-secondary-foreground
|
|
86
|
-
active:bg-secondary-active active:text-secondary-foreground
|
|
87
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
88
|
-
`,
|
|
89
|
-
ghost: `
|
|
90
|
-
bg-transparent text-foreground shadow-none
|
|
91
|
-
hover:bg-hover hover:text-foreground
|
|
92
|
-
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
93
|
-
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
94
|
-
`
|
|
53
|
+
primary: "bg-primary text-primary-foreground",
|
|
54
|
+
success: "bg-success text-success-foreground",
|
|
55
|
+
error: "bg-error text-error-foreground",
|
|
56
|
+
warning: "bg-warning text-warning-foreground",
|
|
57
|
+
info: "bg-info text-info-foreground",
|
|
58
|
+
outline: "bg-transparent text-foreground border border-input-border",
|
|
59
|
+
secondary: "bg-secondary text-secondary-foreground",
|
|
60
|
+
ghost: "bg-transparent text-foreground shadow-none"
|
|
95
61
|
},
|
|
96
62
|
rounded: {
|
|
97
63
|
full: "rounded-full",
|
|
@@ -102,17 +68,17 @@ const chipThemeVariants = cva(`
|
|
|
102
68
|
},
|
|
103
69
|
size: {
|
|
104
70
|
small: `
|
|
105
|
-
|
|
71
|
+
px-1 py-0.5
|
|
106
72
|
[&_button[data-chip-remove='true']]:w-3
|
|
107
73
|
[&_button[data-chip-remove='true']]:h-3
|
|
108
74
|
`,
|
|
109
75
|
medium: `
|
|
110
|
-
|
|
76
|
+
px-1.5 py-1
|
|
111
77
|
[&_button[data-chip-remove='true']]:w-4
|
|
112
78
|
[&_button[data-chip-remove='true']]:h-4
|
|
113
79
|
`,
|
|
114
80
|
large: `
|
|
115
|
-
|
|
81
|
+
px-2 py-1.5
|
|
116
82
|
[&_button[data-chip-remove='true']]:w-5
|
|
117
83
|
[&_button[data-chip-remove='true']]:h-5
|
|
118
84
|
`
|
|
@@ -126,86 +92,231 @@ const chipThemeVariants = cva(`
|
|
|
126
92
|
{
|
|
127
93
|
look: "default",
|
|
128
94
|
selected: true,
|
|
95
|
+
class: "bg-(--color-selected) text-(--color-selected-foreground)"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
look: "primary",
|
|
99
|
+
selected: true,
|
|
100
|
+
class: "bg-primary-selected text-primary-foreground"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
look: "secondary",
|
|
104
|
+
selected: true,
|
|
105
|
+
class: "bg-secondary-selected text-secondary-foreground"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
look: "success",
|
|
109
|
+
selected: true,
|
|
110
|
+
class: "bg-success-selected text-success-foreground"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
look: "error",
|
|
114
|
+
selected: true,
|
|
115
|
+
class: "bg-error-selected text-error-foreground"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
look: "warning",
|
|
119
|
+
selected: true,
|
|
120
|
+
class: "bg-warning-selected text-warning-foreground"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
look: "info",
|
|
124
|
+
selected: true,
|
|
125
|
+
class: "bg-info-selected text-info-foreground"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
look: "outline",
|
|
129
|
+
selected: true,
|
|
130
|
+
class: "bg-(--color-selected) text-(--color-selected-foreground)"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
look: "ghost",
|
|
134
|
+
selected: true,
|
|
135
|
+
class: "bg-(--color-selected) text-(--color-selected-foreground)"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
look: "default",
|
|
139
|
+
interactive: true,
|
|
140
|
+
selected: false,
|
|
141
|
+
class: `
|
|
142
|
+
hover:bg-hover hover:text-foreground
|
|
143
|
+
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
144
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
145
|
+
`
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
look: "primary",
|
|
149
|
+
interactive: true,
|
|
150
|
+
selected: false,
|
|
151
|
+
class: `
|
|
152
|
+
hover:bg-primary-hover hover:text-primary-foreground
|
|
153
|
+
active:bg-primary-active active:text-primary-foreground
|
|
154
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
155
|
+
`
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
look: "secondary",
|
|
159
|
+
interactive: true,
|
|
160
|
+
selected: false,
|
|
161
|
+
class: `
|
|
162
|
+
hover:bg-secondary-hover hover:text-secondary-foreground
|
|
163
|
+
active:bg-secondary-active active:text-secondary-foreground
|
|
164
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
165
|
+
`
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
look: "success",
|
|
169
|
+
interactive: true,
|
|
170
|
+
selected: false,
|
|
171
|
+
class: `
|
|
172
|
+
hover:bg-success-hover hover:text-success-foreground
|
|
173
|
+
active:bg-success-active active:text-success-foreground
|
|
174
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
175
|
+
`
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
look: "error",
|
|
179
|
+
interactive: true,
|
|
180
|
+
selected: false,
|
|
181
|
+
class: `
|
|
182
|
+
hover:bg-error-hover hover:text-error-foreground
|
|
183
|
+
active:bg-error-active active:text-error-foreground
|
|
184
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
185
|
+
`
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
look: "warning",
|
|
189
|
+
interactive: true,
|
|
190
|
+
selected: false,
|
|
191
|
+
class: `
|
|
192
|
+
hover:bg-warning-hover hover:text-warning-foreground
|
|
193
|
+
active:bg-warning-active active:text-warning-foreground
|
|
194
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
195
|
+
`
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
look: "info",
|
|
199
|
+
interactive: true,
|
|
200
|
+
selected: false,
|
|
201
|
+
class: `
|
|
202
|
+
hover:bg-info-hover hover:text-info-foreground
|
|
203
|
+
active:bg-info-active active:text-info-foreground
|
|
204
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
205
|
+
`
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
look: "outline",
|
|
209
|
+
interactive: true,
|
|
210
|
+
selected: false,
|
|
211
|
+
class: `
|
|
212
|
+
hover:bg-hover hover:text-foreground
|
|
213
|
+
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
214
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
215
|
+
`
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
look: "ghost",
|
|
219
|
+
interactive: true,
|
|
220
|
+
selected: false,
|
|
221
|
+
class: `
|
|
222
|
+
hover:bg-hover hover:text-foreground
|
|
223
|
+
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
224
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
225
|
+
`
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
look: "default",
|
|
229
|
+
interactive: true,
|
|
230
|
+
selected: true,
|
|
129
231
|
class: `
|
|
130
|
-
bg-(--color-selected) text-(--color-selected-foreground)
|
|
131
232
|
hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground)
|
|
132
233
|
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
234
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
133
235
|
`
|
|
134
236
|
},
|
|
135
237
|
{
|
|
136
238
|
look: "primary",
|
|
239
|
+
interactive: true,
|
|
137
240
|
selected: true,
|
|
138
241
|
class: `
|
|
139
|
-
bg-primary-selected text-primary-foreground
|
|
140
242
|
hover:bg-primary-selected/95 hover:text-primary-foreground
|
|
141
243
|
active:bg-primary-selected/100 active:text-primary-foreground
|
|
244
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
142
245
|
`
|
|
143
246
|
},
|
|
144
247
|
{
|
|
145
248
|
look: "secondary",
|
|
249
|
+
interactive: true,
|
|
146
250
|
selected: true,
|
|
147
251
|
class: `
|
|
148
|
-
bg-secondary-selected text-secondary-foreground
|
|
149
252
|
hover:bg-secondary-selected/95 hover:text-secondary-foreground
|
|
150
253
|
active:bg-secondary-selected/100 active:text-secondary-foreground
|
|
254
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
151
255
|
`
|
|
152
256
|
},
|
|
153
257
|
{
|
|
154
258
|
look: "success",
|
|
259
|
+
interactive: true,
|
|
155
260
|
selected: true,
|
|
156
261
|
class: `
|
|
157
|
-
bg-success-selected text-success-foreground
|
|
158
262
|
hover:bg-success-selected/95 hover:text-success-foreground
|
|
159
263
|
active:bg-success-selected/100 active:text-success-foreground
|
|
264
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
160
265
|
`
|
|
161
266
|
},
|
|
162
267
|
{
|
|
163
268
|
look: "error",
|
|
269
|
+
interactive: true,
|
|
164
270
|
selected: true,
|
|
165
271
|
class: `
|
|
166
|
-
bg-error-selected text-error-foreground
|
|
167
272
|
hover:bg-error-selected/95 hover:text-error-foreground
|
|
168
273
|
active:bg-error-selected/100 active:text-error-foreground
|
|
274
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
169
275
|
`
|
|
170
276
|
},
|
|
171
277
|
{
|
|
172
278
|
look: "warning",
|
|
279
|
+
interactive: true,
|
|
173
280
|
selected: true,
|
|
174
281
|
class: `
|
|
175
|
-
bg-warning-selected text-warning-foreground
|
|
176
282
|
hover:bg-warning-selected/95 hover:text-warning-foreground
|
|
177
283
|
active:bg-warning-selected/100 active:text-warning-foreground
|
|
284
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
178
285
|
`
|
|
179
286
|
},
|
|
180
287
|
{
|
|
181
288
|
look: "info",
|
|
289
|
+
interactive: true,
|
|
182
290
|
selected: true,
|
|
183
291
|
class: `
|
|
184
|
-
bg-info-selected text-info-foreground
|
|
185
292
|
hover:bg-info-selected/95 hover:text-info-foreground
|
|
186
293
|
active:bg-info-selected/100 active:text-info-foreground
|
|
294
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
187
295
|
`
|
|
188
296
|
},
|
|
189
297
|
{
|
|
190
298
|
look: "outline",
|
|
299
|
+
interactive: true,
|
|
191
300
|
selected: true,
|
|
192
301
|
class: `
|
|
193
|
-
bg-(--color-selected) text-(--color-selected-foreground)
|
|
194
302
|
hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground)
|
|
195
303
|
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
304
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
196
305
|
`
|
|
197
306
|
},
|
|
198
307
|
{
|
|
199
308
|
look: "ghost",
|
|
309
|
+
interactive: true,
|
|
200
310
|
selected: true,
|
|
201
311
|
class: `
|
|
202
|
-
bg-(--color-selected) text-(--color-selected-foreground)
|
|
203
312
|
hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground)
|
|
204
313
|
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
314
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
205
315
|
`
|
|
206
316
|
}
|
|
207
317
|
],
|
|
208
318
|
defaultVariants: {
|
|
319
|
+
interactive: false,
|
|
209
320
|
rounded: "medium",
|
|
210
321
|
selected: false
|
|
211
322
|
}
|
|
@@ -214,9 +325,13 @@ const chipThemeVariants = cva(`
|
|
|
214
325
|
class ChipComponent {
|
|
215
326
|
#destroyRef;
|
|
216
327
|
#elementRef;
|
|
328
|
+
#i18n;
|
|
329
|
+
#routerLink;
|
|
217
330
|
constructor() {
|
|
218
331
|
this.#destroyRef = inject(DestroyRef);
|
|
219
332
|
this.#elementRef = inject(ElementRef);
|
|
333
|
+
this.#i18n = inject(MonaI18nService);
|
|
334
|
+
this.#routerLink = inject(RouterLink, { optional: true });
|
|
220
335
|
this.ariaChecked = computed(() => {
|
|
221
336
|
if (!this.toggleable()) {
|
|
222
337
|
return undefined;
|
|
@@ -226,15 +341,18 @@ class ChipComponent {
|
|
|
226
341
|
...(ngDevMode ? [{ debugName: "ariaChecked" }] : /* istanbul ignore next */ []));
|
|
227
342
|
this.baseClass = computed(() => {
|
|
228
343
|
const disabled = this.disabled();
|
|
344
|
+
const interactive = this.bodyInteractive();
|
|
229
345
|
const look = this.look();
|
|
230
346
|
const rounded = this.rounded();
|
|
231
347
|
const size = this.size();
|
|
232
348
|
const selected = this.selected();
|
|
233
349
|
const userClass = this.userClass();
|
|
234
|
-
const variantClasses = chipThemeVariants({ disabled, look, rounded, size, selected });
|
|
350
|
+
const variantClasses = chipThemeVariants({ disabled, interactive, look, rounded, size, selected });
|
|
235
351
|
return twMerge(variantClasses, userClass);
|
|
236
352
|
}, /* @ts-ignore */
|
|
237
353
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
354
|
+
this.bodyInteractive = computed(() => !this.disabled() && (this.toggleable() || this.isLink()), /* @ts-ignore */
|
|
355
|
+
...(ngDevMode ? [{ debugName: "bodyInteractive" }] : /* istanbul ignore next */ []));
|
|
238
356
|
this.effectiveAriaLabel = computed(() => {
|
|
239
357
|
const explicitLabel = this.ariaLabel();
|
|
240
358
|
if (explicitLabel) {
|
|
@@ -255,7 +373,7 @@ class ChipComponent {
|
|
|
255
373
|
if (explicitTabindex != null) {
|
|
256
374
|
return explicitTabindex;
|
|
257
375
|
}
|
|
258
|
-
if (this.toggleable() || this.
|
|
376
|
+
if (this.toggleable() || this.isLink()) {
|
|
259
377
|
return 0;
|
|
260
378
|
}
|
|
261
379
|
return -1;
|
|
@@ -275,6 +393,9 @@ class ChipComponent {
|
|
|
275
393
|
}
|
|
276
394
|
}, /* @ts-ignore */
|
|
277
395
|
...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
|
|
396
|
+
this.isLink = computed(() => !!this.#routerLink, /* @ts-ignore */
|
|
397
|
+
...(ngDevMode ? [{ debugName: "isLink" }] : /* istanbul ignore next */ []));
|
|
398
|
+
this.messages = this.#i18n.componentMessages("chip", CHIP_DEFAULT_MESSAGES);
|
|
278
399
|
this.prefixTemplate = contentChild(ChipPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
279
400
|
this.role = computed(() => {
|
|
280
401
|
if (this.toggleable()) {
|
|
@@ -290,8 +411,8 @@ class ChipComponent {
|
|
|
290
411
|
*/
|
|
291
412
|
this.ariaLabel = input("", { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
292
413
|
/**
|
|
293
|
-
* @description Emitted when
|
|
294
|
-
* Not emitted when the remove button is activated.
|
|
414
|
+
* @description Emitted when a toggleable chip body is activated via click, Enter, or Space.
|
|
415
|
+
* Not emitted when the remove button is activated or for non-toggleable chips.
|
|
295
416
|
*/
|
|
296
417
|
this.contentClick = output();
|
|
297
418
|
/**
|
|
@@ -358,7 +479,7 @@ class ChipComponent {
|
|
|
358
479
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
359
480
|
/**
|
|
360
481
|
* @description Tab index override for the chip host element. When not set, computed automatically:
|
|
361
|
-
* `0` when `toggleable`
|
|
482
|
+
* `0` when `toggleable` is `true` or functioning as a link, `-1` otherwise. Overridden to `-1` when `disabled` is `true`.
|
|
362
483
|
* @default undefined
|
|
363
484
|
*/
|
|
364
485
|
this.tabindex = input(/* @ts-ignore */
|
|
@@ -394,15 +515,16 @@ class ChipComponent {
|
|
|
394
515
|
this.remove.emit(event);
|
|
395
516
|
}
|
|
396
517
|
#handleActivation() {
|
|
397
|
-
if (this.toggleable()) {
|
|
398
|
-
|
|
518
|
+
if (!this.toggleable() || this.disabled()) {
|
|
519
|
+
return;
|
|
399
520
|
}
|
|
521
|
+
this.selected.set(!this.selected());
|
|
400
522
|
this.contentClick.emit();
|
|
401
523
|
}
|
|
402
524
|
#setSubscriptions() {
|
|
403
525
|
const element = this.#elementRef.nativeElement;
|
|
404
526
|
fromEvent(element, "keydown")
|
|
405
|
-
.pipe(filter(event => !this.disabled() && (event.key === "Enter" || event.key === " ")), takeUntilDestroyed(this.#destroyRef))
|
|
527
|
+
.pipe(filter(event => !this.disabled() && this.toggleable() && (event.key === "Enter" || event.key === " ")), takeUntilDestroyed(this.#destroyRef))
|
|
406
528
|
.subscribe(event => {
|
|
407
529
|
const target = event.target;
|
|
408
530
|
if (target.closest("button[data-chip-remove]")) {
|
|
@@ -412,13 +534,13 @@ class ChipComponent {
|
|
|
412
534
|
this.#handleActivation();
|
|
413
535
|
});
|
|
414
536
|
fromEvent(element, "click")
|
|
415
|
-
.pipe(filter(() => !this.disabled()), takeUntilDestroyed(this.#destroyRef))
|
|
537
|
+
.pipe(filter(() => !this.disabled() && this.toggleable()), takeUntilDestroyed(this.#destroyRef))
|
|
416
538
|
.subscribe(() => {
|
|
417
539
|
this.#handleActivation();
|
|
418
540
|
});
|
|
419
541
|
}
|
|
420
542
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
421
|
-
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() ??
|
|
543
|
+
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() ?? messages().removeLabel(label());\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", "type", "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]" }] }); }
|
|
422
544
|
}
|
|
423
545
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ChipComponent, decorators: [{
|
|
424
546
|
type: Component,
|
|
@@ -429,7 +551,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
429
551
|
"[attr.role]": "role()",
|
|
430
552
|
"[attr.aria-checked]": "ariaChecked()",
|
|
431
553
|
"[attr.aria-label]": "effectiveAriaLabel()"
|
|
432
|
-
}, 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() ??
|
|
554
|
+
}, 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() ?? messages().removeLabel(label());\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" }]
|
|
433
555
|
}], 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 }] }] } });
|
|
434
556
|
|
|
435
557
|
/*
|
|
@@ -440,5 +562,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
440
562
|
* Generated bundle index. Do not edit.
|
|
441
563
|
*/
|
|
442
564
|
|
|
443
|
-
export { ChipComponent, ChipPrefixTemplateDirective };
|
|
565
|
+
export { CHIP_DEFAULT_MESSAGES, ChipComponent, ChipPrefixTemplateDirective };
|
|
444
566
|
//# sourceMappingURL=nanahoshi-mona-ui-chip.mjs.map
|
|
@@ -22,9 +22,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
22
22
|
const circularProgressBarBaseThemeVariants = cva(`
|
|
23
23
|
relative flex items-center justify-center select-none
|
|
24
24
|
text-foreground
|
|
25
|
-
[&_svg]:absolute [&_svg]:
|
|
25
|
+
[&_svg]:absolute [&_svg]:inset-0
|
|
26
26
|
[&_svg]:h-full [&_svg]:w-full
|
|
27
|
-
[&_svg]:-translate-x-1/2 [&_svg]:-translate-y-1/2
|
|
28
27
|
[&_svg_circle]:origin-center
|
|
29
28
|
[&_svg_circle]:-rotate-90
|
|
30
29
|
[&_svg_circle]:transition-[stroke-dashoffset,stroke] duration-(--mona-motion-fast) ease-in
|