@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, input, output, model, Component, Directive } from '@angular/core';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
7
|
+
import { cva } from 'class-variance-authority';
|
|
8
|
+
|
|
9
|
+
const radioButtonVariants = cva(`
|
|
10
|
+
appearance-none outline-none
|
|
11
|
+
peer absolute inset-0 w-full h-full
|
|
12
|
+
opacity-0 cursor-pointer z-10
|
|
13
|
+
focus:ring-2 focus:ring-primary focus:ring-offset-2
|
|
14
|
+
disabled:cursor-not-allowed
|
|
15
|
+
`);
|
|
16
|
+
const radioButtonCircleVariants = cva(`
|
|
17
|
+
w-4.5 h-4.5
|
|
18
|
+
flex items-center justify-center
|
|
19
|
+
overflow-hidden
|
|
20
|
+
bg-input-background
|
|
21
|
+
border border-input-border
|
|
22
|
+
cursor-pointer
|
|
23
|
+
relative
|
|
24
|
+
transition-colors duration-200
|
|
25
|
+
peer-focus:ring-2 peer-focus:ring-primary/40
|
|
26
|
+
peer-disabled:opacity-50 peer-disabled:cursor-not-allowed
|
|
27
|
+
|
|
28
|
+
data-[invalid='true']:border-error
|
|
29
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/40
|
|
30
|
+
`, {
|
|
31
|
+
variants: {
|
|
32
|
+
rounded: {
|
|
33
|
+
full: "rounded-full",
|
|
34
|
+
large: "rounded-lg",
|
|
35
|
+
medium: "rounded-md",
|
|
36
|
+
none: "rounded-none",
|
|
37
|
+
small: "rounded-sm"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const radioButtonIndicatorVariants = cva(`
|
|
42
|
+
flex w-3 h-3 bg-primary transition-all duration-200
|
|
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 radioButtonContainerLabelVariants = cva(`
|
|
55
|
+
w-full h-full flex items-center justify-center gap-1
|
|
56
|
+
relative
|
|
57
|
+
cursor-pointer
|
|
58
|
+
data-[disabled='true']:pointer-events-none
|
|
59
|
+
data-[disabled='true']:cursor-not-allowed
|
|
60
|
+
data-[disabled='true']:opacity-50
|
|
61
|
+
`, {
|
|
62
|
+
variants: {
|
|
63
|
+
labelSize: {
|
|
64
|
+
small: "text-sm",
|
|
65
|
+
medium: "text-base",
|
|
66
|
+
large: "text-lg"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
defaultVariants: {
|
|
70
|
+
labelSize: "medium"
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const radioButtonDirectiveVariants = 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
|
+
place-content-center
|
|
80
|
+
flex items-center justify-center
|
|
81
|
+
|
|
82
|
+
disabled:pointer-events-none
|
|
83
|
+
disabled:cursor-not-allowed
|
|
84
|
+
disabled:opacity-50
|
|
85
|
+
|
|
86
|
+
after:content-['']
|
|
87
|
+
after:w-3 after:h-3
|
|
88
|
+
after:inline-grid
|
|
89
|
+
after:place-content-center
|
|
90
|
+
|
|
91
|
+
checked:after:bg-primary
|
|
92
|
+
checked:after:rounded-full
|
|
93
|
+
|
|
94
|
+
focus-visible:ring-2 focus-visible:ring-primary/40
|
|
95
|
+
|
|
96
|
+
[&.ng-touched.ng-invalid]:border-error
|
|
97
|
+
`, {
|
|
98
|
+
variants: {
|
|
99
|
+
rounded: {
|
|
100
|
+
full: "rounded-full",
|
|
101
|
+
large: "rounded-lg",
|
|
102
|
+
medium: "rounded-md",
|
|
103
|
+
none: "rounded-none",
|
|
104
|
+
small: "rounded-sm"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
compoundVariants: [
|
|
108
|
+
{
|
|
109
|
+
rounded: "full",
|
|
110
|
+
class: "checked:after:rounded-full"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
rounded: "large",
|
|
114
|
+
class: "checked:after:rounded-lg"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
rounded: "medium",
|
|
118
|
+
class: "checked:after:rounded-md"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
rounded: "none",
|
|
122
|
+
class: "checked:after:rounded-none"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
rounded: "small",
|
|
126
|
+
class: "checked:after:rounded-sm"
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const radioButtonThemeVariants = (theme) => {
|
|
132
|
+
switch (theme) {
|
|
133
|
+
case "mona":
|
|
134
|
+
return radioButtonVariants;
|
|
135
|
+
default:
|
|
136
|
+
return radioButtonVariants; // Default to Mona styles
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const radioButtonCircleThemeVariants = (theme) => {
|
|
140
|
+
switch (theme) {
|
|
141
|
+
case "mona":
|
|
142
|
+
return radioButtonCircleVariants;
|
|
143
|
+
default:
|
|
144
|
+
return radioButtonCircleVariants; // Default to Mona styles
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const radioButtonIndicatorThemeVariants = (theme) => {
|
|
148
|
+
switch (theme) {
|
|
149
|
+
case "mona":
|
|
150
|
+
return radioButtonIndicatorVariants;
|
|
151
|
+
default:
|
|
152
|
+
return radioButtonIndicatorVariants; // Default to Mona styles
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const radioButtonContainerLabelThemeVariants = (theme) => {
|
|
156
|
+
switch (theme) {
|
|
157
|
+
case "mona":
|
|
158
|
+
return radioButtonContainerLabelVariants;
|
|
159
|
+
default:
|
|
160
|
+
return radioButtonContainerLabelVariants; // Default to Mona styles
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const radioButtonDirectiveThemeVariants = (theme) => {
|
|
164
|
+
switch (theme) {
|
|
165
|
+
case "mona":
|
|
166
|
+
return radioButtonDirectiveVariants;
|
|
167
|
+
default:
|
|
168
|
+
return radioButtonDirectiveVariants; // Default to Mona styles
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
class RadioButtonComponent {
|
|
173
|
+
constructor() {
|
|
174
|
+
this.#themeService = inject(ThemeService);
|
|
175
|
+
this.containerLabelClasses = computed(() => {
|
|
176
|
+
const theme = this.#themeService.theme();
|
|
177
|
+
const labelSize = this.labelSize();
|
|
178
|
+
const userClasses = this.userClass();
|
|
179
|
+
const variantClasses = radioButtonContainerLabelThemeVariants(theme)({ labelSize });
|
|
180
|
+
return twMerge(variantClasses, userClasses);
|
|
181
|
+
}, /* @ts-ignore */
|
|
182
|
+
...(ngDevMode ? [{ debugName: "containerLabelClasses" }] : /* istanbul ignore next */ []));
|
|
183
|
+
this.radioButtonCircleClasses = computed(() => {
|
|
184
|
+
const theme = this.#themeService.theme();
|
|
185
|
+
const rounded = this.rounded();
|
|
186
|
+
return radioButtonCircleThemeVariants(theme)({ rounded });
|
|
187
|
+
}, /* @ts-ignore */
|
|
188
|
+
...(ngDevMode ? [{ debugName: "radioButtonCircleClasses" }] : /* istanbul ignore next */ []));
|
|
189
|
+
this.radioButtonClasses = computed(() => radioButtonThemeVariants(this.#themeService.theme())(), /* @ts-ignore */
|
|
190
|
+
...(ngDevMode ? [{ debugName: "radioButtonClasses" }] : /* istanbul ignore next */ []));
|
|
191
|
+
this.radioButtonIndicatorClasses = computed(() => {
|
|
192
|
+
const theme = this.#themeService.theme();
|
|
193
|
+
const rounded = this.rounded();
|
|
194
|
+
return radioButtonIndicatorThemeVariants(theme)({ rounded });
|
|
195
|
+
}, /* @ts-ignore */
|
|
196
|
+
...(ngDevMode ? [{ debugName: "radioButtonIndicatorClasses" }] : /* istanbul ignore next */ []));
|
|
197
|
+
/**
|
|
198
|
+
* @description Sets the disabled state of the radio button.
|
|
199
|
+
* @default false
|
|
200
|
+
*/
|
|
201
|
+
this.disabled = input(false, /* @ts-ignore */
|
|
202
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
203
|
+
/**
|
|
204
|
+
* @description Emits when the input loses focus.
|
|
205
|
+
*/
|
|
206
|
+
this.inputBlur = output();
|
|
207
|
+
/**
|
|
208
|
+
* @description Emits when the input is clicked.
|
|
209
|
+
*/
|
|
210
|
+
this.inputClick = output();
|
|
211
|
+
/**
|
|
212
|
+
* @description Emits when the input receives focus.
|
|
213
|
+
*/
|
|
214
|
+
this.inputFocus = output();
|
|
215
|
+
/**
|
|
216
|
+
* @description Marks the radio button as invalid. When bound to a signal form field via `[field]`,
|
|
217
|
+
* this is written by the signal forms `Field` directive.
|
|
218
|
+
* @default false
|
|
219
|
+
*/
|
|
220
|
+
this.invalid = input(false, /* @ts-ignore */
|
|
221
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
222
|
+
/**
|
|
223
|
+
* @description Text label displayed alongside the radio button.
|
|
224
|
+
* When provided, takes precedence over projected content.
|
|
225
|
+
* When empty, projected content inside `<mona-radio-button>` is used.
|
|
226
|
+
* When both are absent, the radio button has no accessible name — always provide one.
|
|
227
|
+
* @default ""
|
|
228
|
+
*/
|
|
229
|
+
this.label = input("", /* @ts-ignore */
|
|
230
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
231
|
+
/**
|
|
232
|
+
* @description Position of the label relative to the radio button circle.
|
|
233
|
+
* @default "after"
|
|
234
|
+
*/
|
|
235
|
+
this.labelPosition = input("after", /* @ts-ignore */
|
|
236
|
+
...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
|
|
237
|
+
/**
|
|
238
|
+
* @description Font size applied to the label text.
|
|
239
|
+
* @default "medium"
|
|
240
|
+
*/
|
|
241
|
+
this.labelSize = input("medium", /* @ts-ignore */
|
|
242
|
+
...(ngDevMode ? [{ debugName: "labelSize" }] : /* istanbul ignore next */ []));
|
|
243
|
+
/**
|
|
244
|
+
* @description HTML `name` attribute forwarded to the native input.
|
|
245
|
+
* Radio buttons that share the same `name` form a mutually exclusive group in the browser.
|
|
246
|
+
* @default ""
|
|
247
|
+
*/
|
|
248
|
+
this.name = input("", /* @ts-ignore */
|
|
249
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
250
|
+
/**
|
|
251
|
+
* @description The identity value of this radio button within a group.
|
|
252
|
+
* Compared against `value()` to determine whether this button is selected.
|
|
253
|
+
* When this button is chosen, its `radioValue` is written to the form as the new group value.
|
|
254
|
+
* @default undefined
|
|
255
|
+
*/
|
|
256
|
+
this.radioValue = input(undefined, /* @ts-ignore */
|
|
257
|
+
...(ngDevMode ? [{ debugName: "radioValue" }] : /* istanbul ignore next */ []));
|
|
258
|
+
/**
|
|
259
|
+
* @description Sets the border radius of the radio button circle and indicator.
|
|
260
|
+
* @default "full"
|
|
261
|
+
*/
|
|
262
|
+
this.rounded = input("full", /* @ts-ignore */
|
|
263
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
264
|
+
this.touch = output();
|
|
265
|
+
/**
|
|
266
|
+
* @description Additional CSS classes merged onto the label container element via `tailwind-merge`.
|
|
267
|
+
* @default ""
|
|
268
|
+
*/
|
|
269
|
+
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
270
|
+
/**
|
|
271
|
+
* @description The currently selected value in the radio group.
|
|
272
|
+
* When bound via `[control]` (signal forms), the `Field` directive keeps this in sync with the form field.
|
|
273
|
+
* When bound via `[(ngModel)]` or `[formControl]`, the CVA layer manages this value.
|
|
274
|
+
* @default undefined
|
|
275
|
+
*/
|
|
276
|
+
this.value = model(undefined, /* @ts-ignore */
|
|
277
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
278
|
+
}
|
|
279
|
+
#themeService;
|
|
280
|
+
onBlur(event) {
|
|
281
|
+
this.inputBlur.emit(event);
|
|
282
|
+
this.touch.emit();
|
|
283
|
+
}
|
|
284
|
+
onSelectionChange() {
|
|
285
|
+
this.value.set(this.radioValue());
|
|
286
|
+
this.touch.emit();
|
|
287
|
+
}
|
|
288
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RadioButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
289
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: RadioButtonComponent, isStandalone: true, selector: "mona-radio-button", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", 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 }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, radioValue: { classPropertyName: "radioValue", publicName: "radioValue", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", 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: { inputBlur: "inputBlur", inputClick: "inputClick", inputFocus: "inputFocus", touch: "touch", value: "valueChange" }, host: { properties: { "attr.data-selected": "radioValue()===value()", "attr.data-disabled": "disabled()" } }, 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 <input\r\n type=\"radio\"\r\n [disabled]=\"disabled()\"\r\n [name]=\"name()\"\r\n [value]=\"radioValue()\"\r\n [class]=\"radioButtonClasses()\"\r\n [checked]=\"radioValue() === value()\"\r\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\r\n (blur)=\"onBlur($event)\"\r\n (click)=\"inputClick.emit($event)\"\r\n (focus)=\"inputFocus.emit($event)\"\r\n (change)=\"onSelectionChange()\" />\r\n <span [class]=\"radioButtonCircleClasses()\" [attr.data-invalid]=\"invalid() || null\">\r\n @if (radioValue() === value()) {\r\n <span [class]=\"radioButtonIndicatorClasses()\"></span>\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: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
290
|
+
}
|
|
291
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RadioButtonComponent, decorators: [{
|
|
292
|
+
type: Component,
|
|
293
|
+
args: [{ selector: "mona-radio-button", imports: [FormsModule, NgTemplateOutlet], host: {
|
|
294
|
+
"[attr.data-selected]": "radioValue()===value()",
|
|
295
|
+
"[attr.data-disabled]": "disabled()"
|
|
296
|
+
}, 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 <input\r\n type=\"radio\"\r\n [disabled]=\"disabled()\"\r\n [name]=\"name()\"\r\n [value]=\"radioValue()\"\r\n [class]=\"radioButtonClasses()\"\r\n [checked]=\"radioValue() === value()\"\r\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\r\n (blur)=\"onBlur($event)\"\r\n (click)=\"inputClick.emit($event)\"\r\n (focus)=\"inputFocus.emit($event)\"\r\n (change)=\"onSelectionChange()\" />\r\n <span [class]=\"radioButtonCircleClasses()\" [attr.data-invalid]=\"invalid() || null\">\r\n @if (radioValue() === value()) {\r\n <span [class]=\"radioButtonIndicatorClasses()\"></span>\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" }]
|
|
297
|
+
}], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputClick: [{ type: i0.Output, args: ["inputClick"] }], 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 }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], radioValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "radioValue", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
298
|
+
|
|
299
|
+
class RadioButtonDirective {
|
|
300
|
+
constructor() {
|
|
301
|
+
this.#themeService = inject(ThemeService);
|
|
302
|
+
this.classes = computed(() => {
|
|
303
|
+
const theme = this.#themeService.theme();
|
|
304
|
+
const rounded = this.rounded();
|
|
305
|
+
return radioButtonDirectiveThemeVariants(theme)({ rounded });
|
|
306
|
+
}, /* @ts-ignore */
|
|
307
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
308
|
+
/**
|
|
309
|
+
* @description Sets the border radius of the radio button.
|
|
310
|
+
* @default "none"
|
|
311
|
+
*/
|
|
312
|
+
this.rounded = input("none", /* @ts-ignore */
|
|
313
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
314
|
+
}
|
|
315
|
+
#themeService;
|
|
316
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RadioButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
317
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: RadioButtonDirective, isStandalone: true, selector: "input[type='radio'][monaRadioButton]", inputs: { rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.role": "'radio'" } }, ngImport: i0 }); }
|
|
318
|
+
}
|
|
319
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RadioButtonDirective, decorators: [{
|
|
320
|
+
type: Directive,
|
|
321
|
+
args: [{
|
|
322
|
+
selector: "input[type='radio'][monaRadioButton]",
|
|
323
|
+
host: {
|
|
324
|
+
"[class]": "classes()",
|
|
325
|
+
"[attr.role]": "'radio'"
|
|
326
|
+
}
|
|
327
|
+
}]
|
|
328
|
+
}], propDecorators: { rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }] } });
|
|
329
|
+
|
|
330
|
+
/*
|
|
331
|
+
* Public API Surface of @nanahoshi/mona-ui/radio-button
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Generated bundle index. Do not edit.
|
|
336
|
+
*/
|
|
337
|
+
|
|
338
|
+
export { RadioButtonComponent, RadioButtonDirective };
|
|
339
|
+
//# sourceMappingURL=nanahoshi-mona-ui-radio-button.mjs.map
|