@area8975/ui 0.2.2-dev.49 → 0.2.2-dev.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/fesm2022/area8975-ui-alert.mjs +113 -0
- package/fesm2022/area8975-ui-alert.mjs.map +1 -0
- package/fesm2022/area8975-ui-avatar.mjs +157 -0
- package/fesm2022/area8975-ui-avatar.mjs.map +1 -0
- package/fesm2022/area8975-ui-badge.mjs +116 -0
- package/fesm2022/area8975-ui-badge.mjs.map +1 -0
- package/fesm2022/area8975-ui-button.mjs +314 -0
- package/fesm2022/area8975-ui-button.mjs.map +1 -0
- package/fesm2022/area8975-ui-calendar.mjs +549 -0
- package/fesm2022/area8975-ui-calendar.mjs.map +1 -0
- package/fesm2022/area8975-ui-card-header.mjs +96 -0
- package/fesm2022/area8975-ui-card-header.mjs.map +1 -0
- package/fesm2022/area8975-ui-card.mjs +73 -0
- package/fesm2022/area8975-ui-card.mjs.map +1 -0
- package/fesm2022/area8975-ui-chart-palette.mjs +225 -0
- package/fesm2022/area8975-ui-chart-palette.mjs.map +1 -0
- package/fesm2022/area8975-ui-charts.mjs +2813 -0
- package/fesm2022/area8975-ui-charts.mjs.map +1 -0
- package/fesm2022/area8975-ui-checkbox.mjs +202 -0
- package/fesm2022/area8975-ui-checkbox.mjs.map +1 -0
- package/fesm2022/area8975-ui-colour.mjs +200 -0
- package/fesm2022/area8975-ui-colour.mjs.map +1 -0
- package/fesm2022/area8975-ui-container.mjs +40 -0
- package/fesm2022/area8975-ui-container.mjs.map +1 -0
- package/fesm2022/area8975-ui-counter.mjs +246 -0
- package/fesm2022/area8975-ui-counter.mjs.map +1 -0
- package/fesm2022/area8975-ui-date-range-picker.mjs +554 -0
- package/fesm2022/area8975-ui-date-range-picker.mjs.map +1 -0
- package/fesm2022/area8975-ui-datepicker.mjs +547 -0
- package/fesm2022/area8975-ui-datepicker.mjs.map +1 -0
- package/fesm2022/area8975-ui-disclosure.mjs +279 -0
- package/fesm2022/area8975-ui-disclosure.mjs.map +1 -0
- package/fesm2022/area8975-ui-drawer.mjs +106 -0
- package/fesm2022/area8975-ui-drawer.mjs.map +1 -0
- package/fesm2022/area8975-ui-dropdown-button.mjs +141 -0
- package/fesm2022/area8975-ui-dropdown-button.mjs.map +1 -0
- package/fesm2022/area8975-ui-dropdown-menu.mjs +96 -0
- package/fesm2022/area8975-ui-dropdown-menu.mjs.map +1 -0
- package/fesm2022/area8975-ui-dropdown.mjs +208 -0
- package/fesm2022/area8975-ui-dropdown.mjs.map +1 -0
- package/fesm2022/area8975-ui-dropzone.mjs +332 -0
- package/fesm2022/area8975-ui-dropzone.mjs.map +1 -0
- package/fesm2022/area8975-ui-field.mjs +191 -0
- package/fesm2022/area8975-ui-field.mjs.map +1 -0
- package/fesm2022/area8975-ui-file-input.mjs +340 -0
- package/fesm2022/area8975-ui-file-input.mjs.map +1 -0
- package/fesm2022/area8975-ui-file.mjs +47 -0
- package/fesm2022/area8975-ui-file.mjs.map +1 -0
- package/fesm2022/area8975-ui-format.mjs +70 -0
- package/fesm2022/area8975-ui-format.mjs.map +1 -0
- package/fesm2022/area8975-ui-input-addon.mjs +42 -0
- package/fesm2022/area8975-ui-input-addon.mjs.map +1 -0
- package/fesm2022/area8975-ui-input-group.mjs +86 -0
- package/fesm2022/area8975-ui-input-group.mjs.map +1 -0
- package/fesm2022/area8975-ui-input.mjs +682 -0
- package/fesm2022/area8975-ui-input.mjs.map +1 -0
- package/fesm2022/area8975-ui-kpi.mjs +167 -0
- package/fesm2022/area8975-ui-kpi.mjs.map +1 -0
- package/fesm2022/area8975-ui-layout.mjs +63 -0
- package/fesm2022/area8975-ui-layout.mjs.map +1 -0
- package/fesm2022/area8975-ui-loading.mjs +76 -0
- package/fesm2022/area8975-ui-loading.mjs.map +1 -0
- package/fesm2022/area8975-ui-modal-close-btn.mjs +89 -0
- package/fesm2022/area8975-ui-modal-close-btn.mjs.map +1 -0
- package/fesm2022/area8975-ui-modal.mjs +235 -0
- package/fesm2022/area8975-ui-modal.mjs.map +1 -0
- package/fesm2022/area8975-ui-money.mjs +230 -0
- package/fesm2022/area8975-ui-money.mjs.map +1 -0
- package/fesm2022/area8975-ui-overlay.mjs +317 -0
- package/fesm2022/area8975-ui-overlay.mjs.map +1 -0
- package/fesm2022/area8975-ui-pagination.mjs +152 -0
- package/fesm2022/area8975-ui-pagination.mjs.map +1 -0
- package/fesm2022/area8975-ui-private.mjs +63 -0
- package/fesm2022/area8975-ui-private.mjs.map +1 -0
- package/fesm2022/area8975-ui-progress.mjs +307 -0
- package/fesm2022/area8975-ui-progress.mjs.map +1 -0
- package/fesm2022/area8975-ui-radio.mjs +199 -0
- package/fesm2022/area8975-ui-radio.mjs.map +1 -0
- package/fesm2022/area8975-ui-rich-text-editor.mjs +778 -0
- package/fesm2022/area8975-ui-rich-text-editor.mjs.map +1 -0
- package/fesm2022/area8975-ui-search.mjs +266 -0
- package/fesm2022/area8975-ui-search.mjs.map +1 -0
- package/fesm2022/area8975-ui-segmented.mjs +118 -0
- package/fesm2022/area8975-ui-segmented.mjs.map +1 -0
- package/fesm2022/area8975-ui-select.mjs +926 -0
- package/fesm2022/area8975-ui-select.mjs.map +1 -0
- package/fesm2022/area8975-ui-sidebar-group.mjs +60 -0
- package/fesm2022/area8975-ui-sidebar-group.mjs.map +1 -0
- package/fesm2022/area8975-ui-sidebar-item.mjs +107 -0
- package/fesm2022/area8975-ui-sidebar-item.mjs.map +1 -0
- package/fesm2022/area8975-ui-sidebar.mjs +109 -0
- package/fesm2022/area8975-ui-sidebar.mjs.map +1 -0
- package/fesm2022/area8975-ui-skeleton.mjs +116 -0
- package/fesm2022/area8975-ui-skeleton.mjs.map +1 -0
- package/fesm2022/area8975-ui-stat.mjs +55 -0
- package/fesm2022/area8975-ui-stat.mjs.map +1 -0
- package/fesm2022/area8975-ui-switch.mjs +132 -0
- package/fesm2022/area8975-ui-switch.mjs.map +1 -0
- package/fesm2022/area8975-ui-tab.mjs +217 -0
- package/fesm2022/area8975-ui-tab.mjs.map +1 -0
- package/fesm2022/area8975-ui-table-filters.mjs +499 -0
- package/fesm2022/area8975-ui-table-filters.mjs.map +1 -0
- package/fesm2022/area8975-ui-table.mjs +1237 -0
- package/fesm2022/area8975-ui-table.mjs.map +1 -0
- package/fesm2022/area8975-ui-textarea.mjs +375 -0
- package/fesm2022/area8975-ui-textarea.mjs.map +1 -0
- package/fesm2022/area8975-ui-theme.mjs +246 -0
- package/fesm2022/area8975-ui-theme.mjs.map +1 -0
- package/fesm2022/area8975-ui-time-select.mjs +170 -0
- package/fesm2022/area8975-ui-time-select.mjs.map +1 -0
- package/fesm2022/area8975-ui-toast.mjs +269 -0
- package/fesm2022/area8975-ui-toast.mjs.map +1 -0
- package/fesm2022/area8975-ui-toaster.mjs +117 -0
- package/fesm2022/area8975-ui-toaster.mjs.map +1 -0
- package/fesm2022/area8975-ui-tooltip.mjs +196 -0
- package/fesm2022/area8975-ui-tooltip.mjs.map +1 -0
- package/fesm2022/area8975-ui-user-menu.mjs +186 -0
- package/fesm2022/area8975-ui-user-menu.mjs.map +1 -0
- package/fesm2022/area8975-ui.mjs +0 -16520
- package/package.json +237 -1
- package/types/area8975-ui-alert.d.ts +25 -0
- package/types/area8975-ui-avatar.d.ts +40 -0
- package/types/area8975-ui-badge.d.ts +31 -0
- package/types/area8975-ui-button.d.ts +129 -0
- package/types/area8975-ui-calendar.d.ts +177 -0
- package/types/area8975-ui-card-header.d.ts +28 -0
- package/types/area8975-ui-card.d.ts +18 -0
- package/types/area8975-ui-chart-palette.d.ts +176 -0
- package/types/area8975-ui-charts.d.ts +747 -0
- package/types/area8975-ui-checkbox.d.ts +61 -0
- package/types/area8975-ui-colour.d.ts +31 -0
- package/types/area8975-ui-container.d.ts +5 -0
- package/types/area8975-ui-counter.d.ts +43 -0
- package/types/area8975-ui-date-range-picker.d.ts +132 -0
- package/types/area8975-ui-datepicker.d.ts +124 -0
- package/types/area8975-ui-disclosure.d.ts +79 -0
- package/types/area8975-ui-drawer.d.ts +25 -0
- package/types/area8975-ui-dropdown-button.d.ts +32 -0
- package/types/area8975-ui-dropdown-menu.d.ts +25 -0
- package/types/area8975-ui-dropdown.d.ts +56 -0
- package/types/area8975-ui-dropzone.d.ts +96 -0
- package/types/area8975-ui-field.d.ts +72 -0
- package/types/area8975-ui-file-input.d.ts +72 -0
- package/types/area8975-ui-file.d.ts +21 -0
- package/types/area8975-ui-format.d.ts +37 -0
- package/types/area8975-ui-input-addon.d.ts +10 -0
- package/types/area8975-ui-input-group.d.ts +18 -0
- package/types/area8975-ui-input.d.ts +224 -0
- package/types/area8975-ui-kpi.d.ts +36 -0
- package/types/area8975-ui-layout.d.ts +7 -0
- package/types/area8975-ui-loading.d.ts +16 -0
- package/types/area8975-ui-modal-close-btn.d.ts +14 -0
- package/types/area8975-ui-modal.d.ts +45 -0
- package/types/area8975-ui-money.d.ts +77 -0
- package/types/area8975-ui-overlay.d.ts +75 -0
- package/types/area8975-ui-pagination.d.ts +27 -0
- package/types/area8975-ui-private.d.ts +20 -0
- package/types/area8975-ui-progress.d.ts +127 -0
- package/types/area8975-ui-radio.d.ts +61 -0
- package/types/area8975-ui-rich-text-editor.d.ts +165 -0
- package/types/area8975-ui-search.d.ts +56 -0
- package/types/area8975-ui-segmented.d.ts +41 -0
- package/types/area8975-ui-select.d.ts +293 -0
- package/types/area8975-ui-sidebar-group.d.ts +15 -0
- package/types/area8975-ui-sidebar-item.d.ts +20 -0
- package/types/area8975-ui-sidebar.d.ts +16 -0
- package/types/area8975-ui-skeleton.d.ts +35 -0
- package/types/area8975-ui-stat.d.ts +13 -0
- package/types/area8975-ui-switch.d.ts +32 -0
- package/types/area8975-ui-tab.d.ts +45 -0
- package/types/area8975-ui-table-filters.d.ts +138 -0
- package/types/area8975-ui-table.d.ts +371 -0
- package/types/area8975-ui-textarea.d.ts +126 -0
- package/types/area8975-ui-theme.d.ts +61 -0
- package/types/area8975-ui-time-select.d.ts +35 -0
- package/types/area8975-ui-toast.d.ts +78 -0
- package/types/area8975-ui-toaster.d.ts +23 -0
- package/types/area8975-ui-tooltip.d.ts +47 -0
- package/types/area8975-ui-user-menu.d.ts +39 -0
- package/types/area8975-ui.d.ts +1 -4546
- package/fesm2022/area8975-ui.mjs.map +0 -1
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Component, ElementRef, computed, contentChild, input, model, viewChild } from "@angular/core";
|
|
4
|
+
import { UiCardComponent } from "@area8975/ui/card";
|
|
5
|
+
import { UiModalCloseButtonComponent } from "@area8975/ui/modal-close-btn";
|
|
6
|
+
import { UiOverlayComponent } from "@area8975/ui/overlay";
|
|
7
|
+
var UiModalComponent = class UiModalComponent {
|
|
8
|
+
isOpen = model.required(...ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []);
|
|
9
|
+
closeBehaviour = input("whenClickOutside", ...ngDevMode ? [{ debugName: "closeBehaviour" }] : /* istanbul ignore next */ []);
|
|
10
|
+
title = input("", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
11
|
+
size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
12
|
+
classes = input("", ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
13
|
+
headerElement = contentChild("header", {
|
|
14
|
+
...ngDevMode ? { debugName: "headerElement" } : /* istanbul ignore next */ {},
|
|
15
|
+
descendants: false
|
|
16
|
+
});
|
|
17
|
+
footerElement = contentChild("footer", {
|
|
18
|
+
...ngDevMode ? { debugName: "footerElement" } : /* istanbul ignore next */ {},
|
|
19
|
+
descendants: false
|
|
20
|
+
});
|
|
21
|
+
panelElement = viewChild("panel", {
|
|
22
|
+
...ngDevMode ? { debugName: "panelElement" } : /* istanbul ignore next */ {},
|
|
23
|
+
read: ElementRef
|
|
24
|
+
});
|
|
25
|
+
generatedClasses = computed(() => [
|
|
26
|
+
"ui-modal",
|
|
27
|
+
`ui-modal--${this.size()}`,
|
|
28
|
+
this.classes()
|
|
29
|
+
].filter(Boolean).join(" "), ...ngDevMode ? [{ debugName: "generatedClasses" }] : /* istanbul ignore next */ []);
|
|
30
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
31
|
+
minVersion: "12.0.0",
|
|
32
|
+
version: "22.2.1",
|
|
33
|
+
ngImport: i0,
|
|
34
|
+
type: UiModalComponent,
|
|
35
|
+
deps: [],
|
|
36
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
37
|
+
});
|
|
38
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
39
|
+
minVersion: "17.0.0",
|
|
40
|
+
version: "22.2.1",
|
|
41
|
+
type: UiModalComponent,
|
|
42
|
+
isStandalone: true,
|
|
43
|
+
selector: "ui-modal",
|
|
44
|
+
inputs: {
|
|
45
|
+
isOpen: {
|
|
46
|
+
classPropertyName: "isOpen",
|
|
47
|
+
publicName: "isOpen",
|
|
48
|
+
isSignal: true,
|
|
49
|
+
isRequired: true,
|
|
50
|
+
transformFunction: null
|
|
51
|
+
},
|
|
52
|
+
closeBehaviour: {
|
|
53
|
+
classPropertyName: "closeBehaviour",
|
|
54
|
+
publicName: "closeBehaviour",
|
|
55
|
+
isSignal: true,
|
|
56
|
+
isRequired: false,
|
|
57
|
+
transformFunction: null
|
|
58
|
+
},
|
|
59
|
+
title: {
|
|
60
|
+
classPropertyName: "title",
|
|
61
|
+
publicName: "title",
|
|
62
|
+
isSignal: true,
|
|
63
|
+
isRequired: false,
|
|
64
|
+
transformFunction: null
|
|
65
|
+
},
|
|
66
|
+
size: {
|
|
67
|
+
classPropertyName: "size",
|
|
68
|
+
publicName: "size",
|
|
69
|
+
isSignal: true,
|
|
70
|
+
isRequired: false,
|
|
71
|
+
transformFunction: null
|
|
72
|
+
},
|
|
73
|
+
classes: {
|
|
74
|
+
classPropertyName: "classes",
|
|
75
|
+
publicName: "classes",
|
|
76
|
+
isSignal: true,
|
|
77
|
+
isRequired: false,
|
|
78
|
+
transformFunction: null
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
outputs: { isOpen: "isOpenChange" },
|
|
82
|
+
queries: [{
|
|
83
|
+
propertyName: "headerElement",
|
|
84
|
+
first: true,
|
|
85
|
+
predicate: ["header"],
|
|
86
|
+
isSignal: true
|
|
87
|
+
}, {
|
|
88
|
+
propertyName: "footerElement",
|
|
89
|
+
first: true,
|
|
90
|
+
predicate: ["footer"],
|
|
91
|
+
isSignal: true
|
|
92
|
+
}],
|
|
93
|
+
viewQueries: [{
|
|
94
|
+
propertyName: "panelElement",
|
|
95
|
+
first: true,
|
|
96
|
+
predicate: ["panel"],
|
|
97
|
+
descendants: true,
|
|
98
|
+
read: ElementRef,
|
|
99
|
+
isSignal: true
|
|
100
|
+
}],
|
|
101
|
+
ngImport: i0,
|
|
102
|
+
template: "@if (isOpen()) {\n <div\n class=\"group z-50 fixed inset-0 flex justify-center items-center bg-black/40 starting:opacity-0 p-4 transition-opacity duration-150 ease-out\"\n animate.leave=\"fs-modal--leaving opacity-0\"\n >\n <ui-overlay\n [isOpen]=\"isOpen\"\n [closeBehaviour]=\"closeBehaviour()\"\n [content]=\"panelElement()\"\n tabIndex=\"-1\"\n role=\"dialog\"\n aria-modal=\"true\"\n class=\"block max-w-full starting:scale-95 group-[.fs-modal--leaving]:scale-95 transition duration-150 ease-out\"\n >\n <ui-card #panel radius=\"xl\" [class]=\"generatedClasses()\">\n <div class=\"flex flex-col max-h-[calc(100dvh-2rem-2px)]\">\n <header class=\"flex justify-between items-center gap-x-5 p-5 border-neutral border-b shrink-0\">\n @if (headerElement()) {\n <ng-container *ngTemplateOutlet=\"headerElement()\" />\n } @else {\n <span class=\"ui-text-h3\">{{ title() }}</span>\n <ui-modal-close-btn [(isOpen)]=\"isOpen\" />\n }\n </header>\n <div class=\"flex-1 min-h-0 overflow-auto\">\n <ng-content />\n </div>\n\n @if (footerElement()) {\n <footer class=\"flex justify-end items-center gap-2.5 p-5 shrink-0\">\n <ng-container *ngTemplateOutlet=\"footerElement()\" />\n </footer>\n }\n </div>\n </ui-card>\n </ui-overlay>\n </div>\n}\n",
|
|
103
|
+
styles: [".ui-modal--backdrop{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;overflow-y:auto;background-color:color-mix(in srgb,oklch(21% .034 264.665) 50%,transparent)}@supports (color: color-mix(in lab,red,red)){.ui-modal--backdrop{background-color:color-mix(in oklab,var(--color-gray-900, oklch(21% .034 264.665)) 50%,transparent)}}.ui-modal{pointer-events:auto;max-height:100vh;overflow:hidden}@media(width>=40rem){.ui-modal--sm{margin-inline:auto;width:100%;max-width:var(--container-lg, 32rem)}}@media(width>=48rem){.ui-modal--md{margin-inline:auto;width:100%;max-width:var(--container-2xl, 42rem)}}@media(width>=64rem){.ui-modal--lg{margin-inline:auto;width:100%;max-width:var(--container-4xl, 56rem)}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"],
|
|
104
|
+
dependencies: [
|
|
105
|
+
{
|
|
106
|
+
kind: "component",
|
|
107
|
+
type: UiOverlayComponent,
|
|
108
|
+
selector: "ui-overlay",
|
|
109
|
+
inputs: [
|
|
110
|
+
"content",
|
|
111
|
+
"anchor",
|
|
112
|
+
"closeBehaviour",
|
|
113
|
+
"isOpen",
|
|
114
|
+
"placement",
|
|
115
|
+
"offset",
|
|
116
|
+
"viewportPadding",
|
|
117
|
+
"matchWidth"
|
|
118
|
+
],
|
|
119
|
+
exportAs: ["uiOverlay"]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
kind: "component",
|
|
123
|
+
type: UiModalCloseButtonComponent,
|
|
124
|
+
selector: "ui-modal-close-btn",
|
|
125
|
+
inputs: ["isOpen"],
|
|
126
|
+
outputs: ["isOpenChange"]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
kind: "directive",
|
|
130
|
+
type: NgTemplateOutlet,
|
|
131
|
+
selector: "[ngTemplateOutlet]",
|
|
132
|
+
inputs: [
|
|
133
|
+
"ngTemplateOutletContext",
|
|
134
|
+
"ngTemplateOutlet",
|
|
135
|
+
"ngTemplateOutletInjector"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
kind: "component",
|
|
140
|
+
type: UiCardComponent,
|
|
141
|
+
selector: "ui-card",
|
|
142
|
+
inputs: ["radius"]
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
148
|
+
minVersion: "12.0.0",
|
|
149
|
+
version: "22.2.1",
|
|
150
|
+
ngImport: i0,
|
|
151
|
+
type: UiModalComponent,
|
|
152
|
+
decorators: [{
|
|
153
|
+
type: Component,
|
|
154
|
+
args: [{
|
|
155
|
+
selector: "ui-modal",
|
|
156
|
+
imports: [
|
|
157
|
+
UiOverlayComponent,
|
|
158
|
+
UiModalCloseButtonComponent,
|
|
159
|
+
NgTemplateOutlet,
|
|
160
|
+
UiCardComponent
|
|
161
|
+
],
|
|
162
|
+
template: "@if (isOpen()) {\n <div\n class=\"group z-50 fixed inset-0 flex justify-center items-center bg-black/40 starting:opacity-0 p-4 transition-opacity duration-150 ease-out\"\n animate.leave=\"fs-modal--leaving opacity-0\"\n >\n <ui-overlay\n [isOpen]=\"isOpen\"\n [closeBehaviour]=\"closeBehaviour()\"\n [content]=\"panelElement()\"\n tabIndex=\"-1\"\n role=\"dialog\"\n aria-modal=\"true\"\n class=\"block max-w-full starting:scale-95 group-[.fs-modal--leaving]:scale-95 transition duration-150 ease-out\"\n >\n <ui-card #panel radius=\"xl\" [class]=\"generatedClasses()\">\n <div class=\"flex flex-col max-h-[calc(100dvh-2rem-2px)]\">\n <header class=\"flex justify-between items-center gap-x-5 p-5 border-neutral border-b shrink-0\">\n @if (headerElement()) {\n <ng-container *ngTemplateOutlet=\"headerElement()\" />\n } @else {\n <span class=\"ui-text-h3\">{{ title() }}</span>\n <ui-modal-close-btn [(isOpen)]=\"isOpen\" />\n }\n </header>\n <div class=\"flex-1 min-h-0 overflow-auto\">\n <ng-content />\n </div>\n\n @if (footerElement()) {\n <footer class=\"flex justify-end items-center gap-2.5 p-5 shrink-0\">\n <ng-container *ngTemplateOutlet=\"footerElement()\" />\n </footer>\n }\n </div>\n </ui-card>\n </ui-overlay>\n </div>\n}\n",
|
|
163
|
+
styles: [".ui-modal--backdrop{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;overflow-y:auto;background-color:color-mix(in srgb,oklch(21% .034 264.665) 50%,transparent)}@supports (color: color-mix(in lab,red,red)){.ui-modal--backdrop{background-color:color-mix(in oklab,var(--color-gray-900, oklch(21% .034 264.665)) 50%,transparent)}}.ui-modal{pointer-events:auto;max-height:100vh;overflow:hidden}@media(width>=40rem){.ui-modal--sm{margin-inline:auto;width:100%;max-width:var(--container-lg, 32rem)}}@media(width>=48rem){.ui-modal--md{margin-inline:auto;width:100%;max-width:var(--container-2xl, 42rem)}}@media(width>=64rem){.ui-modal--lg{margin-inline:auto;width:100%;max-width:var(--container-4xl, 56rem)}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"]
|
|
164
|
+
}]
|
|
165
|
+
}],
|
|
166
|
+
propDecorators: {
|
|
167
|
+
isOpen: [{
|
|
168
|
+
type: i0.Input,
|
|
169
|
+
args: [{
|
|
170
|
+
isSignal: true,
|
|
171
|
+
alias: "isOpen",
|
|
172
|
+
required: true
|
|
173
|
+
}]
|
|
174
|
+
}, {
|
|
175
|
+
type: i0.Output,
|
|
176
|
+
args: ["isOpenChange"]
|
|
177
|
+
}],
|
|
178
|
+
closeBehaviour: [{
|
|
179
|
+
type: i0.Input,
|
|
180
|
+
args: [{
|
|
181
|
+
isSignal: true,
|
|
182
|
+
alias: "closeBehaviour",
|
|
183
|
+
required: false
|
|
184
|
+
}]
|
|
185
|
+
}],
|
|
186
|
+
title: [{
|
|
187
|
+
type: i0.Input,
|
|
188
|
+
args: [{
|
|
189
|
+
isSignal: true,
|
|
190
|
+
alias: "title",
|
|
191
|
+
required: false
|
|
192
|
+
}]
|
|
193
|
+
}],
|
|
194
|
+
size: [{
|
|
195
|
+
type: i0.Input,
|
|
196
|
+
args: [{
|
|
197
|
+
isSignal: true,
|
|
198
|
+
alias: "size",
|
|
199
|
+
required: false
|
|
200
|
+
}]
|
|
201
|
+
}],
|
|
202
|
+
classes: [{
|
|
203
|
+
type: i0.Input,
|
|
204
|
+
args: [{
|
|
205
|
+
isSignal: true,
|
|
206
|
+
alias: "classes",
|
|
207
|
+
required: false
|
|
208
|
+
}]
|
|
209
|
+
}],
|
|
210
|
+
headerElement: [{
|
|
211
|
+
type: i0.ContentChild,
|
|
212
|
+
args: ["header", {
|
|
213
|
+
descendants: false,
|
|
214
|
+
isSignal: true
|
|
215
|
+
}]
|
|
216
|
+
}],
|
|
217
|
+
footerElement: [{
|
|
218
|
+
type: i0.ContentChild,
|
|
219
|
+
args: ["footer", {
|
|
220
|
+
descendants: false,
|
|
221
|
+
isSignal: true
|
|
222
|
+
}]
|
|
223
|
+
}],
|
|
224
|
+
panelElement: [{
|
|
225
|
+
type: i0.ViewChild,
|
|
226
|
+
args: ["panel", {
|
|
227
|
+
read: ElementRef,
|
|
228
|
+
isSignal: true
|
|
229
|
+
}]
|
|
230
|
+
}]
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
export { UiModalComponent };
|
|
234
|
+
|
|
235
|
+
//# sourceMappingURL=area8975-ui-modal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"area8975-ui-modal.mjs","names":[],"sources":["../../../projects/ui/modal/modal.component.ts","../../../projects/ui/modal/modal.component.html"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n computed,\n contentChild,\n ElementRef,\n input,\n model,\n TemplateRef,\n viewChild\n} from '@angular/core';\n\nimport { UiCardComponent } from '@area8975/ui/card';\nimport { UiModalCloseButtonComponent } from '@area8975/ui/modal-close-btn';\nimport { UiOverlayComponent } from '@area8975/ui/overlay';\nimport { UiOverlayCloseBehaviour } from '@area8975/ui/overlay';\n\nimport { ModalSize } from './modal.types';\n\n\n@Component({\n selector: 'ui-modal',\n templateUrl: './modal.component.html',\n styleUrl: './modal.component.css',\n imports: [\n UiOverlayComponent,\n UiModalCloseButtonComponent,\n NgTemplateOutlet,\n UiCardComponent\n ]\n})\nexport class UiModalComponent {\n readonly isOpen = model.required<boolean>();\n readonly closeBehaviour = input<UiOverlayCloseBehaviour>(\n 'whenClickOutside'\n );\n readonly title = input<string>('');\n readonly size = input<ModalSize>('md');\n readonly classes = input<string>('');\n\n readonly headerElement = contentChild<TemplateRef<unknown>>(\n 'header',\n { descendants: false }\n );\n readonly footerElement = contentChild<TemplateRef<unknown>>(\n 'footer',\n { descendants: false }\n );\n readonly panelElement = viewChild(\n 'panel',\n { read: ElementRef<HTMLElement> }\n );\n\n readonly generatedClasses = computed<string>(() =>\n [\n 'ui-modal',\n `ui-modal--${this.size()}`,\n this.classes()\n ]\n .filter(Boolean)\n .join(' ')\n );\n}\n","@if (isOpen()) {\n <div\n class=\"group z-50 fixed inset-0 flex justify-center items-center bg-black/40 starting:opacity-0 p-4 transition-opacity duration-150 ease-out\"\n animate.leave=\"fs-modal--leaving opacity-0\"\n >\n <ui-overlay\n [isOpen]=\"isOpen\"\n [closeBehaviour]=\"closeBehaviour()\"\n [content]=\"panelElement()\"\n tabIndex=\"-1\"\n role=\"dialog\"\n aria-modal=\"true\"\n class=\"block max-w-full starting:scale-95 group-[.fs-modal--leaving]:scale-95 transition duration-150 ease-out\"\n >\n <ui-card #panel radius=\"xl\" [class]=\"generatedClasses()\">\n <div class=\"flex flex-col max-h-[calc(100dvh-2rem-2px)]\">\n <header class=\"flex justify-between items-center gap-x-5 p-5 border-neutral border-b shrink-0\">\n @if (headerElement()) {\n <ng-container *ngTemplateOutlet=\"headerElement()\" />\n } @else {\n <span class=\"ui-text-h3\">{{ title() }}</span>\n <ui-modal-close-btn [(isOpen)]=\"isOpen\" />\n }\n </header>\n <div class=\"flex-1 min-h-0 overflow-auto\">\n <ng-content />\n </div>\n\n @if (footerElement()) {\n <footer class=\"flex justify-end items-center gap-2.5 p-5 shrink-0\">\n <ng-container *ngTemplateOutlet=\"footerElement()\" />\n </footer>\n }\n </div>\n </ui-card>\n </ui-overlay>\n </div>\n}\n"],"mappings":";;;;;;AA+BA,IAAa,mBAAb,MAAa,iBAAgB;CAChB,SAAS,MAAM,SAAmB,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAClC,iBAAiB,MACtB,oBACH,GAAA,YAAA,CAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;CACQ,QAAQ,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,OAAO,MAAiB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAC7B,UAAU,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAE3B,gBAAgB,aACrB,UAAQ;EAAA,GAAA,YAAA,EAAA,WAAA,gBAAA,+BAAA,CAAA;EACN,aAAa;CAAK,CAAA;CAEf,gBAAgB,aACrB,UAAQ;EAAA,GAAA,YAAA,EAAA,WAAA,gBAAA,+BAAA,CAAA;EACN,aAAa;CAAK,CAAA;CAEf,eAAe,UACpB,SAAO;EAAA,GAAA,YAAA,EAAA,WAAA,eAAA,+BAAA,CAAA;EACL,MAAM;CAAuB,CAAA;CAG1B,mBAAmB,eACxB;EACI;EACA,aAAa,KAAK,KAAI;EACtB,KAAK,QAAO;CACf,CAAA,CACI,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,GAChB,GAAA,YAAA,CAAA,EAAA,WAAA,mBAAA,CAAA,+BAAA,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AA;GAAA,MAAA,CAGtB,UAAQ;IACN,aAAa;IAAO,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,cAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAGtB,SAAO;IACL,MAAM;IAAyB,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, booleanAttribute, computed, inject, input } from "@angular/core";
|
|
3
|
+
import { UI_FORMAT, UI_PRIVACY, maskMoney } from "@area8975/ui/format";
|
|
4
|
+
var UiMoneyComponent = class UiMoneyComponent {
|
|
5
|
+
defaults = inject(UI_FORMAT);
|
|
6
|
+
privacy = inject(UI_PRIVACY);
|
|
7
|
+
value = input.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
8
|
+
currency = input(this.defaults.currency, ...ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []);
|
|
9
|
+
locale = input(this.defaults.locale, ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
10
|
+
signDisplay = input("auto", ...ngDevMode ? [{ debugName: "signDisplay" }] : /* istanbul ignore next */ []);
|
|
11
|
+
colourBySign = input(false, {
|
|
12
|
+
...ngDevMode ? { debugName: "colourBySign" } : /* istanbul ignore next */ {},
|
|
13
|
+
transform: booleanAttribute
|
|
14
|
+
});
|
|
15
|
+
wholeUnits = input(false, {
|
|
16
|
+
...ngDevMode ? { debugName: "wholeUnits" } : /* istanbul ignore next */ {},
|
|
17
|
+
transform: booleanAttribute
|
|
18
|
+
});
|
|
19
|
+
compact = input(false, {
|
|
20
|
+
...ngDevMode ? { debugName: "compact" } : /* istanbul ignore next */ {},
|
|
21
|
+
transform: booleanAttribute
|
|
22
|
+
});
|
|
23
|
+
placeholder = input("-", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
24
|
+
amount = computed(() => {
|
|
25
|
+
const value = this.value();
|
|
26
|
+
return value === null || Number.isNaN(value) ? null : value || 0;
|
|
27
|
+
}, ...ngDevMode ? [{ debugName: "amount" }] : /* istanbul ignore next */ []);
|
|
28
|
+
masked = computed(() => this.privacy() !== "visible" && this.amount() !== null, ...ngDevMode ? [{ debugName: "masked" }] : /* istanbul ignore next */ []);
|
|
29
|
+
mask = computed(() => maskMoney(this.currency(), this.locale()), ...ngDevMode ? [{ debugName: "mask" }] : /* istanbul ignore next */ []);
|
|
30
|
+
formatted = computed(() => {
|
|
31
|
+
const amount = this.amount();
|
|
32
|
+
return amount === null ? this.placeholder() : this.format(amount, this.compact());
|
|
33
|
+
}, ...ngDevMode ? [{ debugName: "formatted" }] : /* istanbul ignore next */ []);
|
|
34
|
+
title = computed(() => {
|
|
35
|
+
const amount = this.amount();
|
|
36
|
+
return this.compact() && amount !== null && !this.masked() ? this.format(amount, false) : null;
|
|
37
|
+
}, ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
38
|
+
generatedClasses = computed(() => ["ui-money", this.signClass()].filter(Boolean).join(" "), ...ngDevMode ? [{ debugName: "generatedClasses" }] : /* istanbul ignore next */ []);
|
|
39
|
+
signClass = computed(() => {
|
|
40
|
+
const amount = this.amount();
|
|
41
|
+
if (!this.colourBySign() || amount === null || this.privacy() === "hidden") return "";
|
|
42
|
+
if (amount > 0) return "ui-money--positive";
|
|
43
|
+
return amount < 0 ? "ui-money--negative" : "";
|
|
44
|
+
}, ...ngDevMode ? [{ debugName: "signClass" }] : /* istanbul ignore next */ []);
|
|
45
|
+
format(amount, compact) {
|
|
46
|
+
return new Intl.NumberFormat(this.locale(), {
|
|
47
|
+
style: "currency",
|
|
48
|
+
currency: this.currency(),
|
|
49
|
+
signDisplay: this.signDisplay(),
|
|
50
|
+
notation: compact ? "compact" : "standard",
|
|
51
|
+
...this.wholeUnits() && {
|
|
52
|
+
minimumFractionDigits: 0,
|
|
53
|
+
maximumFractionDigits: 0
|
|
54
|
+
}
|
|
55
|
+
}).format(amount);
|
|
56
|
+
}
|
|
57
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
58
|
+
minVersion: "12.0.0",
|
|
59
|
+
version: "22.2.1",
|
|
60
|
+
ngImport: i0,
|
|
61
|
+
type: UiMoneyComponent,
|
|
62
|
+
deps: [],
|
|
63
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
64
|
+
});
|
|
65
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
66
|
+
minVersion: "17.0.0",
|
|
67
|
+
version: "22.2.1",
|
|
68
|
+
type: UiMoneyComponent,
|
|
69
|
+
isStandalone: true,
|
|
70
|
+
selector: "ui-money",
|
|
71
|
+
inputs: {
|
|
72
|
+
value: {
|
|
73
|
+
classPropertyName: "value",
|
|
74
|
+
publicName: "value",
|
|
75
|
+
isSignal: true,
|
|
76
|
+
isRequired: true,
|
|
77
|
+
transformFunction: null
|
|
78
|
+
},
|
|
79
|
+
currency: {
|
|
80
|
+
classPropertyName: "currency",
|
|
81
|
+
publicName: "currency",
|
|
82
|
+
isSignal: true,
|
|
83
|
+
isRequired: false,
|
|
84
|
+
transformFunction: null
|
|
85
|
+
},
|
|
86
|
+
locale: {
|
|
87
|
+
classPropertyName: "locale",
|
|
88
|
+
publicName: "locale",
|
|
89
|
+
isSignal: true,
|
|
90
|
+
isRequired: false,
|
|
91
|
+
transformFunction: null
|
|
92
|
+
},
|
|
93
|
+
signDisplay: {
|
|
94
|
+
classPropertyName: "signDisplay",
|
|
95
|
+
publicName: "signDisplay",
|
|
96
|
+
isSignal: true,
|
|
97
|
+
isRequired: false,
|
|
98
|
+
transformFunction: null
|
|
99
|
+
},
|
|
100
|
+
colourBySign: {
|
|
101
|
+
classPropertyName: "colourBySign",
|
|
102
|
+
publicName: "colourBySign",
|
|
103
|
+
isSignal: true,
|
|
104
|
+
isRequired: false,
|
|
105
|
+
transformFunction: null
|
|
106
|
+
},
|
|
107
|
+
wholeUnits: {
|
|
108
|
+
classPropertyName: "wholeUnits",
|
|
109
|
+
publicName: "wholeUnits",
|
|
110
|
+
isSignal: true,
|
|
111
|
+
isRequired: false,
|
|
112
|
+
transformFunction: null
|
|
113
|
+
},
|
|
114
|
+
compact: {
|
|
115
|
+
classPropertyName: "compact",
|
|
116
|
+
publicName: "compact",
|
|
117
|
+
isSignal: true,
|
|
118
|
+
isRequired: false,
|
|
119
|
+
transformFunction: null
|
|
120
|
+
},
|
|
121
|
+
placeholder: {
|
|
122
|
+
classPropertyName: "placeholder",
|
|
123
|
+
publicName: "placeholder",
|
|
124
|
+
isSignal: true,
|
|
125
|
+
isRequired: false,
|
|
126
|
+
transformFunction: null
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
host: { properties: {
|
|
130
|
+
"class": "generatedClasses()",
|
|
131
|
+
"attr.title": "title()"
|
|
132
|
+
} },
|
|
133
|
+
ngImport: i0,
|
|
134
|
+
template: "@if (masked()) {\n <span aria-hidden=\"true\">{{ mask() }}</span>\n <span class=\"sr-only\">amount hidden</span>\n} @else {{{ formatted() }}}\n",
|
|
135
|
+
styles: ["@layer properties;:host{position:relative}:host(.ui-money){white-space:nowrap;--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}:host(.ui-money--positive){color:var(--color-success-600, var(--color-teal-600))}:host(.ui-money--negative){color:var(--color-danger-600, var(--color-red-600))}@property --tw-ordinal{syntax: \"*\"; inherits: false;}@property --tw-slashed-zero{syntax: \"*\"; inherits: false;}@property --tw-numeric-figure{syntax: \"*\"; inherits: false;}@property --tw-numeric-spacing{syntax: \"*\"; inherits: false;}@property --tw-numeric-fraction{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-ordinal: initial;--tw-slashed-zero: initial;--tw-numeric-figure: initial;--tw-numeric-spacing: initial;--tw-numeric-fraction: initial}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"]
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
139
|
+
minVersion: "12.0.0",
|
|
140
|
+
version: "22.2.1",
|
|
141
|
+
ngImport: i0,
|
|
142
|
+
type: UiMoneyComponent,
|
|
143
|
+
decorators: [{
|
|
144
|
+
type: Component,
|
|
145
|
+
args: [{
|
|
146
|
+
selector: "ui-money",
|
|
147
|
+
host: {
|
|
148
|
+
"[class]": "generatedClasses()",
|
|
149
|
+
"[attr.title]": "title()"
|
|
150
|
+
},
|
|
151
|
+
template: "@if (masked()) {\n <span aria-hidden=\"true\">{{ mask() }}</span>\n <span class=\"sr-only\">amount hidden</span>\n} @else {{{ formatted() }}}\n",
|
|
152
|
+
styles: ["@layer properties;:host{position:relative}:host(.ui-money){white-space:nowrap;--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}:host(.ui-money--positive){color:var(--color-success-600, var(--color-teal-600))}:host(.ui-money--negative){color:var(--color-danger-600, var(--color-red-600))}@property --tw-ordinal{syntax: \"*\"; inherits: false;}@property --tw-slashed-zero{syntax: \"*\"; inherits: false;}@property --tw-numeric-figure{syntax: \"*\"; inherits: false;}@property --tw-numeric-spacing{syntax: \"*\"; inherits: false;}@property --tw-numeric-fraction{syntax: \"*\"; inherits: false;}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-ordinal: initial;--tw-slashed-zero: initial;--tw-numeric-figure: initial;--tw-numeric-spacing: initial;--tw-numeric-fraction: initial}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"]
|
|
153
|
+
}]
|
|
154
|
+
}],
|
|
155
|
+
propDecorators: {
|
|
156
|
+
value: [{
|
|
157
|
+
type: i0.Input,
|
|
158
|
+
args: [{
|
|
159
|
+
isSignal: true,
|
|
160
|
+
alias: "value",
|
|
161
|
+
required: true
|
|
162
|
+
}]
|
|
163
|
+
}],
|
|
164
|
+
currency: [{
|
|
165
|
+
type: i0.Input,
|
|
166
|
+
args: [{
|
|
167
|
+
isSignal: true,
|
|
168
|
+
alias: "currency",
|
|
169
|
+
required: false
|
|
170
|
+
}]
|
|
171
|
+
}],
|
|
172
|
+
locale: [{
|
|
173
|
+
type: i0.Input,
|
|
174
|
+
args: [{
|
|
175
|
+
isSignal: true,
|
|
176
|
+
alias: "locale",
|
|
177
|
+
required: false
|
|
178
|
+
}]
|
|
179
|
+
}],
|
|
180
|
+
signDisplay: [{
|
|
181
|
+
type: i0.Input,
|
|
182
|
+
args: [{
|
|
183
|
+
isSignal: true,
|
|
184
|
+
alias: "signDisplay",
|
|
185
|
+
required: false
|
|
186
|
+
}]
|
|
187
|
+
}],
|
|
188
|
+
colourBySign: [{
|
|
189
|
+
type: i0.Input,
|
|
190
|
+
args: [{
|
|
191
|
+
isSignal: true,
|
|
192
|
+
alias: "colourBySign",
|
|
193
|
+
required: false
|
|
194
|
+
}]
|
|
195
|
+
}],
|
|
196
|
+
wholeUnits: [{
|
|
197
|
+
type: i0.Input,
|
|
198
|
+
args: [{
|
|
199
|
+
isSignal: true,
|
|
200
|
+
alias: "wholeUnits",
|
|
201
|
+
required: false
|
|
202
|
+
}]
|
|
203
|
+
}],
|
|
204
|
+
compact: [{
|
|
205
|
+
type: i0.Input,
|
|
206
|
+
args: [{
|
|
207
|
+
isSignal: true,
|
|
208
|
+
alias: "compact",
|
|
209
|
+
required: false
|
|
210
|
+
}]
|
|
211
|
+
}],
|
|
212
|
+
placeholder: [{
|
|
213
|
+
type: i0.Input,
|
|
214
|
+
args: [{
|
|
215
|
+
isSignal: true,
|
|
216
|
+
alias: "placeholder",
|
|
217
|
+
required: false
|
|
218
|
+
}]
|
|
219
|
+
}]
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
const MoneySignDisplays = [
|
|
223
|
+
"auto",
|
|
224
|
+
"always",
|
|
225
|
+
"exceptZero",
|
|
226
|
+
"never"
|
|
227
|
+
];
|
|
228
|
+
export { MoneySignDisplays, UiMoneyComponent };
|
|
229
|
+
|
|
230
|
+
//# sourceMappingURL=area8975-ui-money.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"area8975-ui-money.mjs","names":[],"sources":["../../../projects/ui/money/money.component.ts","../../../projects/ui/money/money.component.html","../../../projects/ui/money/money.types.ts"],"sourcesContent":["import { booleanAttribute, Component, computed, inject, input } from '@angular/core';\n\nimport { UI_FORMAT } from '@area8975/ui/format';\nimport { maskMoney, UI_PRIVACY } from '@area8975/ui/format';\n\nimport type { MoneySignDisplay } from './money.types';\n\n\n/**\n * Formats a money value, e.g. -42.1 as \"-£42.10\".\n */\n@Component({\n selector: 'ui-money',\n templateUrl: './money.component.html',\n styleUrl: './money.component.css',\n host: {\n '[class]': 'generatedClasses()',\n '[attr.title]': 'title()'\n }\n})\nexport class UiMoneyComponent {\n private readonly defaults = inject(UI_FORMAT);\n private readonly privacy = inject(UI_PRIVACY);\n\n readonly value = input.required<number | null>();\n\n /** Defaults to the currency from `provideUiFormat`. */\n readonly currency = input<string>(this.defaults.currency);\n\n /** Defaults to the locale from `provideUiFormat`. */\n readonly locale = input<string>(this.defaults.locale);\n readonly signDisplay = input<MoneySignDisplay>('auto');\n\n /** Green for money in, red for money out. */\n readonly colourBySign = input(false, { transform: booleanAttribute });\n\n /** Rounds to whole units, e.g. \"£2,235\" for headline figures where pence are noise. */\n readonly wholeUnits = input(false, { transform: booleanAttribute });\n\n /** Short form like \"£12K\", the full amount goes in the title. */\n readonly compact = input(false, { transform: booleanAttribute });\n\n /** Shown when there's no value. */\n readonly placeholder = input<string>('-');\n\n // -0 would otherwise format as \"-£0.00\"\n private readonly amount = computed(() => {\n const value = this.value();\n\n return value === null || Number.isNaN(value) ? null : value || 0;\n });\n\n protected readonly masked = computed(() => this.privacy() !== 'visible' && this.amount() !== null);\n\n protected readonly mask = computed(() => maskMoney(this.currency(), this.locale()));\n\n protected readonly formatted = computed(() => {\n const amount = this.amount();\n\n return amount === null ? this.placeholder() : this.format(amount, this.compact());\n });\n\n protected readonly title = computed(() => {\n const amount = this.amount();\n\n return this.compact() && amount !== null && !this.masked() ? this.format(amount, false) : null;\n });\n\n readonly generatedClasses = computed(() =>\n [\n 'ui-money',\n this.signClass()\n ]\n .filter(Boolean)\n .join(' ')\n );\n\n private readonly signClass = computed(() => {\n const amount = this.amount();\n\n if (!this.colourBySign() || amount === null || this.privacy() === 'hidden') {\n return '';\n }\n\n if (amount > 0) {\n return 'ui-money--positive';\n }\n\n return amount < 0 ? 'ui-money--negative' : '';\n });\n\n private format(amount: number, compact: boolean): string {\n return new Intl.NumberFormat(this.locale(), {\n style: 'currency',\n currency: this.currency(),\n signDisplay: this.signDisplay(),\n notation: compact ? 'compact' : 'standard',\n ...(this.wholeUnits() && { minimumFractionDigits: 0, maximumFractionDigits: 0 })\n }).format(amount);\n }\n}\n","@if (masked()) {\n <span aria-hidden=\"true\">{{ mask() }}</span>\n <span class=\"sr-only\">amount hidden</span>\n} @else {{{ formatted() }}}\n","/** Intl signDisplay values, controls when a + or - is shown. */\nexport const MoneySignDisplays = [\n 'auto',\n 'always',\n 'exceptZero',\n 'never'\n] as const;\n\n/** @see {@link MoneySignDisplays} */\nexport type MoneySignDisplay = typeof MoneySignDisplays[number];\n"],"mappings":";;;AAoBA,IAAa,mBAAb,MAAa,iBAAgB;CACR,WAAW,OAAO,SAAS;CAC3B,UAAU,OAAO,UAAU;CAEnC,QAAQ,MAAM,SAAyB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAGvC,WAAW,MAAc,KAAK,SAAS,UAAS,G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