@alfadocs/ui-kit 1.118.0 → 1.120.0

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.
Files changed (150) hide show
  1. package/dist/_chunks/{address-autocomplete-zLygkxFc.js → address-autocomplete-D2uNpxcE.js} +2 -2
  2. package/dist/_chunks/{address-fields-Dl1ALKhP.js → address-fields-BU65pA-V.js} +2 -2
  3. package/dist/_chunks/bill-line-table-DUMEHnQ4.js +1754 -0
  4. package/dist/_chunks/{calendar-appointment-editor-dialog-BEmBcb61.js → calendar-appointment-editor-dialog-rw02sXGw.js} +4 -4
  5. package/dist/_chunks/{compact-editor-fields-6sTWRLtf.js → compact-editor-fields-cP6yh7xv.js} +3 -3
  6. package/dist/_chunks/counts-BXtzNv_G.js +92 -0
  7. package/dist/_chunks/{data-grid-DiBSbN2Y.js → data-grid-Bbf8t4z3.js} +2 -2
  8. package/dist/_chunks/{default-tabs-CD285u0C.js → default-tabs-Cxkw1Ws0.js} +332 -368
  9. package/dist/_chunks/{document-scanner-5p-Uu8dy.js → document-scanner-CETscDea.js} +2 -2
  10. package/dist/_chunks/file-code-Cf-_gSzd.js +23 -0
  11. package/dist/_chunks/{file-manager-CV1_GtjC.js → file-manager-DNq-sEsy.js} +2 -2
  12. package/dist/_chunks/{file-upload-CxjCs7TX.js → file-upload-DQc0LsBM.js} +385 -311
  13. package/dist/_chunks/invoice-upload-list-CsFsRgbt.js +952 -0
  14. package/dist/_chunks/map-view-h6ngp2xi.js +1578 -0
  15. package/dist/_chunks/maps-MpMxTBov.js +63 -0
  16. package/dist/_chunks/maps-core-gate-DKx96CC_.js +1492 -0
  17. package/dist/_chunks/{notes-panel-CHR-Jv6N.js → notes-panel-BOwlTz2-.js} +2 -2
  18. package/dist/_chunks/package-plus-CTecQK3x.js +25 -0
  19. package/dist/_chunks/{practice-results-b3uchdBn.js → practice-results-yCresv86.js} +759 -750
  20. package/dist/_chunks/{public-footer-CB7ruuLI.js → public-footer-C8UIzqLJ.js} +326 -243
  21. package/dist/_chunks/{radiograph-panel.agent-9jwXlOXB.js → radiograph-panel.agent-Dcv16n7u.js} +2 -2
  22. package/dist/_chunks/{reserved.agent-V2Eqoabh.js → reserved.agent-DRSZ8UcL.js} +2 -2
  23. package/dist/_chunks/{rich-text-editor-CMPA5Wgy.js → rich-text-editor-BLEdXJ0l.js} +2 -2
  24. package/dist/_chunks/{signed-out-frame-bh7fn_Px.js → signed-out-frame-fUf7tqs3.js} +2 -2
  25. package/dist/_chunks/{task-editor-WdDCqbIL.js → task-editor-Czcx9B-3.js} +2 -2
  26. package/dist/_chunks/{toolbar-z8vXnpXz.js → toolbar-DoKcoE2q.js} +2 -2
  27. package/dist/_chunks/types-BrJRsnSG.js +291 -0
  28. package/dist/_chunks/warehouse-load-summary-D88M4Ii7.js +255 -0
  29. package/dist/agent-catalog.json +360 -14
  30. package/dist/agent-i18n/en.json +31 -2
  31. package/dist/browser-support.js +1 -1
  32. package/dist/components/_shared/warehouse-load/counts.d.ts +82 -0
  33. package/dist/components/_shared/warehouse-load/index.d.ts +4 -0
  34. package/dist/components/_shared/warehouse-load/maps.d.ts +67 -0
  35. package/dist/components/_shared/warehouse-load/types.d.ts +18 -0
  36. package/dist/components/address-autocomplete/index.js +1 -1
  37. package/dist/components/address-fields/index.js +1 -1
  38. package/dist/components/bill-line-table/bill-line-table.columns.d.ts +2 -0
  39. package/dist/components/bill-line-table/bill-line-table.header.d.ts +7 -0
  40. package/dist/components/bill-line-table/bill-line-table.model.d.ts +10 -1
  41. package/dist/components/bill-line-table/bill-line-table.types.d.ts +66 -1
  42. package/dist/components/bill-line-table/bill-line-table.variants.d.ts +12 -0
  43. package/dist/components/bill-line-table/index.d.ts +2 -2
  44. package/dist/components/bill-line-table/index.js +10 -8
  45. package/dist/components/bill-table/index.js +1 -1
  46. package/dist/components/booking/index.js +1 -1
  47. package/dist/components/data-grid/data-grid.variants.d.ts +1 -1
  48. package/dist/components/data-grid/index.js +2 -2
  49. package/dist/components/document-scanner/index.js +1 -1
  50. package/dist/components/file-manager/index.js +1 -1
  51. package/dist/components/file-upload/file-upload.d.ts +30 -1
  52. package/dist/components/file-upload/index.js +1 -1
  53. package/dist/components/flag/flag-view.d.ts +1 -1
  54. package/dist/components/index.d.ts +3 -0
  55. package/dist/components/invoice-upload/index.d.ts +5 -0
  56. package/dist/components/invoice-upload/index.js +7 -0
  57. package/dist/components/invoice-upload/invoice-upload.agent.d.ts +4 -0
  58. package/dist/components/invoice-upload/invoice-upload.d.ts +3 -0
  59. package/dist/components/invoice-upload/types.d.ts +72 -0
  60. package/dist/components/invoice-upload-list/cells.d.ts +36 -0
  61. package/dist/components/invoice-upload-list/columns.d.ts +14 -0
  62. package/dist/components/invoice-upload-list/handle.d.ts +18 -0
  63. package/dist/components/invoice-upload-list/index.d.ts +5 -0
  64. package/dist/components/invoice-upload-list/index.js +10 -0
  65. package/dist/components/invoice-upload-list/invoice-upload-list.agent.d.ts +4 -0
  66. package/dist/components/invoice-upload-list/invoice-upload-list.d.ts +10 -0
  67. package/dist/components/invoice-upload-list/invoice-upload-list.variants.d.ts +28 -0
  68. package/dist/components/invoice-upload-list/model.d.ts +40 -0
  69. package/dist/components/invoice-upload-list/types.d.ts +154 -0
  70. package/dist/components/map-view/index.js +1 -1
  71. package/dist/components/map-view/map-view-pin-geometry.d.ts +39 -0
  72. package/dist/components/map-view/map-view-pin.d.ts +15 -0
  73. package/dist/components/notes-panel/index.js +1 -1
  74. package/dist/components/practice-results/index.js +1 -1
  75. package/dist/components/practice-results/practice-results.d.ts +8 -0
  76. package/dist/components/public-footer/index.js +1 -1
  77. package/dist/components/public-footer/public-footer.d.ts +24 -0
  78. package/dist/components/public-header/public-header.d.ts +1 -1
  79. package/dist/components/radiograph-panel/index.js +1 -1
  80. package/dist/components/rich-text-editor/index.js +1 -1
  81. package/dist/components/task-editor/index.js +1 -1
  82. package/dist/components/warehouse-load-summary/index.d.ts +4 -0
  83. package/dist/components/warehouse-load-summary/index.js +6 -0
  84. package/dist/components/warehouse-load-summary/model.d.ts +8 -0
  85. package/dist/components/warehouse-load-summary/types.d.ts +50 -0
  86. package/dist/components/warehouse-load-summary/warehouse-load-summary.agent.d.ts +4 -0
  87. package/dist/components/warehouse-load-summary/warehouse-load-summary.d.ts +7 -0
  88. package/dist/core.css +1 -1
  89. package/dist/i18n/locales/ar.d.ts +203 -0
  90. package/dist/i18n/locales/ar.js +197 -4
  91. package/dist/i18n/locales/de.d.ts +203 -0
  92. package/dist/i18n/locales/de.js +201 -4
  93. package/dist/i18n/locales/el.d.ts +203 -0
  94. package/dist/i18n/locales/el.js +201 -4
  95. package/dist/i18n/locales/en.d.ts +203 -0
  96. package/dist/i18n/locales/en.js +203 -0
  97. package/dist/i18n/locales/es.d.ts +203 -0
  98. package/dist/i18n/locales/es.js +199 -4
  99. package/dist/i18n/locales/fr.d.ts +203 -0
  100. package/dist/i18n/locales/fr.js +199 -4
  101. package/dist/i18n/locales/hi.d.ts +203 -0
  102. package/dist/i18n/locales/hi.js +197 -4
  103. package/dist/i18n/locales/it.d.ts +203 -0
  104. package/dist/i18n/locales/it.js +197 -4
  105. package/dist/i18n/locales/ja.d.ts +203 -0
  106. package/dist/i18n/locales/ja.js +197 -4
  107. package/dist/i18n/locales/nl.d.ts +203 -0
  108. package/dist/i18n/locales/nl.js +197 -4
  109. package/dist/i18n/locales/pl.d.ts +203 -0
  110. package/dist/i18n/locales/pl.js +197 -4
  111. package/dist/i18n/locales/pt.d.ts +203 -0
  112. package/dist/i18n/locales/pt.js +199 -4
  113. package/dist/i18n/locales/ro.d.ts +203 -0
  114. package/dist/i18n/locales/ro.js +197 -4
  115. package/dist/i18n/locales/ru.d.ts +203 -0
  116. package/dist/i18n/locales/ru.js +197 -4
  117. package/dist/i18n/locales/sq.d.ts +203 -0
  118. package/dist/i18n/locales/sq.js +199 -4
  119. package/dist/i18n/locales/sv.d.ts +203 -0
  120. package/dist/i18n/locales/sv.js +197 -4
  121. package/dist/i18n/locales/tr.d.ts +203 -0
  122. package/dist/i18n/locales/tr.js +197 -4
  123. package/dist/i18n/locales/zh.d.ts +203 -0
  124. package/dist/i18n/locales/zh.js +197 -4
  125. package/dist/index.js +1190 -1174
  126. package/dist/locales/ar.json +207 -4
  127. package/dist/locales/de.json +207 -4
  128. package/dist/locales/el.json +207 -4
  129. package/dist/locales/en.json +203 -0
  130. package/dist/locales/es.json +207 -4
  131. package/dist/locales/fr.json +207 -4
  132. package/dist/locales/hi.json +207 -4
  133. package/dist/locales/it.json +207 -4
  134. package/dist/locales/ja.json +207 -4
  135. package/dist/locales/nl.json +207 -4
  136. package/dist/locales/pl.json +207 -4
  137. package/dist/locales/pt.json +207 -4
  138. package/dist/locales/ro.json +207 -4
  139. package/dist/locales/ru.json +207 -4
  140. package/dist/locales/sq.json +207 -4
  141. package/dist/locales/sv.json +207 -4
  142. package/dist/locales/tr.json +207 -4
  143. package/dist/locales/zh.json +207 -4
  144. package/dist/patterns/calendar/index.js +1 -1
  145. package/dist/patterns/signed-out-frame/index.js +1 -1
  146. package/dist/tokens.css +1 -1
  147. package/package.json +16 -1
  148. package/dist/_chunks/bill-line-table-vCnVo7_a.js +0 -1565
  149. package/dist/_chunks/map-view-CHeGd94F.js +0 -1443
  150. package/dist/_chunks/maps-core-gate-C4dyo1ic.js +0 -1571
