@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,245 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Directive, inject, contentChildren, TemplateRef, computed, contentChild, input, model, Component } from '@angular/core';
|
|
4
|
+
import { LucideMinus, LucidePlus } from '@lucide/angular';
|
|
5
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
6
|
+
import { createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
7
|
+
import { twMerge } from 'tailwind-merge';
|
|
8
|
+
import { cva } from 'class-variance-authority';
|
|
9
|
+
|
|
10
|
+
class ExpansionPanelActionsTemplateDirective {
|
|
11
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelActionsTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
12
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ExpansionPanelActionsTemplateDirective, isStandalone: true, selector: "ng-template[monaExpansionPanelActionsTemplate]", ngImport: i0 }); }
|
|
13
|
+
}
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelActionsTemplateDirective, decorators: [{
|
|
15
|
+
type: Directive,
|
|
16
|
+
args: [{
|
|
17
|
+
selector: "ng-template[monaExpansionPanelActionsTemplate]"
|
|
18
|
+
}]
|
|
19
|
+
}] });
|
|
20
|
+
|
|
21
|
+
class ExpansionPanelIconTemplateDirective {
|
|
22
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelIconTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
23
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ExpansionPanelIconTemplateDirective, isStandalone: true, selector: "ng-template[monaExpansionPanelIconTemplate]", ngImport: i0 }); }
|
|
24
|
+
}
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelIconTemplateDirective, decorators: [{
|
|
26
|
+
type: Directive,
|
|
27
|
+
args: [{
|
|
28
|
+
selector: "ng-template[monaExpansionPanelIconTemplate]"
|
|
29
|
+
}]
|
|
30
|
+
}] });
|
|
31
|
+
|
|
32
|
+
class ExpansionPanelTitleTemplateDirective {
|
|
33
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelTitleTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
34
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: ExpansionPanelTitleTemplateDirective, isStandalone: true, selector: "ng-template[monaExpansionPanelTitleTemplate]", ngImport: i0 }); }
|
|
35
|
+
}
|
|
36
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelTitleTemplateDirective, decorators: [{
|
|
37
|
+
type: Directive,
|
|
38
|
+
args: [{
|
|
39
|
+
selector: "ng-template[monaExpansionPanelTitleTemplate]"
|
|
40
|
+
}]
|
|
41
|
+
}] });
|
|
42
|
+
|
|
43
|
+
const expansionPanelBaseVariants = cva(`
|
|
44
|
+
block w-full bg-background overflow-hidden
|
|
45
|
+
border border-border
|
|
46
|
+
not-last:border-b-transparent not-last:rounded-b-none
|
|
47
|
+
not-first:rounded-t-none relative
|
|
48
|
+
`, {
|
|
49
|
+
variants: {
|
|
50
|
+
rounded: {
|
|
51
|
+
small: "rounded-sm",
|
|
52
|
+
medium: "rounded-md",
|
|
53
|
+
large: "rounded-lg",
|
|
54
|
+
none: "rounded-none"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const expansionPanelHeaderVariants = cva(`
|
|
59
|
+
w-full flex items-center justify-between
|
|
60
|
+
px-2 py-1
|
|
61
|
+
bg-background-dark
|
|
62
|
+
cursor-pointer
|
|
63
|
+
font-medium
|
|
64
|
+
text-foreground
|
|
65
|
+
select-none
|
|
66
|
+
transition-border-b duration-200
|
|
67
|
+
focus-visible:outline-primary/40 focus-visible:border-b-transparent
|
|
68
|
+
focus-visible:ring-1 focus-visible:ring-primary/40
|
|
69
|
+
focus-visible:z-10 focus-visible:relative
|
|
70
|
+
`, {
|
|
71
|
+
variants: {
|
|
72
|
+
collapsed: {
|
|
73
|
+
true: "border-b-transparent",
|
|
74
|
+
false: "border-0 border-b border-border border-solid"
|
|
75
|
+
},
|
|
76
|
+
disabled: {
|
|
77
|
+
true: "pointer-events-none opacity-50 cursor-not-allowed select-none",
|
|
78
|
+
false: ""
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const expansionPanelHeaderTitleVariants = cva(`
|
|
83
|
+
p-1 flex-1
|
|
84
|
+
`);
|
|
85
|
+
const expansionPanelIconContainerVariants = cva(``, {
|
|
86
|
+
variants: {
|
|
87
|
+
hasTemplate: {
|
|
88
|
+
true: "",
|
|
89
|
+
false: "px-2"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const expansionPanelContentVariants = cva(`
|
|
94
|
+
text-foreground
|
|
95
|
+
grid
|
|
96
|
+
transition-[grid-template-rows] duration-300 ease-out
|
|
97
|
+
[&>div]:overflow-hidden
|
|
98
|
+
`, {
|
|
99
|
+
variants: {
|
|
100
|
+
expanded: {
|
|
101
|
+
true: "grid-rows-[1fr]",
|
|
102
|
+
false: "grid-rows-[0fr]"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const expansionPanelBaseThemeVariants = (theme) => {
|
|
108
|
+
switch (theme) {
|
|
109
|
+
case "mona":
|
|
110
|
+
return expansionPanelBaseVariants;
|
|
111
|
+
default:
|
|
112
|
+
return expansionPanelBaseVariants;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const expansionPanelHeaderThemeVariants = (theme) => {
|
|
116
|
+
switch (theme) {
|
|
117
|
+
case "mona":
|
|
118
|
+
return expansionPanelHeaderVariants;
|
|
119
|
+
default:
|
|
120
|
+
return expansionPanelHeaderVariants;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const expansionPanelHeaderTitleThemeVariants = (theme) => {
|
|
124
|
+
switch (theme) {
|
|
125
|
+
case "mona":
|
|
126
|
+
return expansionPanelHeaderTitleVariants;
|
|
127
|
+
default:
|
|
128
|
+
return expansionPanelHeaderTitleVariants;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const expansionPanelIconContainerThemeVariants = (theme) => {
|
|
132
|
+
switch (theme) {
|
|
133
|
+
case "mona":
|
|
134
|
+
return expansionPanelIconContainerVariants;
|
|
135
|
+
default:
|
|
136
|
+
return expansionPanelIconContainerVariants;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const expansionPanelContentThemeVariants = (theme) => {
|
|
140
|
+
switch (theme) {
|
|
141
|
+
case "mona":
|
|
142
|
+
return expansionPanelContentVariants;
|
|
143
|
+
default:
|
|
144
|
+
return expansionPanelContentVariants;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
class ExpansionPanelComponent {
|
|
149
|
+
constructor() {
|
|
150
|
+
this.#themeService = inject(ThemeService);
|
|
151
|
+
this.actionsTemplateList = contentChildren(ExpansionPanelActionsTemplateDirective, { ...(ngDevMode ? { debugName: "actionsTemplateList" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
152
|
+
this.baseClass = computed(() => {
|
|
153
|
+
const theme = this.#themeService.theme();
|
|
154
|
+
const rounded = this.rounded();
|
|
155
|
+
const variantClass = expansionPanelBaseThemeVariants(theme)({ rounded });
|
|
156
|
+
return twMerge(variantClass, this.userClass());
|
|
157
|
+
}, /* @ts-ignore */
|
|
158
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
159
|
+
this.contentClass = computed(() => {
|
|
160
|
+
const theme = this.#themeService.theme();
|
|
161
|
+
const expanded = this.expanded();
|
|
162
|
+
return expansionPanelContentThemeVariants(theme)({ expanded });
|
|
163
|
+
}, /* @ts-ignore */
|
|
164
|
+
...(ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []));
|
|
165
|
+
this.contentId = createElementControlId();
|
|
166
|
+
this.headerClass = computed(() => {
|
|
167
|
+
const theme = this.#themeService.theme();
|
|
168
|
+
const collapsed = !this.expanded();
|
|
169
|
+
const disabled = this.disabled();
|
|
170
|
+
return expansionPanelHeaderThemeVariants(theme)({ collapsed, disabled });
|
|
171
|
+
}, /* @ts-ignore */
|
|
172
|
+
...(ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []));
|
|
173
|
+
this.headerTitleClass = computed(() => {
|
|
174
|
+
const theme = this.#themeService.theme();
|
|
175
|
+
return expansionPanelHeaderTitleThemeVariants(theme)();
|
|
176
|
+
}, /* @ts-ignore */
|
|
177
|
+
...(ngDevMode ? [{ debugName: "headerTitleClass" }] : /* istanbul ignore next */ []));
|
|
178
|
+
this.iconContainerClass = computed(() => {
|
|
179
|
+
const theme = this.#themeService.theme();
|
|
180
|
+
const hasTemplate = !!this.iconTemplate();
|
|
181
|
+
return expansionPanelIconContainerThemeVariants(theme)({ hasTemplate });
|
|
182
|
+
}, /* @ts-ignore */
|
|
183
|
+
...(ngDevMode ? [{ debugName: "iconContainerClass" }] : /* istanbul ignore next */ []));
|
|
184
|
+
this.iconTemplate = contentChild(ExpansionPanelIconTemplateDirective, { ...(ngDevMode ? { debugName: "iconTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
185
|
+
this.titleTemplate = contentChild(ExpansionPanelTitleTemplateDirective, { ...(ngDevMode ? { debugName: "titleTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
186
|
+
/**
|
|
187
|
+
* @description Disables header interaction, suppressing click and keyboard toggling.
|
|
188
|
+
* @default false
|
|
189
|
+
*/
|
|
190
|
+
this.disabled = input(false, /* @ts-ignore */
|
|
191
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
192
|
+
/**
|
|
193
|
+
* @description Sets whether the expansion panel is expanded or collapsed.
|
|
194
|
+
* @default false
|
|
195
|
+
*/
|
|
196
|
+
this.expanded = model(false, /* @ts-ignore */
|
|
197
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
198
|
+
/**
|
|
199
|
+
* @description Sets the border radius of the expansion panel.
|
|
200
|
+
* @default "medium"
|
|
201
|
+
*/
|
|
202
|
+
this.rounded = input("medium", /* @ts-ignore */
|
|
203
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
204
|
+
/**
|
|
205
|
+
* @description Sets the title of the expansion panel.
|
|
206
|
+
* @default ""
|
|
207
|
+
*/
|
|
208
|
+
this.title = input("", /* @ts-ignore */
|
|
209
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
210
|
+
/**
|
|
211
|
+
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
212
|
+
* @default ""
|
|
213
|
+
*/
|
|
214
|
+
this.userClass = input("", /* @ts-ignore */
|
|
215
|
+
...(ngDevMode ? [{ debugName: "userClass" }] : /* istanbul ignore next */ []));
|
|
216
|
+
}
|
|
217
|
+
#themeService;
|
|
218
|
+
toggle() {
|
|
219
|
+
if (this.disabled()) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
this.expanded.update(expanded => !expanded);
|
|
223
|
+
}
|
|
224
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
225
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ExpansionPanelComponent, isStandalone: true, selector: "mona-expansion-panel", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "userClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expanded: "expandedChange" }, host: { properties: { "class": "baseClass()" } }, queries: [{ propertyName: "actionsTemplateList", predicate: ExpansionPanelActionsTemplateDirective, read: TemplateRef, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: ExpansionPanelIconTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "titleTemplate", first: true, predicate: ExpansionPanelTitleTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<div\r\n [class]=\"headerClass()\"\r\n role=\"button\"\r\n [attr.tabindex]=\"disabled() ? -1 : 0\"\r\n [attr.aria-expanded]=\"expanded()\"\r\n [attr.aria-controls]=\"contentId\"\r\n [attr.aria-disabled]=\"disabled() ? 'true' : undefined\"\r\n (click)=\"toggle()\"\r\n (keydown.enter)=\"$event.preventDefault(); toggle()\"\r\n (keydown.space)=\"$event.preventDefault(); toggle()\">\r\n <div [class]=\"headerTitleClass()\">\r\n @if (titleTemplate()) {\r\n <ng-container [ngTemplateOutlet]=\"titleTemplate()\"></ng-container>\r\n } @else {\r\n {{ title() }}\r\n }\r\n </div>\r\n <div>\r\n @for (action of actionsTemplateList(); track $index) {\r\n <ng-container [ngTemplateOutlet]=\"action\"></ng-container>\r\n }\r\n </div>\r\n <div [class]=\"iconContainerClass()\">\r\n @if (iconTemplate()) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"iconTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: expanded() }\"></ng-container>\r\n } @else {\r\n @if (expanded()) {\r\n <svg lucideMinus [size]=\"14\"></svg>\r\n } @else {\r\n <svg lucidePlus [size]=\"14\"></svg>\r\n }\r\n }\r\n </div>\r\n</div>\r\n<div\r\n [id]=\"contentId\"\r\n [class]=\"contentClass()\"\r\n [attr.aria-hidden]=\"!expanded()\"\r\n [attr.inert]=\"!expanded() ? true : undefined\">\r\n <div>\r\n <ng-content></ng-content>\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideMinus, selector: "svg[lucideMinus]" }, { kind: "component", type: LucidePlus, selector: "svg[lucidePlus]" }] }); }
|
|
226
|
+
}
|
|
227
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ExpansionPanelComponent, decorators: [{
|
|
228
|
+
type: Component,
|
|
229
|
+
args: [{ selector: "mona-expansion-panel", imports: [NgTemplateOutlet, LucideMinus, LucidePlus], host: {
|
|
230
|
+
"[class]": "baseClass()"
|
|
231
|
+
}, template: "<div\r\n [class]=\"headerClass()\"\r\n role=\"button\"\r\n [attr.tabindex]=\"disabled() ? -1 : 0\"\r\n [attr.aria-expanded]=\"expanded()\"\r\n [attr.aria-controls]=\"contentId\"\r\n [attr.aria-disabled]=\"disabled() ? 'true' : undefined\"\r\n (click)=\"toggle()\"\r\n (keydown.enter)=\"$event.preventDefault(); toggle()\"\r\n (keydown.space)=\"$event.preventDefault(); toggle()\">\r\n <div [class]=\"headerTitleClass()\">\r\n @if (titleTemplate()) {\r\n <ng-container [ngTemplateOutlet]=\"titleTemplate()\"></ng-container>\r\n } @else {\r\n {{ title() }}\r\n }\r\n </div>\r\n <div>\r\n @for (action of actionsTemplateList(); track $index) {\r\n <ng-container [ngTemplateOutlet]=\"action\"></ng-container>\r\n }\r\n </div>\r\n <div [class]=\"iconContainerClass()\">\r\n @if (iconTemplate()) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"iconTemplate()\"\r\n [ngTemplateOutletContext]=\"{ $implicit: expanded() }\"></ng-container>\r\n } @else {\r\n @if (expanded()) {\r\n <svg lucideMinus [size]=\"14\"></svg>\r\n } @else {\r\n <svg lucidePlus [size]=\"14\"></svg>\r\n }\r\n }\r\n </div>\r\n</div>\r\n<div\r\n [id]=\"contentId\"\r\n [class]=\"contentClass()\"\r\n [attr.aria-hidden]=\"!expanded()\"\r\n [attr.inert]=\"!expanded() ? true : undefined\">\r\n <div>\r\n <ng-content></ng-content>\r\n </div>\r\n</div>\r\n" }]
|
|
232
|
+
}], propDecorators: { actionsTemplateList: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ExpansionPanelActionsTemplateDirective), { ...{
|
|
233
|
+
read: TemplateRef
|
|
234
|
+
}, isSignal: true }] }], iconTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ExpansionPanelIconTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], titleTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ExpansionPanelTitleTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }, { type: i0.Output, args: ["expandedChange"] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "userClass", required: false }] }] } });
|
|
235
|
+
|
|
236
|
+
/*
|
|
237
|
+
* Public API Surface of @nanahoshi/mona-ui/expansion-panel
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Generated bundle index. Do not edit.
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
export { ExpansionPanelActionsTemplateDirective, ExpansionPanelComponent, ExpansionPanelIconTemplateDirective, ExpansionPanelTitleTemplateDirective };
|
|
245
|
+
//# sourceMappingURL=nanahoshi-mona-ui-expansion-panel.mjs.map
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Directive, inject, computed, contentChild, TemplateRef, input, Component } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { cva } from 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
class FieldsetLegendTemplateDirective {
|
|
9
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: FieldsetLegendTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
10
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: FieldsetLegendTemplateDirective, isStandalone: true, selector: "ng-template[monaFieldsetLegendTemplate]", ngImport: i0 }); }
|
|
11
|
+
}
|
|
12
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: FieldsetLegendTemplateDirective, decorators: [{
|
|
13
|
+
type: Directive,
|
|
14
|
+
args: [{
|
|
15
|
+
selector: "ng-template[monaFieldsetLegendTemplate]"
|
|
16
|
+
}]
|
|
17
|
+
}] });
|
|
18
|
+
|
|
19
|
+
const fieldsetBaseVariants = cva(`
|
|
20
|
+
block
|
|
21
|
+
`);
|
|
22
|
+
const fieldsetVariants = cva(`
|
|
23
|
+
bg-background
|
|
24
|
+
border border-border
|
|
25
|
+
text-foreground
|
|
26
|
+
`, {
|
|
27
|
+
variants: {
|
|
28
|
+
rounded: {
|
|
29
|
+
small: "rounded-sm",
|
|
30
|
+
medium: "rounded-md",
|
|
31
|
+
large: "rounded-lg",
|
|
32
|
+
full: "rounded-full",
|
|
33
|
+
none: "rounded-none"
|
|
34
|
+
},
|
|
35
|
+
disabled: {
|
|
36
|
+
true: "pointer-events-none opacity-50 cursor-not-allowed select-none",
|
|
37
|
+
false: ""
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
disabled: false
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
const fieldsetLegendVariants = cva(`
|
|
45
|
+
ml-2
|
|
46
|
+
`, {
|
|
47
|
+
variants: {
|
|
48
|
+
hasTemplate: {
|
|
49
|
+
true: "",
|
|
50
|
+
false: "bg-background-dark text-foreground border border-border px-2"
|
|
51
|
+
},
|
|
52
|
+
rounded: {
|
|
53
|
+
small: "rounded-sm",
|
|
54
|
+
medium: "rounded-md",
|
|
55
|
+
large: "rounded-lg",
|
|
56
|
+
full: "rounded-full",
|
|
57
|
+
none: "rounded-none"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
hasTemplate: false
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const fieldsetBaseThemeVariants = (theme) => {
|
|
66
|
+
switch (theme) {
|
|
67
|
+
case "mona":
|
|
68
|
+
return fieldsetBaseVariants;
|
|
69
|
+
default:
|
|
70
|
+
return fieldsetBaseVariants;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const fieldsetThemeVariants = (theme) => {
|
|
74
|
+
switch (theme) {
|
|
75
|
+
case "mona":
|
|
76
|
+
return fieldsetVariants;
|
|
77
|
+
default:
|
|
78
|
+
return fieldsetVariants;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const fieldsetLegendThemeVariants = (theme) => {
|
|
82
|
+
switch (theme) {
|
|
83
|
+
case "mona":
|
|
84
|
+
return fieldsetLegendVariants;
|
|
85
|
+
default:
|
|
86
|
+
return fieldsetLegendVariants;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
class FieldsetComponent {
|
|
91
|
+
constructor() {
|
|
92
|
+
this.#themeService = inject(ThemeService);
|
|
93
|
+
this.baseClass = computed(() => {
|
|
94
|
+
const theme = this.#themeService.theme();
|
|
95
|
+
return fieldsetBaseThemeVariants(theme)();
|
|
96
|
+
}, /* @ts-ignore */
|
|
97
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
98
|
+
this.fieldsetClass = computed(() => {
|
|
99
|
+
const theme = this.#themeService.theme();
|
|
100
|
+
const rounded = this.rounded();
|
|
101
|
+
const disabled = this.disabled();
|
|
102
|
+
const userClass = this.userClass();
|
|
103
|
+
return twMerge(fieldsetThemeVariants(theme)({ rounded, disabled }), userClass);
|
|
104
|
+
}, /* @ts-ignore */
|
|
105
|
+
...(ngDevMode ? [{ debugName: "fieldsetClass" }] : /* istanbul ignore next */ []));
|
|
106
|
+
this.legendClass = computed(() => {
|
|
107
|
+
const theme = this.#themeService.theme();
|
|
108
|
+
const rounded = this.rounded();
|
|
109
|
+
const hasTemplate = !!this.legendTemplate();
|
|
110
|
+
return fieldsetLegendThemeVariants(theme)({ hasTemplate, rounded });
|
|
111
|
+
}, /* @ts-ignore */
|
|
112
|
+
...(ngDevMode ? [{ debugName: "legendClass" }] : /* istanbul ignore next */ []));
|
|
113
|
+
this.legendTemplate = contentChild(FieldsetLegendTemplateDirective, { ...(ngDevMode ? { debugName: "legendTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
114
|
+
this.legendVisible = computed(() => {
|
|
115
|
+
return !!this.legend() || !!this.legendTemplate();
|
|
116
|
+
}, /* @ts-ignore */
|
|
117
|
+
...(ngDevMode ? [{ debugName: "legendVisible" }] : /* istanbul ignore next */ []));
|
|
118
|
+
/**
|
|
119
|
+
* @description Whether the fieldset and its projected form controls are disabled.
|
|
120
|
+
* Reflected as the native `disabled` attribute on the rendered `<fieldset>`.
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
this.disabled = input(false, /* @ts-ignore */
|
|
124
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
125
|
+
/**
|
|
126
|
+
* @description The legend text of the fieldset. Shown in the top border as a labelled notch.
|
|
127
|
+
* Ignored when `monaFieldsetLegendTemplate` is provided.
|
|
128
|
+
* @default ""
|
|
129
|
+
*/
|
|
130
|
+
this.legend = input("", /* @ts-ignore */
|
|
131
|
+
...(ngDevMode ? [{ debugName: "legend" }] : /* istanbul ignore next */ []));
|
|
132
|
+
/**
|
|
133
|
+
* @description The `name` attribute reflected onto the rendered `<fieldset>` element.
|
|
134
|
+
* @default undefined
|
|
135
|
+
*/
|
|
136
|
+
this.name = input(undefined, /* @ts-ignore */
|
|
137
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
138
|
+
/**
|
|
139
|
+
* @description Border-radius preset applied to the fieldset and its legend.
|
|
140
|
+
* @default "medium"
|
|
141
|
+
*/
|
|
142
|
+
this.rounded = input("medium", /* @ts-ignore */
|
|
143
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
144
|
+
/**
|
|
145
|
+
* @description Additional CSS classes merged onto the rendered `<fieldset>` element via `tailwind-merge`.
|
|
146
|
+
* @default ""
|
|
147
|
+
*/
|
|
148
|
+
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
149
|
+
}
|
|
150
|
+
#themeService;
|
|
151
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: FieldsetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
152
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: FieldsetComponent, isStandalone: true, selector: "mona-fieldset", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, legend: { classPropertyName: "legend", publicName: "legend", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", 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 } }, host: { properties: { "class": "baseClass()" } }, queries: [{ propertyName: "legendTemplate", first: true, predicate: FieldsetLegendTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<fieldset [class]=\"fieldsetClass()\" [disabled]=\"disabled()\" [attr.name]=\"name()\">\n @if (legendVisible()) {\n <legend [class]=\"legendClass()\">\n @if (legendTemplate()) {\n <ng-container [ngTemplateOutlet]=\"legendTemplate()\"></ng-container>\n } @else {\n <span>{{ legend() }}</span>\n }\n </legend>\n }\n <ng-content></ng-content>\n</fieldset>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
153
|
+
}
|
|
154
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: FieldsetComponent, decorators: [{
|
|
155
|
+
type: Component,
|
|
156
|
+
args: [{ selector: "mona-fieldset", imports: [NgTemplateOutlet], host: {
|
|
157
|
+
"[class]": "baseClass()"
|
|
158
|
+
}, template: "<fieldset [class]=\"fieldsetClass()\" [disabled]=\"disabled()\" [attr.name]=\"name()\">\n @if (legendVisible()) {\n <legend [class]=\"legendClass()\">\n @if (legendTemplate()) {\n <ng-container [ngTemplateOutlet]=\"legendTemplate()\"></ng-container>\n } @else {\n <span>{{ legend() }}</span>\n }\n </legend>\n }\n <ng-content></ng-content>\n</fieldset>\n" }]
|
|
159
|
+
}], propDecorators: { legendTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => FieldsetLegendTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], legend: [{ type: i0.Input, args: [{ isSignal: true, alias: "legend", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
160
|
+
|
|
161
|
+
/*
|
|
162
|
+
* Public API Surface of @nanahoshi/mona-ui/fieldset
|
|
163
|
+
*/
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Generated bundle index. Do not edit.
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
export { FieldsetComponent, FieldsetLegendTemplateDirective };
|
|
170
|
+
//# sourceMappingURL=nanahoshi-mona-ui-fieldset.mjs.map
|