@nanahoshi/mona-ui 0.1.1 → 0.2.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/auto-complete/package.json +4 -0
- package/avatar/package.json +4 -0
- package/breadcrumb/package.json +4 -0
- package/button/package.json +4 -0
- package/button-group/package.json +4 -0
- package/calendar/package.json +4 -0
- package/check-box/package.json +4 -0
- package/chip/package.json +4 -0
- package/circular-progress-bar/package.json +4 -0
- package/color-gradient/package.json +4 -0
- package/color-palette/package.json +4 -0
- package/color-picker/package.json +4 -0
- package/combo-box/package.json +4 -0
- package/common/package.json +4 -0
- package/contextmenu/package.json +4 -0
- package/date-input/package.json +4 -0
- package/date-picker/package.json +4 -0
- package/datetime-picker/package.json +4 -0
- package/dialog/package.json +4 -0
- package/dropdown-button/package.json +4 -0
- package/dropdown-list/package.json +4 -0
- package/dropdowns/package.json +4 -0
- package/editor/package.json +4 -0
- package/expansion-panel/package.json +4 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +38 -53
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +19 -53
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +15 -26
- package/fesm2022/nanahoshi-mona-ui-button.mjs +67 -68
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +53 -149
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +48 -95
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +35 -45
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +9 -23
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +26 -77
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +16 -38
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +41 -46
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +32 -52
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +9 -12
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +40 -27
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +51 -51
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +40 -153
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +32 -53
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +7 -12
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +59 -219
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +24 -75
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +11 -44
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +11 -41
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-B2ETh-uI.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-B6FBLtrr.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DZk18LJC.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-OJe4UYuw.mjs} +4 -8
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-C7WKhhig.mjs → nanahoshi-mona-ui-grid-grid-list.component-DCd8K6ng.mjs} +9 -16
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-BRiY0CDX.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Dl8Hlkhj.mjs} +15 -44
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BrYpFMyF.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-C5FRZlvv.mjs} +11 -20
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-T9Bj98kl.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BRZUd8cE.mjs} +109 -393
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +10 -28
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +26 -56
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +31 -122
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +29 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +4 -26
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +5 -18
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +48 -154
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +35 -62
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +24 -108
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +37 -63
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +21 -73
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +8 -30
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +29 -50
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +36 -108
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +19 -60
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +47 -92
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +53 -144
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +54 -110
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +7 -20
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +15 -50
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +28 -91
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +37 -58
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +35 -107
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +22 -30
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +40 -61
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1111 -269
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +41 -27
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +35 -99
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +13 -41
- package/fesm2022/nanahoshi-mona-ui-window.mjs +29 -108
- package/fieldset/package.json +4 -0
- package/filter/package.json +4 -0
- package/grid/package.json +4 -0
- package/internal/filter-input/package.json +4 -0
- package/internal/indicator-icon/package.json +4 -0
- package/internal/list/package.json +4 -0
- package/internal/package.json +4 -0
- package/internal/tree/package.json +4 -0
- package/list/package.json +4 -0
- package/list-box/package.json +4 -0
- package/list-view/package.json +4 -0
- package/menubar/package.json +4 -0
- package/multi-select/package.json +4 -0
- package/notification/package.json +4 -0
- package/numeric-text-box/package.json +4 -0
- package/package.json +2 -1
- package/pager/package.json +4 -0
- package/placeholder/package.json +4 -0
- package/popover/package.json +4 -0
- package/popup/package.json +4 -0
- package/popup-menu/package.json +4 -0
- package/progress-bar/package.json +4 -0
- package/query/package.json +4 -0
- package/radio-button/package.json +4 -0
- package/scroll-view/package.json +4 -0
- package/slider/package.json +4 -0
- package/split-button/package.json +4 -0
- package/splitter/package.json +4 -0
- package/stepper/package.json +4 -0
- package/switch/package.json +4 -0
- package/tabs/package.json +4 -0
- package/text-area/package.json +4 -0
- package/text-box/package.json +4 -0
- package/theme/package.json +4 -0
- package/time-picker/package.json +4 -0
- package/time-selector/package.json +4 -0
- package/tooltip/package.json +4 -0
- package/tree-view/package.json +4 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -7
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +4 -6
- package/types/nanahoshi-mona-ui-button-group.d.ts +2 -3
- package/types/nanahoshi-mona-ui-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +21 -22
- package/types/nanahoshi-mona-ui-check-box.d.ts +6 -9
- package/types/nanahoshi-mona-ui-chip.d.ts +2 -3
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +2 -4
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +10 -11
- package/types/nanahoshi-mona-ui-color-palette.d.ts +4 -5
- package/types/nanahoshi-mona-ui-color-picker.d.ts +6 -5
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -7
- package/types/nanahoshi-mona-ui-date-input.d.ts +2 -3
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-dialog.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +2 -3
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +8 -10
- package/types/nanahoshi-mona-ui-fieldset.d.ts +6 -8
- package/types/nanahoshi-mona-ui-filter.d.ts +2 -3
- package/types/nanahoshi-mona-ui-grid.d.ts +14 -15
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +0 -1
- package/types/nanahoshi-mona-ui-internal.d.ts +8 -1
- package/types/nanahoshi-mona-ui-list-box.d.ts +4 -5
- package/types/nanahoshi-mona-ui-list-view.d.ts +2 -3
- package/types/nanahoshi-mona-ui-menubar.d.ts +6 -7
- package/types/nanahoshi-mona-ui-multi-select.d.ts +8 -9
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +2 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +6 -7
- package/types/nanahoshi-mona-ui-placeholder.d.ts +4 -6
- package/types/nanahoshi-mona-ui-popover.d.ts +8 -9
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +12 -13
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +8 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +8 -11
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +18 -20
- package/types/nanahoshi-mona-ui-slider.d.ts +18 -18
- package/types/nanahoshi-mona-ui-split-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-splitter.d.ts +6 -8
- package/types/nanahoshi-mona-ui-stepper.d.ts +12 -13
- package/types/nanahoshi-mona-ui-switch.d.ts +6 -7
- package/types/nanahoshi-mona-ui-tabs.d.ts +14 -16
- package/types/nanahoshi-mona-ui-text-area.d.ts +2 -4
- package/types/nanahoshi-mona-ui-text-box.d.ts +4 -6
- package/types/nanahoshi-mona-ui-theme.d.ts +111 -12
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-time-selector.d.ts +10 -11
- package/types/nanahoshi-mona-ui-tooltip.d.ts +4 -5
- package/types/nanahoshi-mona-ui-window.d.ts +16 -17
- package/window/package.json +4 -0
|
@@ -7,8 +7,7 @@ import { any, exactly, Dictionary, lastOrDefault, range, index, select } from '@
|
|
|
7
7
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
8
8
|
import { PreventableEvent, TakeFirstPipe } from '@nanahoshi/mona-ui/common';
|
|
9
9
|
import { CalendarService } from '@nanahoshi/mona-ui/date-input';
|
|
10
|
-
import { createElementControlId, rxTimeout } from '@nanahoshi/mona-ui/internal';
|
|
11
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
10
|
+
import { themeRaisedBackdropClasses, createElementControlId, rxTimeout } from '@nanahoshi/mona-ui/internal';
|
|
12
11
|
import { DateTime } from 'luxon';
|
|
13
12
|
import { skip, fromEvent } from 'rxjs';
|
|
14
13
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -56,17 +55,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
56
55
|
}]
|
|
57
56
|
}] });
|
|
58
57
|
|
|
59
|
-
const
|
|
60
|
-
flex flex-col gap-2 p-2
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
const calendarBaseThemeVariants = cva(`
|
|
59
|
+
flex min-w-64 flex-col gap-2 p-2
|
|
60
|
+
select-none
|
|
61
|
+
bg-(--mona-calendar-background) ${themeRaisedBackdropClasses} text-foreground
|
|
62
|
+
border border-border shadow-(--mona-calendar-shadow)
|
|
64
63
|
data-[invalid='true']:border-error
|
|
65
|
-
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/
|
|
64
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
66
65
|
`, {
|
|
67
66
|
variants: {
|
|
68
67
|
disabled: {
|
|
69
|
-
true: "
|
|
68
|
+
true: "pointer-events-none cursor-not-allowed opacity-50"
|
|
70
69
|
},
|
|
71
70
|
readonly: {
|
|
72
71
|
true: "pointer-events-none"
|
|
@@ -80,7 +79,7 @@ const calendarBaseVariants = cva(`
|
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
});
|
|
83
|
-
const
|
|
82
|
+
const calendarHeaderThemeVariants = cva(`
|
|
84
83
|
flex items-center justify-center
|
|
85
84
|
[&>button+button]:not-focus:border-s-0
|
|
86
85
|
[&>button:nth-of-type(2)]:flex-1
|
|
@@ -90,21 +89,22 @@ const calendarHeaderVariants = cva(`
|
|
|
90
89
|
[&>button:nth-of-type(4)]:rounded-es-none
|
|
91
90
|
[&>button]:outline-none
|
|
92
91
|
`);
|
|
93
|
-
const
|
|
94
|
-
|
|
92
|
+
const calendarMonthViewDayThemeVariants = cva(`
|
|
93
|
+
cursor-pointer
|
|
94
|
+
hover:bg-hover active:bg-active
|
|
95
95
|
`, {
|
|
96
96
|
variants: {
|
|
97
97
|
disabled: {
|
|
98
|
-
true: "
|
|
98
|
+
true: "pointer-events-none cursor-not-allowed text-disabled-foreground"
|
|
99
99
|
},
|
|
100
100
|
focused: {
|
|
101
|
-
true: "ring-
|
|
101
|
+
true: "bg-hover outline-none ring-2 ring-inset ring-focus-indicator/35"
|
|
102
102
|
},
|
|
103
103
|
outside: {
|
|
104
|
-
true: "
|
|
104
|
+
true: "text-muted-foreground"
|
|
105
105
|
},
|
|
106
106
|
rangePreview: {
|
|
107
|
-
true: "bg-
|
|
107
|
+
true: "bg-active hover:bg-active"
|
|
108
108
|
},
|
|
109
109
|
rounded: {
|
|
110
110
|
none: "rounded-none",
|
|
@@ -117,7 +117,7 @@ const calendarMonthViewDayVariants = cva(`
|
|
|
117
117
|
true: "bg-primary text-primary-foreground hover:bg-primary-hover"
|
|
118
118
|
},
|
|
119
119
|
today: {
|
|
120
|
-
true: "font-bold text-
|
|
120
|
+
true: "font-bold text-foreground"
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
compoundVariants: [
|
|
@@ -131,35 +131,31 @@ const calendarMonthViewDayVariants = cva(`
|
|
|
131
131
|
rounded: "medium"
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
|
-
const
|
|
135
|
-
grid gap-0.5
|
|
136
|
-
justify-center
|
|
137
|
-
[&>div]:h-full [&>div]:flex
|
|
138
|
-
[&>div]:items-center [&>div]:justify-center
|
|
134
|
+
const calendarMonthViewGridThemeVariants = cva(`
|
|
135
|
+
grid justify-center gap-0.5
|
|
139
136
|
[&>div]:aspect-square
|
|
140
|
-
|
|
141
|
-
const calendarMonthViewGridHeaderVariants = cva(`
|
|
142
|
-
grid justify-center
|
|
143
|
-
gap-0.5 font-semibold text-sm
|
|
144
|
-
[&>div]:h-full [&>div]:flex
|
|
137
|
+
[&>div]:flex [&>div]:h-full
|
|
145
138
|
[&>div]:items-center [&>div]:justify-center
|
|
139
|
+
`);
|
|
140
|
+
const calendarMonthViewGridHeaderThemeVariants = cva(`
|
|
141
|
+
grid justify-center gap-0.5
|
|
142
|
+
text-sm font-semibold text-muted-foreground
|
|
146
143
|
[&>div]:aspect-square
|
|
144
|
+
[&>div]:flex [&>div]:h-full
|
|
145
|
+
[&>div]:items-center [&>div]:justify-center
|
|
147
146
|
`);
|
|
148
|
-
const
|
|
149
|
-
grid grid-cols-3 gap-0.5
|
|
150
|
-
|
|
151
|
-
[&>div]:h-full [&>div]:flex
|
|
147
|
+
const calendarYearViewGridThemeVariants = cva(`
|
|
148
|
+
grid grid-cols-3 justify-center gap-0.5
|
|
149
|
+
[&>div]:flex [&>div]:h-12
|
|
152
150
|
[&>div]:items-center [&>div]:justify-center
|
|
153
|
-
[&>div]:h-12
|
|
154
151
|
`);
|
|
155
|
-
const
|
|
156
|
-
py-2
|
|
157
|
-
hover:bg-hover
|
|
158
|
-
active:bg-active
|
|
152
|
+
const calendarYearViewCellThemeVariants = cva(`
|
|
153
|
+
cursor-pointer py-2
|
|
154
|
+
hover:bg-hover active:bg-active
|
|
159
155
|
`, {
|
|
160
156
|
variants: {
|
|
161
157
|
focused: {
|
|
162
|
-
true: "ring-
|
|
158
|
+
true: "bg-hover outline-none ring-2 ring-inset ring-focus-indicator/35"
|
|
163
159
|
},
|
|
164
160
|
rounded: {
|
|
165
161
|
none: "rounded-none",
|
|
@@ -170,21 +166,18 @@ const calendarYearViewCellVariants = cva(`
|
|
|
170
166
|
}
|
|
171
167
|
}
|
|
172
168
|
});
|
|
173
|
-
const
|
|
174
|
-
grid grid-cols-4 gap-0.5
|
|
175
|
-
|
|
176
|
-
[&>div]:h-full [&>div]:flex
|
|
169
|
+
const calendarDecadeViewGridThemeVariants = cva(`
|
|
170
|
+
grid grid-cols-4 justify-center gap-0.5
|
|
171
|
+
[&>div]:flex [&>div]:h-12
|
|
177
172
|
[&>div]:items-center [&>div]:justify-center
|
|
178
|
-
[&>div]:h-12
|
|
179
173
|
`);
|
|
180
|
-
const
|
|
181
|
-
py-2
|
|
182
|
-
hover:bg-hover
|
|
183
|
-
active:bg-active
|
|
174
|
+
const calendarDecadeViewCellThemeVariants = cva(`
|
|
175
|
+
cursor-pointer py-2
|
|
176
|
+
hover:bg-hover active:bg-active
|
|
184
177
|
`, {
|
|
185
178
|
variants: {
|
|
186
179
|
focused: {
|
|
187
|
-
true: "ring-
|
|
180
|
+
true: "bg-hover outline-none ring-2 ring-inset ring-focus-indicator/35"
|
|
188
181
|
},
|
|
189
182
|
rounded: {
|
|
190
183
|
none: "rounded-none",
|
|
@@ -196,89 +189,14 @@ const calendarDecadeViewCellVariants = cva(`
|
|
|
196
189
|
}
|
|
197
190
|
});
|
|
198
191
|
|
|
199
|
-
const calendarBaseThemeVariants = (theme) => {
|
|
200
|
-
switch (theme) {
|
|
201
|
-
case "mona":
|
|
202
|
-
return calendarBaseVariants;
|
|
203
|
-
default:
|
|
204
|
-
return calendarBaseVariants;
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
const calendarHeaderThemeVariants = (theme) => {
|
|
208
|
-
switch (theme) {
|
|
209
|
-
case "mona":
|
|
210
|
-
return calendarHeaderVariants;
|
|
211
|
-
default:
|
|
212
|
-
return calendarHeaderVariants;
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
const calendarDecadeViewGridThemeVariants = (theme) => {
|
|
216
|
-
switch (theme) {
|
|
217
|
-
case "mona":
|
|
218
|
-
return calendarDecadeViewGridVariants;
|
|
219
|
-
default:
|
|
220
|
-
return calendarDecadeViewGridVariants;
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
const calendarDecadeViewCellThemeVariants = (theme) => {
|
|
224
|
-
switch (theme) {
|
|
225
|
-
case "mona":
|
|
226
|
-
return calendarDecadeViewCellVariants;
|
|
227
|
-
default:
|
|
228
|
-
return calendarDecadeViewCellVariants;
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
const calendarMonthViewDayThemeVariants = (theme) => {
|
|
232
|
-
switch (theme) {
|
|
233
|
-
case "mona":
|
|
234
|
-
return calendarMonthViewDayVariants;
|
|
235
|
-
default:
|
|
236
|
-
return calendarMonthViewDayVariants;
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
const calendarMonthViewGridThemeVariants = (theme) => {
|
|
240
|
-
switch (theme) {
|
|
241
|
-
case "mona":
|
|
242
|
-
return calendarMonthViewGridVariants;
|
|
243
|
-
default:
|
|
244
|
-
return calendarMonthViewGridVariants;
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
const calendarMonthViewGridHeaderThemeVariants = (theme) => {
|
|
248
|
-
switch (theme) {
|
|
249
|
-
case "mona":
|
|
250
|
-
return calendarMonthViewGridHeaderVariants;
|
|
251
|
-
default:
|
|
252
|
-
return calendarMonthViewGridHeaderVariants;
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
const calendarYearViewGridThemeVariants = (theme) => {
|
|
256
|
-
switch (theme) {
|
|
257
|
-
case "mona":
|
|
258
|
-
return calendarYearViewGridVariants;
|
|
259
|
-
default:
|
|
260
|
-
return calendarYearViewGridVariants;
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
const calendarYearViewCellThemeVariants = (theme) => {
|
|
264
|
-
switch (theme) {
|
|
265
|
-
case "mona":
|
|
266
|
-
return calendarYearViewCellVariants;
|
|
267
|
-
default:
|
|
268
|
-
return calendarYearViewCellVariants;
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
|
|
272
192
|
class DecadeYearDirective {
|
|
273
193
|
constructor() {
|
|
274
|
-
this.#themeService = inject(ThemeService);
|
|
275
194
|
this.ariaLabel = computed(() => `Year ${this.year()}`, /* @ts-ignore */
|
|
276
195
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
277
196
|
this.baseClass = computed(() => {
|
|
278
|
-
const theme = this.#themeService.theme();
|
|
279
197
|
const focused = this.focused();
|
|
280
198
|
const rounded = this.rounded();
|
|
281
|
-
return calendarDecadeViewCellThemeVariants(
|
|
199
|
+
return calendarDecadeViewCellThemeVariants({ focused, rounded });
|
|
282
200
|
}, /* @ts-ignore */
|
|
283
201
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
284
202
|
this.focused = computed(() => {
|
|
@@ -307,7 +225,6 @@ class DecadeYearDirective {
|
|
|
307
225
|
this.year = input.required(/* @ts-ignore */
|
|
308
226
|
...(ngDevMode ? [{ debugName: "year" }] : /* istanbul ignore next */ []));
|
|
309
227
|
}
|
|
310
|
-
#themeService;
|
|
311
228
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: DecadeYearDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
312
229
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: DecadeYearDirective, isStandalone: true, selector: "[monaDecadeYear]", inputs: { navigatedDate: { classPropertyName: "navigatedDate", publicName: "navigatedDate", isSignal: true, isRequired: true, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: false, transformFunction: null }, year: { classPropertyName: "year", publicName: "year", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "gridcell" }, properties: { "attr.tabindex": "focused() ? 0 : -1", "attr.aria-current": "isCurrent() ? 'true' : null", "attr.aria-label": "ariaLabel()", "attr.aria-selected": "selected() ? 'true' : null", "class": "baseClass()" } }, ngImport: i0 }); }
|
|
313
230
|
}
|
|
@@ -369,9 +286,7 @@ const compareDates = (date1, date2, operator) => {
|
|
|
369
286
|
|
|
370
287
|
class MonthDayDirective {
|
|
371
288
|
constructor() {
|
|
372
|
-
this.#themeService = inject(ThemeService);
|
|
373
289
|
this.baseClass = computed(() => {
|
|
374
|
-
const theme = this.#themeService.theme();
|
|
375
290
|
const disabled = this.dayDisabled();
|
|
376
291
|
const focused = this.focused();
|
|
377
292
|
const outside = this.outside();
|
|
@@ -379,7 +294,7 @@ class MonthDayDirective {
|
|
|
379
294
|
const rounded = this.rounded();
|
|
380
295
|
const selected = this.selected();
|
|
381
296
|
const today = this.isToday();
|
|
382
|
-
return calendarMonthViewDayThemeVariants(
|
|
297
|
+
return calendarMonthViewDayThemeVariants({
|
|
383
298
|
disabled,
|
|
384
299
|
focused,
|
|
385
300
|
outside,
|
|
@@ -462,7 +377,6 @@ class MonthDayDirective {
|
|
|
462
377
|
this.value = input.required(/* @ts-ignore */
|
|
463
378
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
464
379
|
}
|
|
465
|
-
#themeService;
|
|
466
380
|
onClick(event) {
|
|
467
381
|
if (this.dayDisabled()) {
|
|
468
382
|
return;
|
|
@@ -477,7 +391,7 @@ class MonthDayDirective {
|
|
|
477
391
|
this.dayPointerEnter.emit(this.entry().key);
|
|
478
392
|
}
|
|
479
393
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: MonthDayDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
480
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: MonthDayDirective, isStandalone: true, selector: "[monaMonthDay]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: true, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: true, transformFunction: null }, entry: { classPropertyName: "entry", publicName: "entry", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: true, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: true, transformFunction: null }, monthBounds: { classPropertyName: "monthBounds", publicName: "monthBounds", isSignal: true, isRequired: true, transformFunction: null }, navigatedDate: { classPropertyName: "navigatedDate", publicName: "navigatedDate", isSignal: true, isRequired: true, transformFunction: null }, rangePreview: { classPropertyName: "rangePreview", publicName: "rangePreview", isSignal: true, isRequired: true, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { dayPointerEnter: "dayPointerEnter", daySelect: "daySelect" }, host: { listeners: { "click": "onClick($event)", "pointerenter": "onPointerEnter()" }, properties: { "attr.tabindex": "focused() ? 0 : -1", "attr.aria-
|
|
394
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: MonthDayDirective, isStandalone: true, selector: "[monaMonthDay]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: true, transformFunction: null }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: true, isRequired: true, transformFunction: null }, entry: { classPropertyName: "entry", publicName: "entry", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: true, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: true, transformFunction: null }, monthBounds: { classPropertyName: "monthBounds", publicName: "monthBounds", isSignal: true, isRequired: true, transformFunction: null }, navigatedDate: { classPropertyName: "navigatedDate", publicName: "navigatedDate", isSignal: true, isRequired: true, transformFunction: null }, rangePreview: { classPropertyName: "rangePreview", publicName: "rangePreview", isSignal: true, isRequired: true, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { dayPointerEnter: "dayPointerEnter", daySelect: "daySelect" }, host: { attributes: { "role": "button" }, listeners: { "click": "onClick($event)", "pointerenter": "onPointerEnter()" }, properties: { "attr.tabindex": "focused() ? 0 : -1", "attr.aria-pressed": "selected() ? 'true' : 'false'", "attr.aria-current": "isToday() ? 'date' : null", "attr.aria-disabled": "dayDisabled() ? 'true' : null", "attr.data-range-preview": "rangePreviewed() ? 'true' : null", "class": "baseClass()" } }, ngImport: i0 }); }
|
|
481
395
|
}
|
|
482
396
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: MonthDayDirective, decorators: [{
|
|
483
397
|
type: Directive,
|
|
@@ -485,30 +399,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
485
399
|
selector: "[monaMonthDay]",
|
|
486
400
|
host: {
|
|
487
401
|
"[attr.tabindex]": "focused() ? 0 : -1",
|
|
488
|
-
"[attr.aria-
|
|
402
|
+
"[attr.aria-pressed]": "selected() ? 'true' : 'false'",
|
|
489
403
|
"[attr.aria-current]": "isToday() ? 'date' : null",
|
|
490
404
|
"[attr.aria-disabled]": "dayDisabled() ? 'true' : null",
|
|
491
405
|
"[attr.data-range-preview]": "rangePreviewed() ? 'true' : null",
|
|
492
406
|
"[class]": "baseClass()",
|
|
493
407
|
"(click)": "onClick($event)",
|
|
494
|
-
"(pointerenter)": "onPointerEnter()"
|
|
408
|
+
"(pointerenter)": "onPointerEnter()",
|
|
409
|
+
role: "button"
|
|
495
410
|
}
|
|
496
411
|
}]
|
|
497
412
|
}], propDecorators: { dayPointerEnter: [{ type: i0.Output, args: ["dayPointerEnter"] }], daySelect: [{ type: i0.Output, args: ["daySelect"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: true }] }], disabledDates: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledDates", required: true }] }], entry: [{ type: i0.Input, args: [{ isSignal: true, alias: "entry", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: true }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: true }] }], monthBounds: [{ type: i0.Input, args: [{ isSignal: true, alias: "monthBounds", required: true }] }], navigatedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "navigatedDate", required: true }] }], rangePreview: [{ type: i0.Input, args: [{ isSignal: true, alias: "rangePreview", required: true }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
|
|
498
413
|
|
|
499
414
|
class YearMonthDirective {
|
|
500
415
|
constructor() {
|
|
501
|
-
this.#themeService = inject(ThemeService);
|
|
502
416
|
this.ariaLabel = computed(() => {
|
|
503
417
|
const monthName = this.monthName();
|
|
504
418
|
return `${monthName} ${this.navigatedDate().getFullYear()}`;
|
|
505
419
|
}, /* @ts-ignore */
|
|
506
420
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
507
421
|
this.baseClass = computed(() => {
|
|
508
|
-
const theme = this.#themeService.theme();
|
|
509
422
|
const focused = this.focused();
|
|
510
423
|
const rounded = this.rounded();
|
|
511
|
-
return calendarYearViewCellThemeVariants(
|
|
424
|
+
return calendarYearViewCellThemeVariants({ focused, rounded });
|
|
512
425
|
}, /* @ts-ignore */
|
|
513
426
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
514
427
|
this.focused = computed(() => {
|
|
@@ -543,7 +456,6 @@ class YearMonthDirective {
|
|
|
543
456
|
this.selectedDate = input(/* @ts-ignore */
|
|
544
457
|
...(ngDevMode ? [undefined, { debugName: "selectedDate" }] : /* istanbul ignore next */ []));
|
|
545
458
|
}
|
|
546
|
-
#themeService;
|
|
547
459
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: YearMonthDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
548
460
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: YearMonthDirective, isStandalone: true, selector: "[monaYearMonth]", inputs: { month: { classPropertyName: "month", publicName: "month", isSignal: true, isRequired: true, transformFunction: null }, monthName: { classPropertyName: "monthName", publicName: "monthName", isSignal: true, isRequired: true, transformFunction: null }, navigatedDate: { classPropertyName: "navigatedDate", publicName: "navigatedDate", isSignal: true, isRequired: true, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "gridcell" }, properties: { "attr.tabindex": "focused() ? 0 : -1", "attr.aria-current": "isCurrent() ? 'date' : null", "attr.aria-label": "ariaLabel()", "attr.aria-selected": "selected() ? 'true' : null", "class": "baseClass()" } }, ngImport: i0 }); }
|
|
549
461
|
}
|
|
@@ -568,7 +480,6 @@ class CalendarComponent {
|
|
|
568
480
|
#hostElementRef;
|
|
569
481
|
#monthDict;
|
|
570
482
|
#outputValue;
|
|
571
|
-
#themeService;
|
|
572
483
|
constructor() {
|
|
573
484
|
this.#calendarService = inject(CalendarService, { optional: true });
|
|
574
485
|
this.#destroyRef = inject(DestroyRef);
|
|
@@ -629,7 +540,6 @@ class CalendarComponent {
|
|
|
629
540
|
return [];
|
|
630
541
|
}, /* @ts-ignore */
|
|
631
542
|
...(ngDevMode ? [{ debugName: "#outputValue" }] : /* istanbul ignore next */ []));
|
|
632
|
-
this.#themeService = inject(ThemeService);
|
|
633
543
|
this.ariaLabel = computed(() => {
|
|
634
544
|
const view = this.calendarView();
|
|
635
545
|
const navigatedDate = this.navigatedDate();
|
|
@@ -645,11 +555,10 @@ class CalendarComponent {
|
|
|
645
555
|
}, /* @ts-ignore */
|
|
646
556
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
647
557
|
this.baseClass = computed(() => {
|
|
648
|
-
const theme = this.#themeService.theme();
|
|
649
558
|
const disabled = this.disabled();
|
|
650
559
|
const readonly = this.readonly();
|
|
651
560
|
const rounded = this.rounded() === "full" ? "large" : this.rounded();
|
|
652
|
-
const variantClass = calendarBaseThemeVariants(
|
|
561
|
+
const variantClass = calendarBaseThemeVariants({ disabled, readonly, rounded });
|
|
653
562
|
const userClass = this.userClass();
|
|
654
563
|
return twMerge(variantClass, userClass);
|
|
655
564
|
}, /* @ts-ignore */
|
|
@@ -663,8 +572,7 @@ class CalendarComponent {
|
|
|
663
572
|
}, /* @ts-ignore */
|
|
664
573
|
...(ngDevMode ? [{ debugName: "decadeEnd" }] : /* istanbul ignore next */ []));
|
|
665
574
|
this.decadeGridClass = computed(() => {
|
|
666
|
-
|
|
667
|
-
return calendarDecadeViewGridThemeVariants(theme)();
|
|
575
|
+
return calendarDecadeViewGridThemeVariants();
|
|
668
576
|
}, /* @ts-ignore */
|
|
669
577
|
...(ngDevMode ? [{ debugName: "decadeGridClass" }] : /* istanbul ignore next */ []));
|
|
670
578
|
this.decadeStart = computed(() => {
|
|
@@ -684,8 +592,7 @@ class CalendarComponent {
|
|
|
684
592
|
...(ngDevMode ? [{ debugName: "decadeYears" }] : /* istanbul ignore next */ []));
|
|
685
593
|
this.gridId = createElementControlId();
|
|
686
594
|
this.headerClass = computed(() => {
|
|
687
|
-
|
|
688
|
-
return calendarHeaderThemeVariants(theme)({});
|
|
595
|
+
return calendarHeaderThemeVariants({});
|
|
689
596
|
}, /* @ts-ignore */
|
|
690
597
|
...(ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []));
|
|
691
598
|
this.invalidState = computed(() => this.invalid() || (this.required() && this.touched() && this.isEmptyValue()), /* @ts-ignore */
|
|
@@ -708,13 +615,11 @@ class CalendarComponent {
|
|
|
708
615
|
}, /* @ts-ignore */
|
|
709
616
|
...(ngDevMode ? [{ debugName: "monthDictChunked" }] : /* istanbul ignore next */ []));
|
|
710
617
|
this.monthGridClass = computed(() => {
|
|
711
|
-
|
|
712
|
-
return calendarMonthViewGridThemeVariants(theme)();
|
|
618
|
+
return calendarMonthViewGridThemeVariants();
|
|
713
619
|
}, /* @ts-ignore */
|
|
714
620
|
...(ngDevMode ? [{ debugName: "monthGridClass" }] : /* istanbul ignore next */ []));
|
|
715
621
|
this.monthGridHeaderClass = computed(() => {
|
|
716
|
-
|
|
717
|
-
return calendarMonthViewGridHeaderThemeVariants(theme)();
|
|
622
|
+
return calendarMonthViewGridHeaderThemeVariants();
|
|
718
623
|
}, /* @ts-ignore */
|
|
719
624
|
...(ngDevMode ? [{ debugName: "monthGridHeaderClass" }] : /* istanbul ignore next */ []));
|
|
720
625
|
this.months = computed(() => {
|
|
@@ -821,8 +726,7 @@ class CalendarComponent {
|
|
|
821
726
|
this.yearCellTemplate = contentChild(CalendarYearCellTemplateDirective, /* @ts-ignore */
|
|
822
727
|
...(ngDevMode ? [{ debugName: "yearCellTemplate" }] : /* istanbul ignore next */ []));
|
|
823
728
|
this.yearGridClass = computed(() => {
|
|
824
|
-
|
|
825
|
-
return calendarYearViewGridThemeVariants(theme)();
|
|
729
|
+
return calendarYearViewGridThemeVariants();
|
|
826
730
|
}, /* @ts-ignore */
|
|
827
731
|
...(ngDevMode ? [{ debugName: "yearGridClass" }] : /* istanbul ignore next */ []));
|
|
828
732
|
/**
|
|
@@ -1,45 +1,43 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { computed, model, input, output, Component, Directive } from '@angular/core';
|
|
4
4
|
import * as i1 from '@angular/forms';
|
|
5
5
|
import { FormsModule } from '@angular/forms';
|
|
6
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
7
6
|
import { twMerge } from 'tailwind-merge';
|
|
8
7
|
import { cva } from 'class-variance-authority';
|
|
8
|
+
import { themeControlSurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const checkboxInputThemeVariants = cva(`sr-only appearance-none outline-none peer`);
|
|
11
|
+
const checkmarkThemeVariants = cva(`
|
|
12
12
|
flex items-center justify-center
|
|
13
|
-
|
|
14
|
-
overflow-hidden
|
|
13
|
+
h-4.5 w-4.5 pl-0.25
|
|
14
|
+
cursor-pointer overflow-hidden
|
|
15
|
+
${themeControlSurfaceClasses}
|
|
16
|
+
border border-input-border
|
|
17
|
+
outline-none
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
peer-disabled:pointer-events-none peer-disabled:cursor-not-allowed
|
|
20
|
+
peer-disabled:border-disabled-border peer-disabled:bg-disabled-background peer-disabled:text-disabled-foreground
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
data-[disabled='true']:opacity-50
|
|
22
|
+
peer-checked:border-(--color-selected-border) peer-checked:bg-primary peer-checked:text-primary-foreground
|
|
23
|
+
peer-indeterminate:border-(--color-selected-border) peer-indeterminate:bg-primary peer-indeterminate:text-primary-foreground
|
|
22
24
|
|
|
23
|
-
peer-focus-visible:
|
|
24
|
-
peer-focus-visible:
|
|
25
|
+
peer-focus-visible:border-focus-indicator
|
|
26
|
+
peer-focus-visible:ring-2 peer-focus-visible:ring-focus-indicator/35
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
[&.ng-touched.ng-invalid]:border-error
|
|
29
|
+
data-[invalid='true']:border-error
|
|
30
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
31
|
+
data-[invalid='true']:peer-focus-visible:border-error
|
|
32
|
+
data-[invalid='true']:peer-focus-visible:ring-error/35
|
|
28
33
|
|
|
29
|
-
peer-indeterminate:bg-primary
|
|
30
|
-
peer-indeterminate:text-primary-foreground
|
|
31
|
-
peer-indeterminate:after:content-['']
|
|
32
34
|
peer-indeterminate:after:absolute
|
|
33
35
|
peer-indeterminate:after:inset-[3px_0_3px_0]
|
|
36
|
+
peer-indeterminate:after:content-['']
|
|
37
|
+
peer-indeterminate:after:bg-current
|
|
34
38
|
peer-indeterminate:after:[mask-image:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23FFFFFF'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M5%2012h14'%2F%3E%3C%2Fsvg%3E")]
|
|
35
39
|
peer-indeterminate:after:[mask-repeat:no-repeat]
|
|
36
40
|
peer-indeterminate:after:[mask-size:contain]
|
|
37
|
-
peer-indeterminate:after:bg-current
|
|
38
|
-
|
|
39
|
-
[&.ng-touched.ng-invalid]:border-error
|
|
40
|
-
|
|
41
|
-
data-[invalid='true']:border-error
|
|
42
|
-
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/40
|
|
43
41
|
`, {
|
|
44
42
|
variants: {
|
|
45
43
|
rounded: {
|
|
@@ -51,16 +49,12 @@ const checkmarkVariants = cva(`
|
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
});
|
|
54
|
-
const
|
|
55
|
-
w-full
|
|
56
|
-
inline-flex items-center gap-2
|
|
57
|
-
relative
|
|
58
|
-
|
|
52
|
+
const checkboxContainerLabelThemeVariants = cva(`
|
|
53
|
+
relative inline-flex h-full w-full items-center gap-2
|
|
59
54
|
select-none
|
|
60
|
-
|
|
61
55
|
data-[disabled='true']:pointer-events-none
|
|
62
56
|
data-[disabled='true']:cursor-not-allowed
|
|
63
|
-
data-[disabled='true']:
|
|
57
|
+
data-[disabled='true']:text-disabled-foreground
|
|
64
58
|
`, {
|
|
65
59
|
variants: {
|
|
66
60
|
labelSize: {
|
|
@@ -70,42 +64,42 @@ const checkboxContainerLabelVariants = cva(`
|
|
|
70
64
|
}
|
|
71
65
|
}
|
|
72
66
|
});
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
const checkboxDirectiveThemeVariants = cva(`
|
|
68
|
+
relative h-4.5 w-4.5
|
|
69
|
+
cursor-pointer appearance-none
|
|
70
|
+
${themeControlSurfaceClasses}
|
|
71
|
+
border border-input-border
|
|
72
|
+
outline-none
|
|
79
73
|
|
|
80
|
-
disabled:pointer-events-none
|
|
81
|
-
disabled:
|
|
82
|
-
disabled:opacity-50
|
|
74
|
+
disabled:pointer-events-none disabled:cursor-not-allowed
|
|
75
|
+
disabled:border-disabled-border disabled:bg-disabled-background disabled:text-disabled-foreground
|
|
83
76
|
|
|
84
|
-
checked:text-primary-foreground
|
|
85
|
-
indeterminate:text-primary-foreground
|
|
86
|
-
indeterminate:bg-primary
|
|
87
|
-
checked:bg-primary
|
|
77
|
+
checked:border-(--color-selected-border) checked:bg-primary checked:text-primary-foreground
|
|
78
|
+
indeterminate:border-(--color-selected-border) indeterminate:bg-primary indeterminate:text-primary-foreground
|
|
88
79
|
|
|
89
|
-
focus-visible:
|
|
90
|
-
focus-visible:
|
|
80
|
+
focus-visible:border-focus-indicator
|
|
81
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
91
82
|
|
|
92
|
-
checked:after:content-['']
|
|
93
83
|
checked:after:absolute
|
|
94
84
|
checked:after:inset-[1px_0_0_1px]
|
|
85
|
+
checked:after:content-['']
|
|
86
|
+
checked:after:bg-current
|
|
95
87
|
checked:after:[mask-image:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23FFFFFF'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M18%206%209%2017l-5-5'/%3E%3C/svg%3E")]
|
|
96
88
|
checked:after:[mask-repeat:no-repeat]
|
|
97
89
|
checked:after:[mask-size:contain]
|
|
98
|
-
checked:after:bg-current
|
|
99
90
|
|
|
100
|
-
indeterminate:after:content-['']
|
|
101
91
|
indeterminate:after:absolute
|
|
102
92
|
indeterminate:after:inset-[1px_0_1px_1px]
|
|
93
|
+
indeterminate:after:content-['']
|
|
94
|
+
indeterminate:after:bg-current
|
|
103
95
|
indeterminate:after:[mask-image:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23FFFFFF'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M5%2012h14'%2F%3E%3C%2Fsvg%3E")]
|
|
104
96
|
indeterminate:after:[mask-repeat:no-repeat]
|
|
105
97
|
indeterminate:after:[mask-size:contain]
|
|
106
|
-
indeterminate:after:bg-current
|
|
107
98
|
|
|
108
99
|
[&.ng-touched.ng-invalid]:border-error
|
|
100
|
+
[&.ng-touched.ng-invalid]:ring-2 [&.ng-touched.ng-invalid]:ring-error/35
|
|
101
|
+
[&.ng-touched.ng-invalid]:focus-visible:border-error
|
|
102
|
+
[&.ng-touched.ng-invalid]:focus-visible:ring-error/35
|
|
109
103
|
`, {
|
|
110
104
|
variants: {
|
|
111
105
|
rounded: {
|
|
@@ -118,58 +112,21 @@ const checkboxDirectiveVariants = cva(`
|
|
|
118
112
|
}
|
|
119
113
|
});
|
|
120
114
|
|
|
121
|
-
const checkboxInputThemeVariants = (theme) => {
|
|
122
|
-
switch (theme) {
|
|
123
|
-
case "mona":
|
|
124
|
-
return checkboxVariants;
|
|
125
|
-
default:
|
|
126
|
-
return checkboxVariants;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
const checkmarkThemeVariants = (theme) => {
|
|
130
|
-
switch (theme) {
|
|
131
|
-
case "mona":
|
|
132
|
-
return checkmarkVariants;
|
|
133
|
-
default:
|
|
134
|
-
return checkmarkVariants;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
const checkboxContainerLabelThemeVariants = (theme) => {
|
|
138
|
-
switch (theme) {
|
|
139
|
-
case "mona":
|
|
140
|
-
return checkboxContainerLabelVariants;
|
|
141
|
-
default:
|
|
142
|
-
return checkboxContainerLabelVariants;
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
const checkboxDirectiveThemeVariants = (theme) => {
|
|
146
|
-
switch (theme) {
|
|
147
|
-
case "mona":
|
|
148
|
-
return checkboxDirectiveVariants;
|
|
149
|
-
default:
|
|
150
|
-
return checkboxDirectiveVariants;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
115
|
class CheckBoxComponent {
|
|
155
116
|
constructor() {
|
|
156
|
-
this.#themeService = inject(ThemeService);
|
|
157
117
|
this.checkBoxClasses = computed(() => {
|
|
158
|
-
|
|
159
|
-
return checkboxInputThemeVariants(theme)();
|
|
118
|
+
return checkboxInputThemeVariants();
|
|
160
119
|
}, /* @ts-ignore */
|
|
161
120
|
...(ngDevMode ? [{ debugName: "checkBoxClasses" }] : /* istanbul ignore next */ []));
|
|
162
121
|
this.checkMarkClasses = computed(() => {
|
|
163
|
-
const theme = this.#themeService.theme();
|
|
164
122
|
const rounded = this.rounded();
|
|
165
|
-
return checkmarkThemeVariants(
|
|
123
|
+
return checkmarkThemeVariants({ rounded });
|
|
166
124
|
}, /* @ts-ignore */
|
|
167
125
|
...(ngDevMode ? [{ debugName: "checkMarkClasses" }] : /* istanbul ignore next */ []));
|
|
168
126
|
this.containerLabelClasses = computed(() => {
|
|
169
|
-
const theme = this.#themeService.theme();
|
|
170
127
|
const labelSize = this.labelSize();
|
|
171
128
|
const classes = this.userClass();
|
|
172
|
-
const variantClasses = checkboxContainerLabelThemeVariants(
|
|
129
|
+
const variantClasses = checkboxContainerLabelThemeVariants({ labelSize });
|
|
173
130
|
return twMerge(variantClasses, classes);
|
|
174
131
|
}, /* @ts-ignore */
|
|
175
132
|
...(ngDevMode ? [{ debugName: "containerLabelClasses" }] : /* istanbul ignore next */ []));
|
|
@@ -265,7 +222,6 @@ class CheckBoxComponent {
|
|
|
265
222
|
*/
|
|
266
223
|
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
267
224
|
}
|
|
268
|
-
#themeService;
|
|
269
225
|
onCheckedChange(checked) {
|
|
270
226
|
this.checked.set(checked);
|
|
271
227
|
}
|
|
@@ -292,11 +248,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
292
248
|
|
|
293
249
|
class CheckboxDirective {
|
|
294
250
|
constructor() {
|
|
295
|
-
this.#themeService = inject(ThemeService);
|
|
296
251
|
this.classes = computed(() => {
|
|
297
|
-
const theme = this.#themeService.theme();
|
|
298
252
|
const rounded = this.rounded();
|
|
299
|
-
const variantClasses = checkboxDirectiveThemeVariants(
|
|
253
|
+
const variantClasses = checkboxDirectiveThemeVariants({ rounded });
|
|
300
254
|
const userClass = this.userClass();
|
|
301
255
|
return twMerge(variantClasses, userClass);
|
|
302
256
|
}, /* @ts-ignore */
|
|
@@ -313,7 +267,6 @@ class CheckboxDirective {
|
|
|
313
267
|
*/
|
|
314
268
|
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
315
269
|
}
|
|
316
|
-
#themeService;
|
|
317
270
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CheckboxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
318
271
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: CheckboxDirective, isStandalone: true, selector: "input[type='checkbox'][monaCheckbox]", inputs: { rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0 }); }
|
|
319
272
|
}
|