@nanahoshi/mona-ui 0.43.1 → 0.44.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,1028 @@
1
+ import { NgTemplateOutlet } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { Component, Directive, TemplateRef, booleanAttribute, computed, contentChild, inject, input, model } from "@angular/core";
4
+ import { LucideChevronDown } from "@lucide/angular";
5
+ import { CollapsibleContentDirective, CollapsibleDirective, CollapsibleTriggerDirective } from "@nanahoshi/mona-ui/collapsible";
6
+ import { MonaI18nService, formatGregorianDateToLocaleString } from "@nanahoshi/mona-ui/i18n";
7
+ import { themeRaisedBackdropClasses, toHeadingLevel } from "@nanahoshi/mona-ui/internal";
8
+ import { twMerge } from "tailwind-merge";
9
+ import { cva } from "class-variance-authority";
10
+ import { DateTime } from "luxon";
11
+ var TimelineBodyTemplateDirective = class TimelineBodyTemplateDirective {
12
+ constructor() {
13
+ this.monaTimelineBodyTemplateOf = input(null, ...ngDevMode ? [{ debugName: "monaTimelineBodyTemplateOf" }] : /* istanbul ignore next */ []);
14
+ }
15
+ static ngTemplateContextGuard(_directive, _context) {
16
+ return true;
17
+ }
18
+ static {
19
+ this.ɵfac = i0.ɵɵngDeclareFactory({
20
+ minVersion: "12.0.0",
21
+ version: "22.2.6",
22
+ ngImport: i0,
23
+ type: TimelineBodyTemplateDirective,
24
+ deps: [],
25
+ target: i0.ɵɵFactoryTarget.Directive
26
+ });
27
+ }
28
+ static {
29
+ this.ɵdir = i0.ɵɵngDeclareDirective({
30
+ minVersion: "17.1.0",
31
+ version: "22.2.6",
32
+ type: TimelineBodyTemplateDirective,
33
+ isStandalone: true,
34
+ selector: "ng-template[monaTimelineBodyTemplate]",
35
+ inputs: { monaTimelineBodyTemplateOf: {
36
+ classPropertyName: "monaTimelineBodyTemplateOf",
37
+ publicName: "monaTimelineBodyTemplateOf",
38
+ isSignal: true,
39
+ isRequired: false,
40
+ transformFunction: null
41
+ } },
42
+ ngImport: i0
43
+ });
44
+ }
45
+ };
46
+ i0.ɵɵngDeclareClassMetadata({
47
+ minVersion: "12.0.0",
48
+ version: "22.2.6",
49
+ ngImport: i0,
50
+ type: TimelineBodyTemplateDirective,
51
+ decorators: [{
52
+ type: Directive,
53
+ args: [{ selector: "ng-template[monaTimelineBodyTemplate]" }]
54
+ }],
55
+ propDecorators: { monaTimelineBodyTemplateOf: [{
56
+ type: i0.Input,
57
+ args: [{
58
+ isSignal: true,
59
+ alias: "monaTimelineBodyTemplateOf",
60
+ required: false
61
+ }]
62
+ }] }
63
+ });
64
+ var TimelineDateTemplateDirective = class TimelineDateTemplateDirective {
65
+ constructor() {
66
+ this.monaTimelineDateTemplateOf = input(null, ...ngDevMode ? [{ debugName: "monaTimelineDateTemplateOf" }] : /* istanbul ignore next */ []);
67
+ }
68
+ static ngTemplateContextGuard(_directive, _context) {
69
+ return true;
70
+ }
71
+ static {
72
+ this.ɵfac = i0.ɵɵngDeclareFactory({
73
+ minVersion: "12.0.0",
74
+ version: "22.2.6",
75
+ ngImport: i0,
76
+ type: TimelineDateTemplateDirective,
77
+ deps: [],
78
+ target: i0.ɵɵFactoryTarget.Directive
79
+ });
80
+ }
81
+ static {
82
+ this.ɵdir = i0.ɵɵngDeclareDirective({
83
+ minVersion: "17.1.0",
84
+ version: "22.2.6",
85
+ type: TimelineDateTemplateDirective,
86
+ isStandalone: true,
87
+ selector: "ng-template[monaTimelineDateTemplate]",
88
+ inputs: { monaTimelineDateTemplateOf: {
89
+ classPropertyName: "monaTimelineDateTemplateOf",
90
+ publicName: "monaTimelineDateTemplateOf",
91
+ isSignal: true,
92
+ isRequired: false,
93
+ transformFunction: null
94
+ } },
95
+ ngImport: i0
96
+ });
97
+ }
98
+ };
99
+ i0.ɵɵngDeclareClassMetadata({
100
+ minVersion: "12.0.0",
101
+ version: "22.2.6",
102
+ ngImport: i0,
103
+ type: TimelineDateTemplateDirective,
104
+ decorators: [{
105
+ type: Directive,
106
+ args: [{ selector: "ng-template[monaTimelineDateTemplate]" }]
107
+ }],
108
+ propDecorators: { monaTimelineDateTemplateOf: [{
109
+ type: i0.Input,
110
+ args: [{
111
+ isSignal: true,
112
+ alias: "monaTimelineDateTemplateOf",
113
+ required: false
114
+ }]
115
+ }] }
116
+ });
117
+ var TimelineHeaderTemplateDirective = class TimelineHeaderTemplateDirective {
118
+ constructor() {
119
+ this.monaTimelineHeaderTemplateOf = input(null, ...ngDevMode ? [{ debugName: "monaTimelineHeaderTemplateOf" }] : /* istanbul ignore next */ []);
120
+ }
121
+ static ngTemplateContextGuard(_directive, _context) {
122
+ return true;
123
+ }
124
+ static {
125
+ this.ɵfac = i0.ɵɵngDeclareFactory({
126
+ minVersion: "12.0.0",
127
+ version: "22.2.6",
128
+ ngImport: i0,
129
+ type: TimelineHeaderTemplateDirective,
130
+ deps: [],
131
+ target: i0.ɵɵFactoryTarget.Directive
132
+ });
133
+ }
134
+ static {
135
+ this.ɵdir = i0.ɵɵngDeclareDirective({
136
+ minVersion: "17.1.0",
137
+ version: "22.2.6",
138
+ type: TimelineHeaderTemplateDirective,
139
+ isStandalone: true,
140
+ selector: "ng-template[monaTimelineHeaderTemplate]",
141
+ inputs: { monaTimelineHeaderTemplateOf: {
142
+ classPropertyName: "monaTimelineHeaderTemplateOf",
143
+ publicName: "monaTimelineHeaderTemplateOf",
144
+ isSignal: true,
145
+ isRequired: false,
146
+ transformFunction: null
147
+ } },
148
+ ngImport: i0
149
+ });
150
+ }
151
+ };
152
+ i0.ɵɵngDeclareClassMetadata({
153
+ minVersion: "12.0.0",
154
+ version: "22.2.6",
155
+ ngImport: i0,
156
+ type: TimelineHeaderTemplateDirective,
157
+ decorators: [{
158
+ type: Directive,
159
+ args: [{ selector: "ng-template[monaTimelineHeaderTemplate]" }]
160
+ }],
161
+ propDecorators: { monaTimelineHeaderTemplateOf: [{
162
+ type: i0.Input,
163
+ args: [{
164
+ isSignal: true,
165
+ alias: "monaTimelineHeaderTemplateOf",
166
+ required: false
167
+ }]
168
+ }] }
169
+ });
170
+ var TimelineMarkerTemplateDirective = class TimelineMarkerTemplateDirective {
171
+ constructor() {
172
+ this.monaTimelineMarkerTemplateOf = input(null, ...ngDevMode ? [{ debugName: "monaTimelineMarkerTemplateOf" }] : /* istanbul ignore next */ []);
173
+ }
174
+ static ngTemplateContextGuard(_directive, _context) {
175
+ return true;
176
+ }
177
+ static {
178
+ this.ɵfac = i0.ɵɵngDeclareFactory({
179
+ minVersion: "12.0.0",
180
+ version: "22.2.6",
181
+ ngImport: i0,
182
+ type: TimelineMarkerTemplateDirective,
183
+ deps: [],
184
+ target: i0.ɵɵFactoryTarget.Directive
185
+ });
186
+ }
187
+ static {
188
+ this.ɵdir = i0.ɵɵngDeclareDirective({
189
+ minVersion: "17.1.0",
190
+ version: "22.2.6",
191
+ type: TimelineMarkerTemplateDirective,
192
+ isStandalone: true,
193
+ selector: "ng-template[monaTimelineMarkerTemplate]",
194
+ inputs: { monaTimelineMarkerTemplateOf: {
195
+ classPropertyName: "monaTimelineMarkerTemplateOf",
196
+ publicName: "monaTimelineMarkerTemplateOf",
197
+ isSignal: true,
198
+ isRequired: false,
199
+ transformFunction: null
200
+ } },
201
+ ngImport: i0
202
+ });
203
+ }
204
+ };
205
+ i0.ɵɵngDeclareClassMetadata({
206
+ minVersion: "12.0.0",
207
+ version: "22.2.6",
208
+ ngImport: i0,
209
+ type: TimelineMarkerTemplateDirective,
210
+ decorators: [{
211
+ type: Directive,
212
+ args: [{ selector: "ng-template[monaTimelineMarkerTemplate]" }]
213
+ }],
214
+ propDecorators: { monaTimelineMarkerTemplateOf: [{
215
+ type: i0.Input,
216
+ args: [{
217
+ isSignal: true,
218
+ alias: "monaTimelineMarkerTemplateOf",
219
+ required: false
220
+ }]
221
+ }] }
222
+ });
223
+ const timelineBaseThemeVariants = cva("block w-full min-w-0 [--mona-timeline-event-width:16rem]", {
224
+ variants: { container: {
225
+ true: "@container",
226
+ false: ""
227
+ } },
228
+ defaultVariants: { container: false }
229
+ });
230
+ const timelineListThemeVariants = cva("m-0 list-none p-0", {
231
+ variants: { horizontal: {
232
+ true: `
233
+ grid auto-cols-(--mona-timeline-event-width) grid-flow-col grid-rows-[auto_auto_auto]
234
+ overflow-x-auto overscroll-x-contain px-1 pt-1 pb-3
235
+ focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-indicator
236
+ `,
237
+ false: "flex flex-col"
238
+ } },
239
+ defaultVariants: { horizontal: false }
240
+ });
241
+ const timelineItemThemeVariants = cva("relative min-w-0", {
242
+ variants: { layout: {
243
+ vertical: "grid grid-cols-[2rem_minmax(0,1fr)] gap-x-3 [--mona-timeline-marker-center:0.5rem]",
244
+ alternate: `
245
+ grid grid-cols-[2rem_minmax(0,1fr)] gap-x-3 [--mona-timeline-marker-center:0.5rem]
246
+ @min-[32rem]:grid-cols-[minmax(0,1fr)_2rem_minmax(0,1fr)] @min-[32rem]:gap-x-4
247
+ @min-[32rem]:[--mona-timeline-marker-center:calc(1.375rem+1px)]
248
+ `,
249
+ horizontal: "row-span-3 grid grid-rows-subgrid"
250
+ } },
251
+ defaultVariants: { layout: "vertical" }
252
+ });
253
+ const timelineDateThemeVariants = cva("min-w-0 text-xs leading-4 font-medium text-muted-foreground", {
254
+ variants: {
255
+ layout: {
256
+ vertical: "col-start-2 row-start-1 pb-2",
257
+ alternate: `
258
+ col-start-2 row-start-1 pb-2
259
+ @min-[32rem]:pt-[calc(var(--mona-timeline-marker-center)-0.5rem)] @min-[32rem]:pb-0
260
+ `,
261
+ horizontal: "px-2 text-center"
262
+ },
263
+ flipped: {
264
+ true: "",
265
+ false: ""
266
+ }
267
+ },
268
+ compoundVariants: [
269
+ {
270
+ layout: "alternate",
271
+ flipped: false,
272
+ class: "@min-[32rem]:col-start-1 @min-[32rem]:text-end"
273
+ },
274
+ {
275
+ layout: "alternate",
276
+ flipped: true,
277
+ class: "@min-[32rem]:col-start-3"
278
+ },
279
+ {
280
+ layout: "horizontal",
281
+ flipped: false,
282
+ class: "row-start-1 self-end pb-2"
283
+ },
284
+ {
285
+ layout: "horizontal",
286
+ flipped: true,
287
+ class: "row-start-3 self-start pt-2"
288
+ }
289
+ ],
290
+ defaultVariants: {
291
+ layout: "vertical",
292
+ flipped: false
293
+ }
294
+ });
295
+ const timelineAxisThemeVariants = cva("relative flex justify-center", {
296
+ variants: { layout: {
297
+ vertical: "col-start-1 row-span-2 row-start-1",
298
+ alternate: "col-start-1 row-span-2 row-start-1 @min-[32rem]:col-start-2 @min-[32rem]:row-span-1",
299
+ horizontal: "row-start-2 items-center"
300
+ } },
301
+ defaultVariants: { layout: "vertical" }
302
+ });
303
+ const timelineLineThemeVariants = cva("pointer-events-none absolute border-border", {
304
+ variants: {
305
+ horizontal: {
306
+ true: "top-[calc(50%-1px)] border-t-2",
307
+ false: "start-[calc(50%-1px)] border-s-2"
308
+ },
309
+ first: {
310
+ true: "",
311
+ false: ""
312
+ },
313
+ last: {
314
+ true: "",
315
+ false: ""
316
+ }
317
+ },
318
+ compoundVariants: [
319
+ {
320
+ horizontal: false,
321
+ first: true,
322
+ class: "top-(--mona-timeline-marker-center)"
323
+ },
324
+ {
325
+ horizontal: false,
326
+ first: false,
327
+ class: "top-0"
328
+ },
329
+ {
330
+ horizontal: false,
331
+ last: true,
332
+ class: "bottom-[calc(100%-var(--mona-timeline-marker-center))]"
333
+ },
334
+ {
335
+ horizontal: false,
336
+ last: false,
337
+ class: "bottom-0"
338
+ },
339
+ {
340
+ horizontal: true,
341
+ first: true,
342
+ class: "start-1/2"
343
+ },
344
+ {
345
+ horizontal: true,
346
+ first: false,
347
+ class: "start-0"
348
+ },
349
+ {
350
+ horizontal: true,
351
+ last: true,
352
+ class: "end-1/2"
353
+ },
354
+ {
355
+ horizontal: true,
356
+ last: false,
357
+ class: "end-0"
358
+ }
359
+ ],
360
+ defaultVariants: {
361
+ horizontal: false,
362
+ first: false,
363
+ last: false
364
+ }
365
+ });
366
+ const timelineMarkerThemeVariants = cva("relative flex items-center justify-center", {
367
+ variants: { horizontal: {
368
+ true: "min-h-4",
369
+ false: "mt-[calc(var(--mona-timeline-marker-center)-0.5rem)] h-4"
370
+ } },
371
+ defaultVariants: { horizontal: false }
372
+ });
373
+ const TIMELINE_DOT_CLASSES = `
374
+ block size-3 rounded-full border-2 border-primary bg-primary
375
+ forced-color-adjust-none forced-colors:border-[CanvasText] forced-colors:bg-[CanvasText]
376
+ `;
377
+ const timelineContentThemeVariants = cva("min-w-0", {
378
+ variants: {
379
+ layout: {
380
+ vertical: "col-start-2 row-start-2",
381
+ alternate: "col-start-2 row-start-2 @min-[32rem]:row-start-1",
382
+ horizontal: "px-2"
383
+ },
384
+ flipped: {
385
+ true: "",
386
+ false: ""
387
+ },
388
+ last: {
389
+ true: "",
390
+ false: ""
391
+ }
392
+ },
393
+ compoundVariants: [
394
+ {
395
+ layout: ["alternate", "vertical"],
396
+ last: false,
397
+ class: "pb-6"
398
+ },
399
+ {
400
+ layout: "alternate",
401
+ flipped: false,
402
+ class: "@min-[32rem]:col-start-3"
403
+ },
404
+ {
405
+ layout: "alternate",
406
+ flipped: true,
407
+ class: "@min-[32rem]:col-start-1"
408
+ },
409
+ {
410
+ layout: "horizontal",
411
+ flipped: false,
412
+ class: "row-start-3 pt-3"
413
+ },
414
+ {
415
+ layout: "horizontal",
416
+ flipped: true,
417
+ class: "row-start-1 self-end pb-3"
418
+ }
419
+ ],
420
+ defaultVariants: {
421
+ layout: "vertical",
422
+ flipped: false,
423
+ last: false
424
+ }
425
+ });
426
+ const timelineCardThemeVariants = cva(`
427
+ min-w-0 rounded-lg border border-border
428
+ bg-card text-card-foreground shadow-(--shadow-raised)
429
+ ${themeRaisedBackdropClasses}
430
+ `, {
431
+ variants: { collapsible: {
432
+ true: "",
433
+ false: "flex flex-col gap-1 p-3"
434
+ } },
435
+ defaultVariants: { collapsible: false }
436
+ });
437
+ const TIMELINE_TRIGGER_CLASSES = `
438
+ flex w-full cursor-pointer items-start gap-2 rounded-[inherit] p-3 text-start
439
+ data-[state=open]:rounded-b-none
440
+ transition-colors duration-(--mona-motion-fast) motion-reduce:transition-none
441
+ hover:bg-hover active:bg-active
442
+ focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus-indicator
443
+ `;
444
+ const TIMELINE_HEADER_CLASSES = "flex min-w-0 flex-1 flex-col gap-0.5";
445
+ const TIMELINE_TITLE_CLASSES = "block text-sm leading-5 font-semibold text-card-foreground";
446
+ const TIMELINE_SUBTITLE_CLASSES = "block text-xs leading-4 text-muted-foreground";
447
+ const timelineChevronThemeVariants = cva(`
448
+ mt-0.5 size-4 shrink-0 text-muted-foreground
449
+ transition-transform duration-(--mona-motion-fast) motion-reduce:transition-none
450
+ `, {
451
+ variants: { expanded: {
452
+ true: "rotate-180",
453
+ false: ""
454
+ } },
455
+ defaultVariants: { expanded: false }
456
+ });
457
+ const TIMELINE_COLLAPSIBLE_BODY_CLASSES = "px-3 pb-3 text-sm text-muted-foreground";
458
+ const TIMELINE_BODY_CLASSES = "text-sm text-muted-foreground";
459
+ const TIME_OPTIONS = [
460
+ "dayPeriod",
461
+ "fractionalSecondDigits",
462
+ "hour",
463
+ "minute",
464
+ "second",
465
+ "timeStyle"
466
+ ];
467
+ function readTimelineDate(value) {
468
+ let date = null;
469
+ if (value instanceof Date) date = value;
470
+ else if (typeof value === "number") date = new Date(value);
471
+ else if (typeof value === "string" && value.trim().length > 0) {
472
+ const parsed = DateTime.fromISO(value.trim());
473
+ date = parsed.isValid ? parsed.toJSDate() : null;
474
+ }
475
+ return date != null && Number.isFinite(date.getTime()) ? date : null;
476
+ }
477
+ function showsTime(options) {
478
+ return TIME_OPTIONS.some((option) => options[option] != null);
479
+ }
480
+ function toDateTimeAttribute(date, withTime) {
481
+ const dateTime = DateTime.fromJSDate(date);
482
+ return (withTime ? dateTime.toISO({ suppressMilliseconds: true }) : dateTime.toISODate()) ?? "";
483
+ }
484
+ function readField(event, field) {
485
+ return field.length > 0 ? event[field] : void 0;
486
+ }
487
+ function readText(event, field) {
488
+ const value = readField(event, field);
489
+ return value == null ? "" : String(value);
490
+ }
491
+ var TimelineComponent = class TimelineComponent {
492
+ constructor() {
493
+ this.#entries = computed(() => {
494
+ const dateField = this.dateField();
495
+ const descriptionField = this.descriptionField();
496
+ const format = this.dateFormat();
497
+ const keyField = this.keyField();
498
+ const locale = this.#i18n.localeId();
499
+ const subtitleField = this.subtitleField();
500
+ const titleField = this.titleField();
501
+ const withTime = showsTime(format);
502
+ return Array.from(this.data(), (event) => {
503
+ const date = readTimelineDate(readField(event, dateField));
504
+ return {
505
+ date,
506
+ dateText: date == null ? "" : formatGregorianDateToLocaleString(date, locale, format),
507
+ dateTime: date == null ? null : toDateTimeAttribute(date, withTime),
508
+ description: readText(event, descriptionField),
509
+ event,
510
+ key: keyField ? readField(event, keyField) : event,
511
+ subtitle: readText(event, subtitleField),
512
+ title: readText(event, titleField)
513
+ };
514
+ });
515
+ }, ...ngDevMode ? [{ debugName: "#entries" }] : /* istanbul ignore next */ []);
516
+ this.#horizontal = computed(() => this.orientation() === "horizontal", ...ngDevMode ? [{ debugName: "#horizontal" }] : /* istanbul ignore next */ []);
517
+ this.#i18n = inject(MonaI18nService);
518
+ this.#layout = computed(() => {
519
+ if (this.#horizontal()) return "horizontal";
520
+ return this.alternate() ? "alternate" : "vertical";
521
+ }, ...ngDevMode ? [{ debugName: "#layout" }] : /* istanbul ignore next */ []);
522
+ this.baseClass = computed(() => twMerge(timelineBaseThemeVariants({ container: this.#layout() === "alternate" }), this.userClass()), ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
523
+ this.bodyClass = TIMELINE_BODY_CLASSES;
524
+ this.bodyTemplate = contentChild(TimelineBodyTemplateDirective, {
525
+ ...ngDevMode ? { debugName: "bodyTemplate" } : /* istanbul ignore next */ {},
526
+ read: TemplateRef
527
+ });
528
+ this.collapsibleBodyClass = TIMELINE_COLLAPSIBLE_BODY_CLASSES;
529
+ this.collapsibleCardClass = timelineCardThemeVariants({ collapsible: true });
530
+ this.dateTemplate = contentChild(TimelineDateTemplateDirective, {
531
+ ...ngDevMode ? { debugName: "dateTemplate" } : /* istanbul ignore next */ {},
532
+ read: TemplateRef
533
+ });
534
+ this.dotClass = TIMELINE_DOT_CLASSES;
535
+ this.headerClass = TIMELINE_HEADER_CLASSES;
536
+ this.headerTemplate = contentChild(TimelineHeaderTemplateDirective, {
537
+ ...ngDevMode ? { debugName: "headerTemplate" } : /* istanbul ignore next */ {},
538
+ read: TemplateRef
539
+ });
540
+ this.headingRole = computed(() => this.headingLevel() === null ? null : "heading", ...ngDevMode ? [{ debugName: "headingRole" }] : /* istanbul ignore next */ []);
541
+ this.items = computed(() => {
542
+ const collapsible = this.collapsible();
543
+ const entries = this.#entries();
544
+ const expandedKeys = new Set(this.expandedKeys());
545
+ const hasBodyTemplate = this.bodyTemplate() != null;
546
+ const horizontal = this.#horizontal();
547
+ const layout = this.#layout();
548
+ const alternate = this.alternate();
549
+ return entries.map((entry, index) => {
550
+ const first = index === 0;
551
+ const last = index === entries.length - 1;
552
+ const flipped = alternate && index % 2 === 1;
553
+ return {
554
+ ...entry,
555
+ classes: {
556
+ axis: timelineAxisThemeVariants({ layout }),
557
+ content: timelineContentThemeVariants({
558
+ flipped,
559
+ last,
560
+ layout
561
+ }),
562
+ date: timelineDateThemeVariants({
563
+ flipped,
564
+ layout
565
+ }),
566
+ item: timelineItemThemeVariants({ layout }),
567
+ line: first && last ? "" : timelineLineThemeVariants({
568
+ first,
569
+ horizontal,
570
+ last
571
+ })
572
+ },
573
+ context: {
574
+ $implicit: entry.event,
575
+ date: entry.date,
576
+ expanded: !collapsible || expandedKeys.has(entry.key),
577
+ index
578
+ },
579
+ hasDetails: hasBodyTemplate || entry.description.length > 0
580
+ };
581
+ });
582
+ }, ...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
583
+ this.listClass = computed(() => timelineListThemeVariants({ horizontal: this.#horizontal() }), ...ngDevMode ? [{ debugName: "listClass" }] : /* istanbul ignore next */ []);
584
+ this.listTabIndex = computed(() => this.#horizontal() ? 0 : null, ...ngDevMode ? [{ debugName: "listTabIndex" }] : /* istanbul ignore next */ []);
585
+ this.markerClass = computed(() => timelineMarkerThemeVariants({ horizontal: this.#horizontal() }), ...ngDevMode ? [{ debugName: "markerClass" }] : /* istanbul ignore next */ []);
586
+ this.markerTemplate = contentChild(TimelineMarkerTemplateDirective, {
587
+ ...ngDevMode ? { debugName: "markerTemplate" } : /* istanbul ignore next */ {},
588
+ read: TemplateRef
589
+ });
590
+ this.staticCardClass = timelineCardThemeVariants({ collapsible: false });
591
+ this.subtitleClass = TIMELINE_SUBTITLE_CLASSES;
592
+ this.titleClass = TIMELINE_TITLE_CLASSES;
593
+ this.triggerClass = TIMELINE_TRIGGER_CLASSES;
594
+ this.alternate = input(false, {
595
+ ...ngDevMode ? { debugName: "alternate" } : /* istanbul ignore next */ {},
596
+ transform: booleanAttribute
597
+ });
598
+ this.ariaLabel = input("", {
599
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
600
+ alias: "aria-label"
601
+ });
602
+ this.ariaLabelledBy = input("", {
603
+ ...ngDevMode ? { debugName: "ariaLabelledBy" } : /* istanbul ignore next */ {},
604
+ alias: "aria-labelledby"
605
+ });
606
+ this.collapsible = input(false, {
607
+ ...ngDevMode ? { debugName: "collapsible" } : /* istanbul ignore next */ {},
608
+ transform: booleanAttribute
609
+ });
610
+ this.data = input.required(...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
611
+ this.dateField = input("date", ...ngDevMode ? [{ debugName: "dateField" }] : /* istanbul ignore next */ []);
612
+ this.dateFormat = input({ dateStyle: "medium" }, ...ngDevMode ? [{ debugName: "dateFormat" }] : /* istanbul ignore next */ []);
613
+ this.descriptionField = input("description", ...ngDevMode ? [{ debugName: "descriptionField" }] : /* istanbul ignore next */ []);
614
+ this.expandedKeys = model([], ...ngDevMode ? [{ debugName: "expandedKeys" }] : /* istanbul ignore next */ []);
615
+ this.headingLevel = input(3, {
616
+ ...ngDevMode ? { debugName: "headingLevel" } : /* istanbul ignore next */ {},
617
+ transform: toHeadingLevel
618
+ });
619
+ this.keyField = input("", ...ngDevMode ? [{ debugName: "keyField" }] : /* istanbul ignore next */ []);
620
+ this.orientation = input("vertical", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
621
+ this.subtitleField = input("subtitle", ...ngDevMode ? [{ debugName: "subtitleField" }] : /* istanbul ignore next */ []);
622
+ this.titleField = input("title", ...ngDevMode ? [{ debugName: "titleField" }] : /* istanbul ignore next */ []);
623
+ this.userClass = input("", {
624
+ ...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
625
+ alias: "class"
626
+ });
627
+ }
628
+ #entries;
629
+ #horizontal;
630
+ #i18n;
631
+ #layout;
632
+ chevronClass(expanded) {
633
+ return timelineChevronThemeVariants({ expanded });
634
+ }
635
+ onExpandedChange(item, expanded) {
636
+ const keys = this.expandedKeys().filter((key) => key !== item.key);
637
+ this.expandedKeys.set(expanded ? [...keys, item.key] : keys);
638
+ }
639
+ static {
640
+ this.ɵfac = i0.ɵɵngDeclareFactory({
641
+ minVersion: "12.0.0",
642
+ version: "22.2.6",
643
+ ngImport: i0,
644
+ type: TimelineComponent,
645
+ deps: [],
646
+ target: i0.ɵɵFactoryTarget.Component
647
+ });
648
+ }
649
+ static {
650
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
651
+ minVersion: "17.0.0",
652
+ version: "22.2.6",
653
+ type: TimelineComponent,
654
+ isStandalone: true,
655
+ selector: "mona-timeline",
656
+ inputs: {
657
+ alternate: {
658
+ classPropertyName: "alternate",
659
+ publicName: "alternate",
660
+ isSignal: true,
661
+ isRequired: false,
662
+ transformFunction: null
663
+ },
664
+ ariaLabel: {
665
+ classPropertyName: "ariaLabel",
666
+ publicName: "aria-label",
667
+ isSignal: true,
668
+ isRequired: false,
669
+ transformFunction: null
670
+ },
671
+ ariaLabelledBy: {
672
+ classPropertyName: "ariaLabelledBy",
673
+ publicName: "aria-labelledby",
674
+ isSignal: true,
675
+ isRequired: false,
676
+ transformFunction: null
677
+ },
678
+ collapsible: {
679
+ classPropertyName: "collapsible",
680
+ publicName: "collapsible",
681
+ isSignal: true,
682
+ isRequired: false,
683
+ transformFunction: null
684
+ },
685
+ data: {
686
+ classPropertyName: "data",
687
+ publicName: "data",
688
+ isSignal: true,
689
+ isRequired: true,
690
+ transformFunction: null
691
+ },
692
+ dateField: {
693
+ classPropertyName: "dateField",
694
+ publicName: "dateField",
695
+ isSignal: true,
696
+ isRequired: false,
697
+ transformFunction: null
698
+ },
699
+ dateFormat: {
700
+ classPropertyName: "dateFormat",
701
+ publicName: "dateFormat",
702
+ isSignal: true,
703
+ isRequired: false,
704
+ transformFunction: null
705
+ },
706
+ descriptionField: {
707
+ classPropertyName: "descriptionField",
708
+ publicName: "descriptionField",
709
+ isSignal: true,
710
+ isRequired: false,
711
+ transformFunction: null
712
+ },
713
+ expandedKeys: {
714
+ classPropertyName: "expandedKeys",
715
+ publicName: "expandedKeys",
716
+ isSignal: true,
717
+ isRequired: false,
718
+ transformFunction: null
719
+ },
720
+ headingLevel: {
721
+ classPropertyName: "headingLevel",
722
+ publicName: "headingLevel",
723
+ isSignal: true,
724
+ isRequired: false,
725
+ transformFunction: null
726
+ },
727
+ keyField: {
728
+ classPropertyName: "keyField",
729
+ publicName: "keyField",
730
+ isSignal: true,
731
+ isRequired: false,
732
+ transformFunction: null
733
+ },
734
+ orientation: {
735
+ classPropertyName: "orientation",
736
+ publicName: "orientation",
737
+ isSignal: true,
738
+ isRequired: false,
739
+ transformFunction: null
740
+ },
741
+ subtitleField: {
742
+ classPropertyName: "subtitleField",
743
+ publicName: "subtitleField",
744
+ isSignal: true,
745
+ isRequired: false,
746
+ transformFunction: null
747
+ },
748
+ titleField: {
749
+ classPropertyName: "titleField",
750
+ publicName: "titleField",
751
+ isSignal: true,
752
+ isRequired: false,
753
+ transformFunction: null
754
+ },
755
+ userClass: {
756
+ classPropertyName: "userClass",
757
+ publicName: "class",
758
+ isSignal: true,
759
+ isRequired: false,
760
+ transformFunction: null
761
+ }
762
+ },
763
+ outputs: { expandedKeys: "expandedKeysChange" },
764
+ host: { properties: {
765
+ "attr.aria-label": "null",
766
+ "attr.aria-labelledby": "null",
767
+ "class": "baseClass()"
768
+ } },
769
+ queries: [
770
+ {
771
+ propertyName: "bodyTemplate",
772
+ first: true,
773
+ predicate: TimelineBodyTemplateDirective,
774
+ descendants: true,
775
+ read: TemplateRef,
776
+ isSignal: true
777
+ },
778
+ {
779
+ propertyName: "dateTemplate",
780
+ first: true,
781
+ predicate: TimelineDateTemplateDirective,
782
+ descendants: true,
783
+ read: TemplateRef,
784
+ isSignal: true
785
+ },
786
+ {
787
+ propertyName: "headerTemplate",
788
+ first: true,
789
+ predicate: TimelineHeaderTemplateDirective,
790
+ descendants: true,
791
+ read: TemplateRef,
792
+ isSignal: true
793
+ },
794
+ {
795
+ propertyName: "markerTemplate",
796
+ first: true,
797
+ predicate: TimelineMarkerTemplateDirective,
798
+ descendants: true,
799
+ read: TemplateRef,
800
+ isSignal: true
801
+ }
802
+ ],
803
+ ngImport: i0,
804
+ template: "<ol\n [class]=\"listClass()\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.tabindex]=\"listTabIndex()\">\n @for (item of items(); track item.key) {\n <!-- The date comes first, so assistive technology reads it before the card, wherever the layout puts it. -->\n <li [class]=\"item.classes.item\">\n <div [class]=\"item.classes.date\">\n @if (dateTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"item.context\" />\n } @else if (item.dateTime) {\n <time [attr.datetime]=\"item.dateTime\">{{ item.dateText }}</time>\n }\n </div>\n <div [class]=\"item.classes.axis\">\n @if (item.classes.line) {\n <span [class]=\"item.classes.line\"></span>\n }\n <span [class]=\"markerClass()\">\n @if (markerTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"item.context\" />\n } @else {\n <span [class]=\"dotClass\"></span>\n }\n </span>\n </div>\n <div [class]=\"item.classes.content\">\n @if (collapsible() && item.hasDetails) {\n <div\n monaCollapsible\n [class]=\"collapsibleCardClass\"\n [expanded]=\"item.context.expanded\"\n (expandedChange)=\"onExpandedChange(item, $event)\">\n <div [attr.role]=\"headingRole()\" [attr.aria-level]=\"headingLevel()\">\n <button monaCollapsibleTrigger [class]=\"triggerClass\">\n <span [class]=\"headerClass\">\n <ng-container\n [ngTemplateOutlet]=\"header\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </span>\n <svg\n lucideChevronDown\n aria-hidden=\"true\"\n [class]=\"chevronClass(item.context.expanded)\"></svg>\n </button>\n </div>\n <div monaCollapsibleContent [class]=\"collapsibleBodyClass\">\n <ng-container [ngTemplateOutlet]=\"body\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </div>\n </div>\n } @else {\n <div [class]=\"staticCardClass\">\n @if (headerTemplate(); as template) {\n <div [class]=\"headerClass\" [attr.role]=\"headingRole()\" [attr.aria-level]=\"headingLevel()\">\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"item.context\" />\n </div>\n } @else if (item.title || item.subtitle) {\n <div [class]=\"headerClass\">\n @if (item.title) {\n <div\n [class]=\"titleClass\"\n [attr.role]=\"headingRole()\"\n [attr.aria-level]=\"headingLevel()\">\n {{ item.title }}\n </div>\n }\n @if (item.subtitle) {\n <div [class]=\"subtitleClass\">{{ item.subtitle }}</div>\n }\n </div>\n }\n @if (item.hasDetails) {\n <div [class]=\"bodyClass\">\n <ng-container\n [ngTemplateOutlet]=\"body\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </div>\n }\n </div>\n }\n </div>\n </li>\n }\n</ol>\n\n<!-- In the button that opens the details, so the default header is spans. -->\n<ng-template #header let-item>\n @if (headerTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"item.context\" />\n } @else {\n @if (item.title) {\n <span [class]=\"titleClass\">{{ item.title }}</span>\n }\n @if (item.subtitle) {\n <span [class]=\"subtitleClass\">{{ item.subtitle }}</span>\n }\n }\n</ng-template>\n\n<ng-template #body let-item>\n @if (bodyTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"item.context\" />\n } @else {\n <p class=\"m-0 whitespace-pre-line\">{{ item.description }}</p>\n }\n</ng-template>\n",
805
+ dependencies: [
806
+ {
807
+ kind: "directive",
808
+ type: NgTemplateOutlet,
809
+ selector: "[ngTemplateOutlet]",
810
+ inputs: [
811
+ "ngTemplateOutletContext",
812
+ "ngTemplateOutlet",
813
+ "ngTemplateOutletInjector"
814
+ ]
815
+ },
816
+ {
817
+ kind: "directive",
818
+ type: CollapsibleContentDirective,
819
+ selector: "[monaCollapsibleContent]",
820
+ inputs: ["id"]
821
+ },
822
+ {
823
+ kind: "directive",
824
+ type: CollapsibleDirective,
825
+ selector: "[monaCollapsible]",
826
+ inputs: [
827
+ "animate",
828
+ "disabled",
829
+ "expanded"
830
+ ],
831
+ outputs: ["expandedChange"],
832
+ exportAs: ["monaCollapsible"]
833
+ },
834
+ {
835
+ kind: "directive",
836
+ type: CollapsibleTriggerDirective,
837
+ selector: "[monaCollapsibleTrigger]"
838
+ },
839
+ {
840
+ kind: "component",
841
+ type: LucideChevronDown,
842
+ selector: "svg[lucideChevronDown]"
843
+ }
844
+ ]
845
+ });
846
+ }
847
+ };
848
+ i0.ɵɵngDeclareClassMetadata({
849
+ minVersion: "12.0.0",
850
+ version: "22.2.6",
851
+ ngImport: i0,
852
+ type: TimelineComponent,
853
+ decorators: [{
854
+ type: Component,
855
+ args: [{
856
+ selector: "mona-timeline",
857
+ imports: [
858
+ NgTemplateOutlet,
859
+ CollapsibleContentDirective,
860
+ CollapsibleDirective,
861
+ CollapsibleTriggerDirective,
862
+ LucideChevronDown
863
+ ],
864
+ host: {
865
+ "[attr.aria-label]": "null",
866
+ "[attr.aria-labelledby]": "null",
867
+ "[class]": "baseClass()"
868
+ },
869
+ template: "<ol\n [class]=\"listClass()\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.tabindex]=\"listTabIndex()\">\n @for (item of items(); track item.key) {\n <!-- The date comes first, so assistive technology reads it before the card, wherever the layout puts it. -->\n <li [class]=\"item.classes.item\">\n <div [class]=\"item.classes.date\">\n @if (dateTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"item.context\" />\n } @else if (item.dateTime) {\n <time [attr.datetime]=\"item.dateTime\">{{ item.dateText }}</time>\n }\n </div>\n <div [class]=\"item.classes.axis\">\n @if (item.classes.line) {\n <span [class]=\"item.classes.line\"></span>\n }\n <span [class]=\"markerClass()\">\n @if (markerTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"item.context\" />\n } @else {\n <span [class]=\"dotClass\"></span>\n }\n </span>\n </div>\n <div [class]=\"item.classes.content\">\n @if (collapsible() && item.hasDetails) {\n <div\n monaCollapsible\n [class]=\"collapsibleCardClass\"\n [expanded]=\"item.context.expanded\"\n (expandedChange)=\"onExpandedChange(item, $event)\">\n <div [attr.role]=\"headingRole()\" [attr.aria-level]=\"headingLevel()\">\n <button monaCollapsibleTrigger [class]=\"triggerClass\">\n <span [class]=\"headerClass\">\n <ng-container\n [ngTemplateOutlet]=\"header\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </span>\n <svg\n lucideChevronDown\n aria-hidden=\"true\"\n [class]=\"chevronClass(item.context.expanded)\"></svg>\n </button>\n </div>\n <div monaCollapsibleContent [class]=\"collapsibleBodyClass\">\n <ng-container [ngTemplateOutlet]=\"body\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </div>\n </div>\n } @else {\n <div [class]=\"staticCardClass\">\n @if (headerTemplate(); as template) {\n <div [class]=\"headerClass\" [attr.role]=\"headingRole()\" [attr.aria-level]=\"headingLevel()\">\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"item.context\" />\n </div>\n } @else if (item.title || item.subtitle) {\n <div [class]=\"headerClass\">\n @if (item.title) {\n <div\n [class]=\"titleClass\"\n [attr.role]=\"headingRole()\"\n [attr.aria-level]=\"headingLevel()\">\n {{ item.title }}\n </div>\n }\n @if (item.subtitle) {\n <div [class]=\"subtitleClass\">{{ item.subtitle }}</div>\n }\n </div>\n }\n @if (item.hasDetails) {\n <div [class]=\"bodyClass\">\n <ng-container\n [ngTemplateOutlet]=\"body\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </div>\n }\n </div>\n }\n </div>\n </li>\n }\n</ol>\n\n<!-- In the button that opens the details, so the default header is spans. -->\n<ng-template #header let-item>\n @if (headerTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"item.context\" />\n } @else {\n @if (item.title) {\n <span [class]=\"titleClass\">{{ item.title }}</span>\n }\n @if (item.subtitle) {\n <span [class]=\"subtitleClass\">{{ item.subtitle }}</span>\n }\n }\n</ng-template>\n\n<ng-template #body let-item>\n @if (bodyTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"item.context\" />\n } @else {\n <p class=\"m-0 whitespace-pre-line\">{{ item.description }}</p>\n }\n</ng-template>\n"
870
+ }]
871
+ }],
872
+ propDecorators: {
873
+ bodyTemplate: [{
874
+ type: i0.ContentChild,
875
+ args: [i0.forwardRef(() => TimelineBodyTemplateDirective), {
876
+ read: TemplateRef,
877
+ isSignal: true
878
+ }]
879
+ }],
880
+ dateTemplate: [{
881
+ type: i0.ContentChild,
882
+ args: [i0.forwardRef(() => TimelineDateTemplateDirective), {
883
+ read: TemplateRef,
884
+ isSignal: true
885
+ }]
886
+ }],
887
+ headerTemplate: [{
888
+ type: i0.ContentChild,
889
+ args: [i0.forwardRef(() => TimelineHeaderTemplateDirective), {
890
+ read: TemplateRef,
891
+ isSignal: true
892
+ }]
893
+ }],
894
+ markerTemplate: [{
895
+ type: i0.ContentChild,
896
+ args: [i0.forwardRef(() => TimelineMarkerTemplateDirective), {
897
+ read: TemplateRef,
898
+ isSignal: true
899
+ }]
900
+ }],
901
+ alternate: [{
902
+ type: i0.Input,
903
+ args: [{
904
+ isSignal: true,
905
+ alias: "alternate",
906
+ required: false
907
+ }]
908
+ }],
909
+ ariaLabel: [{
910
+ type: i0.Input,
911
+ args: [{
912
+ isSignal: true,
913
+ alias: "aria-label",
914
+ required: false
915
+ }]
916
+ }],
917
+ ariaLabelledBy: [{
918
+ type: i0.Input,
919
+ args: [{
920
+ isSignal: true,
921
+ alias: "aria-labelledby",
922
+ required: false
923
+ }]
924
+ }],
925
+ collapsible: [{
926
+ type: i0.Input,
927
+ args: [{
928
+ isSignal: true,
929
+ alias: "collapsible",
930
+ required: false
931
+ }]
932
+ }],
933
+ data: [{
934
+ type: i0.Input,
935
+ args: [{
936
+ isSignal: true,
937
+ alias: "data",
938
+ required: true
939
+ }]
940
+ }],
941
+ dateField: [{
942
+ type: i0.Input,
943
+ args: [{
944
+ isSignal: true,
945
+ alias: "dateField",
946
+ required: false
947
+ }]
948
+ }],
949
+ dateFormat: [{
950
+ type: i0.Input,
951
+ args: [{
952
+ isSignal: true,
953
+ alias: "dateFormat",
954
+ required: false
955
+ }]
956
+ }],
957
+ descriptionField: [{
958
+ type: i0.Input,
959
+ args: [{
960
+ isSignal: true,
961
+ alias: "descriptionField",
962
+ required: false
963
+ }]
964
+ }],
965
+ expandedKeys: [{
966
+ type: i0.Input,
967
+ args: [{
968
+ isSignal: true,
969
+ alias: "expandedKeys",
970
+ required: false
971
+ }]
972
+ }, {
973
+ type: i0.Output,
974
+ args: ["expandedKeysChange"]
975
+ }],
976
+ headingLevel: [{
977
+ type: i0.Input,
978
+ args: [{
979
+ isSignal: true,
980
+ alias: "headingLevel",
981
+ required: false
982
+ }]
983
+ }],
984
+ keyField: [{
985
+ type: i0.Input,
986
+ args: [{
987
+ isSignal: true,
988
+ alias: "keyField",
989
+ required: false
990
+ }]
991
+ }],
992
+ orientation: [{
993
+ type: i0.Input,
994
+ args: [{
995
+ isSignal: true,
996
+ alias: "orientation",
997
+ required: false
998
+ }]
999
+ }],
1000
+ subtitleField: [{
1001
+ type: i0.Input,
1002
+ args: [{
1003
+ isSignal: true,
1004
+ alias: "subtitleField",
1005
+ required: false
1006
+ }]
1007
+ }],
1008
+ titleField: [{
1009
+ type: i0.Input,
1010
+ args: [{
1011
+ isSignal: true,
1012
+ alias: "titleField",
1013
+ required: false
1014
+ }]
1015
+ }],
1016
+ userClass: [{
1017
+ type: i0.Input,
1018
+ args: [{
1019
+ isSignal: true,
1020
+ alias: "class",
1021
+ required: false
1022
+ }]
1023
+ }]
1024
+ }
1025
+ });
1026
+ export { TimelineBodyTemplateDirective, TimelineComponent, TimelineDateTemplateDirective, TimelineHeaderTemplateDirective, TimelineMarkerTemplateDirective };
1027
+
1028
+ //# sourceMappingURL=nanahoshi-mona-ui-timeline.mjs.map