@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,332 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, booleanAttribute, computed, input, model, output, signal, viewChild } from "@angular/core";
|
|
3
|
+
import { formatFileSize, selectFiles } from "@area8975/ui/file";
|
|
4
|
+
import { NgIcon, provideIcons } from "@ng-icons/core";
|
|
5
|
+
import { heroArrowUpTray, heroDocument } from "@ng-icons/heroicons/outline";
|
|
6
|
+
var UiDropzoneComponent = class UiDropzoneComponent {
|
|
7
|
+
value = model([], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
8
|
+
id = input("", ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
|
|
9
|
+
accept = input("", ...ngDevMode ? [{ debugName: "accept" }] : /* istanbul ignore next */ []);
|
|
10
|
+
multiple = input(false, {
|
|
11
|
+
...ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {},
|
|
12
|
+
transform: booleanAttribute
|
|
13
|
+
});
|
|
14
|
+
disabled = input(false, {
|
|
15
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
16
|
+
transform: booleanAttribute
|
|
17
|
+
});
|
|
18
|
+
ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
19
|
+
describedBy = input("", ...ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []);
|
|
20
|
+
maxSize = input(null, ...ngDevMode ? [{ debugName: "maxSize" }] : /* istanbul ignore next */ []);
|
|
21
|
+
title = input("", ...ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []);
|
|
22
|
+
hint = input("", ...ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []);
|
|
23
|
+
icon = input("heroArrowUpTray", ...ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []);
|
|
24
|
+
rejected = output();
|
|
25
|
+
picker = viewChild.required("picker", ...ngDevMode ? [{ debugName: "picker" }] : /* istanbul ignore next */ []);
|
|
26
|
+
dragDepth = 0;
|
|
27
|
+
isDragging = signal(false, ...ngDevMode ? [{ debugName: "isDragging" }] : /* istanbul ignore next */ []);
|
|
28
|
+
hasRejection = signal(false, ...ngDevMode ? [{ debugName: "hasRejection" }] : /* istanbul ignore next */ []);
|
|
29
|
+
displayTitle = computed(() => this.title() || (this.multiple() ? "Drop files here or click to browse" : "Drop a file here or click to browse"), ...ngDevMode ? [{ debugName: "displayTitle" }] : /* istanbul ignore next */ []);
|
|
30
|
+
files = computed(() => this.value().map((file) => ({
|
|
31
|
+
name: file.name,
|
|
32
|
+
size: formatFileSize(file.size)
|
|
33
|
+
})), ...ngDevMode ? [{ debugName: "files" }] : /* istanbul ignore next */ []);
|
|
34
|
+
openPicker() {
|
|
35
|
+
if (this.disabled()) return;
|
|
36
|
+
const picker = this.picker().nativeElement;
|
|
37
|
+
if (picker.showPicker) picker.showPicker();
|
|
38
|
+
else picker.click();
|
|
39
|
+
}
|
|
40
|
+
handleKeydown(event) {
|
|
41
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
this.openPicker();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
handlePick(event) {
|
|
47
|
+
const target = event.target;
|
|
48
|
+
this.addFiles([...target.files ?? []]);
|
|
49
|
+
target.value = "";
|
|
50
|
+
}
|
|
51
|
+
handleDragEnter(event) {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
if (this.disabled()) return;
|
|
54
|
+
this.dragDepth++;
|
|
55
|
+
this.isDragging.set(true);
|
|
56
|
+
}
|
|
57
|
+
handleDragOver(event) {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
if (event.dataTransfer) event.dataTransfer.dropEffect = this.disabled() ? "none" : "copy";
|
|
60
|
+
}
|
|
61
|
+
handleDragLeave() {
|
|
62
|
+
this.dragDepth = Math.max(0, this.dragDepth - 1);
|
|
63
|
+
if (!this.dragDepth) this.isDragging.set(false);
|
|
64
|
+
}
|
|
65
|
+
handleDrop(event) {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
this.dragDepth = 0;
|
|
68
|
+
this.isDragging.set(false);
|
|
69
|
+
if (!this.disabled()) this.addFiles([...event.dataTransfer?.files ?? []]);
|
|
70
|
+
}
|
|
71
|
+
clear() {
|
|
72
|
+
this.value.set([]);
|
|
73
|
+
this.hasRejection.set(false);
|
|
74
|
+
}
|
|
75
|
+
addFiles(files) {
|
|
76
|
+
if (!files.length) return;
|
|
77
|
+
const candidates = this.multiple() ? files : files.slice(0, 1);
|
|
78
|
+
const { accepted, rejected } = selectFiles(candidates, this.accept(), this.maxSize());
|
|
79
|
+
this.hasRejection.set(rejected.length > 0);
|
|
80
|
+
if (rejected.length) this.rejected.emit(rejected);
|
|
81
|
+
if (accepted.length) this.value.set(accepted);
|
|
82
|
+
}
|
|
83
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
84
|
+
minVersion: "12.0.0",
|
|
85
|
+
version: "22.2.1",
|
|
86
|
+
ngImport: i0,
|
|
87
|
+
type: UiDropzoneComponent,
|
|
88
|
+
deps: [],
|
|
89
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
90
|
+
});
|
|
91
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
92
|
+
minVersion: "17.0.0",
|
|
93
|
+
version: "22.2.1",
|
|
94
|
+
type: UiDropzoneComponent,
|
|
95
|
+
isStandalone: true,
|
|
96
|
+
selector: "ui-dropzone",
|
|
97
|
+
inputs: {
|
|
98
|
+
value: {
|
|
99
|
+
classPropertyName: "value",
|
|
100
|
+
publicName: "value",
|
|
101
|
+
isSignal: true,
|
|
102
|
+
isRequired: false,
|
|
103
|
+
transformFunction: null
|
|
104
|
+
},
|
|
105
|
+
id: {
|
|
106
|
+
classPropertyName: "id",
|
|
107
|
+
publicName: "id",
|
|
108
|
+
isSignal: true,
|
|
109
|
+
isRequired: false,
|
|
110
|
+
transformFunction: null
|
|
111
|
+
},
|
|
112
|
+
accept: {
|
|
113
|
+
classPropertyName: "accept",
|
|
114
|
+
publicName: "accept",
|
|
115
|
+
isSignal: true,
|
|
116
|
+
isRequired: false,
|
|
117
|
+
transformFunction: null
|
|
118
|
+
},
|
|
119
|
+
multiple: {
|
|
120
|
+
classPropertyName: "multiple",
|
|
121
|
+
publicName: "multiple",
|
|
122
|
+
isSignal: true,
|
|
123
|
+
isRequired: false,
|
|
124
|
+
transformFunction: null
|
|
125
|
+
},
|
|
126
|
+
disabled: {
|
|
127
|
+
classPropertyName: "disabled",
|
|
128
|
+
publicName: "disabled",
|
|
129
|
+
isSignal: true,
|
|
130
|
+
isRequired: false,
|
|
131
|
+
transformFunction: null
|
|
132
|
+
},
|
|
133
|
+
ariaLabel: {
|
|
134
|
+
classPropertyName: "ariaLabel",
|
|
135
|
+
publicName: "ariaLabel",
|
|
136
|
+
isSignal: true,
|
|
137
|
+
isRequired: false,
|
|
138
|
+
transformFunction: null
|
|
139
|
+
},
|
|
140
|
+
describedBy: {
|
|
141
|
+
classPropertyName: "describedBy",
|
|
142
|
+
publicName: "describedBy",
|
|
143
|
+
isSignal: true,
|
|
144
|
+
isRequired: false,
|
|
145
|
+
transformFunction: null
|
|
146
|
+
},
|
|
147
|
+
maxSize: {
|
|
148
|
+
classPropertyName: "maxSize",
|
|
149
|
+
publicName: "maxSize",
|
|
150
|
+
isSignal: true,
|
|
151
|
+
isRequired: false,
|
|
152
|
+
transformFunction: null
|
|
153
|
+
},
|
|
154
|
+
title: {
|
|
155
|
+
classPropertyName: "title",
|
|
156
|
+
publicName: "title",
|
|
157
|
+
isSignal: true,
|
|
158
|
+
isRequired: false,
|
|
159
|
+
transformFunction: null
|
|
160
|
+
},
|
|
161
|
+
hint: {
|
|
162
|
+
classPropertyName: "hint",
|
|
163
|
+
publicName: "hint",
|
|
164
|
+
isSignal: true,
|
|
165
|
+
isRequired: false,
|
|
166
|
+
transformFunction: null
|
|
167
|
+
},
|
|
168
|
+
icon: {
|
|
169
|
+
classPropertyName: "icon",
|
|
170
|
+
publicName: "icon",
|
|
171
|
+
isSignal: true,
|
|
172
|
+
isRequired: false,
|
|
173
|
+
transformFunction: null
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
outputs: {
|
|
177
|
+
value: "valueChange",
|
|
178
|
+
rejected: "rejected"
|
|
179
|
+
},
|
|
180
|
+
host: { properties: { "attr.id": "null" } },
|
|
181
|
+
providers: [provideIcons({
|
|
182
|
+
heroArrowUpTray,
|
|
183
|
+
heroDocument
|
|
184
|
+
})],
|
|
185
|
+
viewQueries: [{
|
|
186
|
+
propertyName: "picker",
|
|
187
|
+
first: true,
|
|
188
|
+
predicate: ["picker"],
|
|
189
|
+
descendants: true,
|
|
190
|
+
isSignal: true
|
|
191
|
+
}],
|
|
192
|
+
ngImport: i0,
|
|
193
|
+
template: "<div\n class=\"ui-dropzone\"\n role=\"button\"\n [attr.id]=\"id() || null\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-describedby]=\"describedBy() || null\"\n [attr.data-dragging]=\"isDragging() ? '' : null\"\n [attr.data-invalid]=\"hasRejection() ? '' : null\"\n (click)=\"openPicker()\"\n (keydown)=\"handleKeydown($event)\"\n (dragenter)=\"handleDragEnter($event)\"\n (dragover)=\"handleDragOver($event)\"\n (dragleave)=\"handleDragLeave()\"\n (drop)=\"handleDrop($event)\"\n>\n <span class=\"ui-dropzone-icon\">\n <ng-icon [name]=\"icon()\" size=\"24\" class=\"shrink-0\" />\n </span>\n\n <span class=\"text-foreground ui-text-body\">\n {{ displayTitle() }}\n </span>\n\n @if (hint()) {\n <span class=\"text-muted-foreground-1 ui-text-caption\">\n {{ hint() }}\n </span>\n }\n</div>\n\n<input\n #picker\n type=\"file\"\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"handlePick($event)\"\n/>\n\n@if (files().length) {\n <div class=\"ui-dropzone-files\">\n <ul class=\"ui-dropzone-list\">\n @for (file of files(); track $index) {\n <li class=\"ui-dropzone-file\">\n <ng-icon\n name=\"heroDocument\"\n class=\"text-muted-foreground-1 shrink-0\"\n />\n <span class=\"text-foreground truncate ui-text-body\">\n {{ file.name }}\n </span>\n <span\n class=\"ms-auto text-muted-foreground-1 shrink-0 ui-text-caption\"\n >\n {{ file.size }}\n </span>\n </li>\n }\n </ul>\n\n @if (!disabled()) {\n <button\n type=\"button\"\n class=\"ui-dropzone-clear ui-text-caption\"\n (click)=\"clear()\"\n >\n {{ files().length > 1 ? 'Remove files' : 'Remove file' }}\n </button>\n }\n </div>\n}\n",
|
|
194
|
+
styles: ["@layer properties;@layer components{:host{width:100%}}:host{display:flex;flex-direction:column;row-gap:calc(var(--spacing, .25rem) * 2)}.ui-dropzone{display:flex;cursor:pointer;flex-direction:column;align-items:center;justify-content:center;row-gap:var(--spacing, .25rem);border-radius:var(--radius-xl, .75rem);border-style:var(--tw-border-style);border-width:2px;--tw-border-style: dashed;border-style:dashed;border-color:var(--border-line-2);background-color:var(--layer);padding-inline:calc(var(--spacing, .25rem) * 6);padding-block:calc(var(--spacing, .25rem) * 8);text-align:center;transition-property:colors,box-shadow;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function, cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration, var(--default-transition-duration, .15s));--tw-duration: .15s;transition-duration:.15s}.ui-dropzone:focus{--tw-outline-style: none;outline-style:none}.ui-dropzone:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ui-dropzone:focus-visible{--tw-ring-color: color-mix(in srgb, oklch(88.2% .059 254.128) 50%, transparent)}@supports (color: color-mix(in lab,red,red)){.ui-dropzone:focus-visible{--tw-ring-color: color-mix(in oklab, var(--color-primary-200, var(--color-blue-200)) 50%, transparent)}}.ui-dropzone:hover,.ui-dropzone:focus-visible{border-color:var(--color-primary-400, var(--color-blue-400))}.ui-dropzone:hover,.ui-dropzone:focus-visible{background-color:color-mix(in srgb,oklch(97% .014 254.604) 40%,transparent)}@supports (color: color-mix(in lab,red,red)){.ui-dropzone:hover,.ui-dropzone:focus-visible{background-color:color-mix(in oklab,var(--color-primary-50, var(--color-blue-50)) 40%,transparent)}}.ui-dropzone[data-dragging]{border-color:var(--color-primary-500, var(--color-blue-500));background-color:var(--color-primary-50, var(--color-blue-50))}.ui-dropzone[data-invalid]{border-color:var(--color-danger-500, var(--color-red-500))}.ui-dropzone[data-invalid]:focus-visible{--tw-ring-color: color-mix(in srgb, oklch(88.5% .062 18.334) 50%, transparent)}@supports (color: color-mix(in lab,red,red)){.ui-dropzone[data-invalid]:focus-visible{--tw-ring-color: color-mix(in oklab, var(--color-danger-200, var(--color-red-200)) 50%, transparent)}}.ui-dropzone[aria-disabled]{pointer-events:none;cursor:not-allowed;opacity:50%}.ui-dropzone-icon{margin-bottom:var(--spacing, .25rem);display:inline-flex;width:calc(var(--spacing, .25rem) * 10);height:calc(var(--spacing, .25rem) * 10);align-items:center;justify-content:center;border-radius:var(--radius-full, calc(infinity * 1px));background-color:var(--surface);color:var(--muted-foreground-1)}.ui-dropzone[data-dragging] .ui-dropzone-icon{background-color:var(--color-primary-100, var(--color-blue-100));color:var(--color-primary-600, var(--color-blue-600))}.ui-dropzone-files{display:flex;flex-direction:column;align-items:flex-end;row-gap:var(--spacing, .25rem)}.ui-dropzone-list{width:100%;border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:1px;border-color:var(--border-line-2)}:where(.ui-dropzone-list>:not(:last-child)){--tw-divide-y-reverse: 0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.ui-dropzone-list>:not(:last-child)){border-color:var(--border-line-2)}.ui-dropzone-file{display:flex;min-width:0px;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2);padding-inline:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 2)}.ui-dropzone-clear{border-radius:.25rem;color:var(--muted-foreground-1)}.ui-dropzone-clear:focus{--tw-outline-style: none;outline-style:none}.ui-dropzone-clear:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ui-dropzone-clear:focus-visible{--tw-ring-color: color-mix(in srgb, oklch(88.2% .059 254.128) 50%, transparent)}@supports (color: color-mix(in lab,red,red)){.ui-dropzone-clear:focus-visible{--tw-ring-color: color-mix(in oklab, var(--color-primary-200, var(--color-blue-200)) 50%, transparent)}}.ui-dropzone-clear:hover,.ui-dropzone-clear:focus-visible{color:var(--color-danger-600, var(--color-red-600))}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-duration{syntax: \"*\"; inherits: false;}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-divide-y-reverse{syntax: \"*\"; inherits: false; initial-value: 0;}@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-border-style: solid;--tw-duration: initial;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-divide-y-reverse: 0}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"],
|
|
195
|
+
dependencies: [{
|
|
196
|
+
kind: "component",
|
|
197
|
+
type: NgIcon,
|
|
198
|
+
selector: "ng-icon",
|
|
199
|
+
inputs: [
|
|
200
|
+
"name",
|
|
201
|
+
"svg",
|
|
202
|
+
"size",
|
|
203
|
+
"strokeWidth",
|
|
204
|
+
"color"
|
|
205
|
+
]
|
|
206
|
+
}]
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
210
|
+
minVersion: "12.0.0",
|
|
211
|
+
version: "22.2.1",
|
|
212
|
+
ngImport: i0,
|
|
213
|
+
type: UiDropzoneComponent,
|
|
214
|
+
decorators: [{
|
|
215
|
+
type: Component,
|
|
216
|
+
args: [{
|
|
217
|
+
selector: "ui-dropzone",
|
|
218
|
+
host: { "[attr.id]": "null" },
|
|
219
|
+
imports: [NgIcon],
|
|
220
|
+
providers: [provideIcons({
|
|
221
|
+
heroArrowUpTray,
|
|
222
|
+
heroDocument
|
|
223
|
+
})],
|
|
224
|
+
template: "<div\n class=\"ui-dropzone\"\n role=\"button\"\n [attr.id]=\"id() || null\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-describedby]=\"describedBy() || null\"\n [attr.data-dragging]=\"isDragging() ? '' : null\"\n [attr.data-invalid]=\"hasRejection() ? '' : null\"\n (click)=\"openPicker()\"\n (keydown)=\"handleKeydown($event)\"\n (dragenter)=\"handleDragEnter($event)\"\n (dragover)=\"handleDragOver($event)\"\n (dragleave)=\"handleDragLeave()\"\n (drop)=\"handleDrop($event)\"\n>\n <span class=\"ui-dropzone-icon\">\n <ng-icon [name]=\"icon()\" size=\"24\" class=\"shrink-0\" />\n </span>\n\n <span class=\"text-foreground ui-text-body\">\n {{ displayTitle() }}\n </span>\n\n @if (hint()) {\n <span class=\"text-muted-foreground-1 ui-text-caption\">\n {{ hint() }}\n </span>\n }\n</div>\n\n<input\n #picker\n type=\"file\"\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"handlePick($event)\"\n/>\n\n@if (files().length) {\n <div class=\"ui-dropzone-files\">\n <ul class=\"ui-dropzone-list\">\n @for (file of files(); track $index) {\n <li class=\"ui-dropzone-file\">\n <ng-icon\n name=\"heroDocument\"\n class=\"text-muted-foreground-1 shrink-0\"\n />\n <span class=\"text-foreground truncate ui-text-body\">\n {{ file.name }}\n </span>\n <span\n class=\"ms-auto text-muted-foreground-1 shrink-0 ui-text-caption\"\n >\n {{ file.size }}\n </span>\n </li>\n }\n </ul>\n\n @if (!disabled()) {\n <button\n type=\"button\"\n class=\"ui-dropzone-clear ui-text-caption\"\n (click)=\"clear()\"\n >\n {{ files().length > 1 ? 'Remove files' : 'Remove file' }}\n </button>\n }\n </div>\n}\n",
|
|
225
|
+
styles: ["@layer properties;@layer components{:host{width:100%}}:host{display:flex;flex-direction:column;row-gap:calc(var(--spacing, .25rem) * 2)}.ui-dropzone{display:flex;cursor:pointer;flex-direction:column;align-items:center;justify-content:center;row-gap:var(--spacing, .25rem);border-radius:var(--radius-xl, .75rem);border-style:var(--tw-border-style);border-width:2px;--tw-border-style: dashed;border-style:dashed;border-color:var(--border-line-2);background-color:var(--layer);padding-inline:calc(var(--spacing, .25rem) * 6);padding-block:calc(var(--spacing, .25rem) * 8);text-align:center;transition-property:colors,box-shadow;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function, cubic-bezier(.4, 0, .2, 1)));transition-duration:var(--tw-duration, var(--default-transition-duration, .15s));--tw-duration: .15s;transition-duration:.15s}.ui-dropzone:focus{--tw-outline-style: none;outline-style:none}.ui-dropzone:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ui-dropzone:focus-visible{--tw-ring-color: color-mix(in srgb, oklch(88.2% .059 254.128) 50%, transparent)}@supports (color: color-mix(in lab,red,red)){.ui-dropzone:focus-visible{--tw-ring-color: color-mix(in oklab, var(--color-primary-200, var(--color-blue-200)) 50%, transparent)}}.ui-dropzone:hover,.ui-dropzone:focus-visible{border-color:var(--color-primary-400, var(--color-blue-400))}.ui-dropzone:hover,.ui-dropzone:focus-visible{background-color:color-mix(in srgb,oklch(97% .014 254.604) 40%,transparent)}@supports (color: color-mix(in lab,red,red)){.ui-dropzone:hover,.ui-dropzone:focus-visible{background-color:color-mix(in oklab,var(--color-primary-50, var(--color-blue-50)) 40%,transparent)}}.ui-dropzone[data-dragging]{border-color:var(--color-primary-500, var(--color-blue-500));background-color:var(--color-primary-50, var(--color-blue-50))}.ui-dropzone[data-invalid]{border-color:var(--color-danger-500, var(--color-red-500))}.ui-dropzone[data-invalid]:focus-visible{--tw-ring-color: color-mix(in srgb, oklch(88.5% .062 18.334) 50%, transparent)}@supports (color: color-mix(in lab,red,red)){.ui-dropzone[data-invalid]:focus-visible{--tw-ring-color: color-mix(in oklab, var(--color-danger-200, var(--color-red-200)) 50%, transparent)}}.ui-dropzone[aria-disabled]{pointer-events:none;cursor:not-allowed;opacity:50%}.ui-dropzone-icon{margin-bottom:var(--spacing, .25rem);display:inline-flex;width:calc(var(--spacing, .25rem) * 10);height:calc(var(--spacing, .25rem) * 10);align-items:center;justify-content:center;border-radius:var(--radius-full, calc(infinity * 1px));background-color:var(--surface);color:var(--muted-foreground-1)}.ui-dropzone[data-dragging] .ui-dropzone-icon{background-color:var(--color-primary-100, var(--color-blue-100));color:var(--color-primary-600, var(--color-blue-600))}.ui-dropzone-files{display:flex;flex-direction:column;align-items:flex-end;row-gap:var(--spacing, .25rem)}.ui-dropzone-list{width:100%;border-radius:var(--radius-lg, .5rem);border-style:var(--tw-border-style);border-width:1px;border-color:var(--border-line-2)}:where(.ui-dropzone-list>:not(:last-child)){--tw-divide-y-reverse: 0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.ui-dropzone-list>:not(:last-child)){border-color:var(--border-line-2)}.ui-dropzone-file{display:flex;min-width:0px;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2);padding-inline:calc(var(--spacing, .25rem) * 3);padding-block:calc(var(--spacing, .25rem) * 2)}.ui-dropzone-clear{border-radius:.25rem;color:var(--muted-foreground-1)}.ui-dropzone-clear:focus{--tw-outline-style: none;outline-style:none}.ui-dropzone-clear:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ui-dropzone-clear:focus-visible{--tw-ring-color: color-mix(in srgb, oklch(88.2% .059 254.128) 50%, transparent)}@supports (color: color-mix(in lab,red,red)){.ui-dropzone-clear:focus-visible{--tw-ring-color: color-mix(in oklab, var(--color-primary-200, var(--color-blue-200)) 50%, transparent)}}.ui-dropzone-clear:hover,.ui-dropzone-clear:focus-visible{color:var(--color-danger-600, var(--color-red-600))}@property --tw-border-style{syntax: \"*\"; inherits: false; initial-value: solid;}@property --tw-duration{syntax: \"*\"; inherits: false;}@property --tw-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: \"*\"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: \"<percentage>\"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: \"*\"; inherits: false;}@property --tw-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: \"*\"; inherits: false;}@property --tw-inset-ring-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: \"*\"; inherits: false;}@property --tw-ring-offset-width{syntax: \"<length>\"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: \"*\"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: \"*\"; inherits: false; initial-value: 0 0 #0000;}@property --tw-divide-y-reverse{syntax: \"*\"; inherits: false; initial-value: 0;}@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-border-style: solid;--tw-duration: initial;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-divide-y-reverse: 0}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"]
|
|
226
|
+
}]
|
|
227
|
+
}],
|
|
228
|
+
propDecorators: {
|
|
229
|
+
value: [{
|
|
230
|
+
type: i0.Input,
|
|
231
|
+
args: [{
|
|
232
|
+
isSignal: true,
|
|
233
|
+
alias: "value",
|
|
234
|
+
required: false
|
|
235
|
+
}]
|
|
236
|
+
}, {
|
|
237
|
+
type: i0.Output,
|
|
238
|
+
args: ["valueChange"]
|
|
239
|
+
}],
|
|
240
|
+
id: [{
|
|
241
|
+
type: i0.Input,
|
|
242
|
+
args: [{
|
|
243
|
+
isSignal: true,
|
|
244
|
+
alias: "id",
|
|
245
|
+
required: false
|
|
246
|
+
}]
|
|
247
|
+
}],
|
|
248
|
+
accept: [{
|
|
249
|
+
type: i0.Input,
|
|
250
|
+
args: [{
|
|
251
|
+
isSignal: true,
|
|
252
|
+
alias: "accept",
|
|
253
|
+
required: false
|
|
254
|
+
}]
|
|
255
|
+
}],
|
|
256
|
+
multiple: [{
|
|
257
|
+
type: i0.Input,
|
|
258
|
+
args: [{
|
|
259
|
+
isSignal: true,
|
|
260
|
+
alias: "multiple",
|
|
261
|
+
required: false
|
|
262
|
+
}]
|
|
263
|
+
}],
|
|
264
|
+
disabled: [{
|
|
265
|
+
type: i0.Input,
|
|
266
|
+
args: [{
|
|
267
|
+
isSignal: true,
|
|
268
|
+
alias: "disabled",
|
|
269
|
+
required: false
|
|
270
|
+
}]
|
|
271
|
+
}],
|
|
272
|
+
ariaLabel: [{
|
|
273
|
+
type: i0.Input,
|
|
274
|
+
args: [{
|
|
275
|
+
isSignal: true,
|
|
276
|
+
alias: "ariaLabel",
|
|
277
|
+
required: false
|
|
278
|
+
}]
|
|
279
|
+
}],
|
|
280
|
+
describedBy: [{
|
|
281
|
+
type: i0.Input,
|
|
282
|
+
args: [{
|
|
283
|
+
isSignal: true,
|
|
284
|
+
alias: "describedBy",
|
|
285
|
+
required: false
|
|
286
|
+
}]
|
|
287
|
+
}],
|
|
288
|
+
maxSize: [{
|
|
289
|
+
type: i0.Input,
|
|
290
|
+
args: [{
|
|
291
|
+
isSignal: true,
|
|
292
|
+
alias: "maxSize",
|
|
293
|
+
required: false
|
|
294
|
+
}]
|
|
295
|
+
}],
|
|
296
|
+
title: [{
|
|
297
|
+
type: i0.Input,
|
|
298
|
+
args: [{
|
|
299
|
+
isSignal: true,
|
|
300
|
+
alias: "title",
|
|
301
|
+
required: false
|
|
302
|
+
}]
|
|
303
|
+
}],
|
|
304
|
+
hint: [{
|
|
305
|
+
type: i0.Input,
|
|
306
|
+
args: [{
|
|
307
|
+
isSignal: true,
|
|
308
|
+
alias: "hint",
|
|
309
|
+
required: false
|
|
310
|
+
}]
|
|
311
|
+
}],
|
|
312
|
+
icon: [{
|
|
313
|
+
type: i0.Input,
|
|
314
|
+
args: [{
|
|
315
|
+
isSignal: true,
|
|
316
|
+
alias: "icon",
|
|
317
|
+
required: false
|
|
318
|
+
}]
|
|
319
|
+
}],
|
|
320
|
+
rejected: [{
|
|
321
|
+
type: i0.Output,
|
|
322
|
+
args: ["rejected"]
|
|
323
|
+
}],
|
|
324
|
+
picker: [{
|
|
325
|
+
type: i0.ViewChild,
|
|
326
|
+
args: ["picker", { isSignal: true }]
|
|
327
|
+
}]
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
export { UiDropzoneComponent };
|
|
331
|
+
|
|
332
|
+
//# sourceMappingURL=area8975-ui-dropzone.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"area8975-ui-dropzone.mjs","names":[],"sources":["../../../projects/ui/dropzone/dropzone.component.ts","../../../projects/ui/dropzone/dropzone.component.html"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n computed,\n ElementRef,\n input,\n model,\n output,\n signal,\n viewChild\n} from '@angular/core';\n\nimport type { FileRejection } from '@area8975/ui/file';\nimport { formatFileSize, selectFiles } from '@area8975/ui/file';\nimport { IconName, NgIcon, provideIcons } from '@ng-icons/core';\nimport { heroArrowUpTray, heroDocument } from '@ng-icons/heroicons/outline';\n\n\n@Component({\n selector: 'ui-dropzone',\n templateUrl: './dropzone.component.html',\n styleUrl: './dropzone.component.css',\n host: { '[attr.id]': 'null' },\n imports: [NgIcon],\n providers: [provideIcons({\n heroArrowUpTray,\n heroDocument\n })]\n})\nexport class UiDropzoneComponent {\n readonly value = model<File[]>([]);\n\n readonly id = input<string>('');\n readonly accept = input<string>('');\n readonly multiple = input(false, { transform: booleanAttribute });\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly ariaLabel = input<string>('');\n readonly describedBy = input<string>('');\n\n /** Max size per file in bytes. */\n readonly maxSize = input<number | null>(null);\n\n readonly title = input<string>('');\n readonly hint = input<string>('');\n readonly icon = input<IconName>('heroArrowUpTray');\n\n readonly rejected = output<FileRejection[]>();\n\n private readonly picker = viewChild.required<ElementRef<HTMLInputElement>>(\n 'picker'\n );\n\n // dragenter/leave fire for every child, so count them instead of toggling\n private dragDepth = 0;\n\n protected readonly isDragging = signal(false);\n protected readonly hasRejection = signal(false);\n\n protected readonly displayTitle = computed(() =>\n this.title() ||\n (this.multiple()\n ? 'Drop files here or click to browse'\n : 'Drop a file here or click to browse')\n );\n\n protected readonly files = computed(() =>\n this.value().map(file => ({\n name: file.name,\n size: formatFileSize(file.size)\n }))\n );\n\n protected openPicker(): void {\n if (this.disabled()) {\n return;\n }\n\n const picker = this.picker().nativeElement;\n\n if (picker.showPicker) {\n picker.showPicker();\n } else {\n picker.click();\n }\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.openPicker();\n }\n }\n\n protected handlePick(event: Event): void {\n const target = event.target as HTMLInputElement;\n\n this.addFiles([...target.files ?? []]);\n\n // reset so picking the same file again still fires change\n target.value = '';\n }\n\n protected handleDragEnter(event: DragEvent): void {\n event.preventDefault();\n\n if (this.disabled()) {\n return;\n }\n\n this.dragDepth++;\n this.isDragging.set(true);\n }\n\n protected handleDragOver(event: DragEvent): void {\n // without this the browser won't allow the drop\n event.preventDefault();\n\n if (event.dataTransfer) {\n event.dataTransfer.dropEffect = this.disabled() ? 'none' : 'copy';\n }\n }\n\n protected handleDragLeave(): void {\n this.dragDepth = Math.max(0, this.dragDepth - 1);\n\n if (!this.dragDepth) {\n this.isDragging.set(false);\n }\n }\n\n protected handleDrop(event: DragEvent): void {\n event.preventDefault();\n\n this.dragDepth = 0;\n this.isDragging.set(false);\n\n if (!this.disabled()) {\n this.addFiles([...event.dataTransfer?.files ?? []]);\n }\n }\n\n protected clear(): void {\n this.value.set([]);\n this.hasRejection.set(false);\n }\n\n private addFiles(files: File[]): void {\n if (!files.length) {\n return;\n }\n\n // the native picker enforces this, but a drop can carry several files\n const candidates = this.multiple() ? files : files.slice(0, 1);\n const { accepted, rejected } = selectFiles(\n candidates,\n this.accept(),\n this.maxSize()\n );\n\n this.hasRejection.set(rejected.length > 0);\n\n if (rejected.length) {\n this.rejected.emit(rejected);\n }\n\n if (accepted.length) {\n this.value.set(accepted);\n }\n }\n}\n","<div\n class=\"ui-dropzone\"\n role=\"button\"\n [attr.id]=\"id() || null\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.aria-disabled]=\"disabled() || null\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-describedby]=\"describedBy() || null\"\n [attr.data-dragging]=\"isDragging() ? '' : null\"\n [attr.data-invalid]=\"hasRejection() ? '' : null\"\n (click)=\"openPicker()\"\n (keydown)=\"handleKeydown($event)\"\n (dragenter)=\"handleDragEnter($event)\"\n (dragover)=\"handleDragOver($event)\"\n (dragleave)=\"handleDragLeave()\"\n (drop)=\"handleDrop($event)\"\n>\n <span class=\"ui-dropzone-icon\">\n <ng-icon [name]=\"icon()\" size=\"24\" class=\"shrink-0\" />\n </span>\n\n <span class=\"text-foreground ui-text-body\">\n {{ displayTitle() }}\n </span>\n\n @if (hint()) {\n <span class=\"text-muted-foreground-1 ui-text-caption\">\n {{ hint() }}\n </span>\n }\n</div>\n\n<input\n #picker\n type=\"file\"\n class=\"sr-only\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"handlePick($event)\"\n/>\n\n@if (files().length) {\n <div class=\"ui-dropzone-files\">\n <ul class=\"ui-dropzone-list\">\n @for (file of files(); track $index) {\n <li class=\"ui-dropzone-file\">\n <ng-icon\n name=\"heroDocument\"\n class=\"text-muted-foreground-1 shrink-0\"\n />\n <span class=\"text-foreground truncate ui-text-body\">\n {{ file.name }}\n </span>\n <span\n class=\"ms-auto text-muted-foreground-1 shrink-0 ui-text-caption\"\n >\n {{ file.size }}\n </span>\n </li>\n }\n </ul>\n\n @if (!disabled()) {\n <button\n type=\"button\"\n class=\"ui-dropzone-clear ui-text-caption\"\n (click)=\"clear()\"\n >\n {{ files().length > 1 ? 'Remove files' : 'Remove file' }}\n </button>\n }\n </div>\n}\n"],"mappings":";;;;;AA6BA,IAAa,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EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, DOCUMENT, booleanAttribute, computed, inject, input } from "@angular/core";
|
|
3
|
+
var UiFieldComponent = class UiFieldComponent {
|
|
4
|
+
label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
5
|
+
hint = input("", ...ngDevMode ? [{ debugName: "hint" }] : /* istanbul ignore next */ []);
|
|
6
|
+
required = input(false, {
|
|
7
|
+
...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
|
|
8
|
+
transform: booleanAttribute
|
|
9
|
+
});
|
|
10
|
+
error = input("", ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
11
|
+
for = input("", ...ngDevMode ? [{ debugName: "for" }] : /* istanbul ignore next */ []);
|
|
12
|
+
hintId = input("", ...ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []);
|
|
13
|
+
errorId = input("", ...ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []);
|
|
14
|
+
labelId = computed(() => this.for() && this.label() ? `${this.for()}-label` : "", ...ngDevMode ? [{ debugName: "labelId" }] : /* istanbul ignore next */ []);
|
|
15
|
+
document = inject(DOCUMENT);
|
|
16
|
+
get forAttr() {
|
|
17
|
+
return this.for() || null;
|
|
18
|
+
}
|
|
19
|
+
get labelIdAttr() {
|
|
20
|
+
return this.labelId() || null;
|
|
21
|
+
}
|
|
22
|
+
onClick(event) {
|
|
23
|
+
const label = event.target.closest("label");
|
|
24
|
+
if (!label?.classList.contains("ui-field-label")) return;
|
|
25
|
+
const control = label.control;
|
|
26
|
+
if (control instanceof HTMLInputElement && (control.type === "checkbox" || control.type === "radio")) return;
|
|
27
|
+
const target = control ?? (this.for() ? this.document.getElementById(this.for()) : null);
|
|
28
|
+
if (target) {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
target.focus();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
get hintAttr() {
|
|
34
|
+
return this.hintId() || null;
|
|
35
|
+
}
|
|
36
|
+
get errorAttr() {
|
|
37
|
+
return this.errorId() || null;
|
|
38
|
+
}
|
|
39
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
40
|
+
minVersion: "12.0.0",
|
|
41
|
+
version: "22.2.1",
|
|
42
|
+
ngImport: i0,
|
|
43
|
+
type: UiFieldComponent,
|
|
44
|
+
deps: [],
|
|
45
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
46
|
+
});
|
|
47
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
48
|
+
minVersion: "17.0.0",
|
|
49
|
+
version: "22.2.1",
|
|
50
|
+
type: UiFieldComponent,
|
|
51
|
+
isStandalone: true,
|
|
52
|
+
selector: "ui-field",
|
|
53
|
+
inputs: {
|
|
54
|
+
label: {
|
|
55
|
+
classPropertyName: "label",
|
|
56
|
+
publicName: "label",
|
|
57
|
+
isSignal: true,
|
|
58
|
+
isRequired: false,
|
|
59
|
+
transformFunction: null
|
|
60
|
+
},
|
|
61
|
+
hint: {
|
|
62
|
+
classPropertyName: "hint",
|
|
63
|
+
publicName: "hint",
|
|
64
|
+
isSignal: true,
|
|
65
|
+
isRequired: false,
|
|
66
|
+
transformFunction: null
|
|
67
|
+
},
|
|
68
|
+
required: {
|
|
69
|
+
classPropertyName: "required",
|
|
70
|
+
publicName: "required",
|
|
71
|
+
isSignal: true,
|
|
72
|
+
isRequired: false,
|
|
73
|
+
transformFunction: null
|
|
74
|
+
},
|
|
75
|
+
error: {
|
|
76
|
+
classPropertyName: "error",
|
|
77
|
+
publicName: "error",
|
|
78
|
+
isSignal: true,
|
|
79
|
+
isRequired: false,
|
|
80
|
+
transformFunction: null
|
|
81
|
+
},
|
|
82
|
+
for: {
|
|
83
|
+
classPropertyName: "for",
|
|
84
|
+
publicName: "for",
|
|
85
|
+
isSignal: true,
|
|
86
|
+
isRequired: false,
|
|
87
|
+
transformFunction: null
|
|
88
|
+
},
|
|
89
|
+
hintId: {
|
|
90
|
+
classPropertyName: "hintId",
|
|
91
|
+
publicName: "hintId",
|
|
92
|
+
isSignal: true,
|
|
93
|
+
isRequired: false,
|
|
94
|
+
transformFunction: null
|
|
95
|
+
},
|
|
96
|
+
errorId: {
|
|
97
|
+
classPropertyName: "errorId",
|
|
98
|
+
publicName: "errorId",
|
|
99
|
+
isSignal: true,
|
|
100
|
+
isRequired: false,
|
|
101
|
+
transformFunction: null
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
host: {
|
|
105
|
+
listeners: { "click": "onClick($event)" },
|
|
106
|
+
classAttribute: "block"
|
|
107
|
+
},
|
|
108
|
+
ngImport: i0,
|
|
109
|
+
template: "@if (label()) {\n <label\n [attr.id]=\"labelIdAttr\"\n [attr.for]=\"forAttr\"\n class=\"ui-text-body ui-field-label\"\n >\n {{ label() }}\n\n @if (required()) {\n <span class=\"text-danger-500\" aria-hidden=\"true\">*</span>\n <span class=\"sr-only\">(required)</span>\n }\n </label>\n}\n\n<ng-content />\n\n@if (error()) {\n <div\n [attr.id]=\"errorAttr\"\n class=\"text-danger-600 ui-text-caption ui-field-hint\"\n role=\"alert\"\n >\n {{ error() }}\n </div>\n} @else if (hint()) {\n <div\n [attr.id]=\"hintAttr\"\n class=\"text-muted-foreground-1 ui-text-caption ui-field-hint\"\n >\n {{ hint() }}\n </div>\n}\n",
|
|
110
|
+
styles: [":host{position:relative}.ui-field-label{margin-bottom:calc(var(--spacing, .25rem) * 1.5);display:inline-flex;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2)}.ui-field-hint{margin-top:calc(var(--spacing, .25rem) * 1.5);display:inline-flex;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"]
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
114
|
+
minVersion: "12.0.0",
|
|
115
|
+
version: "22.2.1",
|
|
116
|
+
ngImport: i0,
|
|
117
|
+
type: UiFieldComponent,
|
|
118
|
+
decorators: [{
|
|
119
|
+
type: Component,
|
|
120
|
+
args: [{
|
|
121
|
+
selector: "ui-field",
|
|
122
|
+
host: {
|
|
123
|
+
class: "block",
|
|
124
|
+
"(click)": "onClick($event)"
|
|
125
|
+
},
|
|
126
|
+
template: "@if (label()) {\n <label\n [attr.id]=\"labelIdAttr\"\n [attr.for]=\"forAttr\"\n class=\"ui-text-body ui-field-label\"\n >\n {{ label() }}\n\n @if (required()) {\n <span class=\"text-danger-500\" aria-hidden=\"true\">*</span>\n <span class=\"sr-only\">(required)</span>\n }\n </label>\n}\n\n<ng-content />\n\n@if (error()) {\n <div\n [attr.id]=\"errorAttr\"\n class=\"text-danger-600 ui-text-caption ui-field-hint\"\n role=\"alert\"\n >\n {{ error() }}\n </div>\n} @else if (hint()) {\n <div\n [attr.id]=\"hintAttr\"\n class=\"text-muted-foreground-1 ui-text-caption ui-field-hint\"\n >\n {{ hint() }}\n </div>\n}\n",
|
|
127
|
+
styles: [":host{position:relative}.ui-field-label{margin-bottom:calc(var(--spacing, .25rem) * 1.5);display:inline-flex;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2)}.ui-field-hint{margin-top:calc(var(--spacing, .25rem) * 1.5);display:inline-flex;align-items:center;column-gap:calc(var(--spacing, .25rem) * 2)}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"]
|
|
128
|
+
}]
|
|
129
|
+
}],
|
|
130
|
+
propDecorators: {
|
|
131
|
+
label: [{
|
|
132
|
+
type: i0.Input,
|
|
133
|
+
args: [{
|
|
134
|
+
isSignal: true,
|
|
135
|
+
alias: "label",
|
|
136
|
+
required: false
|
|
137
|
+
}]
|
|
138
|
+
}],
|
|
139
|
+
hint: [{
|
|
140
|
+
type: i0.Input,
|
|
141
|
+
args: [{
|
|
142
|
+
isSignal: true,
|
|
143
|
+
alias: "hint",
|
|
144
|
+
required: false
|
|
145
|
+
}]
|
|
146
|
+
}],
|
|
147
|
+
required: [{
|
|
148
|
+
type: i0.Input,
|
|
149
|
+
args: [{
|
|
150
|
+
isSignal: true,
|
|
151
|
+
alias: "required",
|
|
152
|
+
required: false
|
|
153
|
+
}]
|
|
154
|
+
}],
|
|
155
|
+
error: [{
|
|
156
|
+
type: i0.Input,
|
|
157
|
+
args: [{
|
|
158
|
+
isSignal: true,
|
|
159
|
+
alias: "error",
|
|
160
|
+
required: false
|
|
161
|
+
}]
|
|
162
|
+
}],
|
|
163
|
+
for: [{
|
|
164
|
+
type: i0.Input,
|
|
165
|
+
args: [{
|
|
166
|
+
isSignal: true,
|
|
167
|
+
alias: "for",
|
|
168
|
+
required: false
|
|
169
|
+
}]
|
|
170
|
+
}],
|
|
171
|
+
hintId: [{
|
|
172
|
+
type: i0.Input,
|
|
173
|
+
args: [{
|
|
174
|
+
isSignal: true,
|
|
175
|
+
alias: "hintId",
|
|
176
|
+
required: false
|
|
177
|
+
}]
|
|
178
|
+
}],
|
|
179
|
+
errorId: [{
|
|
180
|
+
type: i0.Input,
|
|
181
|
+
args: [{
|
|
182
|
+
isSignal: true,
|
|
183
|
+
alias: "errorId",
|
|
184
|
+
required: false
|
|
185
|
+
}]
|
|
186
|
+
}]
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
export { UiFieldComponent };
|
|
190
|
+
|
|
191
|
+
//# sourceMappingURL=area8975-ui-field.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"area8975-ui-field.mjs","names":[],"sources":["../../../projects/ui/field/field.component.ts","../../../projects/ui/field/field.component.html"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n computed,\n DOCUMENT,\n inject,\n input\n} from '@angular/core';\n\n\n@Component({\n selector: 'ui-field',\n templateUrl: './field.component.html',\n styleUrl: './field.component.css',\n host: { class: 'block', '(click)': 'onClick($event)' }\n})\nexport class UiFieldComponent {\n readonly label = input<string>('');\n readonly hint = input<string>('');\n\n /**\n * Shows a \"*\" marker next to the label.\n */\n readonly required = input(false, { transform: booleanAttribute });\n\n /**\n * An error message, shown instead of `hint` when present.\n */\n readonly error = input<string>('');\n\n // Pass the id of the control being labelled (e.g. the `ui-input`'s `id`)\n // so the label is properly associated with it for accessibility.\n readonly for = input<string>('');\n\n // Ids for the hint/error elements - pass both to the control's\n // `describedBy` (e.g. `ui-input`) so screen readers announce whichever\n // is showing. Safe to pass both even though only one renders at a\n // time - an aria-describedby token pointing at a nonexistent id is\n // simply ignored.\n readonly hintId = input<string>('');\n readonly errorId = input<string>('');\n\n /**\n * The label's id, `${for}-label`. Controls that a `<label for>` can't\n * reach (e.g. `ui-rich-text-editor`) point `aria-labelledby` at it.\n */\n readonly labelId = computed(() =>\n this.for() && this.label() ? `${this.for()}-label` : ''\n );\n\n private readonly document = inject(DOCUMENT);\n\n protected get forAttr() {\n return this.for() || null;\n }\n\n protected get labelIdAttr() {\n return this.labelId() || null;\n }\n\n /**\n * A label click is passed on to its control as a click, which opens a\n * `ui-select` or `ui-datepicker` rather than just focusing it, and does\n * nothing at all for controls a label can't target (a contenteditable,\n * a `role=\"button\"` div). So apart from checkboxes and radios, where the\n * click is the point, the label just focuses its control.\n */\n protected onClick(event: MouseEvent) {\n const label = (event.target as Element).closest('label');\n\n if (!label?.classList.contains('ui-field-label')) {\n return;\n }\n\n const control = label.control;\n\n if (\n control instanceof HTMLInputElement &&\n (control.type === 'checkbox' || control.type === 'radio')\n ) {\n return;\n }\n\n const target = control ?? (this.for() ?\n this.document.getElementById(this.for()) :\n null);\n\n if (target) {\n event.preventDefault();\n target.focus();\n }\n }\n\n protected get hintAttr() {\n return this.hintId() || null;\n }\n\n protected get errorAttr() {\n return this.errorId() || null;\n }\n}\n","@if (label()) {\n <label\n [attr.id]=\"labelIdAttr\"\n [attr.for]=\"forAttr\"\n class=\"ui-text-body ui-field-label\"\n >\n {{ label() }}\n\n @if (required()) {\n <span class=\"text-danger-500\" aria-hidden=\"true\">*</span>\n <span class=\"sr-only\">(required)</span>\n }\n </label>\n}\n\n<ng-content />\n\n@if (error()) {\n <div\n [attr.id]=\"errorAttr\"\n class=\"text-danger-600 ui-text-caption ui-field-hint\"\n role=\"alert\"\n >\n {{ error() }}\n </div>\n} @else if (hint()) {\n <div\n [attr.id]=\"hintAttr\"\n class=\"text-muted-foreground-1 ui-text-caption ui-field-hint\"\n >\n {{ hint() }}\n </div>\n}\n"],"mappings":";;AAgBA,IAAa,mBAAb,MAAa,iBAAgB;CAChB,QAAQ,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,OAAO,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAKxB,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CAKrD,QAAQ,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAIzB,MAAM,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CAOvB,SAAS,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAC1B,UAAU,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAM3B,UAAU,eACf,KAAK,IAAG,KAAM,KAAK,MAAK,IAAK,GAAG,KAAK,IAAG,EAAE,UAAW,IACxD,GAAA,YAAA,CAAA,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