@@ -7,7 +7,7 @@ import { I as v } from "./icon-button-S8_weU3g.js";
7
7
  import { B as L } from "./badge-BUk4RjTS.js";
8
8
  import { F as V } from "./form-field-CyHfOVKF.js";
9
9
  import { T as oe } from "./text-area-COMVJ1yE.js";
10
- import { F as de } from "./file-upload-CxjCs7TX.js";
10
+ import { F as de } from "./file-upload-DQc0LsBM.js";
11
11
  import { D as te } from "./date-picker-DBVTj6lO.js";
12
12
  import { D as le } from "./date-range-picker-PTRpDkXT.js";
13
13
  import { E } from "./empty-state-DwJ5YNzz.js";
@@ -533,4 +533,4 @@ export {
533
533
  qe as R,
534
534
  Ae as r
535
535
  };
536
- //# sourceMappingURL=radiograph-panel.agent-9jwXlOXB.js.map
536
+ //# sourceMappingURL=radiograph-panel.agent-Dcv16n7u.js.map
@@ -15,7 +15,7 @@ import { F as Je } from "./form-field-CyHfOVKF.js";
15
15
  import { P as wr } from "./phone-input-BL8Sj6OG.js";
16
16
  import { T as Cr } from "./text-area-COMVJ1yE.js";
