mn-angular-lib 1.0.178 → 1.0.179
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/fesm2022/mn-angular-lib-alert.mjs +535 -0
- package/fesm2022/mn-angular-lib-alert.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs +356 -0
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-button.mjs +382 -0
- package/fesm2022/mn-angular-lib-button.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-calendar-core.mjs +377 -0
- package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-calendar.mjs +1513 -0
- package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-collection.mjs +2277 -0
- package/fesm2022/mn-angular-lib-collection.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-core.mjs +1232 -0
- package/fesm2022/mn-angular-lib-core.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-display.mjs +728 -0
- package/fesm2022/mn-angular-lib-display.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-forms.mjs +4260 -0
- package/fesm2022/mn-angular-lib-forms.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-keyboard.mjs +195 -0
- package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-modal-core.mjs +945 -0
- package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-modal-ui.mjs +2016 -0
- package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-modal.mjs +126 -0
- package/fesm2022/mn-angular-lib-modal.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs +275 -0
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-segmented.mjs +246 -0
- package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-tab.mjs +573 -0
- package/fesm2022/mn-angular-lib-tab.mjs.map +1 -0
- package/fesm2022/mn-angular-lib.mjs +21 -15517
- package/fesm2022/mn-angular-lib.mjs.map +1 -1
- package/package.json +66 -1
- package/src/lib/styles/index.css +2 -2
- package/types/mn-angular-lib-alert.d.ts +258 -0
- package/types/mn-angular-lib-bottom-sheet.d.ts +173 -0
- package/types/mn-angular-lib-button.d.ts +318 -0
- package/types/mn-angular-lib-calendar-core.d.ts +378 -0
- package/types/mn-angular-lib-calendar.d.ts +636 -0
- package/types/mn-angular-lib-collection.d.ts +1550 -0
- package/types/mn-angular-lib-core.d.ts +756 -0
- package/types/mn-angular-lib-display.d.ts +1075 -0
- package/types/mn-angular-lib-forms.d.ts +3235 -0
- package/types/mn-angular-lib-keyboard.d.ts +128 -0
- package/types/mn-angular-lib-modal-core.d.ts +1130 -0
- package/types/mn-angular-lib-modal-ui.d.ts +492 -0
- package/types/mn-angular-lib-modal.d.ts +27 -0
- package/types/mn-angular-lib-rich-text-editor.d.ts +157 -0
- package/types/mn-angular-lib-segmented.d.ts +395 -0
- package/types/mn-angular-lib-tab.d.ts +313 -0
- package/types/mn-angular-lib.d.ts +16 -10822
- /package/{src/lib/features → alert/src}/mn-alert/mn-alert-outlet/mn-alert-outlet.css +0 -0
- /package/{src/lib/features → bottom-sheet/src}/mn-bottom-sheet/mn-bottom-sheet.component.css +0 -0
- /package/{src/lib/features → button/src}/mn-skeleton/mn-skeleton.css +0 -0
- /package/{src/lib/features → collection/src}/mn-list/mn-list.component.css +0 -0
- /package/{src/lib/features → forms/src}/mn-checkbox/mn-checkbox.css +0 -0
- /package/{src/lib/features → forms/src}/mn-dropdown/mn-dropdown.css +0 -0
- /package/{src/lib/features → forms/src}/mn-multi-select/mn-multi-select.css +0 -0
- /package/{src/lib/features → keyboard/src}/mn-keyboard/mn-keyboard.component.css +0 -0
- /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-confirmation-body/mn-confirmation-body.component.css +0 -0
- /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-form-body/mn-form-body.component.css +0 -0
- /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-modal-shell/mn-modal-shell.component.css +0 -0
- /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-wizard-body/mn-wizard-body.component.css +0 -0
- /package/{src/lib/features → rich-text-editor/src}/mn-rich-text-editor/mn-rich-text-editor.component.css +0 -0
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { HostBinding, Input, Component, inject, EventEmitter, Output, ElementRef, Directive, InjectionToken } from '@angular/core';
|
|
3
|
+
import { MnTranslatePipe, MnLanguageService, lucideIcons, provideMnComponentConfig } from 'mn-angular-lib/core';
|
|
4
|
+
import { tv } from 'tailwind-variants';
|
|
5
|
+
import { LucideDynamicIcon } from '@lucide/angular';
|
|
6
|
+
import * as lucide from 'lucide';
|
|
7
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
8
|
+
import { NgClass, NgOptimizedImage } from '@angular/common';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Styling for {@link MnIconChip}: one 10% wash of the colour behind an icon drawn in
|
|
12
|
+
* the consumer's `--color-<colour>-text` token when it defines one (the shade it uses
|
|
13
|
+
* for readable coloured text on a tinted ground) and in the base colour otherwise, the
|
|
14
|
+
* same device `mnBadge` uses. The radius grows with the box so the corner reads the
|
|
15
|
+
* same at every size.
|
|
16
|
+
*/
|
|
17
|
+
const mnIconChipVariants = tv({
|
|
18
|
+
base: 'inline-flex shrink-0 items-center justify-center',
|
|
19
|
+
variants: {
|
|
20
|
+
/**
|
|
21
|
+
* `xs` for compact rows and inline labels, `sm` for list rows, `md` for section-card headers
|
|
22
|
+
* and stat tiles, `lg` for page headers, `xl` for a lone hero or empty-state icon.
|
|
23
|
+
*/
|
|
24
|
+
size: {
|
|
25
|
+
xs: 'h-8 w-8 rounded-lg',
|
|
26
|
+
sm: 'h-9 w-9 rounded-lg',
|
|
27
|
+
md: 'h-10 w-10 rounded-xl',
|
|
28
|
+
lg: 'h-12 w-12 rounded-2xl',
|
|
29
|
+
xl: 'h-14 w-14 rounded-2xl',
|
|
30
|
+
},
|
|
31
|
+
color: {
|
|
32
|
+
primary: 'bg-primary/10 text-(--color-primary-text,var(--color-primary))',
|
|
33
|
+
secondary: 'bg-secondary/10 text-(--color-secondary-text,var(--color-secondary))',
|
|
34
|
+
accent: 'bg-accent/10 text-(--color-accent-text,var(--color-accent))',
|
|
35
|
+
success: 'bg-success/10 text-(--color-success-text,var(--color-success))',
|
|
36
|
+
warning: 'bg-warning/10 text-(--color-warning-text,var(--color-warning))',
|
|
37
|
+
danger: 'bg-error/10 text-(--color-error-text,var(--color-error))',
|
|
38
|
+
gray: 'bg-base-content/10 text-base-content/70',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
size: 'md',
|
|
43
|
+
color: 'primary',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The tinted square that carries an icon in front of a card title, a stat or a list
|
|
49
|
+
* row: the one place a colour says "what kind of thing this is". Project the icon as
|
|
50
|
+
* content; the chip sizes and tints itself and never grows with the row.
|
|
51
|
+
*
|
|
52
|
+
* Decorative for assistive technology: the title or label beside it carries the
|
|
53
|
+
* meaning, so the chip is `aria-hidden` and a screen reader never meets a bare icon.
|
|
54
|
+
*
|
|
55
|
+
* ```html
|
|
56
|
+
* <mn-icon-chip [data]="{ color: 'success', size: 'md' }">
|
|
57
|
+
* <svg lucideCheck [size]="20"></svg>
|
|
58
|
+
* </mn-icon-chip>
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
class MnIconChip {
|
|
62
|
+
/** Size and colour; see {@link MnIconChipTypes}. */
|
|
63
|
+
data = {};
|
|
64
|
+
/** The chip's own classes; the consumer's static classes merge with them. */
|
|
65
|
+
get hostClasses() {
|
|
66
|
+
return mnIconChipVariants({
|
|
67
|
+
size: this.data.size,
|
|
68
|
+
color: this.data.color,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnIconChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: MnIconChip, isStandalone: true, selector: "mn-icon-chip", inputs: { data: "data" }, host: { attributes: { "aria-hidden": "true" }, properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<ng-content></ng-content>\n" });
|
|
73
|
+
}
|
|
74
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnIconChip, decorators: [{
|
|
75
|
+
type: Component,
|
|
76
|
+
args: [{ selector: 'mn-icon-chip', standalone: true, host: { 'aria-hidden': 'true' }, template: "<ng-content></ng-content>\n" }]
|
|
77
|
+
}], propDecorators: { data: [{
|
|
78
|
+
type: Input
|
|
79
|
+
}], hostClasses: [{
|
|
80
|
+
type: HostBinding,
|
|
81
|
+
args: ['class']
|
|
82
|
+
}] } });
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Styling for {@link MnCard}, as tailwind-variants slots: `root` is the card element
|
|
86
|
+
* itself, `accent` the optional bar along its top edge, `header` the heading row and
|
|
87
|
+
* `title` the `h2` inside it.
|
|
88
|
+
*
|
|
89
|
+
* Theme tokens only, so the card holds up in light and dark. The surface reads the
|
|
90
|
+
* consumer's `--color-base-card` when it defines one (a card ground a step off the
|
|
91
|
+
* page background) and falls back to `base-100` otherwise, the same fallback device
|
|
92
|
+
* `mnBadge` uses for its `-text` tokens.
|
|
93
|
+
*/
|
|
94
|
+
const mnCardVariants = tv({
|
|
95
|
+
slots: {
|
|
96
|
+
root: 'relative flex overflow-hidden border border-base-300 ' +
|
|
97
|
+
'bg-(--color-base-card,var(--color-base-100)) transition-all duration-200 motion-reduce:transition-none',
|
|
98
|
+
accent: 'absolute inset-x-0 top-0 h-1',
|
|
99
|
+
header: 'flex flex-wrap items-center gap-3',
|
|
100
|
+
title: 'text-lg font-semibold text-base-content',
|
|
101
|
+
},
|
|
102
|
+
variants: {
|
|
103
|
+
/**
|
|
104
|
+
* Inner padding, and with it the gap between the card's children: a tile needs
|
|
105
|
+
* less air than a section card, and a section card that had to say `gap-4` on
|
|
106
|
+
* every use would drift.
|
|
107
|
+
*/
|
|
108
|
+
padding: {
|
|
109
|
+
sm: { root: 'p-4 gap-3' },
|
|
110
|
+
md: { root: 'p-5 gap-4' },
|
|
111
|
+
lg: { root: 'p-6 gap-5' },
|
|
112
|
+
},
|
|
113
|
+
/** How the children flow: stacked (the default) or on one line, centred. */
|
|
114
|
+
layout: {
|
|
115
|
+
column: { root: 'flex-col' },
|
|
116
|
+
row: { root: 'flex-row items-center' },
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* Hover response. `shadow` is a little depth for a card that only sits there;
|
|
120
|
+
* `lift` promises a destination and belongs on a card that is a link.
|
|
121
|
+
*/
|
|
122
|
+
hover: {
|
|
123
|
+
none: {},
|
|
124
|
+
shadow: { root: 'hover:shadow-md' },
|
|
125
|
+
lift: { root: 'hover:-translate-y-1 hover:shadow-lg' },
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* Entrance. `rise` plays the consumer's `--animate-rise` keyframes when its theme
|
|
129
|
+
* defines them (a short rise-in, delayed per card through
|
|
130
|
+
* {@link MnCard.enterDelayMs}) and is a no-op otherwise; reduced-motion users
|
|
131
|
+
* never see it.
|
|
132
|
+
*/
|
|
133
|
+
enter: {
|
|
134
|
+
none: {},
|
|
135
|
+
rise: { root: 'animate-rise motion-reduce:animate-none' },
|
|
136
|
+
},
|
|
137
|
+
/** Corner rounding, in mn-button's radius tokens. */
|
|
138
|
+
borderRadius: {
|
|
139
|
+
none: { root: 'rounded-none' },
|
|
140
|
+
xs: { root: 'rounded-xs' },
|
|
141
|
+
sm: { root: 'rounded-sm' },
|
|
142
|
+
md: { root: 'rounded-md' },
|
|
143
|
+
lg: { root: 'rounded-lg' },
|
|
144
|
+
xl: { root: 'rounded-xl' },
|
|
145
|
+
two_xl: { root: 'rounded-2xl' },
|
|
146
|
+
three_xl: { root: 'rounded-3xl' },
|
|
147
|
+
four_xl: { root: 'rounded-4xl' },
|
|
148
|
+
},
|
|
149
|
+
/**
|
|
150
|
+
* Colour of the accent bar and of the heading's icon chip: the same palette as
|
|
151
|
+
* mn-button and the icon chip. What the colour *means* (a kind, a status, a
|
|
152
|
+
* module) is the consumer's choice; the card only renders it.
|
|
153
|
+
*/
|
|
154
|
+
color: {
|
|
155
|
+
primary: { accent: 'bg-primary' },
|
|
156
|
+
secondary: { accent: 'bg-secondary' },
|
|
157
|
+
accent: { accent: 'bg-accent' },
|
|
158
|
+
success: { accent: 'bg-success' },
|
|
159
|
+
warning: { accent: 'bg-warning' },
|
|
160
|
+
danger: { accent: 'bg-error' },
|
|
161
|
+
gray: { accent: 'bg-base-content/30' },
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
defaultVariants: {
|
|
165
|
+
padding: 'sm',
|
|
166
|
+
layout: 'column',
|
|
167
|
+
hover: 'shadow',
|
|
168
|
+
enter: 'rise',
|
|
169
|
+
borderRadius: 'two_xl',
|
|
170
|
+
color: 'primary',
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The card: a rounded surface with a hairline border, a hover response and an
|
|
176
|
+
* optional accent bar along its top edge. The body is whatever the consumer projects,
|
|
177
|
+
* so a booking, a competition and a pending-action tile share one look without
|
|
178
|
+
* sharing a view model.
|
|
179
|
+
*
|
|
180
|
+
* It is an attribute as well as an element, like `mnButton` and `mnBadge`: `<mn-card>`
|
|
181
|
+
* for a plain surface, `<a mnCard [routerLink]>` for a card that is a link,
|
|
182
|
+
* `<section mnCard>` when the landmark matters. Extra classes on the host merge with
|
|
183
|
+
* the card's own, so sizing it (`min-w-0 flex-1`, `lg:w-80`) is ordinary CSS on the
|
|
184
|
+
* element, not an input.
|
|
185
|
+
*
|
|
186
|
+
* A **section card** passes a {@link heading}: the card then renders the shared header
|
|
187
|
+
* row, an {@link MnIconChip} beside an `h2`, then whatever trails the title (a badge, a
|
|
188
|
+
* button). Project the icon with the `cardIcon` attribute and group the trailing content
|
|
189
|
+
* in one `cardHeaderEnd` container, so the template reads icon, header end, body:
|
|
190
|
+
*
|
|
191
|
+
* ```html
|
|
192
|
+
* <mn-card [data]="{ padding: 'md', color: 'primary' }" heading="meetings.agenda.title">
|
|
193
|
+
* <svg cardIcon lucideListOrdered [size]="20"></svg>
|
|
194
|
+
* <ng-container cardHeaderEnd>
|
|
195
|
+
* <span mnBadge [data]="{ size: 'sm', color: 'warning' }">Draft</span>
|
|
196
|
+
* </ng-container>
|
|
197
|
+
* ...body...
|
|
198
|
+
* </mn-card>
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
* The other members of the family build on this shell: {@link MnStatTile} for one
|
|
202
|
+
* figure at a glance, and {@link MnProportionBar} for the bar inside a card.
|
|
203
|
+
*/
|
|
204
|
+
class MnCard {
|
|
205
|
+
/** Padding, layout, hover, entrance, radius, colour and accent; see {@link MnCardTypes}. */
|
|
206
|
+
data = {};
|
|
207
|
+
/**
|
|
208
|
+
* Section title, as a translation key or a literal. When set, the header row with
|
|
209
|
+
* the icon chip and `h2` renders above the body. Deliberately not called `title`: a
|
|
210
|
+
* static `title="..."` on the host would also become a browser tooltip.
|
|
211
|
+
*/
|
|
212
|
+
heading;
|
|
213
|
+
/**
|
|
214
|
+
* Delay before the entrance animation starts, in milliseconds, so a row of cards
|
|
215
|
+
* can rise one after another. Ignored when {@link MnCardTypes.enter} is `none`.
|
|
216
|
+
*/
|
|
217
|
+
enterDelayMs = 0;
|
|
218
|
+
/** Resolved slot classes for the current configuration. */
|
|
219
|
+
get styles() {
|
|
220
|
+
return mnCardVariants({
|
|
221
|
+
padding: this.data.padding,
|
|
222
|
+
layout: this.data.layout,
|
|
223
|
+
hover: this.data.hover,
|
|
224
|
+
enter: this.data.enter,
|
|
225
|
+
borderRadius: this.data.borderRadius,
|
|
226
|
+
color: this.data.color,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/** The card element's own classes; the consumer's static classes merge with them. */
|
|
230
|
+
get hostClasses() {
|
|
231
|
+
return this.styles.root();
|
|
232
|
+
}
|
|
233
|
+
/** Staggers the entrance per card. */
|
|
234
|
+
get animationDelay() {
|
|
235
|
+
return `${this.enterDelayMs}ms`;
|
|
236
|
+
}
|
|
237
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
238
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MnCard, isStandalone: true, selector: "mn-card, [mnCard]", inputs: { data: "data", heading: "heading", enterDelayMs: "enterDelayMs" }, host: { properties: { "class": "this.hostClasses", "style.animation-delay": "this.animationDelay" } }, ngImport: i0, template: "<!-- The accent bar sits on the card's top edge, clipped by the host's overflow-hidden\n into the corner radius. Decorative: the colour's meaning is in the content. -->\n@if (data.accent) {\n <span [class]=\"styles.accent()\" aria-hidden=\"true\"></span>\n}\n<!-- The section header: chip, title, then whatever the consumer marks cardHeaderEnd.\n Wraps on narrow screens so a full-width button drops under the title. -->\n@if (heading; as text) {\n <div [class]=\"styles.header()\">\n <mn-icon-chip [data]=\"{ color: data.color }\">\n <ng-content select=\"[cardIcon]\"></ng-content>\n </mn-icon-chip>\n <h2 [class]=\"styles.title()\">{{ text | mnTranslate }}</h2>\n <ng-content select=\"[cardHeaderEnd]\"></ng-content>\n </div>\n}\n<ng-content></ng-content>\n", dependencies: [{ kind: "component", type: MnIconChip, selector: "mn-icon-chip", inputs: ["data"] }, { kind: "pipe", type: MnTranslatePipe, name: "mnTranslate" }] });
|
|
239
|
+
}
|
|
240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnCard, decorators: [{
|
|
241
|
+
type: Component,
|
|
242
|
+
args: [{ selector: 'mn-card, [mnCard]', standalone: true, imports: [MnIconChip, MnTranslatePipe], template: "<!-- The accent bar sits on the card's top edge, clipped by the host's overflow-hidden\n into the corner radius. Decorative: the colour's meaning is in the content. -->\n@if (data.accent) {\n <span [class]=\"styles.accent()\" aria-hidden=\"true\"></span>\n}\n<!-- The section header: chip, title, then whatever the consumer marks cardHeaderEnd.\n Wraps on narrow screens so a full-width button drops under the title. -->\n@if (heading; as text) {\n <div [class]=\"styles.header()\">\n <mn-icon-chip [data]=\"{ color: data.color }\">\n <ng-content select=\"[cardIcon]\"></ng-content>\n </mn-icon-chip>\n <h2 [class]=\"styles.title()\">{{ text | mnTranslate }}</h2>\n <ng-content select=\"[cardHeaderEnd]\"></ng-content>\n </div>\n}\n<ng-content></ng-content>\n" }]
|
|
243
|
+
}], propDecorators: { data: [{
|
|
244
|
+
type: Input
|
|
245
|
+
}], heading: [{
|
|
246
|
+
type: Input
|
|
247
|
+
}], enterDelayMs: [{
|
|
248
|
+
type: Input
|
|
249
|
+
}], hostClasses: [{
|
|
250
|
+
type: HostBinding,
|
|
251
|
+
args: ['class']
|
|
252
|
+
}], animationDelay: [{
|
|
253
|
+
type: HostBinding,
|
|
254
|
+
args: ['style.animation-delay']
|
|
255
|
+
}] } });
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* One fact at a glance: a tinted icon chip, a muted label and a large tabular number,
|
|
259
|
+
* on the {@link MnCard} shell, in a tile that shares a row with its siblings as
|
|
260
|
+
* `flex-1`. Project the icon as content; project a badge or a short note into the
|
|
261
|
+
* `trailing` slot when the number needs a qualifier.
|
|
262
|
+
*
|
|
263
|
+
* ```html
|
|
264
|
+
* <div class="flex flex-wrap gap-4">
|
|
265
|
+
* <mn-stat-tile label="meetings.attending" [value]="yesCount" [data]="{ color: 'success' }">
|
|
266
|
+
* <svg lucideCheck [size]="20"></svg>
|
|
267
|
+
* </mn-stat-tile>
|
|
268
|
+
* </div>
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
class MnStatTile {
|
|
272
|
+
/** Caption under the number, as a translation key or a literal. */
|
|
273
|
+
label;
|
|
274
|
+
/** The figure, already formatted for display. */
|
|
275
|
+
value;
|
|
276
|
+
/** Colour of the chip; see {@link MnStatTileTypes}. */
|
|
277
|
+
data = {};
|
|
278
|
+
/** Grows to share its row and never forces the row wider than its siblings. */
|
|
279
|
+
hostClasses = 'flex flex-1 basis-40 min-w-0';
|
|
280
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnStatTile, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
281
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: MnStatTile, isStandalone: true, selector: "mn-stat-tile", inputs: { label: "label", value: "value", data: "data" }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<!-- The card is a row: chip, then label over number. The muted label reads the\n consumer's muted-text token when it has one and plain base text otherwise. -->\n<div mnCard class=\"w-full\" [data]=\"{ layout: 'row' }\">\n <mn-icon-chip [data]=\"{ color: data.color }\">\n <ng-content></ng-content>\n </mn-icon-chip>\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span class=\"text-sm text-(--color-base-content-muted,var(--color-base-content))\">{{ label | mnTranslate }}</span>\n <div class=\"flex flex-wrap items-baseline gap-2\">\n <span class=\"text-2xl font-bold leading-none tabular-nums text-base-content\">{{ value }}</span>\n <ng-content select=\"[trailing]\"></ng-content>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "component", type: MnCard, selector: "mn-card, [mnCard]", inputs: ["data", "heading", "enterDelayMs"] }, { kind: "component", type: MnIconChip, selector: "mn-icon-chip", inputs: ["data"] }, { kind: "pipe", type: MnTranslatePipe, name: "mnTranslate" }] });
|
|
282
|
+
}
|
|
283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnStatTile, decorators: [{
|
|
284
|
+
type: Component,
|
|
285
|
+
args: [{ selector: 'mn-stat-tile', standalone: true, imports: [MnCard, MnIconChip, MnTranslatePipe], template: "<!-- The card is a row: chip, then label over number. The muted label reads the\n consumer's muted-text token when it has one and plain base text otherwise. -->\n<div mnCard class=\"w-full\" [data]=\"{ layout: 'row' }\">\n <mn-icon-chip [data]=\"{ color: data.color }\">\n <ng-content></ng-content>\n </mn-icon-chip>\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span class=\"text-sm text-(--color-base-content-muted,var(--color-base-content))\">{{ label | mnTranslate }}</span>\n <div class=\"flex flex-wrap items-baseline gap-2\">\n <span class=\"text-2xl font-bold leading-none tabular-nums text-base-content\">{{ value }}</span>\n <ng-content select=\"[trailing]\"></ng-content>\n </div>\n </div>\n</div>\n" }]
|
|
286
|
+
}], propDecorators: { label: [{
|
|
287
|
+
type: Input,
|
|
288
|
+
args: [{ required: true }]
|
|
289
|
+
}], value: [{
|
|
290
|
+
type: Input,
|
|
291
|
+
args: [{ required: true }]
|
|
292
|
+
}], data: [{
|
|
293
|
+
type: Input
|
|
294
|
+
}], hostClasses: [{
|
|
295
|
+
type: HostBinding,
|
|
296
|
+
args: ['class']
|
|
297
|
+
}] } });
|
|
298
|
+
|
|
299
|
+
/** Fill class per colour, spelled out so Tailwind's scanner finds every one. */
|
|
300
|
+
const SEGMENT_CLASS = {
|
|
301
|
+
primary: 'bg-primary',
|
|
302
|
+
secondary: 'bg-secondary',
|
|
303
|
+
accent: 'bg-accent',
|
|
304
|
+
success: 'bg-success',
|
|
305
|
+
warning: 'bg-warning',
|
|
306
|
+
danger: 'bg-error',
|
|
307
|
+
gray: 'bg-base-content/25',
|
|
308
|
+
};
|
|
309
|
+
/** Tinted fill class per colour for a `soft` segment, spelled out for the same reason. */
|
|
310
|
+
const SOFT_SEGMENT_CLASS = {
|
|
311
|
+
primary: 'bg-primary/30',
|
|
312
|
+
secondary: 'bg-secondary/30',
|
|
313
|
+
accent: 'bg-accent/30',
|
|
314
|
+
success: 'bg-success/30',
|
|
315
|
+
warning: 'bg-warning/30',
|
|
316
|
+
danger: 'bg-error/30',
|
|
317
|
+
gray: 'bg-base-content/15',
|
|
318
|
+
};
|
|
319
|
+
/** Track height per size. */
|
|
320
|
+
const HEIGHT_CLASS = {
|
|
321
|
+
sm: 'h-2',
|
|
322
|
+
md: 'h-2.5',
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* The proportional bar every turnout, budget, capacity and collection figure draws:
|
|
326
|
+
* a rounded track with one coloured run per segment, widths from the values. Empty
|
|
327
|
+
* segments are skipped so a zero never leaves a hairline. Announced as one image with
|
|
328
|
+
* the caller's label, because the numbers it visualises are always written out next
|
|
329
|
+
* to it.
|
|
330
|
+
*
|
|
331
|
+
* ```html
|
|
332
|
+
* <mn-proportion-bar
|
|
333
|
+
* [segments]="[{ value: yes, color: 'success' }, { value: maybe, color: 'warning' }]"
|
|
334
|
+
* [total]="invited"
|
|
335
|
+
* ariaLabel="meetings.responses.title">
|
|
336
|
+
* </mn-proportion-bar>
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
class MnProportionBar {
|
|
340
|
+
/** The coloured runs, in draw order from the left. */
|
|
341
|
+
segments;
|
|
342
|
+
/** The whole the segments are measured against; defaults to their sum. */
|
|
343
|
+
total;
|
|
344
|
+
/** Accessible name for the bar as a whole, as a translation key or a literal. */
|
|
345
|
+
ariaLabel;
|
|
346
|
+
/** Track thickness; see {@link MnProportionBarTypes}. */
|
|
347
|
+
data = {};
|
|
348
|
+
/** Resolves the accessible name against the app's bundle. */
|
|
349
|
+
lang = inject(MnLanguageService);
|
|
350
|
+
/** The translated accessible name. */
|
|
351
|
+
get label() {
|
|
352
|
+
return this.lang.translate(this.ariaLabel);
|
|
353
|
+
}
|
|
354
|
+
/** Every class on the track element. */
|
|
355
|
+
get trackClass() {
|
|
356
|
+
return `flex w-full overflow-hidden rounded-full bg-base-content/10 ${HEIGHT_CLASS[this.data.height ?? 'md']}`;
|
|
357
|
+
}
|
|
358
|
+
/** The denominator actually used: the explicit total when positive, else the segment sum. */
|
|
359
|
+
get denominator() {
|
|
360
|
+
const explicit = this.total;
|
|
361
|
+
if (explicit !== null && explicit !== undefined && explicit > 0)
|
|
362
|
+
return explicit;
|
|
363
|
+
return this.segments.reduce((sum, segment) => sum + Math.max(0, segment.value), 0);
|
|
364
|
+
}
|
|
365
|
+
/** Segments with a width, empty ones dropped. */
|
|
366
|
+
get rendered() {
|
|
367
|
+
const denominator = this.denominator;
|
|
368
|
+
if (denominator <= 0)
|
|
369
|
+
return [];
|
|
370
|
+
return this.segments
|
|
371
|
+
.filter((segment) => segment.value > 0)
|
|
372
|
+
.map((segment) => ({
|
|
373
|
+
widthPct: Math.min(100, (segment.value / denominator) * 100),
|
|
374
|
+
fillClass: (segment.soft ? SOFT_SEGMENT_CLASS : SEGMENT_CLASS)[segment.color],
|
|
375
|
+
}));
|
|
376
|
+
}
|
|
377
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnProportionBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
378
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MnProportionBar, isStandalone: true, selector: "mn-proportion-bar", inputs: { segments: "segments", total: "total", ariaLabel: "ariaLabel", data: "data" }, ngImport: i0, template: "<!-- One labelled image: the runs are decoration, the numbers live in the caller's text. -->\n<div role=\"img\" [attr.aria-label]=\"label\" [class]=\"trackClass\">\n @for (segment of rendered; track $index) {\n <span\n class=\"h-full transition-[width] duration-300 ease-out motion-reduce:transition-none\"\n [class]=\"segment.fillClass\"\n [style.width.%]=\"segment.widthPct\"\n ></span>\n }\n</div>\n" });
|
|
379
|
+
}
|
|
380
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnProportionBar, decorators: [{
|
|
381
|
+
type: Component,
|
|
382
|
+
args: [{ selector: 'mn-proportion-bar', standalone: true, template: "<!-- One labelled image: the runs are decoration, the numbers live in the caller's text. -->\n<div role=\"img\" [attr.aria-label]=\"label\" [class]=\"trackClass\">\n @for (segment of rendered; track $index) {\n <span\n class=\"h-full transition-[width] duration-300 ease-out motion-reduce:transition-none\"\n [class]=\"segment.fillClass\"\n [style.width.%]=\"segment.widthPct\"\n ></span>\n }\n</div>\n" }]
|
|
383
|
+
}], propDecorators: { segments: [{
|
|
384
|
+
type: Input,
|
|
385
|
+
args: [{ required: true }]
|
|
386
|
+
}], total: [{
|
|
387
|
+
type: Input
|
|
388
|
+
}], ariaLabel: [{
|
|
389
|
+
type: Input,
|
|
390
|
+
args: [{ required: true }]
|
|
391
|
+
}], data: [{
|
|
392
|
+
type: Input
|
|
393
|
+
}] } });
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Styling for {@link MnBreadcrumbs}, expressed as tailwind-variants slots so the
|
|
397
|
+
* template can pull one class string per role. Theme tokens only, so the trail
|
|
398
|
+
* reads correctly in both light and dark. Links and the Back control are native
|
|
399
|
+
* `<button>`/`<a>` elements reset to look like plain text with a hover accent.
|
|
400
|
+
*/
|
|
401
|
+
const mnBreadcrumbsVariants = tv({
|
|
402
|
+
slots: {
|
|
403
|
+
root: 'flex items-center',
|
|
404
|
+
list: 'flex flex-wrap items-center',
|
|
405
|
+
link: 'inline-flex items-center bg-transparent border-0 p-0 rounded-md cursor-pointer ' +
|
|
406
|
+
'text-base-content/60 hover:text-primary transition-colors ' +
|
|
407
|
+
'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary',
|
|
408
|
+
current: 'inline-flex items-center font-semibold text-base-content',
|
|
409
|
+
separator: 'inline-flex shrink-0 text-base-content/40',
|
|
410
|
+
back: 'inline-flex items-center gap-1 bg-transparent border-0 p-0 rounded-md cursor-pointer ' +
|
|
411
|
+
'text-base-content/70 hover:text-primary transition-colors ' +
|
|
412
|
+
'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary',
|
|
413
|
+
},
|
|
414
|
+
variants: {
|
|
415
|
+
size: {
|
|
416
|
+
// Text size lives on the root so every crumb, separator and the Back
|
|
417
|
+
// control inherit it; only the inter-crumb gap changes per slot.
|
|
418
|
+
sm: { root: 'text-xs', list: 'gap-1' },
|
|
419
|
+
md: { root: 'text-sm', list: 'gap-1.5' },
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
defaultVariants: {
|
|
423
|
+
size: 'md',
|
|
424
|
+
},
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
/** Lucide icons this file renders. */
|
|
428
|
+
const ICONS = lucideIcons({ ChevronLeft: lucide.ChevronLeft, ChevronRight: lucide.ChevronRight });
|
|
429
|
+
/**
|
|
430
|
+
* A flexible breadcrumb trail.
|
|
431
|
+
*
|
|
432
|
+
* Given crumbs it renders a linkable trail (`root › … › current`) where the last
|
|
433
|
+
* crumb is the current page and is never a link. Given no crumbs it degrades to
|
|
434
|
+
* a single "Back" control — the two are mutually exclusive. "Flexible" here is
|
|
435
|
+
* input-driven, not viewport-driven: there is deliberately no responsive
|
|
436
|
+
* collapse, no scroll machinery — it is a list of links plus a fallback.
|
|
437
|
+
*
|
|
438
|
+
* Navigation stays router- and history-agnostic where possible: a crumb (or the
|
|
439
|
+
* Back control) with an `href` renders a plain `<a>` and navigates natively;
|
|
440
|
+
* otherwise clicks emit outputs for the app to handle. Only the Back fallback
|
|
441
|
+
* with no `href` reaches for `history.back()`.
|
|
442
|
+
*/
|
|
443
|
+
class MnBreadcrumbs {
|
|
444
|
+
/** Lucide icons the template renders. */
|
|
445
|
+
icons = ICONS;
|
|
446
|
+
/** Trail crumbs and Back-fallback configuration. */
|
|
447
|
+
data = { items: [] };
|
|
448
|
+
/** Emits the crumb that was clicked (non-current crumbs only). */
|
|
449
|
+
crumbClick = new EventEmitter();
|
|
450
|
+
/** Emits when the fallback "Back" control is activated. */
|
|
451
|
+
back = new EventEmitter();
|
|
452
|
+
/** Conventional key an app defines to translate the Back control's label. */
|
|
453
|
+
static BACK_LABEL_KEY = 'mnBreadcrumbs.back';
|
|
454
|
+
/** Conventional key an app defines to name the navigation landmark. */
|
|
455
|
+
static NAV_LABEL_KEY = 'mnBreadcrumbs.label';
|
|
456
|
+
/** Resolves this component's own labels against the app's bundle. */
|
|
457
|
+
lang = inject(MnLanguageService);
|
|
458
|
+
/** Resolved tailwind-variants slot functions for the current size. */
|
|
459
|
+
get styles() {
|
|
460
|
+
return mnBreadcrumbsVariants({ size: this.data.size });
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Accessible name of the `<nav>` landmark.
|
|
464
|
+
*
|
|
465
|
+
* A landmark's name is announced verbatim, so leaving it as a hardcoded English
|
|
466
|
+
* "Breadcrumb" put one English word into every page of a translated app — in the
|
|
467
|
+
* one place only screen-reader users hear.
|
|
468
|
+
*/
|
|
469
|
+
get navLabel() {
|
|
470
|
+
return this.lang.translateIfPresent(MnBreadcrumbs.NAV_LABEL_KEY) ?? 'Breadcrumb';
|
|
471
|
+
}
|
|
472
|
+
/** Whether a linkable trail should render (vs the Back fallback). */
|
|
473
|
+
get hasTrail() {
|
|
474
|
+
return (this.data.items?.length ?? 0) > 0;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Text of the Back control, already translated.
|
|
478
|
+
*
|
|
479
|
+
* `data.backLabel` is a key (or a literal, which `translate` passes through
|
|
480
|
+
* unchanged). Without one this falls back to the conventional key and then to
|
|
481
|
+
* English — never to a raw key: the old default was the bare key `'back'`, which
|
|
482
|
+
* the template's translate pipe echoed as lowercase "back" in every app that had
|
|
483
|
+
* not happened to define it.
|
|
484
|
+
*/
|
|
485
|
+
get backLabel() {
|
|
486
|
+
if (this.data.backLabel) {
|
|
487
|
+
return this.lang.translate(this.data.backLabel);
|
|
488
|
+
}
|
|
489
|
+
return this.lang.translateIfPresent(MnBreadcrumbs.BACK_LABEL_KEY) ?? 'Back';
|
|
490
|
+
}
|
|
491
|
+
/** The last crumb is the current page and is rendered as plain text. */
|
|
492
|
+
isCurrent(index) {
|
|
493
|
+
return index === this.data.items.length - 1;
|
|
494
|
+
}
|
|
495
|
+
/** Runs a crumb's own callback and notifies listeners of the click. */
|
|
496
|
+
onCrumb(item) {
|
|
497
|
+
item.onClick?.();
|
|
498
|
+
this.crumbClick.emit(item);
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Fallback Back action. Always emits `back` for listeners; when no `backHref`
|
|
502
|
+
* anchor is carrying the navigation, steps back through browser history.
|
|
503
|
+
*/
|
|
504
|
+
onBack() {
|
|
505
|
+
this.back.emit();
|
|
506
|
+
if (!this.data.backHref) {
|
|
507
|
+
window.history.back();
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnBreadcrumbs, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
511
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MnBreadcrumbs, isStandalone: true, selector: "mn-breadcrumbs", inputs: { data: "data" }, outputs: { crumbClick: "crumbClick", back: "back" }, ngImport: i0, template: "<nav [attr.aria-label]=\"navLabel\" [class]=\"styles.root()\">\n @if (hasTrail) {\n <ol [class]=\"styles.list()\">\n @for (item of data.items; track $index; let first = $first) {\n @if (!first) {\n <li aria-hidden=\"true\" [class]=\"styles.separator()\">\n <svg [size]=\"14\" [lucideIcon]=\"icons.ChevronRight\"></svg>\n </li>\n }\n <li class=\"inline-flex items-center\">\n @if (isCurrent($index)) {\n <span aria-current=\"page\" [class]=\"styles.current()\">{{ item.label | mnTranslate }}</span>\n } @else if (item.href) {\n <a [attr.href]=\"item.href\" [class]=\"styles.link()\" (click)=\"onCrumb(item)\">{{ item.label | mnTranslate }}</a>\n } @else {\n <button type=\"button\" [class]=\"styles.link()\" (click)=\"onCrumb(item)\">{{ item.label | mnTranslate }}</button>\n }\n </li>\n }\n </ol>\n } @else if (data.backHref) {\n <a [attr.href]=\"data.backHref\" [class]=\"styles.back()\" (click)=\"onBack()\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ backLabel }}\n </a>\n } @else {\n <button type=\"button\" [class]=\"styles.back()\" (click)=\"onBack()\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ backLabel }}\n </button>\n }\n</nav>\n", dependencies: [{ kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "pipe", type: MnTranslatePipe, name: "mnTranslate" }] });
|
|
512
|
+
}
|
|
513
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnBreadcrumbs, decorators: [{
|
|
514
|
+
type: Component,
|
|
515
|
+
args: [{ selector: 'mn-breadcrumbs', standalone: true, imports: [MnTranslatePipe, LucideDynamicIcon], template: "<nav [attr.aria-label]=\"navLabel\" [class]=\"styles.root()\">\n @if (hasTrail) {\n <ol [class]=\"styles.list()\">\n @for (item of data.items; track $index; let first = $first) {\n @if (!first) {\n <li aria-hidden=\"true\" [class]=\"styles.separator()\">\n <svg [size]=\"14\" [lucideIcon]=\"icons.ChevronRight\"></svg>\n </li>\n }\n <li class=\"inline-flex items-center\">\n @if (isCurrent($index)) {\n <span aria-current=\"page\" [class]=\"styles.current()\">{{ item.label | mnTranslate }}</span>\n } @else if (item.href) {\n <a [attr.href]=\"item.href\" [class]=\"styles.link()\" (click)=\"onCrumb(item)\">{{ item.label | mnTranslate }}</a>\n } @else {\n <button type=\"button\" [class]=\"styles.link()\" (click)=\"onCrumb(item)\">{{ item.label | mnTranslate }}</button>\n }\n </li>\n }\n </ol>\n } @else if (data.backHref) {\n <a [attr.href]=\"data.backHref\" [class]=\"styles.back()\" (click)=\"onBack()\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ backLabel }}\n </a>\n } @else {\n <button type=\"button\" [class]=\"styles.back()\" (click)=\"onBack()\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ backLabel }}\n </button>\n }\n</nav>\n" }]
|
|
516
|
+
}], propDecorators: { data: [{
|
|
517
|
+
type: Input
|
|
518
|
+
}], crumbClick: [{
|
|
519
|
+
type: Output
|
|
520
|
+
}], back: [{
|
|
521
|
+
type: Output
|
|
522
|
+
}] } });
|
|
523
|
+
|
|
524
|
+
const mnIconVariants = tv({
|
|
525
|
+
base: 'inline-flex shrink-0',
|
|
526
|
+
variants: {
|
|
527
|
+
color: {
|
|
528
|
+
current: 'text-current',
|
|
529
|
+
primary: 'text-primary',
|
|
530
|
+
secondary: 'text-secondary',
|
|
531
|
+
danger: 'text-error',
|
|
532
|
+
warning: 'text-warning',
|
|
533
|
+
success: 'text-success',
|
|
534
|
+
accent: 'text-accent',
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
defaultVariants: {
|
|
538
|
+
color: 'current',
|
|
539
|
+
},
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
// Custom SVGs that are NOT available in lucide (https://lucide.dev).
|
|
543
|
+
// For any lucide icon, render lucide icon data instead — e.g.
|
|
544
|
+
// `<svg [lucideIcon]="icons.X" [size]="18"></svg>` with `lucideIcons()` — rather than adding it here.
|
|
545
|
+
// Sourced from the .svg files in the ./icons/ directory.
|
|
546
|
+
const pistolSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8.72 14.56 9 10h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v4c2.5 0 1 4 1 4-4 6-1 6-1 6h3.38a1 1 0 0 0 .89-.55za1 1 0 0 1 .9-.56H13a2 2 0 0 0 2-2v-1a1 1 0 0 1 1-1" /></svg>`;
|
|
547
|
+
const MN_ICON_MAP = {
|
|
548
|
+
pistol: pistolSvg,
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
class MnIcon {
|
|
552
|
+
data = {};
|
|
553
|
+
sanitizer = inject(DomSanitizer);
|
|
554
|
+
el = inject(ElementRef);
|
|
555
|
+
svgContent = '';
|
|
556
|
+
get iconSize() {
|
|
557
|
+
return this.data.size ?? 24;
|
|
558
|
+
}
|
|
559
|
+
get hostClasses() {
|
|
560
|
+
return mnIconVariants({
|
|
561
|
+
color: this.data.color,
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
resolvedName = null;
|
|
565
|
+
ngOnInit() {
|
|
566
|
+
const attrs = this.el.nativeElement.attributes;
|
|
567
|
+
for (const item of Array.from(attrs)) {
|
|
568
|
+
const attr = item.name.toLowerCase();
|
|
569
|
+
if (attr.startsWith('mnicon')) {
|
|
570
|
+
const iconKey = attr.slice('mnicon'.length);
|
|
571
|
+
for (const key of Object.keys(MN_ICON_MAP)) {
|
|
572
|
+
if (key.toLowerCase() === iconKey) {
|
|
573
|
+
this.resolvedName = key;
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
if (this.resolvedName)
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
this.updateContent();
|
|
582
|
+
}
|
|
583
|
+
ngOnChanges() {
|
|
584
|
+
this.updateContent();
|
|
585
|
+
}
|
|
586
|
+
updateContent() {
|
|
587
|
+
const name = this.data.name ?? this.resolvedName;
|
|
588
|
+
if (name) {
|
|
589
|
+
const raw = MN_ICON_MAP[name];
|
|
590
|
+
if (raw) {
|
|
591
|
+
const size = this.iconSize;
|
|
592
|
+
const isFullSvg = raw.trim().startsWith('<svg');
|
|
593
|
+
if (isFullSvg) {
|
|
594
|
+
const sized = raw.replace(/<svg([^>]*)>/, (_match, attrs) => {
|
|
595
|
+
let updated = attrs.replace(/width="[^"]*"/, `width="${size}"`);
|
|
596
|
+
updated = updated.replace(/height="[^"]*"/, `height="${size}"`);
|
|
597
|
+
if (!attrs.includes('width='))
|
|
598
|
+
updated += ` width="${size}"`;
|
|
599
|
+
if (!attrs.includes('height='))
|
|
600
|
+
updated += ` height="${size}"`;
|
|
601
|
+
return `<svg${updated}>`;
|
|
602
|
+
});
|
|
603
|
+
this.svgContent = this.sanitizer.bypassSecurityTrustHtml(sized);
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${raw}</svg>`;
|
|
607
|
+
this.svgContent = this.sanitizer.bypassSecurityTrustHtml(svg);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
this.svgContent = '';
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
this.svgContent = '';
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
619
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: MnIcon, isStandalone: true, selector: "mn-icon", inputs: { data: "data" }, host: { properties: { "class": "this.hostClasses" } }, usesOnChanges: true, ngImport: i0, template: "<span\n [style.width.px]=\"iconSize\"\n [style.height.px]=\"iconSize\"\n style=\"display: inline-flex; align-items: center; justify-content: center;\"\n [innerHTML]=\"svgContent\"\n></span>\n" });
|
|
620
|
+
}
|
|
621
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnIcon, decorators: [{
|
|
622
|
+
type: Component,
|
|
623
|
+
args: [{ selector: 'mn-icon', standalone: true, template: "<span\n [style.width.px]=\"iconSize\"\n [style.height.px]=\"iconSize\"\n style=\"display: inline-flex; align-items: center; justify-content: center;\"\n [innerHTML]=\"svgContent\"\n></span>\n" }]
|
|
624
|
+
}], propDecorators: { data: [{
|
|
625
|
+
type: Input
|
|
626
|
+
}], hostClasses: [{
|
|
627
|
+
type: HostBinding,
|
|
628
|
+
args: ['class']
|
|
629
|
+
}] } });
|
|
630
|
+
|
|
631
|
+
// AUTO-GENERATED — do not edit manually.
|
|
632
|
+
// Run `npm run generate:icons` to regenerate after modifying MN_ICON_MAP.
|
|
633
|
+
class MnIconAttributes {
|
|
634
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnIconAttributes, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
635
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.3", type: MnIconAttributes, isStandalone: true, selector: "mn-icon[mnIconPistol]", ngImport: i0 });
|
|
636
|
+
}
|
|
637
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnIconAttributes, decorators: [{
|
|
638
|
+
type: Directive,
|
|
639
|
+
args: [{
|
|
640
|
+
selector: 'mn-icon[mnIconPistol]',
|
|
641
|
+
standalone: true,
|
|
642
|
+
}]
|
|
643
|
+
}] });
|
|
644
|
+
|
|
645
|
+
const mnInformationCardVariants = tv({
|
|
646
|
+
base: '',
|
|
647
|
+
variants: {
|
|
648
|
+
bottomBorder: {
|
|
649
|
+
true: 'border-b border-b-2 border-primary-500',
|
|
650
|
+
},
|
|
651
|
+
shadow: {
|
|
652
|
+
true: 'shadow-xl',
|
|
653
|
+
},
|
|
654
|
+
textPosition: {
|
|
655
|
+
left: 'text-left',
|
|
656
|
+
center: 'text-center',
|
|
657
|
+
right: 'text-right',
|
|
658
|
+
},
|
|
659
|
+
borderRadius: {
|
|
660
|
+
none: 'rounded-none',
|
|
661
|
+
xs: 'rounded-xs',
|
|
662
|
+
sm: 'rounded-sm',
|
|
663
|
+
md: 'rounded-md',
|
|
664
|
+
lg: 'rounded-lg',
|
|
665
|
+
xl: 'rounded-xl',
|
|
666
|
+
two_xl: 'rounded-2xl',
|
|
667
|
+
three_xl: 'rounded-3xl',
|
|
668
|
+
four_xl: 'rounded-4xl',
|
|
669
|
+
},
|
|
670
|
+
},
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
class MnInformationCard {
|
|
674
|
+
data;
|
|
675
|
+
get hostClasses() {
|
|
676
|
+
return mnInformationCardVariants({
|
|
677
|
+
bottomBorder: this.data.bottomBorder,
|
|
678
|
+
shadow: this.data.shadow,
|
|
679
|
+
textPosition: this.data.textPosition,
|
|
680
|
+
borderRadius: this.data.borderRadius
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnInformationCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
684
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: MnInformationCard, isStandalone: true, selector: "mn-lib-information-card", inputs: { data: "data" }, ngImport: i0, template: "<div class=\"flex flex-col items-center gap-y-4 p-4 size-full\" [ngClass]=\"hostClasses\">\n<ng-content select=\"[header]\"></ng-content>\n<ng-content></ng-content>\n<ng-content select=\"[footer]\"></ng-content>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
685
|
+
}
|
|
686
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnInformationCard, decorators: [{
|
|
687
|
+
type: Component,
|
|
688
|
+
args: [{ selector: 'mn-lib-information-card', standalone: true, imports: [
|
|
689
|
+
NgClass
|
|
690
|
+
], template: "<div class=\"flex flex-col items-center gap-y-4 p-4 size-full\" [ngClass]=\"hostClasses\">\n<ng-content select=\"[header]\"></ng-content>\n<ng-content></ng-content>\n<ng-content select=\"[footer]\"></ng-content>\n</div>\n" }]
|
|
691
|
+
}], propDecorators: { data: [{
|
|
692
|
+
type: Input,
|
|
693
|
+
args: [{ required: true }]
|
|
694
|
+
}] } });
|
|
695
|
+
|
|
696
|
+
const MN_LIB_DUAL_HORIZONTAL_IMAGE = new InjectionToken('MN_LIB_DUAL_HORIZONTAL_IMAGE');
|
|
697
|
+
class MnDualHorizontalImage {
|
|
698
|
+
componentConfig = inject(MN_LIB_DUAL_HORIZONTAL_IMAGE);
|
|
699
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnDualHorizontalImage, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
700
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MnDualHorizontalImage, isStandalone: true, selector: "mn-lib-dual-horizontal-image", host: { classAttribute: "block" }, providers: [
|
|
701
|
+
provideMnComponentConfig(MN_LIB_DUAL_HORIZONTAL_IMAGE, 'mn-dual-horizontal-image'),
|
|
702
|
+
], ngImport: i0, template: "<div class=\"flex flex-col w-full -space-y-16 md:-space-y-24 lg:-space-y-24\">\n@for (image of componentConfig.images; track image.id) {\n <div\n class=\"relative aspect-3/2 w-[75%] md:w-[65%]\n overflow-hidden rounded-3xl shadow-md\n first:self-start last:self-end\"\n >\n <img\n [ngSrc]=\"image.url\"\n fill\n class=\"object-cover\"\n [alt]=\"image.alt\"\n />\n </div>\n } @empty {\n <p>{{ componentConfig.noImagesFound ?? 'No images found' }}</p>\n }\n</div>\n\n", dependencies: [{ kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }] });
|
|
703
|
+
}
|
|
704
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnDualHorizontalImage, decorators: [{
|
|
705
|
+
type: Component,
|
|
706
|
+
args: [{ selector: 'mn-lib-dual-horizontal-image', standalone: true, imports: [
|
|
707
|
+
NgOptimizedImage
|
|
708
|
+
], providers: [
|
|
709
|
+
provideMnComponentConfig(MN_LIB_DUAL_HORIZONTAL_IMAGE, 'mn-dual-horizontal-image'),
|
|
710
|
+
], host: {
|
|
711
|
+
class: 'block'
|
|
712
|
+
}, template: "<div class=\"flex flex-col w-full -space-y-16 md:-space-y-24 lg:-space-y-24\">\n@for (image of componentConfig.images; track image.id) {\n <div\n class=\"relative aspect-3/2 w-[75%] md:w-[65%]\n overflow-hidden rounded-3xl shadow-md\n first:self-start last:self-end\"\n >\n <img\n [ngSrc]=\"image.url\"\n fill\n class=\"object-cover\"\n [alt]=\"image.alt\"\n />\n </div>\n } @empty {\n <p>{{ componentConfig.noImagesFound ?? 'No images found' }}</p>\n }\n</div>\n\n" }]
|
|
713
|
+
}] });
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Public API of the `mn-angular-lib/display` entry point: display components (card, breadcrumbs, icon, information card, dual image).
|
|
717
|
+
*
|
|
718
|
+
* Each entry point is its own module in the published package, so a consumer's bundler
|
|
719
|
+
* splits it into the chunk that uses it instead of loading the whole library at startup.
|
|
720
|
+
* The root `mn-angular-lib` entry re-exports every entry point.
|
|
721
|
+
*/
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Generated bundle index. Do not edit.
|
|
725
|
+
*/
|
|
726
|
+
|
|
727
|
+
export { MN_ICON_MAP, MN_LIB_DUAL_HORIZONTAL_IMAGE, MnBreadcrumbs, MnCard, MnDualHorizontalImage, MnIcon, MnIconAttributes, MnIconChip, MnInformationCard, MnProportionBar, MnStatTile, mnBreadcrumbsVariants, mnCardVariants, mnIconChipVariants, mnIconVariants, mnInformationCardVariants };
|
|
728
|
+
//# sourceMappingURL=mn-angular-lib-display.mjs.map
|