mn-angular-lib 2.0.34 → 2.0.35
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 +515 -527
- package/fesm2022/mn-angular-lib-alert.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs +264 -357
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-button.mjs +819 -382
- package/fesm2022/mn-angular-lib-button.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar-core.mjs +240 -365
- package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar.mjs +1691 -1545
- package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-collection.mjs +2367 -2796
- package/fesm2022/mn-angular-lib-collection.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-core.mjs +693 -1241
- package/fesm2022/mn-angular-lib-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-display.mjs +679 -712
- package/fesm2022/mn-angular-lib-display.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-forms.mjs +3671 -4647
- package/fesm2022/mn-angular-lib-forms.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-keyboard.mjs +221 -190
- package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-core.mjs +711 -896
- package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-ui.mjs +2089 -2035
- package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal.mjs +76 -121
- package/fesm2022/mn-angular-lib-modal.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs +289 -277
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-segmented.mjs +189 -241
- package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-tab.mjs +409 -642
- package/fesm2022/mn-angular-lib-tab.mjs.map +1 -1
- package/fesm2022/mn-angular-lib.mjs +16 -29
- package/package.json +1 -1
- package/types/mn-angular-lib-alert.d.ts +239 -241
- package/types/mn-angular-lib-bottom-sheet.d.ts +190 -150
- package/types/mn-angular-lib-button.d.ts +319 -317
- package/types/mn-angular-lib-calendar-core.d.ts +199 -209
- package/types/mn-angular-lib-calendar.d.ts +656 -511
- package/types/mn-angular-lib-collection.d.ts +1649 -1585
- package/types/mn-angular-lib-core.d.ts +524 -535
- package/types/mn-angular-lib-display.d.ts +946 -886
- package/types/mn-angular-lib-forms.d.ts +3012 -3013
- package/types/mn-angular-lib-keyboard.d.ts +125 -85
- package/types/mn-angular-lib-modal-core.d.ts +978 -994
- package/types/mn-angular-lib-modal-ui.d.ts +541 -493
- package/types/mn-angular-lib-modal.d.ts +24 -27
- package/types/mn-angular-lib-rich-text-editor.d.ts +131 -98
- package/types/mn-angular-lib-segmented.d.ts +354 -341
- package/types/mn-angular-lib-tab.d.ts +345 -336
- package/types/mn-angular-lib.d.ts +16 -16
- package/fesm2022/mn-angular-lib.mjs.map +0 -1
|
@@ -1,728 +1,695 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { tv } from
|
|
5
|
-
import { MnSkeleton } from
|
|
6
|
-
import { LucideDynamicIcon } from
|
|
7
|
-
import * as lucide from
|
|
8
|
-
import { DomSanitizer } from
|
|
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
|
-
*/
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, Directive, ElementRef, EventEmitter, HostBinding, Input, Output, inject } from "@angular/core";
|
|
3
|
+
import { MnLanguageService, MnTranslatePipe, lucideIcons } from "mn-angular-lib/core";
|
|
4
|
+
import { tv } from "tailwind-variants";
|
|
5
|
+
import { MnSkeleton } from "mn-angular-lib/button";
|
|
6
|
+
import { LucideDynamicIcon } from "@lucide/angular";
|
|
7
|
+
import * as lucide from "lucide";
|
|
8
|
+
import { DomSanitizer } from "@angular/platform-browser";
|
|
17
9
|
const mnIconChipVariants = tv({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
10
|
+
base: "inline-flex shrink-0 items-center justify-center",
|
|
11
|
+
variants: {
|
|
12
|
+
size: {
|
|
13
|
+
xs: "h-8 w-8 rounded-lg",
|
|
14
|
+
sm: "h-9 w-9 rounded-lg",
|
|
15
|
+
md: "h-10 w-10 rounded-xl",
|
|
16
|
+
lg: "h-12 w-12 rounded-2xl",
|
|
17
|
+
xl: "h-14 w-14 rounded-2xl"
|
|
18
|
+
},
|
|
19
|
+
color: {
|
|
20
|
+
primary: "bg-primary/10 text-(--color-primary-text,var(--color-primary))",
|
|
21
|
+
secondary: "bg-secondary/10 text-(--color-secondary-text,var(--color-secondary))",
|
|
22
|
+
accent: "bg-accent/10 text-(--color-accent-text,var(--color-accent))",
|
|
23
|
+
success: "bg-success/10 text-(--color-success-text,var(--color-success))",
|
|
24
|
+
warning: "bg-warning/10 text-(--color-warning-text,var(--color-warning))",
|
|
25
|
+
danger: "bg-error/10 text-(--color-error-text,var(--color-error))",
|
|
26
|
+
gray: "bg-base-content/10 text-base-content/70"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
size: "md",
|
|
31
|
+
color: "primary"
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var MnIconChip = class MnIconChip {
|
|
35
|
+
data = {};
|
|
36
|
+
get hostClasses() {
|
|
37
|
+
return mnIconChipVariants({
|
|
38
|
+
size: this.data.size,
|
|
39
|
+
color: this.data.color
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
43
|
+
minVersion: "12.0.0",
|
|
44
|
+
version: "22.2.2",
|
|
45
|
+
ngImport: i0,
|
|
46
|
+
type: MnIconChip,
|
|
47
|
+
deps: [],
|
|
48
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
49
|
+
});
|
|
50
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
51
|
+
minVersion: "14.0.0",
|
|
52
|
+
version: "22.2.2",
|
|
53
|
+
type: MnIconChip,
|
|
54
|
+
isStandalone: true,
|
|
55
|
+
selector: "mn-icon-chip",
|
|
56
|
+
inputs: { data: "data" },
|
|
57
|
+
host: {
|
|
58
|
+
attributes: { "aria-hidden": "true" },
|
|
59
|
+
properties: { "class": "this.hostClasses" }
|
|
60
|
+
},
|
|
61
|
+
ngImport: i0,
|
|
62
|
+
template: "<ng-content></ng-content>\n"
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
66
|
+
minVersion: "12.0.0",
|
|
67
|
+
version: "22.2.2",
|
|
68
|
+
ngImport: i0,
|
|
69
|
+
type: MnIconChip,
|
|
70
|
+
decorators: [{
|
|
71
|
+
type: Component,
|
|
72
|
+
args: [{
|
|
73
|
+
selector: "mn-icon-chip",
|
|
74
|
+
standalone: true,
|
|
75
|
+
host: { "aria-hidden": "true" },
|
|
76
|
+
template: "<ng-content></ng-content>\n"
|
|
77
|
+
}]
|
|
78
|
+
}],
|
|
79
|
+
propDecorators: {
|
|
80
|
+
data: [{ type: Input }],
|
|
81
|
+
hostClasses: [{
|
|
82
|
+
type: HostBinding,
|
|
83
|
+
args: ["class"]
|
|
84
|
+
}]
|
|
85
|
+
}
|
|
45
86
|
});
|
|
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: "22.1.7", ngImport: i0, type: MnIconChip, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", 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: "22.1.7", 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
87
|
const mnCardVariants = tv({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
88
|
+
slots: {
|
|
89
|
+
root: "relative flex overflow-hidden border border-base-300 bg-(--color-base-card,var(--color-base-100)) transition-[translate,box-shadow,border-color] duration-200 motion-reduce:transition-none",
|
|
90
|
+
accent: "absolute inset-x-0 top-0 h-1",
|
|
91
|
+
header: "flex flex-wrap items-center gap-3",
|
|
92
|
+
title: "text-lg font-semibold text-base-content"
|
|
93
|
+
},
|
|
94
|
+
variants: {
|
|
95
|
+
padding: {
|
|
96
|
+
sm: { root: "p-4 gap-3" },
|
|
97
|
+
md: { root: "p-5 gap-4" },
|
|
98
|
+
lg: { root: "p-6 gap-5" }
|
|
99
|
+
},
|
|
100
|
+
layout: {
|
|
101
|
+
column: { root: "flex-col" },
|
|
102
|
+
row: { root: "flex-row items-center" }
|
|
103
|
+
},
|
|
104
|
+
hover: {
|
|
105
|
+
none: {},
|
|
106
|
+
shadow: { root: "hover:shadow-md" },
|
|
107
|
+
lift: { root: "cursor-pointer hover:-translate-y-1 hover:shadow-lg motion-reduce:hover:translate-y-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary" }
|
|
108
|
+
},
|
|
109
|
+
enter: {
|
|
110
|
+
none: {},
|
|
111
|
+
rise: { root: "animate-rise motion-reduce:animate-none" }
|
|
112
|
+
},
|
|
113
|
+
borderRadius: {
|
|
114
|
+
none: { root: "rounded-none" },
|
|
115
|
+
xs: { root: "rounded-xs" },
|
|
116
|
+
sm: { root: "rounded-sm" },
|
|
117
|
+
md: { root: "rounded-md" },
|
|
118
|
+
lg: { root: "rounded-lg" },
|
|
119
|
+
xl: { root: "rounded-xl" },
|
|
120
|
+
two_xl: { root: "rounded-2xl" },
|
|
121
|
+
three_xl: { root: "rounded-3xl" },
|
|
122
|
+
four_xl: { root: "rounded-4xl" }
|
|
123
|
+
},
|
|
124
|
+
color: {
|
|
125
|
+
primary: { accent: "bg-primary" },
|
|
126
|
+
secondary: { accent: "bg-secondary" },
|
|
127
|
+
accent: { accent: "bg-accent" },
|
|
128
|
+
success: { accent: "bg-success" },
|
|
129
|
+
warning: { accent: "bg-warning" },
|
|
130
|
+
danger: { accent: "bg-error" },
|
|
131
|
+
gray: { accent: "bg-base-content/30" }
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
defaultVariants: {
|
|
135
|
+
padding: "sm",
|
|
136
|
+
layout: "column",
|
|
137
|
+
hover: "none",
|
|
138
|
+
enter: "none",
|
|
139
|
+
borderRadius: "two_xl",
|
|
140
|
+
color: "primary"
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
var MnCard = class MnCard {
|
|
144
|
+
data = {};
|
|
145
|
+
heading;
|
|
146
|
+
enterDelayMs = 0;
|
|
147
|
+
get styles() {
|
|
148
|
+
return mnCardVariants({
|
|
149
|
+
padding: this.data.padding,
|
|
150
|
+
layout: this.data.layout,
|
|
151
|
+
hover: this.data.hover,
|
|
152
|
+
enter: this.data.enter,
|
|
153
|
+
borderRadius: this.data.borderRadius,
|
|
154
|
+
color: this.data.color
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
get hostClasses() {
|
|
158
|
+
return this.styles.root();
|
|
159
|
+
}
|
|
160
|
+
get animationDelay() {
|
|
161
|
+
return `${this.enterDelayMs}ms`;
|
|
162
|
+
}
|
|
163
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
164
|
+
minVersion: "12.0.0",
|
|
165
|
+
version: "22.2.2",
|
|
166
|
+
ngImport: i0,
|
|
167
|
+
type: MnCard,
|
|
168
|
+
deps: [],
|
|
169
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
170
|
+
});
|
|
171
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
172
|
+
minVersion: "17.0.0",
|
|
173
|
+
version: "22.2.2",
|
|
174
|
+
type: MnCard,
|
|
175
|
+
isStandalone: true,
|
|
176
|
+
selector: "mn-card, [mnCard]",
|
|
177
|
+
inputs: {
|
|
178
|
+
data: "data",
|
|
179
|
+
heading: "heading",
|
|
180
|
+
enterDelayMs: "enterDelayMs"
|
|
181
|
+
},
|
|
182
|
+
host: { properties: {
|
|
183
|
+
"class": "this.hostClasses",
|
|
184
|
+
"style.animation-delay": "this.animationDelay"
|
|
185
|
+
} },
|
|
186
|
+
ngImport: i0,
|
|
187
|
+
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",
|
|
188
|
+
dependencies: [{
|
|
189
|
+
kind: "component",
|
|
190
|
+
type: MnIconChip,
|
|
191
|
+
selector: "mn-icon-chip",
|
|
192
|
+
inputs: ["data"]
|
|
193
|
+
}, {
|
|
194
|
+
kind: "pipe",
|
|
195
|
+
type: MnTranslatePipe,
|
|
196
|
+
name: "mnTranslate"
|
|
197
|
+
}]
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
201
|
+
minVersion: "12.0.0",
|
|
202
|
+
version: "22.2.2",
|
|
203
|
+
ngImport: i0,
|
|
204
|
+
type: MnCard,
|
|
205
|
+
decorators: [{
|
|
206
|
+
type: Component,
|
|
207
|
+
args: [{
|
|
208
|
+
selector: "mn-card, [mnCard]",
|
|
209
|
+
standalone: true,
|
|
210
|
+
imports: [MnIconChip, MnTranslatePipe],
|
|
211
|
+
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"
|
|
212
|
+
}]
|
|
213
|
+
}],
|
|
214
|
+
propDecorators: {
|
|
215
|
+
data: [{ type: Input }],
|
|
216
|
+
heading: [{ type: Input }],
|
|
217
|
+
enterDelayMs: [{ type: Input }],
|
|
218
|
+
hostClasses: [{
|
|
219
|
+
type: HostBinding,
|
|
220
|
+
args: ["class"]
|
|
221
|
+
}],
|
|
222
|
+
animationDelay: [{
|
|
223
|
+
type: HostBinding,
|
|
224
|
+
args: ["style.animation-delay"]
|
|
225
|
+
}]
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
var MnStatTile = class MnStatTile {
|
|
229
|
+
label;
|
|
230
|
+
value;
|
|
231
|
+
loading = false;
|
|
232
|
+
data = {};
|
|
233
|
+
hostClasses = "flex flex-1 basis-40 min-w-0";
|
|
234
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
235
|
+
minVersion: "12.0.0",
|
|
236
|
+
version: "22.2.2",
|
|
237
|
+
ngImport: i0,
|
|
238
|
+
type: MnStatTile,
|
|
239
|
+
deps: [],
|
|
240
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
241
|
+
});
|
|
242
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
243
|
+
minVersion: "17.0.0",
|
|
244
|
+
version: "22.2.2",
|
|
245
|
+
type: MnStatTile,
|
|
246
|
+
isStandalone: true,
|
|
247
|
+
selector: "mn-stat-tile",
|
|
248
|
+
inputs: {
|
|
249
|
+
label: "label",
|
|
250
|
+
value: "value",
|
|
251
|
+
loading: "loading",
|
|
252
|
+
data: "data"
|
|
253
|
+
},
|
|
254
|
+
host: { properties: { "class": "this.hostClasses" } },
|
|
255
|
+
ngImport: i0,
|
|
256
|
+
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' }\" [attr.aria-busy]=\"loading || null\">\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 <!-- The skeleton is the height of the number's line box, so the tile keeps its height when it lands. -->\n @if (loading) {\n <mn-skeleton [data]=\"{ width: '2.5rem', height: '1.5rem' }\"></mn-skeleton>\n } @else {\n <span class=\"text-2xl font-bold leading-none tabular-nums text-base-content\">{{ value }}</span>\n <ng-content select=\"[trailing]\"></ng-content>\n }\n </div>\n </div>\n</div>\n",
|
|
257
|
+
dependencies: [
|
|
258
|
+
{
|
|
259
|
+
kind: "component",
|
|
260
|
+
type: MnCard,
|
|
261
|
+
selector: "mn-card, [mnCard]",
|
|
262
|
+
inputs: [
|
|
263
|
+
"data",
|
|
264
|
+
"heading",
|
|
265
|
+
"enterDelayMs"
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
kind: "component",
|
|
270
|
+
type: MnIconChip,
|
|
271
|
+
selector: "mn-icon-chip",
|
|
272
|
+
inputs: ["data"]
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
kind: "component",
|
|
276
|
+
type: MnSkeleton,
|
|
277
|
+
selector: "mn-skeleton",
|
|
278
|
+
inputs: ["data"]
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
kind: "pipe",
|
|
282
|
+
type: MnTranslatePipe,
|
|
283
|
+
name: "mnTranslate"
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
289
|
+
minVersion: "12.0.0",
|
|
290
|
+
version: "22.2.2",
|
|
291
|
+
ngImport: i0,
|
|
292
|
+
type: MnStatTile,
|
|
293
|
+
decorators: [{
|
|
294
|
+
type: Component,
|
|
295
|
+
args: [{
|
|
296
|
+
selector: "mn-stat-tile",
|
|
297
|
+
standalone: true,
|
|
298
|
+
imports: [
|
|
299
|
+
MnCard,
|
|
300
|
+
MnIconChip,
|
|
301
|
+
MnSkeleton,
|
|
302
|
+
MnTranslatePipe
|
|
303
|
+
],
|
|
304
|
+
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' }\" [attr.aria-busy]=\"loading || null\">\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 <!-- The skeleton is the height of the number's line box, so the tile keeps its height when it lands. -->\n @if (loading) {\n <mn-skeleton [data]=\"{ width: '2.5rem', height: '1.5rem' }\"></mn-skeleton>\n } @else {\n <span class=\"text-2xl font-bold leading-none tabular-nums text-base-content\">{{ value }}</span>\n <ng-content select=\"[trailing]\"></ng-content>\n }\n </div>\n </div>\n</div>\n"
|
|
305
|
+
}]
|
|
306
|
+
}],
|
|
307
|
+
propDecorators: {
|
|
308
|
+
label: [{
|
|
309
|
+
type: Input,
|
|
310
|
+
args: [{ required: true }]
|
|
311
|
+
}],
|
|
312
|
+
value: [{
|
|
313
|
+
type: Input,
|
|
314
|
+
args: [{ required: true }]
|
|
315
|
+
}],
|
|
316
|
+
loading: [{ type: Input }],
|
|
317
|
+
data: [{ type: Input }],
|
|
318
|
+
hostClasses: [{
|
|
319
|
+
type: HostBinding,
|
|
320
|
+
args: ["class"]
|
|
321
|
+
}]
|
|
322
|
+
}
|
|
182
323
|
});
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* The card: a rounded surface with a hairline border, a hover response and an
|
|
186
|
-
* optional accent bar along its top edge. The body is whatever the consumer projects,
|
|
187
|
-
* so a booking, a competition and a pending-action tile share one look without
|
|
188
|
-
* sharing a view model.
|
|
189
|
-
*
|
|
190
|
-
* It is an attribute as well as an element, like `mnButton` and `mnBadge`: `<mn-card>`
|
|
191
|
-
* for a plain surface, `<a mnCard [routerLink]>` for a card that is a link,
|
|
192
|
-
* `<section mnCard>` when the landmark matters. Extra classes on the host merge with
|
|
193
|
-
* the card's own, so sizing it (`min-w-0 flex-1`, `lg:w-80`) is ordinary CSS on the
|
|
194
|
-
* element, not an input.
|
|
195
|
-
*
|
|
196
|
-
* A **section card** passes a {@link heading}: the card then renders the shared header
|
|
197
|
-
* row, an {@link MnIconChip} beside an `h2`, then whatever trails the title (a badge, a
|
|
198
|
-
* button). Project the icon with the `cardIcon` attribute and group the trailing content
|
|
199
|
-
* in one `cardHeaderEnd` container, so the template reads icon, header end, body:
|
|
200
|
-
*
|
|
201
|
-
* ```html
|
|
202
|
-
* <mn-card [data]="{ padding: 'md', color: 'primary' }" heading="meetings.agenda.title">
|
|
203
|
-
* <svg cardIcon lucideListOrdered [size]="20"></svg>
|
|
204
|
-
* <ng-container cardHeaderEnd>
|
|
205
|
-
* <span mnBadge [data]="{ size: 'sm', color: 'warning' }">Draft</span>
|
|
206
|
-
* </ng-container>
|
|
207
|
-
* ...body...
|
|
208
|
-
* </mn-card>
|
|
209
|
-
* ```
|
|
210
|
-
*
|
|
211
|
-
* The other members of the family build on this shell: {@link MnStatTile} for one
|
|
212
|
-
* figure at a glance, and {@link MnProportionBar} for the bar inside a card.
|
|
213
|
-
*/
|
|
214
|
-
class MnCard {
|
|
215
|
-
/** Padding, layout, hover, entrance, radius, colour and accent; see {@link MnCardTypes}. */
|
|
216
|
-
data = {};
|
|
217
|
-
/**
|
|
218
|
-
* Section title, as a translation key or a literal. When set, the header row with
|
|
219
|
-
* the icon chip and `h2` renders above the body. Deliberately not called `title`: a
|
|
220
|
-
* static `title="..."` on the host would also become a browser tooltip.
|
|
221
|
-
*/
|
|
222
|
-
heading;
|
|
223
|
-
/**
|
|
224
|
-
* Delay before the entrance animation starts, in milliseconds, so a row of cards
|
|
225
|
-
* can rise one after another. Ignored when {@link MnCardTypes.enter} is `none`.
|
|
226
|
-
*/
|
|
227
|
-
enterDelayMs = 0;
|
|
228
|
-
/** Resolved slot classes for the current configuration. */
|
|
229
|
-
get styles() {
|
|
230
|
-
return mnCardVariants({
|
|
231
|
-
padding: this.data.padding,
|
|
232
|
-
layout: this.data.layout,
|
|
233
|
-
hover: this.data.hover,
|
|
234
|
-
enter: this.data.enter,
|
|
235
|
-
borderRadius: this.data.borderRadius,
|
|
236
|
-
color: this.data.color,
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
/** The card element's own classes; the consumer's static classes merge with them. */
|
|
240
|
-
get hostClasses() {
|
|
241
|
-
return this.styles.root();
|
|
242
|
-
}
|
|
243
|
-
/** Staggers the entrance per card. */
|
|
244
|
-
get animationDelay() {
|
|
245
|
-
return `${this.enterDelayMs}ms`;
|
|
246
|
-
}
|
|
247
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
248
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", 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" }] });
|
|
249
|
-
}
|
|
250
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnCard, decorators: [{
|
|
251
|
-
type: Component,
|
|
252
|
-
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" }]
|
|
253
|
-
}], propDecorators: { data: [{
|
|
254
|
-
type: Input
|
|
255
|
-
}], heading: [{
|
|
256
|
-
type: Input
|
|
257
|
-
}], enterDelayMs: [{
|
|
258
|
-
type: Input
|
|
259
|
-
}], hostClasses: [{
|
|
260
|
-
type: HostBinding,
|
|
261
|
-
args: ['class']
|
|
262
|
-
}], animationDelay: [{
|
|
263
|
-
type: HostBinding,
|
|
264
|
-
args: ['style.animation-delay']
|
|
265
|
-
}] } });
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* One fact at a glance: a tinted icon chip, a muted label and a large tabular number,
|
|
269
|
-
* on the {@link MnCard} shell, in a tile that shares a row with its siblings as
|
|
270
|
-
* `flex-1`. Project the icon as content; project a badge or a short note into the
|
|
271
|
-
* `trailing` slot when the number needs a qualifier. Set `loading` while the figure is still on
|
|
272
|
-
* its way: the tile keeps its label and icon and holds a skeleton where the number goes, so a
|
|
273
|
-
* count that has not arrived never reads as a zero.
|
|
274
|
-
*
|
|
275
|
-
* ```html
|
|
276
|
-
* <div class="flex flex-wrap gap-4">
|
|
277
|
-
* <mn-stat-tile label="meetings.attending" [value]="yesCount" [data]="{ color: 'success' }">
|
|
278
|
-
* <svg lucideCheck [size]="20"></svg>
|
|
279
|
-
* </mn-stat-tile>
|
|
280
|
-
* </div>
|
|
281
|
-
* ```
|
|
282
|
-
*/
|
|
283
|
-
class MnStatTile {
|
|
284
|
-
/** Caption under the number, as a translation key or a literal. */
|
|
285
|
-
label;
|
|
286
|
-
/** The figure, already formatted for display. */
|
|
287
|
-
value;
|
|
288
|
-
/**
|
|
289
|
-
* The figure has not arrived yet: a skeleton takes the number's place, the trailing slot is
|
|
290
|
-
* held back and the tile is marked busy. Label and icon stay, so nothing moves when it lands.
|
|
291
|
-
*/
|
|
292
|
-
loading = false;
|
|
293
|
-
/** Colour of the chip; see {@link MnStatTileTypes}. */
|
|
294
|
-
data = {};
|
|
295
|
-
/** Grows to share its row and never forces the row wider than its siblings. */
|
|
296
|
-
hostClasses = 'flex flex-1 basis-40 min-w-0';
|
|
297
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnStatTile, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
298
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnStatTile, isStandalone: true, selector: "mn-stat-tile", inputs: { label: "label", value: "value", loading: "loading", 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' }\" [attr.aria-busy]=\"loading || null\">\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 <!-- The skeleton is the height of the number's line box, so the tile keeps its height when it lands. -->\n @if (loading) {\n <mn-skeleton [data]=\"{ width: '2.5rem', height: '1.5rem' }\"></mn-skeleton>\n } @else {\n <span class=\"text-2xl font-bold leading-none tabular-nums text-base-content\">{{ value }}</span>\n <ng-content select=\"[trailing]\"></ng-content>\n }\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: "component", type: MnSkeleton, selector: "mn-skeleton", inputs: ["data"] }, { kind: "pipe", type: MnTranslatePipe, name: "mnTranslate" }] });
|
|
299
|
-
}
|
|
300
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnStatTile, decorators: [{
|
|
301
|
-
type: Component,
|
|
302
|
-
args: [{ selector: 'mn-stat-tile', standalone: true, imports: [MnCard, MnIconChip, MnSkeleton, 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' }\" [attr.aria-busy]=\"loading || null\">\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 <!-- The skeleton is the height of the number's line box, so the tile keeps its height when it lands. -->\n @if (loading) {\n <mn-skeleton [data]=\"{ width: '2.5rem', height: '1.5rem' }\"></mn-skeleton>\n } @else {\n <span class=\"text-2xl font-bold leading-none tabular-nums text-base-content\">{{ value }}</span>\n <ng-content select=\"[trailing]\"></ng-content>\n }\n </div>\n </div>\n</div>\n" }]
|
|
303
|
-
}], propDecorators: { label: [{
|
|
304
|
-
type: Input,
|
|
305
|
-
args: [{ required: true }]
|
|
306
|
-
}], value: [{
|
|
307
|
-
type: Input,
|
|
308
|
-
args: [{ required: true }]
|
|
309
|
-
}], loading: [{
|
|
310
|
-
type: Input
|
|
311
|
-
}], data: [{
|
|
312
|
-
type: Input
|
|
313
|
-
}], hostClasses: [{
|
|
314
|
-
type: HostBinding,
|
|
315
|
-
args: ['class']
|
|
316
|
-
}] } });
|
|
317
|
-
|
|
318
|
-
/** Fill class per colour, spelled out so Tailwind's scanner finds every one. */
|
|
319
324
|
const SEGMENT_CLASS = {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
primary: "bg-primary",
|
|
326
|
+
secondary: "bg-secondary",
|
|
327
|
+
accent: "bg-accent",
|
|
328
|
+
success: "bg-success",
|
|
329
|
+
warning: "bg-warning",
|
|
330
|
+
danger: "bg-error",
|
|
331
|
+
gray: "bg-base-content/25"
|
|
327
332
|
};
|
|
328
|
-
/** Tinted fill class per colour for a `soft` segment, spelled out for the same reason. */
|
|
329
333
|
const SOFT_SEGMENT_CLASS = {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
334
|
+
primary: "bg-primary/30",
|
|
335
|
+
secondary: "bg-secondary/30",
|
|
336
|
+
accent: "bg-accent/30",
|
|
337
|
+
success: "bg-success/30",
|
|
338
|
+
warning: "bg-warning/30",
|
|
339
|
+
danger: "bg-error/30",
|
|
340
|
+
gray: "bg-base-content/15"
|
|
337
341
|
};
|
|
338
|
-
/** Track height per size. */
|
|
339
342
|
const HEIGHT_CLASS = {
|
|
340
|
-
|
|
341
|
-
|
|
343
|
+
sm: "h-2",
|
|
344
|
+
md: "h-2.5"
|
|
342
345
|
};
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}], ariaLabel: [{
|
|
422
|
-
type: Input,
|
|
423
|
-
args: [{ required: true }]
|
|
424
|
-
}], ariaLabelParams: [{
|
|
425
|
-
type: Input
|
|
426
|
-
}], data: [{
|
|
427
|
-
type: Input
|
|
428
|
-
}] } });
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Styling for {@link MnBreadcrumbs}, expressed as tailwind-variants slots so the
|
|
432
|
-
* template can pull one class string per role. Theme tokens only, so the trail
|
|
433
|
-
* reads correctly in both light and dark. Links and the Back control are native
|
|
434
|
-
* `<button>`/`<a>` elements reset to look like plain text with a hover accent.
|
|
435
|
-
*
|
|
436
|
-
* A crumb carries vertical padding that the list takes back with a negative
|
|
437
|
-
* margin, so the row keeps the height it always had while each crumb is a
|
|
438
|
-
* target you can hit rather than the bare height of its text. The collapsed
|
|
439
|
-
* control replaces the trail on a phone, where it is the only way up, so it
|
|
440
|
-
* takes a full 44px.
|
|
441
|
-
*/
|
|
346
|
+
var MnProportionBar = class MnProportionBar {
|
|
347
|
+
segments;
|
|
348
|
+
total;
|
|
349
|
+
ariaLabel;
|
|
350
|
+
ariaLabelParams;
|
|
351
|
+
data = {};
|
|
352
|
+
lang = inject(MnLanguageService);
|
|
353
|
+
get label() {
|
|
354
|
+
return this.lang.translate(this.ariaLabel, this.ariaLabelParams);
|
|
355
|
+
}
|
|
356
|
+
get trackClass() {
|
|
357
|
+
return `flex w-full overflow-hidden rounded-full bg-base-content/10 ${HEIGHT_CLASS[this.data.height ?? "md"]}`;
|
|
358
|
+
}
|
|
359
|
+
get denominator() {
|
|
360
|
+
const explicit = this.total;
|
|
361
|
+
if (explicit !== null && explicit !== void 0 && explicit > 0) return explicit;
|
|
362
|
+
return this.segments.reduce((sum, segment) => sum + Math.max(0, segment.value), 0);
|
|
363
|
+
}
|
|
364
|
+
get rendered() {
|
|
365
|
+
const denominator = this.denominator;
|
|
366
|
+
if (denominator <= 0) return [];
|
|
367
|
+
return this.segments.filter((segment) => segment.value > 0).map((segment) => ({
|
|
368
|
+
widthPct: Math.min(100, segment.value / denominator * 100),
|
|
369
|
+
fillClass: (segment.soft ? SOFT_SEGMENT_CLASS : SEGMENT_CLASS)[segment.color]
|
|
370
|
+
}));
|
|
371
|
+
}
|
|
372
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
373
|
+
minVersion: "12.0.0",
|
|
374
|
+
version: "22.2.2",
|
|
375
|
+
ngImport: i0,
|
|
376
|
+
type: MnProportionBar,
|
|
377
|
+
deps: [],
|
|
378
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
379
|
+
});
|
|
380
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
381
|
+
minVersion: "17.0.0",
|
|
382
|
+
version: "22.2.2",
|
|
383
|
+
type: MnProportionBar,
|
|
384
|
+
isStandalone: true,
|
|
385
|
+
selector: "mn-proportion-bar",
|
|
386
|
+
inputs: {
|
|
387
|
+
segments: "segments",
|
|
388
|
+
total: "total",
|
|
389
|
+
ariaLabel: "ariaLabel",
|
|
390
|
+
ariaLabelParams: "ariaLabelParams",
|
|
391
|
+
data: "data"
|
|
392
|
+
},
|
|
393
|
+
ngImport: i0,
|
|
394
|
+
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"
|
|
395
|
+
});
|
|
396
|
+
};
|
|
397
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
398
|
+
minVersion: "12.0.0",
|
|
399
|
+
version: "22.2.2",
|
|
400
|
+
ngImport: i0,
|
|
401
|
+
type: MnProportionBar,
|
|
402
|
+
decorators: [{
|
|
403
|
+
type: Component,
|
|
404
|
+
args: [{
|
|
405
|
+
selector: "mn-proportion-bar",
|
|
406
|
+
standalone: true,
|
|
407
|
+
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"
|
|
408
|
+
}]
|
|
409
|
+
}],
|
|
410
|
+
propDecorators: {
|
|
411
|
+
segments: [{
|
|
412
|
+
type: Input,
|
|
413
|
+
args: [{ required: true }]
|
|
414
|
+
}],
|
|
415
|
+
total: [{ type: Input }],
|
|
416
|
+
ariaLabel: [{
|
|
417
|
+
type: Input,
|
|
418
|
+
args: [{ required: true }]
|
|
419
|
+
}],
|
|
420
|
+
ariaLabelParams: [{ type: Input }],
|
|
421
|
+
data: [{ type: Input }]
|
|
422
|
+
}
|
|
423
|
+
});
|
|
442
424
|
const mnBreadcrumbsVariants = tv({
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
425
|
+
slots: {
|
|
426
|
+
root: "flex items-center",
|
|
427
|
+
list: "flex flex-wrap items-center -my-1.5",
|
|
428
|
+
link: "inline-flex items-center bg-transparent border-0 px-1 -mx-1 py-1.5 rounded-md cursor-pointer text-base-content/60 hover:text-primary transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
429
|
+
current: "inline-flex items-center py-1.5 font-semibold text-base-content",
|
|
430
|
+
separator: "inline-flex shrink-0 text-base-content/40",
|
|
431
|
+
back: "inline-flex items-center gap-1 bg-transparent border-0 p-0 rounded-md cursor-pointer text-base-content/70 hover:text-primary transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
432
|
+
collapsed: "inline-flex min-h-11 items-center gap-1 bg-transparent border-0 px-1 -mx-1 rounded-md cursor-pointer text-base-content/70 hover:text-primary transition-colors sm:hidden focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"
|
|
433
|
+
},
|
|
434
|
+
variants: {
|
|
435
|
+
size: {
|
|
436
|
+
sm: {
|
|
437
|
+
root: "text-xs",
|
|
438
|
+
list: "gap-1"
|
|
439
|
+
},
|
|
440
|
+
md: {
|
|
441
|
+
root: "text-sm",
|
|
442
|
+
list: "gap-1.5"
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
collapsible: {
|
|
446
|
+
true: { list: "hidden sm:flex" },
|
|
447
|
+
false: {}
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
defaultVariants: {
|
|
451
|
+
size: "md",
|
|
452
|
+
collapsible: false
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
const ICONS = lucideIcons({
|
|
456
|
+
ChevronLeft: lucide.ChevronLeft,
|
|
457
|
+
ChevronRight: lucide.ChevronRight
|
|
458
|
+
});
|
|
459
|
+
var MnBreadcrumbs = class MnBreadcrumbs {
|
|
460
|
+
icons = ICONS;
|
|
461
|
+
data = { items: [] };
|
|
462
|
+
crumbClick = new EventEmitter();
|
|
463
|
+
back = new EventEmitter();
|
|
464
|
+
static BACK_LABEL_KEY = "mnBreadcrumbs.back";
|
|
465
|
+
static NAV_LABEL_KEY = "mnBreadcrumbs.label";
|
|
466
|
+
lang = inject(MnLanguageService);
|
|
467
|
+
get styles() {
|
|
468
|
+
return mnBreadcrumbsVariants({
|
|
469
|
+
size: this.data.size,
|
|
470
|
+
collapsible: this.collapsesToParent
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
get collapsesToParent() {
|
|
474
|
+
return this.data.collapse !== "never" && (this.data.items?.length ?? 0) > 1;
|
|
475
|
+
}
|
|
476
|
+
get parentCrumb() {
|
|
477
|
+
if (!this.collapsesToParent) return null;
|
|
478
|
+
return this.data.items[this.data.items.length - 2];
|
|
479
|
+
}
|
|
480
|
+
get navLabel() {
|
|
481
|
+
return this.lang.translateIfPresent(MnBreadcrumbs.NAV_LABEL_KEY) ?? "Breadcrumb";
|
|
482
|
+
}
|
|
483
|
+
get hasTrail() {
|
|
484
|
+
return (this.data.items?.length ?? 0) > 0;
|
|
485
|
+
}
|
|
486
|
+
get backLabel() {
|
|
487
|
+
if (this.data.backLabel) return this.lang.translate(this.data.backLabel);
|
|
488
|
+
return this.lang.translateIfPresent(MnBreadcrumbs.BACK_LABEL_KEY) ?? "Back";
|
|
489
|
+
}
|
|
490
|
+
isCurrent(index) {
|
|
491
|
+
return index === this.data.items.length - 1;
|
|
492
|
+
}
|
|
493
|
+
onCrumb(item) {
|
|
494
|
+
item.onClick?.();
|
|
495
|
+
this.crumbClick.emit(item);
|
|
496
|
+
}
|
|
497
|
+
onBack() {
|
|
498
|
+
this.back.emit();
|
|
499
|
+
if (!this.data.backHref) window.history.back();
|
|
500
|
+
}
|
|
501
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
502
|
+
minVersion: "12.0.0",
|
|
503
|
+
version: "22.2.2",
|
|
504
|
+
ngImport: i0,
|
|
505
|
+
type: MnBreadcrumbs,
|
|
506
|
+
deps: [],
|
|
507
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
508
|
+
});
|
|
509
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
510
|
+
minVersion: "17.0.0",
|
|
511
|
+
version: "22.2.2",
|
|
512
|
+
type: MnBreadcrumbs,
|
|
513
|
+
isStandalone: true,
|
|
514
|
+
selector: "mn-breadcrumbs",
|
|
515
|
+
inputs: { data: "data" },
|
|
516
|
+
outputs: {
|
|
517
|
+
crumbClick: "crumbClick",
|
|
518
|
+
back: "back"
|
|
519
|
+
},
|
|
520
|
+
ngImport: i0,
|
|
521
|
+
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 <!--\n Below `sm` the trail above is hidden and this takes its place: the parent\n crumb as a back control. Both sit in the DOM and CSS decides which one is\n there for the reader, so nothing has to measure a width.\n -->\n @if (parentCrumb; as parent) {\n @if (parent.href) {\n <a [attr.href]=\"parent.href\" [class]=\"styles.collapsed()\" (click)=\"onCrumb(parent)\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ parent.label | mnTranslate }}\n </a>\n } @else {\n <button type=\"button\" [class]=\"styles.collapsed()\" (click)=\"onCrumb(parent)\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ parent.label | mnTranslate }}\n </button>\n }\n }\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",
|
|
522
|
+
dependencies: [{
|
|
523
|
+
kind: "component",
|
|
524
|
+
type: LucideDynamicIcon,
|
|
525
|
+
selector: "svg[lucideIcon]",
|
|
526
|
+
inputs: ["lucideIcon"]
|
|
527
|
+
}, {
|
|
528
|
+
kind: "pipe",
|
|
529
|
+
type: MnTranslatePipe,
|
|
530
|
+
name: "mnTranslate"
|
|
531
|
+
}]
|
|
532
|
+
});
|
|
533
|
+
};
|
|
534
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
535
|
+
minVersion: "12.0.0",
|
|
536
|
+
version: "22.2.2",
|
|
537
|
+
ngImport: i0,
|
|
538
|
+
type: MnBreadcrumbs,
|
|
539
|
+
decorators: [{
|
|
540
|
+
type: Component,
|
|
541
|
+
args: [{
|
|
542
|
+
selector: "mn-breadcrumbs",
|
|
543
|
+
standalone: true,
|
|
544
|
+
imports: [MnTranslatePipe, LucideDynamicIcon],
|
|
545
|
+
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 <!--\n Below `sm` the trail above is hidden and this takes its place: the parent\n crumb as a back control. Both sit in the DOM and CSS decides which one is\n there for the reader, so nothing has to measure a width.\n -->\n @if (parentCrumb; as parent) {\n @if (parent.href) {\n <a [attr.href]=\"parent.href\" [class]=\"styles.collapsed()\" (click)=\"onCrumb(parent)\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ parent.label | mnTranslate }}\n </a>\n } @else {\n <button type=\"button\" [class]=\"styles.collapsed()\" (click)=\"onCrumb(parent)\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ parent.label | mnTranslate }}\n </button>\n }\n }\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"
|
|
546
|
+
}]
|
|
547
|
+
}],
|
|
548
|
+
propDecorators: {
|
|
549
|
+
data: [{ type: Input }],
|
|
550
|
+
crumbClick: [{ type: Output }],
|
|
551
|
+
back: [{ type: Output }]
|
|
552
|
+
}
|
|
475
553
|
});
|
|
476
|
-
|
|
477
|
-
/** Lucide icons this file renders. */
|
|
478
|
-
const ICONS = lucideIcons({ ChevronLeft: lucide.ChevronLeft, ChevronRight: lucide.ChevronRight });
|
|
479
|
-
/**
|
|
480
|
-
* A flexible breadcrumb trail.
|
|
481
|
-
*
|
|
482
|
-
* Given crumbs it renders a linkable trail (`root › … › current`) where the last
|
|
483
|
-
* crumb is the current page and is never a link. Given no crumbs it degrades to
|
|
484
|
-
* a single "Back" control — the two are mutually exclusive.
|
|
485
|
-
*
|
|
486
|
-
* The one thing a width decides is how much of the trail shows: below `sm` the
|
|
487
|
-
* crumbs give way to the parent crumb alone, drawn as a back control, unless
|
|
488
|
-
* `data.collapse` is `'never'`. That measures nothing — both renderings sit in
|
|
489
|
-
* the DOM and a Tailwind breakpoint hides one — and there is deliberately no
|
|
490
|
-
* scroll machinery: on a phone a hierarchy is a way up rather than a map, and a
|
|
491
|
-
* trail that scrolls sideways buries the one link anybody reaches for.
|
|
492
|
-
*
|
|
493
|
-
* Navigation stays router- and history-agnostic where possible: a crumb (or the
|
|
494
|
-
* Back control) with an `href` renders a plain `<a>` and navigates natively;
|
|
495
|
-
* otherwise clicks emit outputs for the app to handle. Only the Back fallback
|
|
496
|
-
* with no `href` reaches for `history.back()`.
|
|
497
|
-
*/
|
|
498
|
-
class MnBreadcrumbs {
|
|
499
|
-
/** Lucide icons the template renders. */
|
|
500
|
-
icons = ICONS;
|
|
501
|
-
/** Trail crumbs and Back-fallback configuration. */
|
|
502
|
-
data = { items: [] };
|
|
503
|
-
/** Emits the crumb that was clicked (non-current crumbs only). */
|
|
504
|
-
crumbClick = new EventEmitter();
|
|
505
|
-
/** Emits when the fallback "Back" control is activated. */
|
|
506
|
-
back = new EventEmitter();
|
|
507
|
-
/** Conventional key an app defines to translate the Back control's label. */
|
|
508
|
-
static BACK_LABEL_KEY = 'mnBreadcrumbs.back';
|
|
509
|
-
/** Conventional key an app defines to name the navigation landmark. */
|
|
510
|
-
static NAV_LABEL_KEY = 'mnBreadcrumbs.label';
|
|
511
|
-
/** Resolves this component's own labels against the app's bundle. */
|
|
512
|
-
lang = inject(MnLanguageService);
|
|
513
|
-
/** Resolved tailwind-variants slot functions for the current size. */
|
|
514
|
-
get styles() {
|
|
515
|
-
return mnBreadcrumbsVariants({ size: this.data.size, collapsible: this.collapsesToParent });
|
|
516
|
-
}
|
|
517
|
-
/** Whether the parent crumb replaces the trail below `sm`. */
|
|
518
|
-
get collapsesToParent() {
|
|
519
|
-
return this.data.collapse !== 'never' && (this.data.items?.length ?? 0) > 1;
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* The crumb one level above the current page, or `null` when the trail stays
|
|
523
|
-
* whole: a single crumb has nowhere to go up to, and `'never'` asks for every
|
|
524
|
-
* crumb at every width.
|
|
525
|
-
*/
|
|
526
|
-
get parentCrumb() {
|
|
527
|
-
if (!this.collapsesToParent) {
|
|
528
|
-
return null;
|
|
529
|
-
}
|
|
530
|
-
return this.data.items[this.data.items.length - 2];
|
|
531
|
-
}
|
|
532
|
-
/**
|
|
533
|
-
* Accessible name of the `<nav>` landmark.
|
|
534
|
-
*
|
|
535
|
-
* A landmark's name is announced verbatim, so leaving it as a hardcoded English
|
|
536
|
-
* "Breadcrumb" put one English word into every page of a translated app — in the
|
|
537
|
-
* one place only screen-reader users hear.
|
|
538
|
-
*/
|
|
539
|
-
get navLabel() {
|
|
540
|
-
return this.lang.translateIfPresent(MnBreadcrumbs.NAV_LABEL_KEY) ?? 'Breadcrumb';
|
|
541
|
-
}
|
|
542
|
-
/** Whether a linkable trail should render (vs the Back fallback). */
|
|
543
|
-
get hasTrail() {
|
|
544
|
-
return (this.data.items?.length ?? 0) > 0;
|
|
545
|
-
}
|
|
546
|
-
/**
|
|
547
|
-
* Text of the Back control, already translated.
|
|
548
|
-
*
|
|
549
|
-
* `data.backLabel` is a key (or a literal, which `translate` passes through
|
|
550
|
-
* unchanged). Without one this falls back to the conventional key and then to
|
|
551
|
-
* English — never to a raw key: the old default was the bare key `'back'`, which
|
|
552
|
-
* the template's translate pipe echoed as lowercase "back" in every app that had
|
|
553
|
-
* not happened to define it.
|
|
554
|
-
*/
|
|
555
|
-
get backLabel() {
|
|
556
|
-
if (this.data.backLabel) {
|
|
557
|
-
return this.lang.translate(this.data.backLabel);
|
|
558
|
-
}
|
|
559
|
-
return this.lang.translateIfPresent(MnBreadcrumbs.BACK_LABEL_KEY) ?? 'Back';
|
|
560
|
-
}
|
|
561
|
-
/** The last crumb is the current page and is rendered as plain text. */
|
|
562
|
-
isCurrent(index) {
|
|
563
|
-
return index === this.data.items.length - 1;
|
|
564
|
-
}
|
|
565
|
-
/** Runs a crumb's own callback and notifies listeners of the click. */
|
|
566
|
-
onCrumb(item) {
|
|
567
|
-
item.onClick?.();
|
|
568
|
-
this.crumbClick.emit(item);
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Fallback Back action. Always emits `back` for listeners; when no `backHref`
|
|
572
|
-
* anchor is carrying the navigation, steps back through browser history.
|
|
573
|
-
*/
|
|
574
|
-
onBack() {
|
|
575
|
-
this.back.emit();
|
|
576
|
-
if (!this.data.backHref) {
|
|
577
|
-
window.history.back();
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnBreadcrumbs, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
581
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", 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 <!--\n Below `sm` the trail above is hidden and this takes its place: the parent\n crumb as a back control. Both sit in the DOM and CSS decides which one is\n there for the reader, so nothing has to measure a width.\n -->\n @if (parentCrumb; as parent) {\n @if (parent.href) {\n <a [attr.href]=\"parent.href\" [class]=\"styles.collapsed()\" (click)=\"onCrumb(parent)\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ parent.label | mnTranslate }}\n </a>\n } @else {\n <button type=\"button\" [class]=\"styles.collapsed()\" (click)=\"onCrumb(parent)\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ parent.label | mnTranslate }}\n </button>\n }\n }\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" }] });
|
|
582
|
-
}
|
|
583
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnBreadcrumbs, decorators: [{
|
|
584
|
-
type: Component,
|
|
585
|
-
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 <!--\n Below `sm` the trail above is hidden and this takes its place: the parent\n crumb as a back control. Both sit in the DOM and CSS decides which one is\n there for the reader, so nothing has to measure a width.\n -->\n @if (parentCrumb; as parent) {\n @if (parent.href) {\n <a [attr.href]=\"parent.href\" [class]=\"styles.collapsed()\" (click)=\"onCrumb(parent)\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ parent.label | mnTranslate }}\n </a>\n } @else {\n <button type=\"button\" [class]=\"styles.collapsed()\" (click)=\"onCrumb(parent)\">\n <svg [size]=\"16\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n {{ parent.label | mnTranslate }}\n </button>\n }\n }\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" }]
|
|
586
|
-
}], propDecorators: { data: [{
|
|
587
|
-
type: Input
|
|
588
|
-
}], crumbClick: [{
|
|
589
|
-
type: Output
|
|
590
|
-
}], back: [{
|
|
591
|
-
type: Output
|
|
592
|
-
}] } });
|
|
593
|
-
|
|
594
554
|
const mnIconVariants = tv({
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
},
|
|
607
|
-
defaultVariants: {
|
|
608
|
-
color: 'current',
|
|
609
|
-
},
|
|
555
|
+
base: "inline-flex shrink-0",
|
|
556
|
+
variants: { color: {
|
|
557
|
+
current: "text-current",
|
|
558
|
+
primary: "text-primary",
|
|
559
|
+
secondary: "text-secondary",
|
|
560
|
+
danger: "text-error",
|
|
561
|
+
warning: "text-warning",
|
|
562
|
+
success: "text-success",
|
|
563
|
+
accent: "text-accent"
|
|
564
|
+
} },
|
|
565
|
+
defaultVariants: { color: "current" }
|
|
610
566
|
});
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
567
|
+
const MN_ICON_MAP = { pistol: `<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>` };
|
|
568
|
+
var MnIcon = class MnIcon {
|
|
569
|
+
data = {};
|
|
570
|
+
sanitizer = inject(DomSanitizer);
|
|
571
|
+
el = inject(ElementRef);
|
|
572
|
+
svgContent = "";
|
|
573
|
+
get iconSize() {
|
|
574
|
+
return this.data.size ?? 24;
|
|
575
|
+
}
|
|
576
|
+
get hostClasses() {
|
|
577
|
+
return mnIconVariants({ color: this.data.color });
|
|
578
|
+
}
|
|
579
|
+
resolvedName = null;
|
|
580
|
+
ngOnInit() {
|
|
581
|
+
const attrs = this.el.nativeElement.attributes;
|
|
582
|
+
for (const item of Array.from(attrs)) {
|
|
583
|
+
const attr = item.name.toLowerCase();
|
|
584
|
+
if (attr.startsWith("mnicon")) {
|
|
585
|
+
const iconKey = attr.slice(6);
|
|
586
|
+
for (const key of Object.keys(MN_ICON_MAP)) if (key.toLowerCase() === iconKey) {
|
|
587
|
+
this.resolvedName = key;
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
if (this.resolvedName) break;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
this.updateContent();
|
|
594
|
+
}
|
|
595
|
+
ngOnChanges() {
|
|
596
|
+
this.updateContent();
|
|
597
|
+
}
|
|
598
|
+
updateContent() {
|
|
599
|
+
const name = this.data.name ?? this.resolvedName;
|
|
600
|
+
if (name) {
|
|
601
|
+
const raw = MN_ICON_MAP[name];
|
|
602
|
+
if (raw) {
|
|
603
|
+
const size = this.iconSize;
|
|
604
|
+
if (raw.trim().startsWith("<svg")) {
|
|
605
|
+
const sized = raw.replace(/<svg([^>]*)>/, (_match, attrs) => {
|
|
606
|
+
let updated = attrs.replace(/width="[^"]*"/, `width="${size}"`);
|
|
607
|
+
updated = updated.replace(/height="[^"]*"/, `height="${size}"`);
|
|
608
|
+
if (!attrs.includes("width=")) updated += ` width="${size}"`;
|
|
609
|
+
if (!attrs.includes("height=")) updated += ` height="${size}"`;
|
|
610
|
+
return `<svg${updated}>`;
|
|
611
|
+
});
|
|
612
|
+
this.svgContent = this.sanitizer.bypassSecurityTrustHtml(sized);
|
|
613
|
+
} else {
|
|
614
|
+
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>`;
|
|
615
|
+
this.svgContent = this.sanitizer.bypassSecurityTrustHtml(svg);
|
|
616
|
+
}
|
|
617
|
+
} else this.svgContent = "";
|
|
618
|
+
} else this.svgContent = "";
|
|
619
|
+
}
|
|
620
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
621
|
+
minVersion: "12.0.0",
|
|
622
|
+
version: "22.2.2",
|
|
623
|
+
ngImport: i0,
|
|
624
|
+
type: MnIcon,
|
|
625
|
+
deps: [],
|
|
626
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
627
|
+
});
|
|
628
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
629
|
+
minVersion: "14.0.0",
|
|
630
|
+
version: "22.2.2",
|
|
631
|
+
type: MnIcon,
|
|
632
|
+
isStandalone: true,
|
|
633
|
+
selector: "mn-icon",
|
|
634
|
+
inputs: { data: "data" },
|
|
635
|
+
host: { properties: { "class": "this.hostClasses" } },
|
|
636
|
+
usesOnChanges: true,
|
|
637
|
+
ngImport: i0,
|
|
638
|
+
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"
|
|
639
|
+
});
|
|
619
640
|
};
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
});
|
|
673
|
-
this.svgContent = this.sanitizer.bypassSecurityTrustHtml(sized);
|
|
674
|
-
}
|
|
675
|
-
else {
|
|
676
|
-
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>`;
|
|
677
|
-
this.svgContent = this.sanitizer.bypassSecurityTrustHtml(svg);
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
else {
|
|
681
|
-
this.svgContent = '';
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
else {
|
|
685
|
-
this.svgContent = '';
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
689
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", 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" });
|
|
690
|
-
}
|
|
691
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnIcon, decorators: [{
|
|
692
|
-
type: Component,
|
|
693
|
-
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" }]
|
|
694
|
-
}], propDecorators: { data: [{
|
|
695
|
-
type: Input
|
|
696
|
-
}], hostClasses: [{
|
|
697
|
-
type: HostBinding,
|
|
698
|
-
args: ['class']
|
|
699
|
-
}] } });
|
|
700
|
-
|
|
701
|
-
// AUTO-GENERATED — do not edit manually.
|
|
702
|
-
// Run `npm run generate:icons` to regenerate after modifying MN_ICON_MAP.
|
|
703
|
-
class MnIconAttributes {
|
|
704
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnIconAttributes, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
705
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.7", type: MnIconAttributes, isStandalone: true, selector: "mn-icon[mnIconPistol]", ngImport: i0 });
|
|
706
|
-
}
|
|
707
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnIconAttributes, decorators: [{
|
|
708
|
-
type: Directive,
|
|
709
|
-
args: [{
|
|
710
|
-
selector: 'mn-icon[mnIconPistol]',
|
|
711
|
-
standalone: true,
|
|
712
|
-
}]
|
|
713
|
-
}] });
|
|
714
|
-
|
|
715
|
-
/**
|
|
716
|
-
* Public API of the `mn-angular-lib/display` entry point: display components (card, breadcrumbs, icon).
|
|
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
|
-
|
|
641
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
642
|
+
minVersion: "12.0.0",
|
|
643
|
+
version: "22.2.2",
|
|
644
|
+
ngImport: i0,
|
|
645
|
+
type: MnIcon,
|
|
646
|
+
decorators: [{
|
|
647
|
+
type: Component,
|
|
648
|
+
args: [{
|
|
649
|
+
selector: "mn-icon",
|
|
650
|
+
standalone: true,
|
|
651
|
+
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"
|
|
652
|
+
}]
|
|
653
|
+
}],
|
|
654
|
+
propDecorators: {
|
|
655
|
+
data: [{ type: Input }],
|
|
656
|
+
hostClasses: [{
|
|
657
|
+
type: HostBinding,
|
|
658
|
+
args: ["class"]
|
|
659
|
+
}]
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
var MnIconAttributes = class MnIconAttributes {
|
|
663
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
664
|
+
minVersion: "12.0.0",
|
|
665
|
+
version: "22.2.2",
|
|
666
|
+
ngImport: i0,
|
|
667
|
+
type: MnIconAttributes,
|
|
668
|
+
deps: [],
|
|
669
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
670
|
+
});
|
|
671
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
672
|
+
minVersion: "14.0.0",
|
|
673
|
+
version: "22.2.2",
|
|
674
|
+
type: MnIconAttributes,
|
|
675
|
+
isStandalone: true,
|
|
676
|
+
selector: "mn-icon[mnIconPistol]",
|
|
677
|
+
ngImport: i0
|
|
678
|
+
});
|
|
679
|
+
};
|
|
680
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
681
|
+
minVersion: "12.0.0",
|
|
682
|
+
version: "22.2.2",
|
|
683
|
+
ngImport: i0,
|
|
684
|
+
type: MnIconAttributes,
|
|
685
|
+
decorators: [{
|
|
686
|
+
type: Directive,
|
|
687
|
+
args: [{
|
|
688
|
+
selector: "mn-icon[mnIconPistol]",
|
|
689
|
+
standalone: true
|
|
690
|
+
}]
|
|
691
|
+
}]
|
|
692
|
+
});
|
|
727
693
|
export { MN_ICON_MAP, MnBreadcrumbs, MnCard, MnIcon, MnIconAttributes, MnIconChip, MnProportionBar, MnStatTile, mnBreadcrumbsVariants, mnCardVariants, mnIconChipVariants, mnIconVariants };
|
|
728
|
-
|
|
694
|
+
|
|
695
|
+
//# sourceMappingURL=mn-angular-lib-display.mjs.map
|