17
17
  import { T as Yt } from "./text-input-B6iAgCr3.js";
18
- import { A as Tr } from "./address-fields-Dl1ALKhP.js";
18
+ import { A as Tr } from "./address-fields-BU65pA-V.js";
19
19
  import { S as qn } from "./spinner-CoflYlEx.js";
20
20
  import { a as on } from "./format-price-CIX0YJZn.js";
21
21
  import { C as Ar } from "./credit-card-D9XZsHGA.js";
@@ -4597,4 +4597,4 @@ export {
4597
4597
  bs as b,
4598
4598
  Mo as c
4599
4599
  };
4600
- //# sourceMappingURL=reserved.agent-V2Eqoabh.js.map
4600
+ //# sourceMappingURL=reserved.agent-DRSZ8UcL.js.map
@@ -29,7 +29,7 @@ import { D as ie } from "./dialog-CIUn5oLb.js";
29
29
  import { C as jn } from "./color-picker-AcaWuKah.js";
30
30
  import { S as nn } from "./state-backed-text-input-DVETOhSS.js";
31
31
  import { C as ua } from "./checkbox-DV4sNDeB.js";
32
- import { F as ma } from "./file-upload-CxjCs7TX.js";
32
+ import { F as ma } from "./file-upload-DQc0LsBM.js";
33
33
  import { c as I } from "./createLucideIcon-DhHxpK9K.js";
