@alfadocs/ui-kit-debug 1.126.0 → 1.127.1
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/dist/_chunks/{balance-badge-cell-DtxbGJcA.js → balance-badge-cell-BtFge7Y6.js} +3 -3
- package/dist/_chunks/{balance-badge-cell-DtxbGJcA.js.map → balance-badge-cell-BtFge7Y6.js.map} +1 -1
- package/dist/_chunks/{bill-line-table-HrynB7ND.js → bill-line-table-BRxX0Awq.js} +2 -2
- package/dist/_chunks/{bill-line-table-HrynB7ND.js.map → bill-line-table-BRxX0Awq.js.map} +1 -1
- package/dist/_chunks/{calendar-appointment-editor-dialog-CiCmsBCH.js → calendar-appointment-editor-dialog-B-zYgCgH.js} +2 -2
- package/dist/_chunks/{calendar-appointment-editor-dialog-CiCmsBCH.js.map → calendar-appointment-editor-dialog-B-zYgCgH.js.map} +1 -1
- package/dist/_chunks/{data-grid-C71BhGDw.js → data-grid-bzvkQ3kc.js} +446 -423
- package/dist/_chunks/data-grid-bzvkQ3kc.js.map +1 -0
- package/dist/_chunks/{data-table-DhYx-hCD.js → data-table-BCfkcPti.js} +2 -2
- package/dist/_chunks/{data-table-DhYx-hCD.js.map → data-table-BCfkcPti.js.map} +1 -1
- package/dist/_chunks/{default-tabs-RvCI5uN0.js → default-tabs-yEfqAPuT.js} +3 -3
- package/dist/_chunks/{default-tabs-RvCI5uN0.js.map → default-tabs-yEfqAPuT.js.map} +1 -1
- package/dist/_chunks/{file-manager-DNq-sEsy.js → file-manager-Dpwv0qs-.js} +2 -2
- package/dist/_chunks/{file-manager-DNq-sEsy.js.map → file-manager-Dpwv0qs-.js.map} +1 -1
- package/dist/_chunks/{heatmap-BurtKmeu.js → heatmap-Ds5DJBUL.js} +2 -2
- package/dist/_chunks/{heatmap-BurtKmeu.js.map → heatmap-Ds5DJBUL.js.map} +1 -1
- package/dist/_chunks/{invoice-upload-list-C95s5Q7m.js → invoice-upload-list-CgS_TBuX.js} +12 -12
- package/dist/_chunks/invoice-upload-list-CgS_TBuX.js.map +1 -0
- package/dist/_chunks/{link-cell-renderer-BEaLczk2.js → link-cell-renderer-CC9VHU68.js} +2 -2
- package/dist/_chunks/{link-cell-renderer-BEaLczk2.js.map → link-cell-renderer-CC9VHU68.js.map} +1 -1
- package/dist/_chunks/{muscle-scheme-TgnoZGDA.js → muscle-scheme-CHrjv7p2.js} +237 -235
- package/dist/_chunks/{muscle-scheme-TgnoZGDA.js.map → muscle-scheme-CHrjv7p2.js.map} +1 -1
- package/dist/_chunks/{parts-CcyRkB8t.js → parts-tGzYz0uG.js} +42 -36
- package/dist/_chunks/parts-tGzYz0uG.js.map +1 -0
- package/dist/_chunks/{toolbar-Dznu_Dou.js → toolbar-Co46MEn9.js} +3 -3
- package/dist/_chunks/{toolbar-Dznu_Dou.js.map → toolbar-Co46MEn9.js.map} +1 -1
- package/dist/_chunks/warehouse-load-summary-DkAKXcw0.js +289 -0
- package/dist/_chunks/warehouse-load-summary-DkAKXcw0.js.map +1 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/browser-support.js +1 -1
- package/dist/components/_shared/table-toolbar/parts.d.ts.map +1 -1
- package/dist/components/bill-line-table/index.js +1 -1
- package/dist/components/bill-table/index.js +1 -1
- package/dist/components/data-grid/data-grid.variants.d.ts +3 -1
- package/dist/components/data-grid/data-grid.variants.d.ts.map +1 -1
- package/dist/components/data-grid/header.d.ts.map +1 -1
- package/dist/components/data-grid/index.js +2 -2
- package/dist/components/data-table/index.js +2 -2
- package/dist/components/file-manager/index.js +1 -1
- package/dist/components/heatmap/index.js +1 -1
- package/dist/components/invoice-upload-list/columns.d.ts.map +1 -1
- package/dist/components/invoice-upload-list/index.js +1 -1
- package/dist/components/muscle-scheme/index.js +1 -1
- package/dist/components/muscle-scheme/muscle-scheme.d.ts.map +1 -1
- package/dist/components/patient-table/index.js +1 -1
- package/dist/components/warehouse-load-summary/index.js +1 -1
- package/dist/components/warehouse-load-summary/types.d.ts +6 -0
- package/dist/components/warehouse-load-summary/types.d.ts.map +1 -1
- package/dist/components/warehouse-load-summary/warehouse-load-summary.d.ts +1 -1
- package/dist/components/warehouse-load-summary/warehouse-load-summary.d.ts.map +1 -1
- package/dist/core.css +1 -1
- package/dist/host-legacy.css +9 -0
- package/dist/i18n/locales/ar.d.ts +5 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +5 -0
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +5 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +5 -0
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +5 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +5 -0
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +5 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +5 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +5 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +5 -0
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +5 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +5 -0
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +5 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +5 -0
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +5 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +5 -0
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +5 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +5 -0
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +5 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +5 -0
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +5 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +5 -0
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +5 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +5 -0
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +5 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +5 -0
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +5 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +5 -0
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +5 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +5 -0
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +5 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +5 -0
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +5 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +5 -0
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +5 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +5 -0
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +13 -13
- package/dist/locales/ar.json +5 -0
- package/dist/locales/de.json +5 -0
- package/dist/locales/el.json +5 -0
- package/dist/locales/en.json +5 -0
- package/dist/locales/es.json +5 -0
- package/dist/locales/fr.json +5 -0
- package/dist/locales/hi.json +5 -0
- package/dist/locales/it.json +5 -0
- package/dist/locales/ja.json +5 -0
- package/dist/locales/nl.json +5 -0
- package/dist/locales/pl.json +5 -0
- package/dist/locales/pt.json +5 -0
- package/dist/locales/ro.json +5 -0
- package/dist/locales/ru.json +5 -0
- package/dist/locales/sq.json +5 -0
- package/dist/locales/sv.json +5 -0
- package/dist/locales/tr.json +5 -0
- package/dist/locales/zh.json +5 -0
- package/dist/patterns/calendar/index.js +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/data-grid-C71BhGDw.js.map +0 -1
- package/dist/_chunks/invoice-upload-list-C95s5Q7m.js.map +0 -1
- package/dist/_chunks/parts-CcyRkB8t.js.map +0 -1
- package/dist/_chunks/warehouse-load-summary-D88M4Ii7.js +0 -255
- package/dist/_chunks/warehouse-load-summary-D88M4Ii7.js.map +0 -1
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import { jsxs as u, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { useId as A, useRef as _, useEffect as F, useMemo as y } from "react";
|
|
3
|
-
import { useTranslation as W } from "react-i18next";
|
|
4
|
-
import { u as C } from "./registry-DvAUVLHh.js";
|
|
5
|
-
import { A as f } from "./alert-C4WKViaS.js";
|
|
6
|
-
import { S as R } from "./stat-WGLdn5Vn.js";
|
|
7
|
-
import { a as j } from "./stat-group-CC4-O-Fj.js";
|
|
8
|
-
import { W as U, w as k } from "./counts-BXtzNv_G.js";
|
|
9
|
-
const H = /* @__PURE__ */ new Set([
|
|
10
|
-
"itemsUpdated",
|
|
11
|
-
"filesWithErrors"
|
|
12
|
-
]), D = /* @__PURE__ */ new Set([
|
|
13
|
-
"invoicesLoaded",
|
|
14
|
-
"filesWithErrors"
|
|
15
|
-
]);
|
|
16
|
-
function p(a) {
|
|
17
|
-
return typeof a == "number" && Number.isFinite(a) && a >= 0;
|
|
18
|
-
}
|
|
19
|
-
function O(a, t) {
|
|
20
|
-
const n = [];
|
|
21
|
-
for (const s of U) {
|
|
22
|
-
if (t === "invoice" && D.has(s)) continue;
|
|
23
|
-
const i = a[s];
|
|
24
|
-
if (!p(i)) continue;
|
|
25
|
-
const r = Math.trunc(i);
|
|
26
|
-
r === 0 && H.has(s) || n.push({ key: s, count: r });
|
|
27
|
-
}
|
|
28
|
-
return n;
|
|
29
|
-
}
|
|
30
|
-
function V(a, t, n) {
|
|
31
|
-
if (a) return a;
|
|
32
|
-
const i = (t.filesWithErrors ?? 0) > 0 || n.length > 0, r = p(t.invoicesLoaded) && t.invoicesLoaded >= 1 || p(t.linesLoaded) && t.linesLoaded >= 1;
|
|
33
|
-
return i ? r ? "partial" : "error" : r ? "success" : "unchanged";
|
|
34
|
-
}
|
|
35
|
-
const $ = {
|
|
36
|
-
id: "warehouse-load-summary",
|
|
37
|
-
capabilities: [],
|
|
38
|
-
state: {
|
|
39
|
-
counts: {
|
|
40
|
-
type: "Record<string, number>",
|
|
41
|
-
description: "The counts shown, by key (invoicesLoaded, itemsCreated, itemsUpdated, linesLoaded, linesAlreadyLoaded, linesSkipped, filesWithErrors). Hidden counts are absent.",
|
|
42
|
-
read: (a) => a.getCounts()
|
|
43
|
-
},
|
|
44
|
-
failedFileIds: {
|
|
45
|
-
type: "string[]",
|
|
46
|
-
description: "Ids of the failed files listed. File names and error texts are not read.",
|
|
47
|
-
read: (a) => a.getFailedFileIds()
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
actions: {},
|
|
51
|
-
domHooks: {
|
|
52
|
-
root: {
|
|
53
|
-
attr: "data-component",
|
|
54
|
-
value: "warehouse-load-summary",
|
|
55
|
-
description: "Marks the summary root."
|
|
56
|
-
},
|
|
57
|
-
instanceId: {
|
|
58
|
-
attr: "data-component-id",
|
|
59
|
-
sourceProp: "id",
|
|
60
|
-
description: "Sourced from the id prop."
|
|
61
|
-
},
|
|
62
|
-
item: {
|
|
63
|
-
attr: "data-file-id",
|
|
64
|
-
description: "Each failed file row emits its id as data-file-id."
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, B = {
|
|
68
|
-
success: "success",
|
|
69
|
-
partial: "warning",
|
|
70
|
-
error: "error",
|
|
71
|
-
unchanged: "info"
|
|
72
|
-
}, M = [], S = {
|
|
73
|
-
filesWithErrors: "destructive"
|
|
74
|
-
};
|
|
75
|
-
function te({
|
|
76
|
-
counts: a,
|
|
77
|
-
scope: t = "batch",
|
|
78
|
-
outcome: n,
|
|
79
|
-
failedFiles: s = M,
|
|
80
|
-
headingLevel: i = 2,
|
|
81
|
-
focusOnMount: r = !0,
|
|
82
|
-
actions: h,
|
|
83
|
-
id: g,
|
|
84
|
-
className: E
|
|
85
|
-
}) {
|
|
86
|
-
const { t: d, i18n: I } = W("ui"), m = I.language, v = A(), L = _(null);
|
|
87
|
-
F(() => {
|
|
88
|
-
var e;
|
|
89
|
-
r && ((e = L.current) == null || e.focus({ preventScroll: !0 }));
|
|
90
|
-
}, [r]);
|
|
91
|
-
const l = y(() => O(a, t), [a, t]), c = V(n, a, s), x = y(
|
|
92
|
-
() => ({
|
|
93
|
-
getCounts: () => Object.fromEntries(l.map((e) => [e.key, e.count])),
|
|
94
|
-
getFailedFileIds: () => s.map((e) => e.id)
|
|
95
|
-
}),
|
|
96
|
-
[l, s]
|
|
97
|
-
);
|
|
98
|
-
C($, x, g);
|
|
99
|
-
const N = d(`warehouseLoadSummary.title.${t}.${c}`, {
|
|
100
|
-
defaultValue: Y[t][c]
|
|
101
|
-
}), T = l.filter((e) => e.count > 0).map((e) => k(d, m, e.key, e.count)), w = G(T, m);
|
|
102
|
-
return /* @__PURE__ */ u(
|
|
103
|
-
"div",
|
|
104
|
-
{
|
|
105
|
-
"data-component": "warehouse-load-summary",
|
|
106
|
-
"data-component-id": g,
|
|
107
|
-
"data-outcome": c,
|
|
108
|
-
className: ["ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", E].filter(Boolean).join(" "),
|
|
109
|
-
children: [
|
|
110
|
-
/* @__PURE__ */ u(
|
|
111
|
-
f,
|
|
112
|
-
{
|
|
113
|
-
variant: B[c],
|
|
114
|
-
announce: r ? "off" : "polite",
|
|
115
|
-
children: [
|
|
116
|
-
/* @__PURE__ */ o(
|
|
117
|
-
f.Title,
|
|
118
|
-
{
|
|
119
|
-
ref: L,
|
|
120
|
-
tabIndex: -1,
|
|
121
|
-
className: "ds:outline-none",
|
|
122
|
-
as: `h${i}`,
|
|
123
|
-
children: N
|
|
124
|
-
}
|
|
125
|
-
),
|
|
126
|
-
w ? /* @__PURE__ */ o(f.Description, { children: w }) : null
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
),
|
|
130
|
-
l.length > 0 ? /* @__PURE__ */ o(
|
|
131
|
-
j,
|
|
132
|
-
{
|
|
133
|
-
"aria-label": d("warehouseLoadSummary.counts", {
|
|
134
|
-
defaultValue: "Load counts"
|
|
135
|
-
}),
|
|
136
|
-
maxColumns: 4,
|
|
137
|
-
children: l.map(({ key: e, count: b }) => /* @__PURE__ */ o(
|
|
138
|
-
R,
|
|
139
|
-
{
|
|
140
|
-
variant: "outlined",
|
|
141
|
-
size: "sm",
|
|
142
|
-
label: d(`warehouseLoadSummary.stat.${e}`, {
|
|
143
|
-
defaultValue: z[e]
|
|
144
|
-
}),
|
|
145
|
-
value: b,
|
|
146
|
-
locale: m,
|
|
147
|
-
intent: b > 0 && e in S ? S[e] : "foreground"
|
|
148
|
-
},
|
|
149
|
-
e
|
|
150
|
-
))
|
|
151
|
-
}
|
|
152
|
-
) : null,
|
|
153
|
-
s.length > 0 ? /* @__PURE__ */ u(
|
|
154
|
-
"div",
|
|
155
|
-
{
|
|
156
|
-
role: "group",
|
|
157
|
-
"aria-labelledby": v,
|
|
158
|
-
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
|
|
159
|
-
children: [
|
|
160
|
-
/* @__PURE__ */ o(
|
|
161
|
-
K,
|
|
162
|
-
{
|
|
163
|
-
as: `h${Math.min(i + 1, 6)}`,
|
|
164
|
-
id: v,
|
|
165
|
-
children: d("warehouseLoadSummary.failedFiles", {
|
|
166
|
-
defaultValue: "Files that could not be loaded"
|
|
167
|
-
})
|
|
168
|
-
}
|
|
169
|
-
),
|
|
170
|
-
/* @__PURE__ */ o(
|
|
171
|
-
"ul",
|
|
172
|
-
{
|
|
173
|
-
role: "list",
|
|
174
|
-
className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-xs)] ds:p-0",
|
|
175
|
-
children: s.map((e) => /* @__PURE__ */ u(
|
|
176
|
-
"li",
|
|
177
|
-
{
|
|
178
|
-
"data-file-id": e.id,
|
|
179
|
-
className: "ds:flex ds:flex-col ds:break-words ds:border-s-[length:var(--border-width-md)] ds:border-s-[color:var(--destructive)] ds:ps-[var(--spacing-sm)]",
|
|
180
|
-
children: [
|
|
181
|
-
/* @__PURE__ */ o(
|
|
182
|
-
"span",
|
|
183
|
-
{
|
|
184
|
-
dir: "auto",
|
|
185
|
-
className: "type-label ds:text-[var(--foreground)]",
|
|
186
|
-
children: e.fileName
|
|
187
|
-
}
|
|
188
|
-
),
|
|
189
|
-
/* @__PURE__ */ o(
|
|
190
|
-
"span",
|
|
191
|
-
{
|
|
192
|
-
dir: "auto",
|
|
193
|
-
className: "type-meta ds:text-[var(--muted-foreground)]",
|
|
194
|
-
children: e.error
|
|
195
|
-
}
|
|
196
|
-
)
|
|
197
|
-
]
|
|
198
|
-
},
|
|
199
|
-
e.id
|
|
200
|
-
))
|
|
201
|
-
}
|
|
202
|
-
)
|
|
203
|
-
]
|
|
204
|
-
}
|
|
205
|
-
) : null,
|
|
206
|
-
h ? /* @__PURE__ */ o("div", { className: "ds:flex ds:flex-wrap ds:justify-end ds:gap-[var(--spacing-sm)]", children: h }) : null
|
|
207
|
-
]
|
|
208
|
-
}
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
const Y = {
|
|
212
|
-
invoice: {
|
|
213
|
-
success: "Invoice loaded",
|
|
214
|
-
partial: "Invoice loaded with warnings",
|
|
215
|
-
error: "The invoice could not be loaded",
|
|
216
|
-
unchanged: "Nothing new to load"
|
|
217
|
-
},
|
|
218
|
-
batch: {
|
|
219
|
-
success: "Invoices loaded",
|
|
220
|
-
partial: "Invoices loaded, some files failed",
|
|
221
|
-
error: "No invoices were loaded",
|
|
222
|
-
unchanged: "Nothing new to load"
|
|
223
|
-
}
|
|
224
|
-
}, z = {
|
|
225
|
-
invoicesLoaded: "Invoices loaded",
|
|
226
|
-
itemsCreated: "Items created",
|
|
227
|
-
itemsUpdated: "Items updated",
|
|
228
|
-
linesLoaded: "Lines loaded",
|
|
229
|
-
linesAlreadyLoaded: "Lines already loaded",
|
|
230
|
-
linesSkipped: "Lines skipped",
|
|
231
|
-
filesWithErrors: "Files with errors"
|
|
232
|
-
};
|
|
233
|
-
function G(a, t) {
|
|
234
|
-
if (a.length === 0) return "";
|
|
235
|
-
try {
|
|
236
|
-
return new Intl.ListFormat(t, {
|
|
237
|
-
style: "long",
|
|
238
|
-
type: "conjunction"
|
|
239
|
-
}).format(a);
|
|
240
|
-
} catch {
|
|
241
|
-
return a.join(", ");
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
function K({
|
|
245
|
-
as: a,
|
|
246
|
-
id: t,
|
|
247
|
-
children: n
|
|
248
|
-
}) {
|
|
249
|
-
return /* @__PURE__ */ o(a, { id: t, className: "type-label ds:m-0 ds:text-[var(--foreground)]", children: n });
|
|
250
|
-
}
|
|
251
|
-
export {
|
|
252
|
-
te as W,
|
|
253
|
-
$ as w
|
|
254
|
-
};
|
|
255
|
-
//# sourceMappingURL=warehouse-load-summary-D88M4Ii7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"warehouse-load-summary-D88M4Ii7.js","sources":["../../src/components/warehouse-load-summary/model.ts","../../src/components/warehouse-load-summary/warehouse-load-summary.agent.ts","../../src/components/warehouse-load-summary/warehouse-load-summary.tsx"],"sourcesContent":["import { WAREHOUSE_COUNT_KEYS } from '../_shared/warehouse-load';\nimport type {\n WarehouseCountKey,\n WarehouseLoadCounts,\n WarehouseLoadFailedFile,\n WarehouseLoadOutcome,\n WarehouseLoadScope,\n} from './types';\n\n/** Counts that hide at zero (nothing to report). */\nconst HIDE_AT_ZERO: ReadonlySet<WarehouseCountKey> = new Set([\n 'itemsUpdated',\n 'filesWithErrors',\n]);\n/** Counts a single-invoice summary leaves out. */\nconst BATCH_ONLY: ReadonlySet<WarehouseCountKey> = new Set([\n 'invoicesLoaded',\n 'filesWithErrors',\n]);\n\nfunction usable(value: number | undefined): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value >= 0;\n}\n\n/** The counts to show, in vocabulary order. */\nexport function visibleCounts(\n counts: WarehouseLoadCounts,\n scope: WarehouseLoadScope,\n): Array<{ key: WarehouseCountKey; count: number }> {\n const out: Array<{ key: WarehouseCountKey; count: number }> = [];\n for (const key of WAREHOUSE_COUNT_KEYS) {\n if (scope === 'invoice' && BATCH_ONLY.has(key)) continue;\n const value = counts[key];\n if (!usable(value)) continue;\n const count = Math.trunc(value);\n if (count === 0 && HIDE_AT_ZERO.has(key)) continue;\n out.push({ key, count });\n }\n return out;\n}\n\nexport function resolveOutcome(\n outcome: WarehouseLoadOutcome | undefined,\n counts: WarehouseLoadCounts,\n failedFiles: ReadonlyArray<WarehouseLoadFailedFile>,\n): WarehouseLoadOutcome {\n if (outcome) return outcome;\n const errors = counts.filesWithErrors ?? 0;\n const failed = errors > 0 || failedFiles.length > 0;\n const loaded =\n (usable(counts.invoicesLoaded) && counts.invoicesLoaded >= 1) ||\n (usable(counts.linesLoaded) && counts.linesLoaded >= 1);\n if (failed) return loaded ? 'partial' : 'error';\n return loaded ? 'success' : 'unchanged';\n}\n","/* -------------------------------------------------------------------- */\n/* Agent adapter: WarehouseLoadSummary. */\n/* Read-only display. State is counts and ids; no actions, because the */\n/* host's `actions` slot owns every button. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { WarehouseLoadSummaryHandle } from './types';\n\nexport const warehouseLoadSummaryAgent: AgentAdapter<WarehouseLoadSummaryHandle> =\n {\n id: 'warehouse-load-summary',\n capabilities: [],\n state: {\n counts: {\n type: 'Record<string, number>',\n description:\n 'The counts shown, by key (invoicesLoaded, itemsCreated, itemsUpdated, linesLoaded, linesAlreadyLoaded, linesSkipped, filesWithErrors). Hidden counts are absent.',\n read: (handle) => handle.getCounts(),\n },\n failedFileIds: {\n type: 'string[]',\n description:\n 'Ids of the failed files listed. File names and error texts are not read.',\n read: (handle) => handle.getFailedFileIds(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'warehouse-load-summary',\n description: 'Marks the summary root.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-file-id',\n description: 'Each failed file row emits its id as data-file-id.',\n },\n },\n };\n","import { useEffect, useId, useMemo, useRef, type ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent';\nimport { Alert } from '../alert';\nimport { Stat } from '../stat';\nimport { StatGroup } from '../stat-group';\nimport { warehouseCountLabel } from '../_shared/warehouse-load';\nimport { visibleCounts, resolveOutcome } from './model';\nimport { warehouseLoadSummaryAgent } from './warehouse-load-summary.agent';\nimport type {\n WarehouseCountKey,\n WarehouseLoadFailedFile,\n WarehouseLoadOutcome,\n WarehouseLoadSummaryHandle,\n WarehouseLoadSummaryProps,\n} from './types';\n\nconst ALERT_VARIANT = {\n success: 'success',\n partial: 'warning',\n error: 'error',\n unchanged: 'info',\n} as const satisfies Record<WarehouseLoadOutcome, string>;\n\nconst NO_FAILED_FILES: ReadonlyArray<WarehouseLoadFailedFile> = [];\n\nconst STAT_INTENT = {\n filesWithErrors: 'destructive',\n} as const satisfies Partial<Record<WarehouseCountKey, string>>;\n\n/**\n * What a warehouse load produced: a heading by outcome, one tile per count\n * and the files that failed. Displays only; the platform counts.\n */\nexport function WarehouseLoadSummary({\n counts,\n scope = 'batch',\n outcome,\n failedFiles = NO_FAILED_FILES,\n headingLevel = 2,\n focusOnMount = true,\n actions,\n id,\n className,\n}: WarehouseLoadSummaryProps) {\n const { t, i18n } = useTranslation('ui');\n const language = i18n.language;\n const headingId = useId();\n const titleRef = useRef<HTMLHeadingElement>(null);\n\n // The summary replaces the review step, so focus would drop to <body>.\n // Focusing the heading makes screen readers read the result (WCAG 2.4.3,\n // 4.1.3); the Alert then stays silent so it is not read twice.\n useEffect(() => {\n if (focusOnMount) titleRef.current?.focus({ preventScroll: true });\n }, [focusOnMount]);\n\n const shown = useMemo(() => visibleCounts(counts, scope), [counts, scope]);\n const resolved = resolveOutcome(outcome, counts, failedFiles);\n\n const handle = useMemo<WarehouseLoadSummaryHandle>(\n () => ({\n getCounts: () => Object.fromEntries(shown.map((c) => [c.key, c.count])),\n getFailedFileIds: () => failedFiles.map((f) => f.id),\n }),\n [shown, failedFiles],\n );\n useAgentRegistration(warehouseLoadSummaryAgent, handle, id);\n\n const title = t(`warehouseLoadSummary.title.${scope}.${resolved}`, {\n defaultValue: DEFAULT_TITLES[scope][resolved],\n });\n const sentence = shown\n .filter((c) => c.count > 0)\n .map((c) => warehouseCountLabel(t, language, c.key, c.count));\n const description = formatList(sentence, language);\n\n return (\n <div\n data-component=\"warehouse-load-summary\"\n data-component-id={id}\n data-outcome={resolved}\n className={['ds:flex ds:flex-col ds:gap-[var(--spacing-md)]', className]\n .filter(Boolean)\n .join(' ')}\n >\n <Alert\n variant={ALERT_VARIANT[resolved]}\n announce={focusOnMount ? 'off' : 'polite'}\n >\n <Alert.Title\n ref={titleRef}\n tabIndex={-1}\n className=\"ds:outline-none\"\n as={`h${headingLevel}` as const}\n >\n {title}\n </Alert.Title>\n {description ? (\n <Alert.Description>{description}</Alert.Description>\n ) : null}\n </Alert>\n\n {shown.length > 0 ? (\n <StatGroup\n aria-label={t('warehouseLoadSummary.counts', {\n defaultValue: 'Load counts',\n })}\n maxColumns={4}\n >\n {shown.map(({ key, count }) => (\n <Stat\n key={key}\n variant=\"outlined\"\n size=\"sm\"\n label={t(`warehouseLoadSummary.stat.${key}`, {\n defaultValue: DEFAULT_STAT_LABELS[key],\n })}\n value={count}\n locale={language}\n intent={\n count > 0 && key in STAT_INTENT\n ? STAT_INTENT[key as keyof typeof STAT_INTENT]\n : 'foreground'\n }\n />\n ))}\n </StatGroup>\n ) : null}\n\n {failedFiles.length > 0 ? (\n <div\n role=\"group\"\n aria-labelledby={headingId}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <SubHeading\n as={`h${Math.min(headingLevel + 1, 6)}` as 'h3'}\n id={headingId}\n >\n {t('warehouseLoadSummary.failedFiles', {\n defaultValue: 'Files that could not be loaded',\n })}\n </SubHeading>\n {/* eslint-disable-next-line jsx-a11y/no-redundant-roles -- Safari drops list semantics under list-none */}\n <ul\n role=\"list\"\n className=\"ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-xs)] ds:p-0\"\n >\n {failedFiles.map((file) => (\n <li\n key={file.id}\n data-file-id={file.id}\n className=\"ds:flex ds:flex-col ds:break-words ds:border-s-[length:var(--border-width-md)] ds:border-s-[color:var(--destructive)] ds:ps-[var(--spacing-sm)]\"\n >\n <span\n dir=\"auto\"\n className=\"type-label ds:text-[var(--foreground)]\"\n >\n {file.fileName}\n </span>\n <span\n dir=\"auto\"\n className=\"type-meta ds:text-[var(--muted-foreground)]\"\n >\n {file.error}\n </span>\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n\n {actions ? (\n <div className=\"ds:flex ds:flex-wrap ds:justify-end ds:gap-[var(--spacing-sm)]\">\n {actions}\n </div>\n ) : null}\n </div>\n );\n}\n\nconst DEFAULT_TITLES = {\n invoice: {\n success: 'Invoice loaded',\n partial: 'Invoice loaded with warnings',\n error: 'The invoice could not be loaded',\n unchanged: 'Nothing new to load',\n },\n batch: {\n success: 'Invoices loaded',\n partial: 'Invoices loaded, some files failed',\n error: 'No invoices were loaded',\n unchanged: 'Nothing new to load',\n },\n} as const;\n\nconst DEFAULT_STAT_LABELS = {\n invoicesLoaded: 'Invoices loaded',\n itemsCreated: 'Items created',\n itemsUpdated: 'Items updated',\n linesLoaded: 'Lines loaded',\n linesAlreadyLoaded: 'Lines already loaded',\n linesSkipped: 'Lines skipped',\n filesWithErrors: 'Files with errors',\n} as const satisfies Record<WarehouseCountKey, string>;\n\nfunction formatList(parts: string[], language: string | undefined): string {\n if (parts.length === 0) return '';\n try {\n return new Intl.ListFormat(language, {\n style: 'long',\n type: 'conjunction',\n }).format(parts);\n } catch {\n return parts.join(', ');\n }\n}\n\nfunction SubHeading({\n as: Tag,\n id,\n children,\n}: {\n as: 'h3' | 'h4' | 'h5' | 'h6';\n id: string;\n children: ReactNode;\n}) {\n return (\n <Tag id={id} className=\"type-label ds:m-0 ds:text-[var(--foreground)]\">\n {children}\n </Tag>\n );\n}\n"],"names":["HIDE_AT_ZERO","BATCH_ONLY","usable","value","visibleCounts","counts","scope","out","key","WAREHOUSE_COUNT_KEYS","count","resolveOutcome","outcome","failedFiles","failed","loaded","warehouseLoadSummaryAgent","handle","ALERT_VARIANT","NO_FAILED_FILES","STAT_INTENT","WarehouseLoadSummary","headingLevel","focusOnMount","actions","id","className","t","i18n","useTranslation","language","headingId","useId","titleRef","useRef","useEffect","_a","shown","useMemo","resolved","c","f","useAgentRegistration","title","DEFAULT_TITLES","sentence","warehouseCountLabel","description","formatList","jsxs","Alert","jsx","StatGroup","Stat","DEFAULT_STAT_LABELS","SubHeading","file","parts","Tag","children"],"mappings":";;;;;;;;AAUA,MAAMA,wBAAmD,IAAI;AAAA,EAC3D;AAAA,EACA;AACF,CAAC,GAEKC,wBAAiD,IAAI;AAAA,EACzD;AAAA,EACA;AACF,CAAC;AAED,SAASC,EAAOC,GAA4C;AAC1D,SAAO,OAAOA,KAAU,YAAY,OAAO,SAASA,CAAK,KAAKA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