@nanahoshi/mona-ui 0.3.0 → 0.4.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.
@@ -0,0 +1,4 @@
1
+ {
2
+ "module": "../fesm2022/nanahoshi-mona-ui-card.mjs",
3
+ "typings": "../types/nanahoshi-mona-ui-card.d.ts"
4
+ }
@@ -0,0 +1,307 @@
1
+ import { NgTemplateOutlet } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, TemplateRef, Directive, signal, Service, computed, contentChild, input, Component, viewChild, afterRenderEffect, DestroyRef, contentChildren } from '@angular/core';
4
+ import { classInputToClass } from '@nanahoshi/mona-ui/common';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import { themeRaisedBackdropClasses, createElementControlId } from '@nanahoshi/mona-ui/internal';
7
+ import { cva } from 'class-variance-authority';
8
+
9
+ class CardContentDirective {
10
+ constructor() {
11
+ this.templateRef = inject(TemplateRef);
12
+ }
13
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
14
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: CardContentDirective, isStandalone: true, selector: "[monaCardContent]", ngImport: i0 }); }
15
+ }
16
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardContentDirective, decorators: [{
17
+ type: Directive,
18
+ args: [{
19
+ selector: "[monaCardContent]"
20
+ }]
21
+ }] });
22
+
23
+ class CardService {
24
+ constructor() {
25
+ this.actionTemplate = signal([], /* @ts-ignore */
26
+ ...(ngDevMode ? [{ debugName: "actionTemplate" }] : /* istanbul ignore next */ []));
27
+ this.descriptionId = signal(null, /* @ts-ignore */
28
+ ...(ngDevMode ? [{ debugName: "descriptionId" }] : /* istanbul ignore next */ []));
29
+ this.descriptionTemplate = signal(null, /* @ts-ignore */
30
+ ...(ngDevMode ? [{ debugName: "descriptionTemplate" }] : /* istanbul ignore next */ []));
31
+ this.footerClass = signal(undefined, /* @ts-ignore */
32
+ ...(ngDevMode ? [{ debugName: "footerClass" }] : /* istanbul ignore next */ []));
33
+ this.footerTemplate = signal(null, /* @ts-ignore */
34
+ ...(ngDevMode ? [{ debugName: "footerTemplate" }] : /* istanbul ignore next */ []));
35
+ this.headerClass = signal(undefined, /* @ts-ignore */
36
+ ...(ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []));
37
+ this.headerTemplate = signal(null, /* @ts-ignore */
38
+ ...(ngDevMode ? [{ debugName: "headerTemplate" }] : /* istanbul ignore next */ []));
39
+ this.titleId = signal(null, /* @ts-ignore */
40
+ ...(ngDevMode ? [{ debugName: "titleId" }] : /* istanbul ignore next */ []));
41
+ this.titleTemplate = signal(null, /* @ts-ignore */
42
+ ...(ngDevMode ? [{ debugName: "titleTemplate" }] : /* istanbul ignore next */ []));
43
+ }
44
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardService, deps: [], target: i0.ɵɵFactoryTarget.Service }); }
45
+ static { this.ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.6", ngImport: i0, type: CardService, autoProvided: false }); }
46
+ }
47
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardService, decorators: [{
48
+ type: Service,
49
+ args: [{ autoProvided: false }]
50
+ }] });
51
+
52
+ const roundedTopVariants = {
53
+ small: "rounded-tl-sm rounded-tr-sm",
54
+ medium: "rounded-tl-md rounded-tr-md",
55
+ large: "rounded-tl-lg rounded-tr-lg",
56
+ xlarge: "rounded-tl-xl rounded-tr-xl",
57
+ xxlarge: "rounded-tl-2xl rounded-tr-2xl",
58
+ none: "rounded-none"
59
+ };
60
+ const roundedBottomVariants = {
61
+ small: "rounded-bl-sm rounded-br-sm",
62
+ medium: "rounded-bl-md rounded-br-md",
63
+ large: "rounded-bl-lg rounded-br-lg",
64
+ xlarge: "rounded-bl-xl rounded-br-xl",
65
+ xxlarge: "rounded-bl-2xl rounded-br-2xl",
66
+ none: "rounded-none"
67
+ };
68
+ const roundedAllVariants = {
69
+ small: "rounded-sm",
70
+ medium: "rounded-md",
71
+ large: "rounded-lg",
72
+ xlarge: "rounded-xl",
73
+ xxlarge: "rounded-2xl",
74
+ none: "rounded-none"
75
+ };
76
+ const cardBaseThemeVariants = cva(`
77
+ flex flex-col gap-2 py-4
78
+ ${themeRaisedBackdropClasses}
79
+ border border-border
80
+ bg-(--color-card) text-(--color-card-foreground)
81
+ shadow-(--shadow-raised)
82
+ `, {
83
+ variants: {
84
+ rounded: roundedAllVariants,
85
+ hasFooter: {
86
+ true: "pb-0",
87
+ false: ""
88
+ },
89
+ hasHeader: {
90
+ true: "pt-0",
91
+ false: ""
92
+ }
93
+ }
94
+ });
95
+ const cardFooterThemeVariants = cva(`
96
+ flex flex-row
97
+ justify-between
98
+ items-center
99
+ p-4
100
+ border-t
101
+ border-border
102
+ `, {
103
+ variants: {
104
+ rounded: roundedBottomVariants
105
+ }
106
+ });
107
+ const cardHeaderThemeVariants = cva(`
108
+ grid grid-cols-[1fr_auto] grid-rows-2
109
+ p-4 pb-0
110
+ `, {
111
+ variants: {
112
+ rounded: roundedTopVariants
113
+ }
114
+ });
115
+ const cardHeaderTitleThemeVariants = cva(`col-start-1 row-start-1 items-center`);
116
+ const cardHeaderDescriptionThemeVariants = cva(`col-start-1 row-start-2`);
117
+ const cardHeaderActionsThemeVariants = cva(`col-start-2 row-start-1 row-span-2 self-start justify-self-end`);
118
+
119
+ class CardComponent {
120
+ constructor() {
121
+ this.#cardService = inject(CardService);
122
+ this.actionsCellClass = cardHeaderActionsThemeVariants();
123
+ this.actionTemplate = this.#cardService.actionTemplate.asReadonly();
124
+ this.baseClass = computed(() => {
125
+ const rounded = this.rounded();
126
+ const hasHeader = !!this.headerTemplate();
127
+ const hasFooter = !!this.footerTemplate();
128
+ const variantClass = cardBaseThemeVariants({ rounded, hasHeader, hasFooter });
129
+ const userClass = classInputToClass(this.userClass());
130
+ return twMerge(variantClass, userClass);
131
+ }, /* @ts-ignore */
132
+ ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
133
+ this.contentDirective = contentChild(CardContentDirective, /* @ts-ignore */
134
+ ...(ngDevMode ? [{ debugName: "contentDirective" }] : /* istanbul ignore next */ []));
135
+ this.descriptionCellClass = cardHeaderDescriptionThemeVariants();
136
+ this.descriptionId = this.#cardService.descriptionId.asReadonly();
137
+ this.descriptionTemplate = this.#cardService.descriptionTemplate.asReadonly();
138
+ this.footerClass = computed(() => {
139
+ const rounded = this.rounded();
140
+ const variantClass = cardFooterThemeVariants({ rounded });
141
+ const userClass = classInputToClass(this.#cardService.footerClass());
142
+ return twMerge(variantClass, userClass);
143
+ }, /* @ts-ignore */
144
+ ...(ngDevMode ? [{ debugName: "footerClass" }] : /* istanbul ignore next */ []));
145
+ this.footerTemplate = this.#cardService.footerTemplate.asReadonly();
146
+ this.headerClass = computed(() => {
147
+ const rounded = this.rounded();
148
+ const variantClass = cardHeaderThemeVariants({ rounded });
149
+ const userClass = classInputToClass(this.#cardService.headerClass());
150
+ return twMerge(variantClass, userClass);
151
+ }, /* @ts-ignore */
152
+ ...(ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []));
153
+ this.headerTemplate = this.#cardService.headerTemplate.asReadonly();
154
+ this.titleCellClass = cardHeaderTitleThemeVariants();
155
+ this.titleId = this.#cardService.titleId.asReadonly();
156
+ this.titleTemplate = this.#cardService.titleTemplate.asReadonly();
157
+ /**
158
+ * @description Controls the border radius applied to the card and its header/footer regions.
159
+ * @default "medium"
160
+ */
161
+ this.rounded = input("medium", /* @ts-ignore */
162
+ ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
163
+ /**
164
+ * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
165
+ * @default ""
166
+ */
167
+ this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
168
+ }
169
+ #cardService;
170
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
171
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CardComponent, isStandalone: true, selector: "mona-card", 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": "baseClass()", "attr.aria-labelledby": "titleId()", "attr.aria-describedby": "descriptionId()" } }, providers: [CardService], queries: [{ propertyName: "contentDirective", first: true, predicate: CardContentDirective, descendants: true, isSignal: true }], ngImport: i0, template: "@if (headerTemplate()) {\n <div [class]=\"headerClass()\">\n @if (titleTemplate()) {\n <div [class]=\"titleCellClass\">\n <ng-container [ngTemplateOutlet]=\"titleTemplate()\" [ngTemplateOutletContext]=\"{ $implicit: titleId() }\" />\n </div>\n }\n @if (descriptionTemplate()) {\n <div [class]=\"descriptionCellClass\">\n <ng-container\n [ngTemplateOutlet]=\"descriptionTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: descriptionId() }\"\n />\n </div>\n }\n @if (actionTemplate().length > 0) {\n <div [class]=\"actionsCellClass\" role=\"group\" aria-label=\"Card actions\">\n @for (template of actionTemplate(); track template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n }\n </div>\n }\n </div>\n}\n<ng-container [ngTemplateOutlet]=\"contentDirective()?.templateRef ?? null\" />\n@if (footerTemplate()) {\n <div [class]=\"footerClass()\">\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\" />\n </div>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
172
+ }
173
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardComponent, decorators: [{
174
+ type: Component,
175
+ args: [{ selector: "mona-card", imports: [NgTemplateOutlet], host: {
176
+ "[class]": "baseClass()",
177
+ "[attr.aria-labelledby]": "titleId()",
178
+ "[attr.aria-describedby]": "descriptionId()"
179
+ }, providers: [CardService], template: "@if (headerTemplate()) {\n <div [class]=\"headerClass()\">\n @if (titleTemplate()) {\n <div [class]=\"titleCellClass\">\n <ng-container [ngTemplateOutlet]=\"titleTemplate()\" [ngTemplateOutletContext]=\"{ $implicit: titleId() }\" />\n </div>\n }\n @if (descriptionTemplate()) {\n <div [class]=\"descriptionCellClass\">\n <ng-container\n [ngTemplateOutlet]=\"descriptionTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: descriptionId() }\"\n />\n </div>\n }\n @if (actionTemplate().length > 0) {\n <div [class]=\"actionsCellClass\" role=\"group\" aria-label=\"Card actions\">\n @for (template of actionTemplate(); track template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n }\n </div>\n }\n </div>\n}\n<ng-container [ngTemplateOutlet]=\"contentDirective()?.templateRef ?? null\" />\n@if (footerTemplate()) {\n <div [class]=\"footerClass()\">\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\" />\n </div>\n}\n" }]
180
+ }], propDecorators: { contentDirective: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CardContentDirective), { isSignal: true }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
181
+
182
+ class CardFooterComponent {
183
+ #cardService;
184
+ constructor() {
185
+ this.#cardService = inject(CardService);
186
+ this.footerTemplate = viewChild.required(TemplateRef, /* @ts-ignore */
187
+ ...(ngDevMode ? [{ debugName: "footerTemplate" }] : /* istanbul ignore next */ []));
188
+ /**
189
+ * @description Additional CSS classes merged onto the rendered footer element via `tailwind-merge`.
190
+ * @default ""
191
+ */
192
+ this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
193
+ afterRenderEffect({
194
+ read: () => {
195
+ this.#cardService.footerTemplate.set(this.footerTemplate());
196
+ this.#cardService.footerClass.set(this.userClass());
197
+ }
198
+ });
199
+ inject(DestroyRef).onDestroy(() => {
200
+ this.#cardService.footerTemplate.set(null);
201
+ this.#cardService.footerClass.set(null);
202
+ });
203
+ }
204
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
205
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: CardFooterComponent, isStandalone: true, selector: "mona-card-footer", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "footerTemplate", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template>\n <ng-content></ng-content>\n</ng-template>\n" }); }
206
+ }
207
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardFooterComponent, decorators: [{
208
+ type: Component,
209
+ args: [{ selector: "mona-card-footer", imports: [], template: "<ng-template>\n <ng-content></ng-content>\n</ng-template>\n" }]
210
+ }], ctorParameters: () => [], propDecorators: { footerTemplate: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
211
+
212
+ class CardActionDirective {
213
+ constructor() {
214
+ this.templateRef = inject(TemplateRef);
215
+ }
216
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardActionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
217
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: CardActionDirective, isStandalone: true, selector: "[monaCardAction]", ngImport: i0 }); }
218
+ }
219
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardActionDirective, decorators: [{
220
+ type: Directive,
221
+ args: [{
222
+ selector: "[monaCardAction]"
223
+ }]
224
+ }] });
225
+
226
+ class CardDescriptionDirective {
227
+ constructor() {
228
+ this.id = createElementControlId();
229
+ this.templateRef = inject(TemplateRef);
230
+ }
231
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardDescriptionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
232
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: CardDescriptionDirective, isStandalone: true, selector: "[monaCardDescription]", ngImport: i0 }); }
233
+ }
234
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardDescriptionDirective, decorators: [{
235
+ type: Directive,
236
+ args: [{
237
+ selector: "[monaCardDescription]"
238
+ }]
239
+ }] });
240
+
241
+ class CardTitleDirective {
242
+ constructor() {
243
+ this.id = createElementControlId();
244
+ this.templateRef = inject(TemplateRef);
245
+ }
246
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardTitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
247
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: CardTitleDirective, isStandalone: true, selector: "[monaCardTitle]", ngImport: i0 }); }
248
+ }
249
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardTitleDirective, decorators: [{
250
+ type: Directive,
251
+ args: [{
252
+ selector: "[monaCardTitle]"
253
+ }]
254
+ }] });
255
+
256
+ class CardHeaderComponent {
257
+ #cardService;
258
+ constructor() {
259
+ this.#cardService = inject(CardService);
260
+ this.actionDirective = contentChildren(CardActionDirective, /* @ts-ignore */
261
+ ...(ngDevMode ? [{ debugName: "actionDirective" }] : /* istanbul ignore next */ []));
262
+ this.descriptionDirective = contentChild(CardDescriptionDirective, /* @ts-ignore */
263
+ ...(ngDevMode ? [{ debugName: "descriptionDirective" }] : /* istanbul ignore next */ []));
264
+ this.headerTemplate = viewChild.required(TemplateRef, /* @ts-ignore */
265
+ ...(ngDevMode ? [{ debugName: "headerTemplate" }] : /* istanbul ignore next */ []));
266
+ this.titleDirective = contentChild(CardTitleDirective, /* @ts-ignore */
267
+ ...(ngDevMode ? [{ debugName: "titleDirective" }] : /* istanbul ignore next */ []));
268
+ /**
269
+ * @description Additional CSS classes merged onto the rendered header element via `tailwind-merge`.
270
+ * @default ""
271
+ */
272
+ this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
273
+ afterRenderEffect({
274
+ read: () => {
275
+ this.#cardService.actionTemplate.set(this.actionDirective().map(directive => directive.templateRef));
276
+ this.#cardService.descriptionId.set(this.descriptionDirective()?.id ?? null);
277
+ this.#cardService.descriptionTemplate.set(this.descriptionDirective()?.templateRef ?? null);
278
+ this.#cardService.headerTemplate.set(this.headerTemplate());
279
+ this.#cardService.headerClass.set(this.userClass());
280
+ this.#cardService.titleId.set(this.titleDirective()?.id ?? null);
281
+ this.#cardService.titleTemplate.set(this.titleDirective()?.templateRef ?? null);
282
+ }
283
+ });
284
+ inject(DestroyRef).onDestroy(() => {
285
+ this.#cardService.actionTemplate.set([]);
286
+ this.#cardService.descriptionId.set(null);
287
+ this.#cardService.descriptionTemplate.set(null);
288
+ this.#cardService.headerTemplate.set(null);
289
+ this.#cardService.headerClass.set(null);
290
+ this.#cardService.titleId.set(null);
291
+ this.#cardService.titleTemplate.set(null);
292
+ });
293
+ }
294
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
295
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: CardHeaderComponent, isStandalone: true, selector: "mona-card-header", inputs: { userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "actionDirective", predicate: CardActionDirective, isSignal: true }, { propertyName: "descriptionDirective", first: true, predicate: CardDescriptionDirective, descendants: true, isSignal: true }, { propertyName: "titleDirective", first: true, predicate: CardTitleDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "headerTemplate", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template>\n <ng-content></ng-content>\n</ng-template>\n" }); }
296
+ }
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CardHeaderComponent, decorators: [{
298
+ type: Component,
299
+ args: [{ selector: "mona-card-header", template: "<ng-template>\n <ng-content></ng-content>\n</ng-template>\n" }]
300
+ }], ctorParameters: () => [], propDecorators: { actionDirective: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CardActionDirective), { isSignal: true }] }], descriptionDirective: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CardDescriptionDirective), { isSignal: true }] }], headerTemplate: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }], titleDirective: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CardTitleDirective), { isSignal: true }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
301
+
302
+ /**
303
+ * Generated bundle index. Do not edit.
304
+ */
305
+
306
+ export { CardActionDirective, CardComponent, CardContentDirective, CardDescriptionDirective, CardFooterComponent, CardHeaderComponent, CardTitleDirective };
307
+ //# sourceMappingURL=nanahoshi-mona-ui-card.mjs.map
@@ -586,6 +586,24 @@ class IterablePatchStore {
586
586
  const createIterablePatchStore = (options) => new IterablePatchStore(options);
587
587
  const createObjectPatchStore = (options) => new ObjectPatchStore(options);
588
588
 
589
+ const classInputToClass = (input) => {
590
+ if (input == null) {
591
+ return "";
592
+ }
593
+ if (typeof input === "string") {
594
+ return input;
595
+ }
596
+ if (Array.isArray(input)) {
597
+ return input.join(" ");
598
+ }
599
+ if (typeof input === "object") {
600
+ return Object.entries(input)
601
+ .map(([key, value]) => (!!value ? key : ""))
602
+ .join(" ");
603
+ }
604
+ return "";
605
+ };
606
+
589
607
  /**
590
608
  * Calculates the percentage of a value within a given range, rounded to the specified precision.
591
609
  * @param value The current value.
@@ -638,5 +656,5 @@ function moveIndices(array, indices, offset) {
638
656
  * Generated bundle index. Do not edit.
639
657
  */
640
658
 
641
- export { AnyPipe, ContainsPipe, FilterChangeEvent, IterablePatchStore, ObjectPatchStore, PreventableEvent, SlicePipe, TakeFirstPipe, buildNested, createIterablePatchStore, createObjectPatchStore, deepEquals, deepMerge, getPercentage, isEmptyObject, isPlainObject, mergeInto, mergePatchInto, moveIndices, patchAt, prunePatch, setAt };
659
+ export { AnyPipe, ContainsPipe, FilterChangeEvent, IterablePatchStore, ObjectPatchStore, PreventableEvent, SlicePipe, TakeFirstPipe, buildNested, classInputToClass, createIterablePatchStore, createObjectPatchStore, deepEquals, deepMerge, getPercentage, isEmptyObject, isPlainObject, mergeInto, mergePatchInto, moveIndices, patchAt, prunePatch, setAt };
642
660
  //# sourceMappingURL=nanahoshi-mona-ui-common.mjs.map
@@ -209,6 +209,8 @@ const dark$5 = Object.freeze({
209
209
  "--color-surface-muted": "#161718",
210
210
  "--color-surface-raised": "#242528",
211
211
  "--color-surface-overlay": "#161718",
212
+ "--color-card": "var(--color-surface-raised)",
213
+ "--color-card-foreground": "var(--color-foreground)",
212
214
  "--color-foreground": "#D6D6D8",
213
215
  "--color-muted-foreground": "#A8A8AD",
214
216
  "--color-input-background": "#1D1E20",
@@ -364,6 +366,8 @@ const light$3 = Object.freeze({
364
366
  "--color-surface-muted": "#f3f4f5",
365
367
  "--color-surface-raised": "#fbfbfb",
366
368
  "--color-surface-overlay": "#f9f9fa",
369
+ "--color-card": "var(--mona-effect-raised-background-color)",
370
+ "--color-card-foreground": "var(--color-foreground)",
367
371
  "--color-foreground": "#252525",
368
372
  "--color-muted-foreground": "#6f7074",
369
373
  "--color-input-background": "#f3f4f5",
@@ -437,6 +441,8 @@ const dark$3 = Object.freeze({
437
441
  "--color-surface-muted": "#252527",
438
442
  "--color-surface-raised": "#202022",
439
443
  "--color-surface-overlay": "#262628",
444
+ "--color-card": "var(--mona-effect-raised-background-color)",
445
+ "--color-card-foreground": "var(--color-foreground)",
440
446
  "--color-foreground": "#f5f5f6",
441
447
  "--color-muted-foreground": "#a9aaae",
442
448
  "--color-input-background": "#252527",
@@ -686,6 +692,8 @@ const light$1 = Object.freeze({
686
692
  "--color-surface-muted": "oklch(96.7% 0.001 286.375)",
687
693
  "--color-surface-raised": "oklch(100% 0 0)",
688
694
  "--color-surface-overlay": "oklch(100% 0 0)",
695
+ "--color-card": "var(--color-surface-raised)",
696
+ "--color-card-foreground": "var(--color-foreground)",
689
697
  "--color-foreground": "oklch(14.1% 0.005 285.823)",
690
698
  "--color-muted-foreground": "oklch(55.2% 0.016 285.938)",
691
699
  "--color-input-background": "oklch(100% 0 0)",
@@ -746,6 +754,8 @@ const dark$1 = Object.freeze({
746
754
  "--color-surface-muted": "oklch(20.5% 0.006 285.885)",
747
755
  "--color-surface-raised": "oklch(24% 0.006 286.033)",
748
756
  "--color-surface-overlay": "oklch(27.4% 0.006 286.033)",
757
+ "--color-card": "var(--color-surface-raised)",
758
+ "--color-card-foreground": "var(--color-foreground)",
749
759
  "--color-foreground": "oklch(98.5% 0 0)",
750
760
  "--color-muted-foreground": "oklch(70.5% 0.015 286.067)",
751
761
  "--color-input-background": "oklch(20.5% 0.006 285.885)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanahoshi/mona-ui",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "A very light Angular UI framework",
5
5
  "author": "Nanahoshi",
6
6
  "repository": {
@@ -85,6 +85,10 @@
85
85
  "types": "./types/nanahoshi-mona-ui-calendar.d.ts",
86
86
  "default": "./fesm2022/nanahoshi-mona-ui-calendar.mjs"
87
87
  },
88
+ "./card": {
89
+ "types": "./types/nanahoshi-mona-ui-card.d.ts",
90
+ "default": "./fesm2022/nanahoshi-mona-ui-card.mjs"
91
+ },
88
92
  "./check-box": {
89
93
  "types": "./types/nanahoshi-mona-ui-check-box.d.ts",
90
94
  "default": "./fesm2022/nanahoshi-mona-ui-check-box.mjs"
@@ -0,0 +1,104 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { TemplateRef } from '@angular/core';
3
+ import * as class_variance_authority_types from 'class-variance-authority/types';
4
+ import { VariantInputs } from '@nanahoshi/mona-ui/internal';
5
+ import { VariantProps } from 'class-variance-authority';
6
+ import { ClassInputType } from '@nanahoshi/mona-ui/common';
7
+
8
+ declare class CardContentDirective {
9
+ readonly templateRef: TemplateRef<any>;
10
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardContentDirective, never>;
11
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CardContentDirective, "[monaCardContent]", never, {}, {}, never, never, true, never>;
12
+ }
13
+
14
+ declare const cardBaseThemeVariants: (props?: ({
15
+ rounded?: "small" | "medium" | "large" | "xlarge" | "xxlarge" | "none" | null | undefined;
16
+ hasFooter?: boolean | null | undefined;
17
+ hasHeader?: boolean | null | undefined;
18
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
19
+ type CardBaseVariantProps = VariantProps<typeof cardBaseThemeVariants>;
20
+ type CardBaseVariantInput = VariantInputs<CardBaseVariantProps>;
21
+ type CardVariantProps = CardBaseVariantProps;
22
+ type CardVariantInput = Omit<CardBaseVariantInput, "hasFooter" | "hasHeader">;
23
+
24
+ declare class CardComponent implements CardVariantInput {
25
+ #private;
26
+ protected readonly actionsCellClass: string;
27
+ protected readonly actionTemplate: _angular_core.Signal<_angular_core.TemplateRef<unknown>[]>;
28
+ protected readonly baseClass: _angular_core.Signal<string>;
29
+ protected readonly contentDirective: _angular_core.Signal<CardContentDirective | undefined>;
30
+ protected readonly descriptionCellClass: string;
31
+ protected readonly descriptionId: _angular_core.Signal<string | null>;
32
+ protected readonly descriptionTemplate: _angular_core.Signal<_angular_core.TemplateRef<unknown> | null>;
33
+ protected readonly footerClass: _angular_core.Signal<string>;
34
+ protected readonly footerTemplate: _angular_core.Signal<_angular_core.TemplateRef<unknown> | null>;
35
+ protected readonly headerClass: _angular_core.Signal<string>;
36
+ protected readonly headerTemplate: _angular_core.Signal<_angular_core.TemplateRef<unknown> | null>;
37
+ protected readonly titleCellClass: string;
38
+ protected readonly titleId: _angular_core.Signal<string | null>;
39
+ protected readonly titleTemplate: _angular_core.Signal<_angular_core.TemplateRef<unknown> | null>;
40
+ /**
41
+ * @description Controls the border radius applied to the card and its header/footer regions.
42
+ * @default "medium"
43
+ */
44
+ readonly rounded: _angular_core.InputSignal<"small" | "medium" | "large" | "xlarge" | "xxlarge" | "none" | null | undefined>;
45
+ /**
46
+ * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
47
+ * @default ""
48
+ */
49
+ readonly userClass: _angular_core.InputSignal<string>;
50
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardComponent, never>;
51
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CardComponent, "mona-card", never, { "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, ["contentDirective"], never, true, never>;
52
+ }
53
+
54
+ declare class CardFooterComponent {
55
+ #private;
56
+ private readonly footerTemplate;
57
+ /**
58
+ * @description Additional CSS classes merged onto the rendered footer element via `tailwind-merge`.
59
+ * @default ""
60
+ */
61
+ readonly userClass: _angular_core.InputSignal<ClassInputType>;
62
+ constructor();
63
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardFooterComponent, never>;
64
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CardFooterComponent, "mona-card-footer", never, { "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
65
+ }
66
+
67
+ declare class CardHeaderComponent {
68
+ #private;
69
+ private readonly actionDirective;
70
+ private readonly descriptionDirective;
71
+ private readonly headerTemplate;
72
+ private readonly titleDirective;
73
+ /**
74
+ * @description Additional CSS classes merged onto the rendered header element via `tailwind-merge`.
75
+ * @default ""
76
+ */
77
+ readonly userClass: _angular_core.InputSignal<ClassInputType>;
78
+ constructor();
79
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardHeaderComponent, never>;
80
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CardHeaderComponent, "mona-card-header", never, { "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, ["actionDirective", "descriptionDirective", "titleDirective"], ["*"], true, never>;
81
+ }
82
+
83
+ declare class CardActionDirective {
84
+ readonly templateRef: TemplateRef<any>;
85
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardActionDirective, never>;
86
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CardActionDirective, "[monaCardAction]", never, {}, {}, never, never, true, never>;
87
+ }
88
+
89
+ declare class CardDescriptionDirective {
90
+ readonly id: string;
91
+ readonly templateRef: TemplateRef<any>;
92
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardDescriptionDirective, never>;
93
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CardDescriptionDirective, "[monaCardDescription]", never, {}, {}, never, never, true, never>;
94
+ }
95
+
96
+ declare class CardTitleDirective {
97
+ readonly id: string;
98
+ readonly templateRef: TemplateRef<any>;
99
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CardTitleDirective, never>;
100
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CardTitleDirective, "[monaCardTitle]", never, {}, {}, never, never, true, never>;
101
+ }
102
+
103
+ export { CardActionDirective, CardComponent, CardContentDirective, CardDescriptionDirective, CardFooterComponent, CardHeaderComponent, CardTitleDirective };
104
+ export type { CardVariantProps };
@@ -22,8 +22,9 @@ declare const circularProgressBarBaseThemeVariants: (props?: ({
22
22
  } & class_variance_authority_types.ClassProp) | undefined) => string;
23
23
  type CircularProgressBarBaseVariantProps = VariantProps<typeof circularProgressBarBaseThemeVariants>;
24
24
  type CircularProgressBarBaseVariantInput = VariantInputs<CircularProgressBarBaseVariantProps>;
25
+ type CircularProgressBarVariantInput = CircularProgressBarBaseVariantInput;
25
26
 
26
- declare class CircularProgressBarComponent implements CircularProgressBarBaseVariantInput {
27
+ declare class CircularProgressBarComponent implements CircularProgressBarVariantInput {
27
28
  protected readonly baseClasses: _angular_core.Signal<string>;
28
29
  protected readonly center: _angular_core.Signal<{
29
30
  x: number;
@@ -6,6 +6,8 @@ type SelectionMode = "single" | "multiple";
6
6
 
7
7
  type ScrollDirection = "left" | "right";
8
8
 
9
+ type ClassInputType = string | string[] | Record<string, unknown> | null | undefined;
10
+
9
11
  type ColorMode = "hsv" | "rgb";
10
12
  type ColorOutputFormat = "hex" | "rgb" | "hsl";
11
13
 
@@ -369,6 +371,8 @@ declare class IterablePatchStore<TItem, TId> implements IIterablePatchStore<TIte
369
371
  declare const createIterablePatchStore: <TItem, TId>(options: IterablePatchStoreOptions<TItem, TId>) => IIterablePatchStore<TItem, TId>;
370
372
  declare const createObjectPatchStore: <T>(options: ObjectPatchStoreOptions<T>) => IObjectPatchStore<T>;
371
373
 
374
+ declare const classInputToClass: (input: ClassInputType) => string;
375
+
372
376
  /**
373
377
  * Calculates the percentage of a value within a given range, rounded to the specified precision.
374
378
  * @param value The current value.
@@ -382,5 +386,5 @@ declare const getPercentage: (value: number, min: number, max: number, precision
382
386
 
383
387
  declare function moveIndices<T>(array: T[], indices: number[], offset: number): T[];
384
388
 
385
- export { AnyPipe, ContainsPipe, FilterChangeEvent, IterablePatchStore, ObjectPatchStore, PreventableEvent, SlicePipe, TakeFirstPipe, buildNested, createIterablePatchStore, createObjectPatchStore, deepEquals, deepMerge, getPercentage, isEmptyObject, isPlainObject, mergeInto, mergePatchInto, moveIndices, patchAt, prunePatch, setAt };
386
- export type { ArrayStrategy, BaseChangeStrategy, ColorMode, ColorOutputFormat, DataType, DeepMergeOptions, DeepPartial, FilterOperator, FilterableOptions, IIterablePatchStore, IObjectPatchStore, IterablePatchStoreOptions, ObjectPatchStoreOptions, Orientation, PaletteType, Path, PathValue, Position, ScrollDirection, SelectionMode, VirtualScrollOptions };
389
+ export { AnyPipe, ContainsPipe, FilterChangeEvent, IterablePatchStore, ObjectPatchStore, PreventableEvent, SlicePipe, TakeFirstPipe, buildNested, classInputToClass, createIterablePatchStore, createObjectPatchStore, deepEquals, deepMerge, getPercentage, isEmptyObject, isPlainObject, mergeInto, mergePatchInto, moveIndices, patchAt, prunePatch, setAt };
390
+ export type { ArrayStrategy, BaseChangeStrategy, ClassInputType, ColorMode, ColorOutputFormat, DataType, DeepMergeOptions, DeepPartial, FilterOperator, FilterableOptions, IIterablePatchStore, IObjectPatchStore, IterablePatchStoreOptions, ObjectPatchStoreOptions, Orientation, PaletteType, Path, PathValue, Position, ScrollDirection, SelectionMode, VirtualScrollOptions };