34
34
  import { E as fa } from "./ellipsis-dRo9ouSU.js";
35
35
  import { H as ga } from "./highlighter-DSkckT2Q.js";
@@ -4146,4 +4146,4 @@ export {
4146
4146
  Ii as r,
4147
4147
  Ts as w
4148
4148
  };
4149
- //# sourceMappingURL=rich-text-editor-CMPA5Wgy.js.map
4149
+ //# sourceMappingURL=rich-text-editor-BLEdXJ0l.js.map
@@ -2,7 +2,7 @@ import { jsxs as d, jsx as e, Fragment as v } from "react/jsx-runtime";
2
2
  import { forwardRef as y } from "react";
3
3
  import { c as H } from "./index-D2ZczOXr.js";
4
4
  import { A as S } from "./app-frame-DUPEwu4E.js";
5
- import { P as x } from "./public-footer-CB7ruuLI.js";
5
+ import { P as x } from "./public-footer-C8UIzqLJ.js";
6
6
  import { useTranslation as b } from "react-i18next";
7
7
  import { B as u } from "./button-DohK_Ak_.js";
8
8
  import { H as N, g as O, f as F, a as z, d as B } from "./header-l_B8MV0g.js";
@@ -168,4 +168,4 @@ export {
168
168
  V as S,
169
169
  w as a
170
170
  };
171
- //# sourceMappingURL=signed-out-frame-bh7fn_Px.js.map
171
+ //# sourceMappingURL=signed-out-frame-fUf7tqs3.js.map
@@ -24,7 +24,7 @@ import { T as Vt } from "./time-picker-DDr5vhwQ.js";
24
24
  import { u as _t } from "./registry-DvAUVLHh.js";
25
25
  import { u as zt } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
26
26
  import { c as Lt } from "./compose-refs-C0k0tdqF.js";
27
- import { a as Ut, E as Wt } from "./compact-editor-fields-6sTWRLtf.js";
27
+ import { E as Ut, a as Wt } from "./compact-editor-fields-cP6yh7xv.js";
28
28
  import { n as Kt } from "./normalize-diacritics-BNGbFNlJ.js";
29
29
  import { P as Ht } from "./privacy-mask-DJ1gee4c.js";
30
30
  import { g as Me, h as Gt } from "./handled-rejection-6gqCf5vt.js";
@@ -1215,4 +1215,4 @@ export {
1215
1215
  gn as T,
1216
1216
  ln as t
1217
1217
  };
1218
- //# sourceMappingURL=task-editor-WdDCqbIL.js.map
1218
+ //# sourceMappingURL=task-editor-Czcx9B-3.js.map
@@ -5,7 +5,7 @@ import { T as v, c as N, a as R } from "./parts-CcyRkB8t.js";
5
5
  import { e as k, s as P, w as A, a as B } from "./export-files-BByoK9Cg.js";
6
6
  import { i as O } from "./is-development-CLUAnsU7.js";
7
7
  import { d as j, g as Q, u as _ } from "./grid-context-jn9y8tNE.js";
