@nanahoshi/mona-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
- package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
- package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
- package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
- package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
- package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
- package/package.json +289 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
- package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
- package/types/nanahoshi-mona-ui-button.d.ts +111 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
- package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
- package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
- package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
- package/types/nanahoshi-mona-ui-common.d.ts +386 -0
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
- package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
- package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
- package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
- package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
- package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
- package/types/nanahoshi-mona-ui-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
- package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
- package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
- package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
- package/types/nanahoshi-mona-ui-query.d.ts +89 -0
- package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
- package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
- package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
- package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
- package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
- package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
- package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
- package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
- package/types/nanahoshi-mona-ui-window.d.ts +295 -0
- package/types/nanahoshi-mona-ui.d.ts +2 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, computed, model, input, output, Component, Directive } from '@angular/core';
|
|
4
|
+
import * as i1 from '@angular/forms';
|
|
5
|
+
import { FormsModule } from '@angular/forms';
|
|
6
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
7
|
+
import { twMerge } from 'tailwind-merge';
|
|
8
|
+
import { cva } from 'class-variance-authority';
|
|
9
|
+
|
|
10
|
+
const checkboxVariants = cva(`sr-only appearance-none outline-none peer`);
|
|
11
|
+
const checkmarkVariants = cva(`
|
|
12
|
+
flex items-center justify-center
|
|
13
|
+
w-4.5 h-4.5 pl-0.25
|
|
14
|
+
overflow-hidden outline-none
|
|
15
|
+
|
|
16
|
+
bg-input-background border border-input-border
|
|
17
|
+
cursor-pointer
|
|
18
|
+
|
|
19
|
+
data-[disabled='true']:pointer-events-none
|
|
20
|
+
data-[disabled='true']:cursor-not-allowed
|
|
21
|
+
data-[disabled='true']:opacity-50
|
|
22
|
+
|
|
23
|
+
peer-focus-visible:ring-2 peer-focus-visible:ring-primary/40
|
|
24
|
+
peer-focus-visible:border-primary
|
|
25
|
+
|
|
26
|
+
peer-checked:bg-primary
|
|
27
|
+
peer-checked:text-primary-foreground
|
|
28
|
+
|
|
29
|
+
peer-indeterminate:bg-primary
|
|
30
|
+
peer-indeterminate:text-primary-foreground
|
|
31
|
+
peer-indeterminate:after:content-['']
|
|
32
|
+
peer-indeterminate:after:absolute
|
|
33
|
+
peer-indeterminate:after:inset-[3px_0_3px_0]
|
|
34
|
+
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
|
+
peer-indeterminate:after:[mask-repeat:no-repeat]
|
|
36
|
+
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
|
+
`, {
|
|
44
|
+
variants: {
|
|
45
|
+
rounded: {
|
|
46
|
+
full: "rounded-full",
|
|
47
|
+
large: "rounded-lg",
|
|
48
|
+
medium: "rounded-md",
|
|
49
|
+
none: "rounded-none",
|
|
50
|
+
small: "rounded-sm"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const checkboxContainerLabelVariants = cva(`
|
|
55
|
+
w-full h-full
|
|
56
|
+
inline-flex items-center gap-2
|
|
57
|
+
relative
|
|
58
|
+
|
|
59
|
+
select-none
|
|
60
|
+
|
|
61
|
+
data-[disabled='true']:pointer-events-none
|
|
62
|
+
data-[disabled='true']:cursor-not-allowed
|
|
63
|
+
data-[disabled='true']:opacity-50
|
|
64
|
+
`, {
|
|
65
|
+
variants: {
|
|
66
|
+
labelSize: {
|
|
67
|
+
large: "text-lg",
|
|
68
|
+
medium: "text-md",
|
|
69
|
+
small: "text-sm"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const checkboxDirectiveVariants = cva(`
|
|
74
|
+
appearance-none outline-none
|
|
75
|
+
w-4.5 h-4.5
|
|
76
|
+
bg-input-background border border-input-border
|
|
77
|
+
cursor-pointer
|
|
78
|
+
relative
|
|
79
|
+
|
|
80
|
+
disabled:pointer-events-none
|
|
81
|
+
disabled:cursor-not-allowed
|
|
82
|
+
disabled:opacity-50
|
|
83
|
+
|
|
84
|
+
checked:text-primary-foreground
|
|
85
|
+
indeterminate:text-primary-foreground
|
|
86
|
+
indeterminate:bg-primary
|
|
87
|
+
checked:bg-primary
|
|
88
|
+
|
|
89
|
+
focus-visible:ring-2 focus-visible:ring-primary/40
|
|
90
|
+
focus-visible:border-primary
|
|
91
|
+
|
|
92
|
+
checked:after:content-['']
|
|
93
|
+
checked:after:absolute
|
|
94
|
+
checked:after:inset-[1px_0_0_1px]
|
|
95
|
+
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
|
+
checked:after:[mask-repeat:no-repeat]
|
|
97
|
+
checked:after:[mask-size:contain]
|
|
98
|
+
checked:after:bg-current
|
|
99
|
+
|
|
100
|
+
indeterminate:after:content-['']
|
|
101
|
+
indeterminate:after:absolute
|
|
102
|
+
indeterminate:after:inset-[1px_0_1px_1px]
|
|
103
|
+
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
|
+
indeterminate:after:[mask-repeat:no-repeat]
|
|
105
|
+
indeterminate:after:[mask-size:contain]
|
|
106
|
+
indeterminate:after:bg-current
|
|
107
|
+
|
|
108
|
+
[&.ng-touched.ng-invalid]:border-error
|
|
109
|
+
`, {
|
|
110
|
+
variants: {
|
|
111
|
+
rounded: {
|
|
112
|
+
full: "rounded-full",
|
|
113
|
+
large: "rounded-lg",
|
|
114
|
+
medium: "rounded-md",
|
|
115
|
+
none: "rounded-none",
|
|
116
|
+
small: "rounded-sm"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
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
|
+
class CheckBoxComponent {
|
|
155
|
+
constructor() {
|
|
156
|
+
this.#themeService = inject(ThemeService);
|
|
157
|
+
this.checkBoxClasses = computed(() => {
|
|
158
|
+
const theme = this.#themeService.theme();
|
|
159
|
+
return checkboxInputThemeVariants(theme)();
|
|
160
|
+
}, /* @ts-ignore */
|
|
161
|
+
...(ngDevMode ? [{ debugName: "checkBoxClasses" }] : /* istanbul ignore next */ []));
|
|
162
|
+
this.checkMarkClasses = computed(() => {
|
|
163
|
+
const theme = this.#themeService.theme();
|
|
164
|
+
const rounded = this.rounded();
|
|
165
|
+
return checkmarkThemeVariants(theme)({ rounded });
|
|
166
|
+
}, /* @ts-ignore */
|
|
167
|
+
...(ngDevMode ? [{ debugName: "checkMarkClasses" }] : /* istanbul ignore next */ []));
|
|
168
|
+
this.containerLabelClasses = computed(() => {
|
|
169
|
+
const theme = this.#themeService.theme();
|
|
170
|
+
const labelSize = this.labelSize();
|
|
171
|
+
const classes = this.userClass();
|
|
172
|
+
const variantClasses = checkboxContainerLabelThemeVariants(theme)({ labelSize });
|
|
173
|
+
return twMerge(variantClasses, classes);
|
|
174
|
+
}, /* @ts-ignore */
|
|
175
|
+
...(ngDevMode ? [{ debugName: "containerLabelClasses" }] : /* istanbul ignore next */ []));
|
|
176
|
+
this.invalidState = computed(() => this.invalid() || (this.required() && this.touched() && !this.checked()), /* @ts-ignore */
|
|
177
|
+
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
178
|
+
/**
|
|
179
|
+
* @description Whether the control is checked.
|
|
180
|
+
* @default false
|
|
181
|
+
*/
|
|
182
|
+
this.checked = model(false, /* @ts-ignore */
|
|
183
|
+
...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
184
|
+
/**
|
|
185
|
+
* @description Renders the component with reduced visual emphasis and removes pointer interaction.
|
|
186
|
+
* @default false
|
|
187
|
+
*/
|
|
188
|
+
this.disabled = input(false, /* @ts-ignore */
|
|
189
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
190
|
+
/**
|
|
191
|
+
* @description Activates indeterminate mode, showing a dash instead of a checkmark.
|
|
192
|
+
* @default false
|
|
193
|
+
*/
|
|
194
|
+
this.indeterminate = input(false, /* @ts-ignore */
|
|
195
|
+
...(ngDevMode ? [{ debugName: "indeterminate" }] : /* istanbul ignore next */ []));
|
|
196
|
+
/**
|
|
197
|
+
* @description Emitted when the checkbox input loses focus.
|
|
198
|
+
*/
|
|
199
|
+
this.inputBlur = output();
|
|
200
|
+
/**
|
|
201
|
+
* @description Emitted when the checkbox value changes.
|
|
202
|
+
*/
|
|
203
|
+
this.inputChange = output();
|
|
204
|
+
/**
|
|
205
|
+
* @description Emitted when the checkbox input gains focus.
|
|
206
|
+
*/
|
|
207
|
+
this.inputFocus = output();
|
|
208
|
+
/**
|
|
209
|
+
* @description Marks the checkbox as invalid. When bound to a signal form field via `[field]`,
|
|
210
|
+
* this is written by the signal forms `Field` directive.
|
|
211
|
+
* @default false
|
|
212
|
+
*/
|
|
213
|
+
this.invalid = input(false, /* @ts-ignore */
|
|
214
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
215
|
+
/**
|
|
216
|
+
* @description Text label displayed alongside the checkbox. When provided, takes precedence over projected content.
|
|
217
|
+
* @default ""
|
|
218
|
+
*/
|
|
219
|
+
this.label = input("", /* @ts-ignore */
|
|
220
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
221
|
+
/**
|
|
222
|
+
* @description Position of the label relative to the checkbox.
|
|
223
|
+
* @default "after"
|
|
224
|
+
*/
|
|
225
|
+
this.labelPosition = input("after", /* @ts-ignore */
|
|
226
|
+
...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
|
|
227
|
+
/**
|
|
228
|
+
* @description Controls the font size of the label text.
|
|
229
|
+
* @default "medium"
|
|
230
|
+
*/
|
|
231
|
+
this.labelSize = input("medium", /* @ts-ignore */
|
|
232
|
+
...(ngDevMode ? [{ debugName: "labelSize" }] : /* istanbul ignore next */ []));
|
|
233
|
+
/**
|
|
234
|
+
* @description Marks the control as required for form validation.
|
|
235
|
+
* @default false
|
|
236
|
+
*/
|
|
237
|
+
this.required = input(false, /* @ts-ignore */
|
|
238
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
239
|
+
/**
|
|
240
|
+
* @description Border-radius preset applied to the checkmark box.
|
|
241
|
+
* @default "medium"
|
|
242
|
+
*/
|
|
243
|
+
this.rounded = input("medium", /* @ts-ignore */
|
|
244
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
245
|
+
/**
|
|
246
|
+
* @description Tab index of the native checkbox input.
|
|
247
|
+
* @default 0
|
|
248
|
+
*/
|
|
249
|
+
this.tabIndex = input(0, /* @ts-ignore */
|
|
250
|
+
...(ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []));
|
|
251
|
+
/**
|
|
252
|
+
* @description Emitted when the checkbox loses focus or its value changes.
|
|
253
|
+
*/
|
|
254
|
+
this.touch = output();
|
|
255
|
+
/**
|
|
256
|
+
* @description Marks the checkbox as touched. When bound to a signal form field via `[field]`,
|
|
257
|
+
* this is written by the signal forms `Field` directive.
|
|
258
|
+
* @default false
|
|
259
|
+
*/
|
|
260
|
+
this.touched = input(false, /* @ts-ignore */
|
|
261
|
+
...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
262
|
+
/**
|
|
263
|
+
* @description Additional CSS classes merged onto the label container via `tailwind-merge`.
|
|
264
|
+
* @default ""
|
|
265
|
+
*/
|
|
266
|
+
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
267
|
+
}
|
|
268
|
+
#themeService;
|
|
269
|
+
onCheckedChange(checked) {
|
|
270
|
+
this.checked.set(checked);
|
|
271
|
+
}
|
|
272
|
+
onInputChange(event) {
|
|
273
|
+
this.inputChange.emit(event);
|
|
274
|
+
this.touch.emit();
|
|
275
|
+
}
|
|
276
|
+
onInputBlur(event) {
|
|
277
|
+
this.inputBlur.emit(event);
|
|
278
|
+
this.touch.emit();
|
|
279
|
+
}
|
|
280
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CheckBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
281
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CheckBoxComponent, isStandalone: true, selector: "mona-check-box", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, labelSize: { classPropertyName: "labelSize", publicName: "labelSize", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange", inputBlur: "inputBlur", inputChange: "inputChange", inputFocus: "inputFocus", touch: "touch" }, host: { properties: { "class": "'flex'", "attr.data-checked": "checked()", "attr.data-disabled": "disabled()", "attr.data-indeterminate": "indeterminate()" } }, ngImport: i0, template: "<label [class]=\"containerLabelClasses()\" [attr.data-disabled]=\"disabled()\">\r\n @if (labelPosition() === \"before\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n\r\n <input\r\n type=\"checkbox\"\r\n [disabled]=\"disabled()\"\r\n [indeterminate]=\"indeterminate()\"\r\n [required]=\"required()\"\r\n [ngModel]=\"checked()\"\r\n [tabindex]=\"disabled() ? -1 : tabIndex()\"\r\n [class]=\"checkBoxClasses()\"\r\n [attr.aria-checked]=\"indeterminate() ? 'mixed' : null\"\r\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\r\n [attr.aria-label]=\"label() || null\"\r\n (change)=\"onInputChange($event)\"\r\n (blur)=\"onInputBlur($event)\"\r\n (focus)=\"inputFocus.emit($event)\"\r\n (ngModelChange)=\"onCheckedChange($event)\"\r\n #checkBox />\r\n\r\n <span [class]=\"checkMarkClasses()\" [attr.data-invalid]=\"invalidState() || null\" aria-hidden=\"true\">\r\n @if (checked()) {\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"16\"\r\n height=\"16\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n class=\"lucide lucide-check stroke-primary-foreground\">\r\n <path d=\"M18 6 9 17l-5-5\" />\r\n </svg>\r\n }\r\n </span>\r\n @if (labelPosition() === \"after\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n</label>\r\n\r\n<ng-template #labelTemplate>\r\n @if (label()) {\r\n <span>{{ label() }}</span>\r\n } @else {\r\n <ng-content></ng-content>\r\n }\r\n</ng-template>\r\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox]:not([ngNoCva])[formControlName],input[type=checkbox]:not([ngNoCva])[formControl],input[type=checkbox]:not([ngNoCva])[ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.CheckboxRequiredValidator, selector: "input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
282
|
+
}
|
|
283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CheckBoxComponent, decorators: [{
|
|
284
|
+
type: Component,
|
|
285
|
+
args: [{ selector: "mona-check-box", imports: [FormsModule, NgTemplateOutlet], host: {
|
|
286
|
+
"[class]": "'flex'",
|
|
287
|
+
"[attr.data-checked]": "checked()",
|
|
288
|
+
"[attr.data-disabled]": "disabled()",
|
|
289
|
+
"[attr.data-indeterminate]": "indeterminate()"
|
|
290
|
+
}, template: "<label [class]=\"containerLabelClasses()\" [attr.data-disabled]=\"disabled()\">\r\n @if (labelPosition() === \"before\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n\r\n <input\r\n type=\"checkbox\"\r\n [disabled]=\"disabled()\"\r\n [indeterminate]=\"indeterminate()\"\r\n [required]=\"required()\"\r\n [ngModel]=\"checked()\"\r\n [tabindex]=\"disabled() ? -1 : tabIndex()\"\r\n [class]=\"checkBoxClasses()\"\r\n [attr.aria-checked]=\"indeterminate() ? 'mixed' : null\"\r\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\r\n [attr.aria-label]=\"label() || null\"\r\n (change)=\"onInputChange($event)\"\r\n (blur)=\"onInputBlur($event)\"\r\n (focus)=\"inputFocus.emit($event)\"\r\n (ngModelChange)=\"onCheckedChange($event)\"\r\n #checkBox />\r\n\r\n <span [class]=\"checkMarkClasses()\" [attr.data-invalid]=\"invalidState() || null\" aria-hidden=\"true\">\r\n @if (checked()) {\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"16\"\r\n height=\"16\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n class=\"lucide lucide-check stroke-primary-foreground\">\r\n <path d=\"M18 6 9 17l-5-5\" />\r\n </svg>\r\n }\r\n </span>\r\n @if (labelPosition() === \"after\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n</label>\r\n\r\n<ng-template #labelTemplate>\r\n @if (label()) {\r\n <span>{{ label() }}</span>\r\n } @else {\r\n <ng-content></ng-content>\r\n }\r\n</ng-template>\r\n" }]
|
|
291
|
+
}], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputChange: [{ type: i0.Output, args: ["inputChange"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], labelSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelSize", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
292
|
+
|
|
293
|
+
class CheckboxDirective {
|
|
294
|
+
constructor() {
|
|
295
|
+
this.#themeService = inject(ThemeService);
|
|
296
|
+
this.classes = computed(() => {
|
|
297
|
+
const theme = this.#themeService.theme();
|
|
298
|
+
const rounded = this.rounded();
|
|
299
|
+
const variantClasses = checkboxDirectiveThemeVariants(theme)({ rounded });
|
|
300
|
+
const userClass = this.userClass();
|
|
301
|
+
return twMerge(variantClasses, userClass);
|
|
302
|
+
}, /* @ts-ignore */
|
|
303
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
304
|
+
/**
|
|
305
|
+
* @description Border-radius preset applied to the checkbox.
|
|
306
|
+
* @default "medium"
|
|
307
|
+
*/
|
|
308
|
+
this.rounded = input("medium", /* @ts-ignore */
|
|
309
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
310
|
+
/**
|
|
311
|
+
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
312
|
+
* @default ""
|
|
313
|
+
*/
|
|
314
|
+
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
315
|
+
}
|
|
316
|
+
#themeService;
|
|
317
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CheckboxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
318
|
+
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
|
+
}
|
|
320
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CheckboxDirective, decorators: [{
|
|
321
|
+
type: Directive,
|
|
322
|
+
args: [{
|
|
323
|
+
selector: "input[type='checkbox'][monaCheckbox]",
|
|
324
|
+
host: {
|
|
325
|
+
"[class]": "classes()"
|
|
326
|
+
}
|
|
327
|
+
}]
|
|
328
|
+
}], propDecorators: { rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
329
|
+
|
|
330
|
+
/*
|
|
331
|
+
* Public API Surface of @nanahoshi/mona-ui/check-box
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Generated bundle index. Do not edit.
|
|
336
|
+
*/
|
|
337
|
+
|
|
338
|
+
export { CheckBoxComponent, CheckboxDirective };
|
|
339
|
+
//# sourceMappingURL=nanahoshi-mona-ui-check-box.mjs.map
|