@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,200 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, booleanAttribute, computed, input, model, viewChild } from "@angular/core";
|
|
3
|
+
import { UiButtonComponent } from "@area8975/ui/button";
|
|
4
|
+
import { UiInputComponent } from "@area8975/ui/input";
|
|
5
|
+
import { UiInputGroupComponent } from "@area8975/ui/input-group";
|
|
6
|
+
const HEX_PATTERN = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
7
|
+
var UiColourComponent = class UiColourComponent {
|
|
8
|
+
value = model("#000000", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
9
|
+
id = input("", ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
|
|
10
|
+
disabled = input(false, {
|
|
11
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
12
|
+
transform: booleanAttribute
|
|
13
|
+
});
|
|
14
|
+
picker = viewChild.required("picker", ...ngDevMode ? [{ debugName: "picker" }] : /* istanbul ignore next */ []);
|
|
15
|
+
isValid = computed(() => HEX_PATTERN.test(this.value()), ...ngDevMode ? [{ debugName: "isValid" }] : /* istanbul ignore next */ []);
|
|
16
|
+
pickerValue = computed(() => {
|
|
17
|
+
if (!this.isValid()) return "#000000";
|
|
18
|
+
const hex = this.value().slice(1).toLowerCase();
|
|
19
|
+
return hex.length === 3 ? "#" + [...hex].map((char) => char + char).join("") : "#" + hex;
|
|
20
|
+
}, ...ngDevMode ? [{ debugName: "pickerValue" }] : /* istanbul ignore next */ []);
|
|
21
|
+
openPicker() {
|
|
22
|
+
const picker = this.picker().nativeElement;
|
|
23
|
+
if (picker.showPicker) picker.showPicker();
|
|
24
|
+
else picker.click();
|
|
25
|
+
}
|
|
26
|
+
handlePick(event) {
|
|
27
|
+
this.value.set(event.target.value);
|
|
28
|
+
}
|
|
29
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
30
|
+
minVersion: "12.0.0",
|
|
31
|
+
version: "22.2.1",
|
|
32
|
+
ngImport: i0,
|
|
33
|
+
type: UiColourComponent,
|
|
34
|
+
deps: [],
|
|
35
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
36
|
+
});
|
|
37
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
38
|
+
minVersion: "17.2.0",
|
|
39
|
+
version: "22.2.1",
|
|
40
|
+
type: UiColourComponent,
|
|
41
|
+
isStandalone: true,
|
|
42
|
+
selector: "ui-colour",
|
|
43
|
+
inputs: {
|
|
44
|
+
value: {
|
|
45
|
+
classPropertyName: "value",
|
|
46
|
+
publicName: "value",
|
|
47
|
+
isSignal: true,
|
|
48
|
+
isRequired: false,
|
|
49
|
+
transformFunction: null
|
|
50
|
+
},
|
|
51
|
+
id: {
|
|
52
|
+
classPropertyName: "id",
|
|
53
|
+
publicName: "id",
|
|
54
|
+
isSignal: true,
|
|
55
|
+
isRequired: false,
|
|
56
|
+
transformFunction: null
|
|
57
|
+
},
|
|
58
|
+
disabled: {
|
|
59
|
+
classPropertyName: "disabled",
|
|
60
|
+
publicName: "disabled",
|
|
61
|
+
isSignal: true,
|
|
62
|
+
isRequired: false,
|
|
63
|
+
transformFunction: null
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
outputs: { value: "valueChange" },
|
|
67
|
+
host: { properties: { "attr.id": "null" } },
|
|
68
|
+
viewQueries: [{
|
|
69
|
+
propertyName: "picker",
|
|
70
|
+
first: true,
|
|
71
|
+
predicate: ["picker"],
|
|
72
|
+
descendants: true,
|
|
73
|
+
isSignal: true
|
|
74
|
+
}],
|
|
75
|
+
ngImport: i0,
|
|
76
|
+
template: "<ui-input-group [validationState]=\"isValid() ? null : false\">\n <ui-button\n appearance=\"white\"\n intent=\"secondary\"\n size=\"sm\"\n classes=\"h-full\"\n ariaLabel=\"Pick colour\"\n [disabled]=\"disabled()\"\n (click)=\"openPicker()\"\n >\n <span\n class=\"border border-line-2 rounded size-5\"\n [style.background-color]=\"isValid() ? value() : 'transparent'\"\n ></span>\n </ui-button>\n\n <input\n #picker\n type=\"color\"\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [value]=\"pickerValue()\"\n [disabled]=\"disabled()\"\n (input)=\"handlePick($event)\"\n />\n\n <ui-input\n [(value)]=\"value\"\n [id]=\"id()\"\n [disabled]=\"disabled()\"\n [maxlength]=\"7\"\n [spellcheck]=\"false\"\n autocomplete=\"off\"\n placeholder=\"#000000\"\n />\n</ui-input-group>\n",
|
|
77
|
+
dependencies: [
|
|
78
|
+
{
|
|
79
|
+
kind: "component",
|
|
80
|
+
type: UiInputComponent,
|
|
81
|
+
selector: "ui-input",
|
|
82
|
+
inputs: [
|
|
83
|
+
"value",
|
|
84
|
+
"classes",
|
|
85
|
+
"type",
|
|
86
|
+
"id",
|
|
87
|
+
"name",
|
|
88
|
+
"placeholder",
|
|
89
|
+
"autocomplete",
|
|
90
|
+
"inputmode",
|
|
91
|
+
"required",
|
|
92
|
+
"disabled",
|
|
93
|
+
"readonly",
|
|
94
|
+
"validationState",
|
|
95
|
+
"min",
|
|
96
|
+
"max",
|
|
97
|
+
"step",
|
|
98
|
+
"pattern",
|
|
99
|
+
"minlength",
|
|
100
|
+
"maxlength",
|
|
101
|
+
"autofocus",
|
|
102
|
+
"spellcheck",
|
|
103
|
+
"revealable",
|
|
104
|
+
"list",
|
|
105
|
+
"ariaLabel",
|
|
106
|
+
"describedBy",
|
|
107
|
+
"inputRole",
|
|
108
|
+
"ariaExpanded",
|
|
109
|
+
"ariaControls",
|
|
110
|
+
"ariaActiveDescendant",
|
|
111
|
+
"ariaAutocomplete",
|
|
112
|
+
"ariaHasPopup"
|
|
113
|
+
],
|
|
114
|
+
outputs: [
|
|
115
|
+
"valueChange",
|
|
116
|
+
"validationStateChange",
|
|
117
|
+
"focused",
|
|
118
|
+
"blurred"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
kind: "component",
|
|
123
|
+
type: UiInputGroupComponent,
|
|
124
|
+
selector: "ui-input-group",
|
|
125
|
+
inputs: ["validationState"],
|
|
126
|
+
outputs: ["validationStateChange"]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
kind: "component",
|
|
130
|
+
type: UiButtonComponent,
|
|
131
|
+
selector: "ui-button",
|
|
132
|
+
inputs: [
|
|
133
|
+
"appearance",
|
|
134
|
+
"intent",
|
|
135
|
+
"size",
|
|
136
|
+
"classes",
|
|
137
|
+
"type",
|
|
138
|
+
"ariaLabel",
|
|
139
|
+
"disabled",
|
|
140
|
+
"loading"
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
147
|
+
minVersion: "12.0.0",
|
|
148
|
+
version: "22.2.1",
|
|
149
|
+
ngImport: i0,
|
|
150
|
+
type: UiColourComponent,
|
|
151
|
+
decorators: [{
|
|
152
|
+
type: Component,
|
|
153
|
+
args: [{
|
|
154
|
+
selector: "ui-colour",
|
|
155
|
+
imports: [
|
|
156
|
+
UiInputComponent,
|
|
157
|
+
UiInputGroupComponent,
|
|
158
|
+
UiButtonComponent
|
|
159
|
+
],
|
|
160
|
+
host: { "[attr.id]": "null" },
|
|
161
|
+
template: "<ui-input-group [validationState]=\"isValid() ? null : false\">\n <ui-button\n appearance=\"white\"\n intent=\"secondary\"\n size=\"sm\"\n classes=\"h-full\"\n ariaLabel=\"Pick colour\"\n [disabled]=\"disabled()\"\n (click)=\"openPicker()\"\n >\n <span\n class=\"border border-line-2 rounded size-5\"\n [style.background-color]=\"isValid() ? value() : 'transparent'\"\n ></span>\n </ui-button>\n\n <input\n #picker\n type=\"color\"\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [value]=\"pickerValue()\"\n [disabled]=\"disabled()\"\n (input)=\"handlePick($event)\"\n />\n\n <ui-input\n [(value)]=\"value\"\n [id]=\"id()\"\n [disabled]=\"disabled()\"\n [maxlength]=\"7\"\n [spellcheck]=\"false\"\n autocomplete=\"off\"\n placeholder=\"#000000\"\n />\n</ui-input-group>\n"
|
|
162
|
+
}]
|
|
163
|
+
}],
|
|
164
|
+
propDecorators: {
|
|
165
|
+
value: [{
|
|
166
|
+
type: i0.Input,
|
|
167
|
+
args: [{
|
|
168
|
+
isSignal: true,
|
|
169
|
+
alias: "value",
|
|
170
|
+
required: false
|
|
171
|
+
}]
|
|
172
|
+
}, {
|
|
173
|
+
type: i0.Output,
|
|
174
|
+
args: ["valueChange"]
|
|
175
|
+
}],
|
|
176
|
+
id: [{
|
|
177
|
+
type: i0.Input,
|
|
178
|
+
args: [{
|
|
179
|
+
isSignal: true,
|
|
180
|
+
alias: "id",
|
|
181
|
+
required: false
|
|
182
|
+
}]
|
|
183
|
+
}],
|
|
184
|
+
disabled: [{
|
|
185
|
+
type: i0.Input,
|
|
186
|
+
args: [{
|
|
187
|
+
isSignal: true,
|
|
188
|
+
alias: "disabled",
|
|
189
|
+
required: false
|
|
190
|
+
}]
|
|
191
|
+
}],
|
|
192
|
+
picker: [{
|
|
193
|
+
type: i0.ViewChild,
|
|
194
|
+
args: ["picker", { isSignal: true }]
|
|
195
|
+
}]
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
export { UiColourComponent };
|
|
199
|
+
|
|
200
|
+
//# sourceMappingURL=area8975-ui-colour.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"area8975-ui-colour.mjs","names":[],"sources":["../../../projects/ui/colour/colour.component.ts","../../../projects/ui/colour/colour.component.html"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n computed,\n ElementRef,\n input,\n model,\n viewChild\n} from '@angular/core';\n\nimport { UiButtonComponent } from '@area8975/ui/button';\nimport { UiInputComponent } from '@area8975/ui/input';\nimport { UiInputGroupComponent } from '@area8975/ui/input-group';\n\n\nconst HEX_PATTERN = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\n\n@Component({\n selector: 'ui-colour',\n templateUrl: './colour.component.html',\n imports: [UiInputComponent, UiInputGroupComponent, UiButtonComponent],\n host: { '[attr.id]': 'null' }\n})\nexport class UiColourComponent {\n readonly value = model<string>('#000000');\n\n readonly id = input<string>('');\n readonly disabled = input(false, { transform: booleanAttribute });\n\n private readonly picker = viewChild.required<ElementRef<HTMLInputElement>>(\n 'picker'\n );\n\n protected readonly isValid = computed(() => HEX_PATTERN.test(this.value()));\n\n // the native picker only understands lowercase #rrggbb\n protected readonly pickerValue = computed(() => {\n if (!this.isValid()) {\n return '#000000';\n }\n\n const hex = this.value().slice(1).toLowerCase();\n\n return hex.length === 3\n ? '#' + [...hex].map(char => char + char).join('')\n : '#' + hex;\n });\n\n protected openPicker(): void {\n const picker = this.picker().nativeElement;\n\n if (picker.showPicker) {\n picker.showPicker();\n } else {\n picker.click();\n }\n }\n\n protected handlePick(event: Event): void {\n this.value.set((event.target as HTMLInputElement).value);\n }\n}\n","<ui-input-group [validationState]=\"isValid() ? null : false\">\n <ui-button\n appearance=\"white\"\n intent=\"secondary\"\n size=\"sm\"\n classes=\"h-full\"\n ariaLabel=\"Pick colour\"\n [disabled]=\"disabled()\"\n (click)=\"openPicker()\"\n >\n <span\n class=\"border border-line-2 rounded size-5\"\n [style.background-color]=\"isValid() ? value() : 'transparent'\"\n ></span>\n </ui-button>\n\n <input\n #picker\n type=\"color\"\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [value]=\"pickerValue()\"\n [disabled]=\"disabled()\"\n (input)=\"handlePick($event)\"\n />\n\n <ui-input\n [(value)]=\"value\"\n [id]=\"id()\"\n [disabled]=\"disabled()\"\n [maxlength]=\"7\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;EAN7B,MAAA;EACa,MAAA,CAAA;GAAA,UAAA;GAAW,SAEZ;IAAC;IAAkB;IAAuB;GAAiB;GAAC,MAC/D,EAAE,aAAa,OAAM;GAAE,UAAA;EAAA,CAAA;CASzB,CAAA;CAAA,gBAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAA;EAAA,CAAA;EAAA,IAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component } from "@angular/core";
|
|
3
|
+
var UiContainerComponent = class UiContainerComponent {
|
|
4
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
5
|
+
minVersion: "12.0.0",
|
|
6
|
+
version: "22.2.1",
|
|
7
|
+
ngImport: i0,
|
|
8
|
+
type: UiContainerComponent,
|
|
9
|
+
deps: [],
|
|
10
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
11
|
+
});
|
|
12
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
13
|
+
minVersion: "14.0.0",
|
|
14
|
+
version: "22.2.1",
|
|
15
|
+
type: UiContainerComponent,
|
|
16
|
+
isStandalone: true,
|
|
17
|
+
selector: "ui-container",
|
|
18
|
+
host: { classAttribute: "block container" },
|
|
19
|
+
ngImport: i0,
|
|
20
|
+
template: "<ng-content></ng-content>",
|
|
21
|
+
isInline: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
25
|
+
minVersion: "12.0.0",
|
|
26
|
+
version: "22.2.1",
|
|
27
|
+
ngImport: i0,
|
|
28
|
+
type: UiContainerComponent,
|
|
29
|
+
decorators: [{
|
|
30
|
+
type: Component,
|
|
31
|
+
args: [{
|
|
32
|
+
selector: "ui-container",
|
|
33
|
+
template: "<ng-content></ng-content>",
|
|
34
|
+
host: { class: "block container" }
|
|
35
|
+
}]
|
|
36
|
+
}]
|
|
37
|
+
});
|
|
38
|
+
export { UiContainerComponent };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=area8975-ui-container.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"area8975-ui-container.mjs","names":[],"sources":["../../../projects/ui/container/container.component.ts"],"sourcesContent":["import { Component } from '@angular/core';\n\n\n@Component({\n selector: 'ui-container',\n template: '<ng-content></ng-content>',\n host: { class: 'block container' }\n})\nexport class UiContainerComponent {}\n"],"mappings":";;AAQA,IAAa,uBAAb,MAAa,qBAAoB;CAApB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAoB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAApB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAoB,cAAA;EAAA,UAAA;EAAA,MAAA,EAAA,gBAAA,kBAAA;EAAA,UAAA;EAAA,UAHnB;EAA2B,UAAA;CAAA,CAAA;;AAG5B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EALhC,MAAA;EAAU,MAAA,CAAA;GACP,UAAU;GACV,UAAU;GACV,MAAM,EAAE,OAAO,kBAAiB;EACnC,CAAA"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Component, contentChild, input, model } from "@angular/core";
|
|
4
|
+
import { UiInputComponent } from "@area8975/ui/input";
|
|
5
|
+
import { NgIcon, provideIcons } from "@ng-icons/core";
|
|
6
|
+
import { heroMinus, heroPlus } from "@ng-icons/heroicons/outline";
|
|
7
|
+
var UiCounterComponent = class UiCounterComponent {
|
|
8
|
+
value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
9
|
+
step = input(1, ...ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []);
|
|
10
|
+
max = input(...ngDevMode ? [void 0, { debugName: "max" }] : /* istanbul ignore next */ []);
|
|
11
|
+
min = input(...ngDevMode ? [void 0, { debugName: "min" }] : /* istanbul ignore next */ []);
|
|
12
|
+
placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
13
|
+
leadingElement = contentChild("leading", ...ngDevMode ? [{ debugName: "leadingElement" }] : /* istanbul ignore next */ []);
|
|
14
|
+
trailingElement = contentChild("trailing", ...ngDevMode ? [{ debugName: "trailingElement" }] : /* istanbul ignore next */ []);
|
|
15
|
+
onStepUp() {
|
|
16
|
+
let value = this.value() ?? 0;
|
|
17
|
+
value += this.step();
|
|
18
|
+
const max = this.max();
|
|
19
|
+
if (max !== void 0 && value > max) value = max;
|
|
20
|
+
this.value.set(value);
|
|
21
|
+
}
|
|
22
|
+
onStepDown() {
|
|
23
|
+
let value = this.value() ?? 0;
|
|
24
|
+
value -= this.step();
|
|
25
|
+
const min = this.min();
|
|
26
|
+
if (min !== void 0 && value < min) value = min;
|
|
27
|
+
this.value.set(value);
|
|
28
|
+
}
|
|
29
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
30
|
+
minVersion: "12.0.0",
|
|
31
|
+
version: "22.2.1",
|
|
32
|
+
ngImport: i0,
|
|
33
|
+
type: UiCounterComponent,
|
|
34
|
+
deps: [],
|
|
35
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
36
|
+
});
|
|
37
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
38
|
+
minVersion: "17.2.0",
|
|
39
|
+
version: "22.2.1",
|
|
40
|
+
type: UiCounterComponent,
|
|
41
|
+
isStandalone: true,
|
|
42
|
+
selector: "ui-counter",
|
|
43
|
+
inputs: {
|
|
44
|
+
value: {
|
|
45
|
+
classPropertyName: "value",
|
|
46
|
+
publicName: "value",
|
|
47
|
+
isSignal: true,
|
|
48
|
+
isRequired: false,
|
|
49
|
+
transformFunction: null
|
|
50
|
+
},
|
|
51
|
+
step: {
|
|
52
|
+
classPropertyName: "step",
|
|
53
|
+
publicName: "step",
|
|
54
|
+
isSignal: true,
|
|
55
|
+
isRequired: false,
|
|
56
|
+
transformFunction: null
|
|
57
|
+
},
|
|
58
|
+
max: {
|
|
59
|
+
classPropertyName: "max",
|
|
60
|
+
publicName: "max",
|
|
61
|
+
isSignal: true,
|
|
62
|
+
isRequired: false,
|
|
63
|
+
transformFunction: null
|
|
64
|
+
},
|
|
65
|
+
min: {
|
|
66
|
+
classPropertyName: "min",
|
|
67
|
+
publicName: "min",
|
|
68
|
+
isSignal: true,
|
|
69
|
+
isRequired: false,
|
|
70
|
+
transformFunction: null
|
|
71
|
+
},
|
|
72
|
+
placeholder: {
|
|
73
|
+
classPropertyName: "placeholder",
|
|
74
|
+
publicName: "placeholder",
|
|
75
|
+
isSignal: true,
|
|
76
|
+
isRequired: false,
|
|
77
|
+
transformFunction: null
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
outputs: { value: "valueChange" },
|
|
81
|
+
providers: [provideIcons({
|
|
82
|
+
heroPlus,
|
|
83
|
+
heroMinus
|
|
84
|
+
})],
|
|
85
|
+
queries: [{
|
|
86
|
+
propertyName: "leadingElement",
|
|
87
|
+
first: true,
|
|
88
|
+
predicate: ["leading"],
|
|
89
|
+
descendants: true,
|
|
90
|
+
isSignal: true
|
|
91
|
+
}, {
|
|
92
|
+
propertyName: "trailingElement",
|
|
93
|
+
first: true,
|
|
94
|
+
predicate: ["trailing"],
|
|
95
|
+
descendants: true,
|
|
96
|
+
isSignal: true
|
|
97
|
+
}],
|
|
98
|
+
ngImport: i0,
|
|
99
|
+
template: "<ui-input\n [(value)]=\"value\"\n [placeholder]=\"placeholder()\"\n type=\"number\"\n classes=\"[&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [appearance:textfield]\"\n>\n <ng-template #leading>\n <ng-container *ngTemplateOutlet=\"leadingElement()\" />\n </ng-template>\n <ng-template #trailing>\n <ng-container *ngTemplateOutlet=\"trailingElement()\" />\n\n <div class=\"flex self-stretch ms-2\">\n <button\n type=\"button\"\n class=\"inline-flex justify-center items-center w-8\"\n (click)=\"onStepUp()\"\n >\n <ng-icon name=\"heroPlus\" class=\"shrink-0\" />\n </button>\n <button\n type=\"button\"\n class=\"inline-flex justify-center items-center w-8\"\n (click)=\"onStepDown()\"\n >\n <ng-icon name=\"heroMinus\" class=\"shrink-0\" />\n </button>\n </div>\n </ng-template>\n</ui-input>\n",
|
|
100
|
+
dependencies: [
|
|
101
|
+
{
|
|
102
|
+
kind: "component",
|
|
103
|
+
type: UiInputComponent,
|
|
104
|
+
selector: "ui-input",
|
|
105
|
+
inputs: [
|
|
106
|
+
"value",
|
|
107
|
+
"classes",
|
|
108
|
+
"type",
|
|
109
|
+
"id",
|
|
110
|
+
"name",
|
|
111
|
+
"placeholder",
|
|
112
|
+
"autocomplete",
|
|
113
|
+
"inputmode",
|
|
114
|
+
"required",
|
|
115
|
+
"disabled",
|
|
116
|
+
"readonly",
|
|
117
|
+
"validationState",
|
|
118
|
+
"min",
|
|
119
|
+
"max",
|
|
120
|
+
"step",
|
|
121
|
+
"pattern",
|
|
122
|
+
"minlength",
|
|
123
|
+
"maxlength",
|
|
124
|
+
"autofocus",
|
|
125
|
+
"spellcheck",
|
|
126
|
+
"revealable",
|
|
127
|
+
"list",
|
|
128
|
+
"ariaLabel",
|
|
129
|
+
"describedBy",
|
|
130
|
+
"inputRole",
|
|
131
|
+
"ariaExpanded",
|
|
132
|
+
"ariaControls",
|
|
133
|
+
"ariaActiveDescendant",
|
|
134
|
+
"ariaAutocomplete",
|
|
135
|
+
"ariaHasPopup"
|
|
136
|
+
],
|
|
137
|
+
outputs: [
|
|
138
|
+
"valueChange",
|
|
139
|
+
"validationStateChange",
|
|
140
|
+
"focused",
|
|
141
|
+
"blurred"
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
kind: "directive",
|
|
146
|
+
type: NgTemplateOutlet,
|
|
147
|
+
selector: "[ngTemplateOutlet]",
|
|
148
|
+
inputs: [
|
|
149
|
+
"ngTemplateOutletContext",
|
|
150
|
+
"ngTemplateOutlet",
|
|
151
|
+
"ngTemplateOutletInjector"
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
kind: "component",
|
|
156
|
+
type: NgIcon,
|
|
157
|
+
selector: "ng-icon",
|
|
158
|
+
inputs: [
|
|
159
|
+
"name",
|
|
160
|
+
"svg",
|
|
161
|
+
"size",
|
|
162
|
+
"strokeWidth",
|
|
163
|
+
"color"
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
170
|
+
minVersion: "12.0.0",
|
|
171
|
+
version: "22.2.1",
|
|
172
|
+
ngImport: i0,
|
|
173
|
+
type: UiCounterComponent,
|
|
174
|
+
decorators: [{
|
|
175
|
+
type: Component,
|
|
176
|
+
args: [{
|
|
177
|
+
selector: "ui-counter",
|
|
178
|
+
imports: [
|
|
179
|
+
UiInputComponent,
|
|
180
|
+
NgTemplateOutlet,
|
|
181
|
+
NgIcon
|
|
182
|
+
],
|
|
183
|
+
providers: [provideIcons({
|
|
184
|
+
heroPlus,
|
|
185
|
+
heroMinus
|
|
186
|
+
})],
|
|
187
|
+
template: "<ui-input\n [(value)]=\"value\"\n [placeholder]=\"placeholder()\"\n type=\"number\"\n classes=\"[&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [appearance:textfield]\"\n>\n <ng-template #leading>\n <ng-container *ngTemplateOutlet=\"leadingElement()\" />\n </ng-template>\n <ng-template #trailing>\n <ng-container *ngTemplateOutlet=\"trailingElement()\" />\n\n <div class=\"flex self-stretch ms-2\">\n <button\n type=\"button\"\n class=\"inline-flex justify-center items-center w-8\"\n (click)=\"onStepUp()\"\n >\n <ng-icon name=\"heroPlus\" class=\"shrink-0\" />\n </button>\n <button\n type=\"button\"\n class=\"inline-flex justify-center items-center w-8\"\n (click)=\"onStepDown()\"\n >\n <ng-icon name=\"heroMinus\" class=\"shrink-0\" />\n </button>\n </div>\n </ng-template>\n</ui-input>\n"
|
|
188
|
+
}]
|
|
189
|
+
}],
|
|
190
|
+
propDecorators: {
|
|
191
|
+
value: [{
|
|
192
|
+
type: i0.Input,
|
|
193
|
+
args: [{
|
|
194
|
+
isSignal: true,
|
|
195
|
+
alias: "value",
|
|
196
|
+
required: false
|
|
197
|
+
}]
|
|
198
|
+
}, {
|
|
199
|
+
type: i0.Output,
|
|
200
|
+
args: ["valueChange"]
|
|
201
|
+
}],
|
|
202
|
+
step: [{
|
|
203
|
+
type: i0.Input,
|
|
204
|
+
args: [{
|
|
205
|
+
isSignal: true,
|
|
206
|
+
alias: "step",
|
|
207
|
+
required: false
|
|
208
|
+
}]
|
|
209
|
+
}],
|
|
210
|
+
max: [{
|
|
211
|
+
type: i0.Input,
|
|
212
|
+
args: [{
|
|
213
|
+
isSignal: true,
|
|
214
|
+
alias: "max",
|
|
215
|
+
required: false
|
|
216
|
+
}]
|
|
217
|
+
}],
|
|
218
|
+
min: [{
|
|
219
|
+
type: i0.Input,
|
|
220
|
+
args: [{
|
|
221
|
+
isSignal: true,
|
|
222
|
+
alias: "min",
|
|
223
|
+
required: false
|
|
224
|
+
}]
|
|
225
|
+
}],
|
|
226
|
+
placeholder: [{
|
|
227
|
+
type: i0.Input,
|
|
228
|
+
args: [{
|
|
229
|
+
isSignal: true,
|
|
230
|
+
alias: "placeholder",
|
|
231
|
+
required: false
|
|
232
|
+
}]
|
|
233
|
+
}],
|
|
234
|
+
leadingElement: [{
|
|
235
|
+
type: i0.ContentChild,
|
|
236
|
+
args: ["leading", { isSignal: true }]
|
|
237
|
+
}],
|
|
238
|
+
trailingElement: [{
|
|
239
|
+
type: i0.ContentChild,
|
|
240
|
+
args: ["trailing", { isSignal: true }]
|
|
241
|
+
}]
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
export { UiCounterComponent };
|
|
245
|
+
|
|
246
|
+
//# sourceMappingURL=area8975-ui-counter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"area8975-ui-counter.mjs","names":[],"sources":["../../../projects/ui/counter/counter.component.ts","../../../projects/ui/counter/counter.component.html"],"sourcesContent":["import { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n contentChild,\n input,\n model,\n TemplateRef\n} from '@angular/core';\n\nimport { UiInputComponent } from '@area8975/ui/input';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { heroMinus, heroPlus } from '@ng-icons/heroicons/outline';\n\n\n// todo\n// this component is just a number input with custom step buttons\n\n@Component({\n selector: 'ui-counter',\n templateUrl: './counter.component.html',\n imports: [UiInputComponent, NgTemplateOutlet, NgIcon],\n providers: [provideIcons({ heroPlus, heroMinus })]\n})\nexport class UiCounterComponent {\n readonly value = model<number | null>(null);\n readonly step = input<number>(1);\n readonly max = input<number>();\n readonly min = input<number>();\n readonly placeholder = input<string>('');\n\n // Leading/Trialing elements that appear inside of the input.\n readonly leadingElement = contentChild<TemplateRef<unknown>>('leading');\n readonly trailingElement = contentChild<TemplateRef<unknown>>('trailing');\n\n onStepUp() {\n let value = this.value() ?? 0;\n\n value += this.step();\n\n const max = this.max();\n\n if (max !== undefined && value > max) {\n value = max;\n }\n\n this.value.set(value);\n }\n\n onStepDown() {\n let value = this.value() ?? 0;\n\n value -= this.step();\n\n const min = this.min();\n\n if (min !== undefined && value < min) {\n value = min;\n }\n\n this.value.set(value);\n }\n}\n","<ui-input\n [(value)]=\"value\"\n [placeholder]=\"placeholder()\"\n type=\"number\"\n classes=\"[&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [appearance:textfield]\"\n>\n <ng-template #leading>\n <ng-container *ngTemplateOutlet=\"leadingElement()\" />\n </ng-template>\n <ng-template #trailing>\n <ng-container *ngTemplateOutlet=\"trailingElement()\" />\n\n <div class=\"flex self-stretch ms-2\">\n <button\n type=\"button\"\n class=\"inline-flex justify-center items-center w-8\"\n (click)=\"onStepUp()\"\n >\n <ng-icon name=\"heroPlus\" class=\"shrink-0\" />\n </button>\n <button\n type=\"button\"\n class=\"inline-flex justify-center items-center w-8\"\n (click)=\"onStepDown()\"\n >\n <ng-icon name=\"heroMinus\" class=\"shrink-0\" />\n </button>\n </div>\n </ng-template>\n</ui-input>\n"],"mappings":";;;;;;AAuBA,IAAa,qBAAb,MAAa,mBAAkB;CAClB,QAAQ,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAClC,OAAO,MAAc,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CACvB,MAAM,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CACrB,MAAM,MAAe,GAAA,YAAA,CAAA,QAA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