8
- import { g as U } from "./data-grid-DiBSbN2Y.js";
8
+ import { g as U } from "./data-grid-Bbf8t4z3.js";
9
9
  function S() {
10
10
  var t;
11
11
  return ((t = _()) == null ? void 0 : t.toolbarSeam) ?? null;
@@ -156,4 +156,4 @@ export {
156
156
  Z as D,
157
157
  Y as a
158
158
  };
159
- //# sourceMappingURL=toolbar-z8vXnpXz.js.map
159
+ //# sourceMappingURL=toolbar-DoKcoE2q.js.map
@@ -0,0 +1,291 @@
1
+ import { jsxs as c, jsx as r, Fragment as G } from "react/jsx-runtime";
2
+ import { forwardRef as J, useId as W, useRef as g, useEffect as X, useMemo as y, useCallback as S, useImperativeHandle as Q } from "react";
3
+ import { useTranslation as Y } from "react-i18next";
4
+ import { u as Z } from "./registry-DvAUVLHh.js";
5
+ import { F as R, a as ee } from "./file-upload-DQc0LsBM.js";
6
+ import { B as te } from "./badge-BUk4RjTS.js";
7
+ import { I as ie } from "./icon-button-S8_weU3g.js";
8
+ import { a as F } from "./format-number-DdzqwMs1.js";
9
+ import { I as re } from "./info-CGn22peZ.js";
10
+ import { L as ae } from "./loader-circle-BECIU_8N.js";
11
+ import { C as ne } from "./check-DrFSN__t.js";
12
+ import { F as oe } from "./file-code-Cf-_gSzd.js";
13
+ import { X as se } from "./x-B5YnXwCz.js";
14
+ const de = {
15
+ id: "invoice-upload",
16
+ capabilities: ["dismiss"],
17
+ state: {
18
+ files: {
19
+ type: "Array<{ id, name, size, state: 'waiting' | 'reading' | 'read' | 'error' }>",
20
+ descriptionKey: "ui.agent.invoiceUpload.state.files",
21
+ description: "Files in the list. Identifiers and metadata only: never file content or error text.",
22
+ read: (a) => a.getFiles()
23
+ }
24
+ },
25
+ actions: {
26
+ remove_file: {
27
+ safety: "destructive",
28
+ argsType: "{ id: string }",
29
+ argsSchema: {
30
+ type: "object",
31
+ properties: {
32
+ id: {
33
+ type: "string",
34
+ description: "Id of the file to remove (data-file-id)."
35
+ }
36
+ },
37
+ required: ["id"]
38
+ },
39
+ idempotent: !0,
40
+ descriptionKey: "ui.agent.invoiceUpload.actions.removeFile",
41
+ description: "Remove the file with the given id from the list. The host is told through onRemove.",
42
+ examples: [{ args: { id: "file-1" }, note: "Remove the first file." }],
43
+ invoke: (a, d) => {
44
+ a.removeFile(d.id);
45
+ }
46
+ },
47
+ clear: {
48
+ safety: "destructive",
49
+ idempotent: !0,
50
+ descriptionKey: "ui.agent.invoiceUpload.actions.clear",
51
+ description: "Remove every file from the list.",
52
+ invoke: (a) => {
53
+ a.clear();
54
+ }
55
+ }
56
+ },
57
+ domHooks: {
58
+ root: { attr: "data-component", value: "invoice-upload" },
59
+ instanceId: {
60
+ attr: "data-component-id",
61
+ sourceProp: "id",
62
+ description: "Sourced from the id prop."
63
+ },
64
+ item: {
65
+ attr: "data-file-id",
66
+ description: "Each listed file emits its id as data-file-id."
67
+ }
68
+ }
69
+ }, ce = [".xml", ".p7m"], le = [];
70
+ function me(a) {
71
+ return { "*/*": a.map((d) => d.toLowerCase()) };
72
+ }
73
+ function pe() {
74
+ return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
75
+ }
76
+ const b = {
77
+ waiting: {
78
+ key: "invoiceUpload.state.waiting",
79
+ en: "Waiting",
80
+ variant: "neutral"
81
+ },
82
+ reading: {
83
+ key: "invoiceUpload.state.reading",
84
+ en: "Reading",
85
+ variant: "info"
86
+ },
87
+ read: { key: "invoiceUpload.state.read", en: "Read", variant: "success" },
88
+ error: { key: "invoiceUpload.state.error", en: "Error", variant: "error" }
89
+ }, ue = J(
90
+ ({
91
+ id: a,
92
+ mode: d = "single",
93
+ accept: w = ce,
94
+ maxFileSize: _,
95
+ maxFiles: $,
96
+ maxTotalSize: L,
97
+ files: i = le,
98
+ onFilesChosen: v,
99
+ onRemove: l,
100
+ onReject: f,
101
+ disabled: x = !1,
102
+ disabledReason: I,
103
+ upsell: A,
104
+ className: B
105
+ }, O) => {
106
+ const { t: n, i18n: m } = Y("ui"), U = W(), E = d === "multiple", h = g(i);
107
+ h.current = i;
108
+ const o = g(l);
109
+ o.current = l;
110
+ const N = g(/* @__PURE__ */ new Map()), T = g(null), z = g(null);
111
+ X(() => {
112
+ var s, p;
113
+ const e = z.current;
114
+ if (!e || i.some((u) => u.id === e.id)) return;
115
+ z.current = null;
116
+ const t = i[Math.min(e.index, i.length - 1)];
117
+ t ? (s = N.current.get(t.id)) == null || s.focus() : (p = T.current) == null || p.focus();
118
+ }, [i]);
119
+ const M = y(() => me(w), [w]), V = y(
120
+ () => i.filter((e) => e.state !== "error").map((e) => ({ size: e.size })),
121
+ [i]
122
+ ), K = S(
123
+ (e) => {
124
+ e.length !== 0 && (v == null || v(e.map((t) => ({ id: pe(), file: t }))));
125
+ },
126
+ [v]
127
+ ), P = S(
128
+ (e) => {
129
+ f == null || f(
130
+ e.map(
131
+ (t) => ({
132
+ name: t.file.name,
133
+ size: t.file.size,
134
+ reason: t.reason === "file-too-small" ? "file-invalid-type" : t.reason
135
+ })
136
+ )
137
+ );
138
+ },
139
+ [f]
140
+ ), k = y(
141
+ () => ({
142
+ getFiles: () => h.current.map((e) => ({
143
+ id: e.id,
144
+ name: e.name,
145
+ size: e.size,
146
+ state: e.state
147
+ })),
148
+ removeFile: (e) => {
149
+ var t;
150
+ h.current.some((s) => s.id === e) && ((t = o.current) == null || t.call(o, e));
151
+ },
152
+ clear: () => {
153
+ var e;
154
+ for (const t of h.current) (e = o.current) == null || e.call(o, t.id);
155
+ }
156
+ }),
157
+ []
158
+ );
159
+ Q(O, () => k, [k]), Z(de, k, a);
160
+ const H = y(() => {
161
+ if (i.length === 0) return "";
162
+ if (i.length === 1) {
163
+ const t = i[0];
164
+ return t.state === "error" && t.error ? t.error : n(b[t.state].key, b[t.state].en);
165
+ }
166
+ const e = i.filter(
167
+ (t) => t.state === "read" || t.state === "error"
168
+ ).length;
169
+ return n("invoiceUpload.progress", "{{done}} of {{total}} files done", {
170
+ done: F(e, m.language),
171
+ total: F(i.length, m.language)
172
+ });
173
+ }, [i, n, m.language]), C = `${U}-reason`, j = (e, t) => {
174
+ const s = `${U}-name-${t}`, p = `${U}-remove-${t}`, u = b[e.state], q = e.state === "reading" ? /* @__PURE__ */ r(ae, { className: "ds:animate-spin ds:motion-reduce:animate-none" }) : e.state === "read" ? /* @__PURE__ */ r(ne, {}) : void 0;
175
+ return /* @__PURE__ */ c(
176
+ "li",
177
+ {
178
+ "data-file-id": e.id,
179
+ "data-state": e.state,
180
+ className: "ds:flex ds:items-start ds:gap-[var(--spacing-md)] ds:rounded-[var(--radius-md)] ds:border ds:border-border ds:bg-background ds:p-[var(--spacing-md)]",
181
+ children: [
182
+ /* @__PURE__ */ r(
183
+ oe,
184
+ {
185
+ "aria-hidden": "true",
186
+ className: "ds:size-8 ds:shrink-0 ds:text-muted-foreground"
187
+ }
188
+ ),
189
+ /* @__PURE__ */ c("div", { className: "ds:min-w-0 ds:flex-1", children: [
190
+ /* @__PURE__ */ r("p", { id: s, className: "type-label ds:m-0 ds:truncate", children: e.name }),
191
+ /* @__PURE__ */ c("p", { className: "type-meta ds:m-0 ds:text-muted-foreground", children: [
192
+ ee(e.size, m.language, n),
193
+ e.state === "read" && e.invoiceCount !== void 0 && /* @__PURE__ */ r("span", { className: "ds:ms-[var(--spacing-sm)]", children: n("invoiceUpload.invoiceCount", {
194
+ count: e.invoiceCount,
195
+ countText: F(e.invoiceCount, m.language),
196
+ defaultValue: "{{countText}} invoices",
197
+ defaultValue_one: "{{countText}} invoice",
198
+ defaultValue_other: "{{countText}} invoices"
199
+ }) })
200
+ ] }),
201
+ e.state === "error" && e.error && /* @__PURE__ */ r("p", { className: "type-meta ds:m-0 ds:mt-[var(--spacing-xs)] ds:text-destructive", children: e.error })
202
+ ] }),
203
+ /* @__PURE__ */ r(te, { variant: u.variant, size: "md", leading: q, children: n(u.key, u.en) }),
204
+ /* @__PURE__ */ r(
205
+ ie,
206
+ {
207
+ ref: (D) => {
208
+ D ? N.current.set(e.id, D) : N.current.delete(e.id);
209
+ },
210
+ id: p,
211
+ intent: "ghost",
212
+ icon: /* @__PURE__ */ r(se, {}),
213
+ "aria-label": n("invoiceUpload.remove", "Remove"),
214
+ "aria-labelledby": `${p} ${s}`,
215
+ onClick: () => {
216
+ z.current = { id: e.id, index: t }, l == null || l(e.id);
217
+ }
218
+ }
219
+ )
220
+ ]
221
+ },
222
+ e.id
223
+ );
224
+ };
225
+ return /* @__PURE__ */ c(
226
+ "div",
227
+ {
228
+ "data-component": "invoice-upload",
229
+ "data-component-id": a,
230
+ "data-mode": d,
231
+ className: ["ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", B].filter(Boolean).join(" "),
232
+ children: [
233
+ A ? /* @__PURE__ */ r("div", { "data-slot": "upsell", children: A }) : /* @__PURE__ */ c(G, { children: [
234
+ /* @__PURE__ */ r(
235
+ R,
236
+ {
237
+ ref: T,
238
+ variant: "dropzone",
239
+ multiple: E,
240
+ maxFiles: E ? $ ?? 1 / 0 : 1,
241
+ maxSize: _,
242
+ maxTotalSize: L,
243
+ accept: M,
244
+ strictAccept: !0,
245
+ showFileList: !1,
246
+ listedFiles: V,
247
+ disabled: x,
248
+ describedBy: x && I ? C : void 0,
249
+ onDrop: K,
250
+ onReject: P
251
+ }
252
+ ),
253
+ x && I && /* @__PURE__ */ c(
254
+ "p",
255
+ {
256
+ id: C,
257
+ className: "type-meta ds:m-0 ds:flex ds:items-center ds:gap-[var(--spacing-xs)] ds:text-muted-foreground",
258
+ children: [
259
+ /* @__PURE__ */ r(re, { "aria-hidden": "true", className: "ds:size-3.5 ds:shrink-0" }),
260
+ I
261
+ ]
262
+ }
263
+ )
264
+ ] }),
265
+ i.length > 0 && /* @__PURE__ */ r(
266
+ "ul",
267
+ {
268
+ "aria-label": n("invoiceUpload.listLabel", "Chosen invoice files"),
269
+ className: "ds:m-0 ds:flex ds:max-h-[32rem] ds:list-none ds:flex-col ds:gap-[var(--spacing-sm)] ds:overflow-y-auto ds:p-0",
270
+ children: i.map(j)
271
+ }
272
+ ),
273
+ /* @__PURE__ */ r("span", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: H })
274
+ ]
275
+ }
276
+ );
277
+ }
278
+ );
279
+ ue.displayName = "InvoiceUpload";
280
+ const we = [
281
+ "file-invalid-type",
282
+ "file-too-large",
283
+ "too-many-files",
284
+ "total-too-large"
285
+ ];
286
+ export {
287
+ we as I,
288
+ ue as a,
289
+ de as i
290
+ };
291
+ //# sourceMappingURL=types-BrJRsnSG.js.map
@@ -0,0 +1,255 @@
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