@pixstella/components 0.3.0 → 0.3.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.
Files changed (38) hide show
  1. package/COPY-PASTE.md +109 -0
  2. package/README.md +9 -75
  3. package/dist/app/components/Dashboard/dashboardRegistry.cjs +1 -1
  4. package/dist/app/components/Dashboard/dashboardRegistry.mjs +202 -201
  5. package/dist/app/components/Table/DataTable.cjs +1 -1
  6. package/dist/app/components/Table/DataTable.mjs +46 -49
  7. package/dist/app/components/ai/ConfidenceSuggestions/ConfidenceSuggestions.cjs +1 -1
  8. package/dist/app/components/ai/ConfidenceSuggestions/ConfidenceSuggestions.mjs +53 -53
  9. package/dist/app/components/ai/ProposalCard/ProposalCard.cjs +1 -1
  10. package/dist/app/components/ai/ProposalCard/ProposalCard.mjs +227 -227
  11. package/dist/app/components/ai/ReviewTable/ReviewTable.cjs +1 -1
  12. package/dist/app/components/ai/ReviewTable/ReviewTable.mjs +81 -81
  13. package/dist/app/components/ai/SuggestionChecklist/SuggestionChecklist.cjs +1 -1
  14. package/dist/app/components/ai/SuggestionChecklist/SuggestionChecklist.mjs +15 -14
  15. package/dist/app/components/ui/AuthSection/AuthSection.cjs +1 -1
  16. package/dist/app/components/ui/AuthSection/AuthSection.mjs +19 -18
  17. package/dist/app/components/ui/Checkbox/Checkbox.cjs +1 -0
  18. package/dist/app/components/ui/Checkbox/Checkbox.css +1 -0
  19. package/dist/app/components/ui/Checkbox/Checkbox.mjs +87 -0
  20. package/dist/app/components/ui/DataGrid/DataGrid.cjs +1 -1
  21. package/dist/app/components/ui/DataGrid/DataGrid.mjs +196 -199
  22. package/dist/app/components/ui/PreviewConfirmDialog/PreviewConfirmDialog.cjs +1 -1
  23. package/dist/app/components/ui/PreviewConfirmDialog/PreviewConfirmDialog.mjs +47 -48
  24. package/dist/browser/pixstella.esm.js +70 -70
  25. package/dist/browser/pixstella.standalone.js +72 -72
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.cts +32 -1
  28. package/dist/index.d.ts +32 -1
  29. package/dist/index.mjs +2886 -2884
  30. package/dist/registry/files/174512e8f294ad2f +101 -0
  31. package/dist/registry/files/4c7e419c8caf02c3 +119 -0
  32. package/dist/registry/files/{f23e788832b45fc0 → 67ac8b4abe3fc564} +2 -1
  33. package/dist/registry/files/{e84f443f3fc3f261 → 995feaa023211faf} +4 -8
  34. package/dist/registry/files/{5ba71aa83263995e → a27872a7d58aeb58} +4 -5
  35. package/dist/registry/files/{162078d04cb26276 → df919b524be27e88} +4 -5
  36. package/dist/registry/index.json +1 -1
  37. package/dist/styles.css +3 -0
  38. package/package.json +3 -10
@@ -1,4 +1,4 @@
1
- import { jsx as e, jsxs as s, Fragment as D } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as a, Fragment as D } from "react/jsx-runtime";
2
2
  import { useState as C, useId as Fe, useRef as me, useEffect as re, useMemo as Re } from "react";
3
3
  import Be from "../../ui/StatusBadge/StatusBadge.mjs";
4
4
  import K from "../../ui/TextField/TextField.mjs";
@@ -10,7 +10,7 @@ import H from "../../ui/Button/Button.mjs";
10
10
  import { SparkleIcon as Oe, CheckIcon as he, AlertIcon as ge } from "../icons/AiIcons.mjs";
11
11
  import { riseProps as Me } from "../Rise/Rise.mjs";
12
12
  import { proposalProblems as Ve, WIDE_KINDS as Ke, parseAmount as F } from "./proposals.mjs";
13
- import { approveEach as Er, canApproveTogether as zr } from "./proposals.mjs";
13
+ import { approveEach as Wr, canApproveTogether as Lr } from "./proposals.mjs";
14
14
  import './ProposalCard.css';/* empty css */
15
15
  import He from "../../../icons/glyphs/ArrowRight.mjs";
16
16
  import Ge from "../../../icons/glyphs/CheckCircle.mjs";
@@ -19,6 +19,7 @@ import Qe from "../../../icons/glyphs/ExternalLink.mjs";
19
19
  import Xe from "../../../icons/glyphs/Info.mjs";
20
20
  import Ye from "../../../icons/glyphs/Refresh.mjs";
21
21
  import Je from "../../../icons/glyphs/Undo.mjs";
22
+ import { Checkbox as er } from "../../ui/Checkbox/Checkbox.mjs";
22
23
  const Z = {
23
24
  status: { pending: "Pending", applied: "Applied", rejected: "Rejected", stale: "Out of date", undone: "Undone" },
24
25
  approve: "Approve",
@@ -50,7 +51,7 @@ const Z = {
50
51
  missingPrices: (r) => r === 1 ? "1 line needs a price before you can approve." : `${r} lines need a price before you can approve.`,
51
52
  records: (r) => r === 1 ? "record" : "records",
52
53
  more: (r) => `+${r} more`,
53
- skipped: (r, n) => `${r} skipped${n ? ` (${n})` : ""}`,
54
+ skipped: (r, s) => `${r} skipped${s ? ` (${s})` : ""}`,
54
55
  alsoCloses: "Also closes",
55
56
  closed: (r) => `Closed ${r}`,
56
57
  due: (r) => `due ${r}`,
@@ -65,86 +66,86 @@ const Z = {
65
66
  error: "Couldn't save the change",
66
67
  undoError: "Couldn't undo the change"
67
68
  };
68
- function er(r, n) {
69
- const c = F(r);
70
- if (Number.isNaN(c)) return String(r ?? "");
69
+ function rr(r, s) {
70
+ const l = F(r);
71
+ if (Number.isNaN(l)) return String(r ?? "");
71
72
  try {
72
- return new Intl.NumberFormat("en-US", { style: "currency", currency: n || "USD" }).format(c);
73
+ return new Intl.NumberFormat("en-US", { style: "currency", currency: s || "USD" }).format(l);
73
74
  } catch {
74
- return `${c.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${n || ""}`.trim();
75
+ return `${l.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${s || ""}`.trim();
75
76
  }
76
77
  }
77
- function rr(r) {
78
+ function sr(r) {
78
79
  if (!r) return "";
79
- const n = String(r), c = /^\d{4}-\d{2}-\d{2}$/.test(n), i = new Date(c ? `${n}T00:00:00Z` : n);
80
- return Number.isNaN(i.getTime()) ? n : new Intl.DateTimeFormat("en-GB", { day: "numeric", month: "short", year: "numeric", ...c ? { timeZone: "UTC" } : null }).format(i);
80
+ const s = String(r), l = /^\d{4}-\d{2}-\d{2}$/.test(s), i = new Date(l ? `${s}T00:00:00Z` : s);
81
+ return Number.isNaN(i.getTime()) ? s : new Intl.DateTimeFormat("en-GB", { day: "numeric", month: "short", year: "numeric", ...l ? { timeZone: "UTC" } : null }).format(i);
81
82
  }
82
- function nr(r) {
83
- const n = new Date(r);
84
- if (Number.isNaN(n.getTime())) return String(r);
85
- const c = (/* @__PURE__ */ new Date()).toDateString() === n.toDateString();
86
- return new Intl.DateTimeFormat("en-GB", c ? { hour: "2-digit", minute: "2-digit" } : { weekday: "short", hour: "2-digit", minute: "2-digit" }).format(n);
83
+ function ar(r) {
84
+ const s = new Date(r);
85
+ if (Number.isNaN(s.getTime())) return String(r);
86
+ const l = (/* @__PURE__ */ new Date()).toDateString() === s.toDateString();
87
+ return new Intl.DateTimeFormat("en-GB", l ? { hour: "2-digit", minute: "2-digit" } : { weekday: "short", hour: "2-digit", minute: "2-digit" }).format(s);
87
88
  }
88
- const P = (r, ...n) => typeof r == "function" ? r(...n) : r, q = (r) => r == null || String(r).trim() === "", ye = () => /* @__PURE__ */ e(He, { trim: !0, size: null, strokeWidth: 2 }), _e = () => /* @__PURE__ */ e(Je, { size: null, strokeWidth: 2 }), sr = () => /* @__PURE__ */ e(Qe, { size: null, strokeWidth: 2 }), ar = () => /* @__PURE__ */ e(Xe, { size: null, strokeWidth: 2 }), tr = () => /* @__PURE__ */ e(Ye, { size: null, strokeWidth: 2 }), or = () => /* @__PURE__ */ e(Ze, { size: null, strokeWidth: 2 }), cr = () => /* @__PURE__ */ e(Ge, { size: null, strokeWidth: 2 }), Ne = { pending: "info", applied: "success", rejected: "neutral", stale: "warning", undone: "neutral" };
89
- function lr({ status: r, undone: n = !1, labels: c, size: i = "sm", className: u = "" }) {
90
- const o = { ...Z.status, ...c?.status || c }, l = n ? "undone" : r in Ne ? r : "pending";
91
- return /* @__PURE__ */ e(Be, { tone: Ne[l], dot: !0, size: i, className: `proposal-status proposal-status--${l} ${u}`.trim(), children: o[l] });
89
+ const P = (r, ...s) => typeof r == "function" ? r(...s) : r, q = (r) => r == null || String(r).trim() === "", fe = () => /* @__PURE__ */ e(He, { trim: !0, size: null, strokeWidth: 2 }), _e = () => /* @__PURE__ */ e(Je, { size: null, strokeWidth: 2 }), nr = () => /* @__PURE__ */ e(Qe, { size: null, strokeWidth: 2 }), tr = () => /* @__PURE__ */ e(Xe, { size: null, strokeWidth: 2 }), or = () => /* @__PURE__ */ e(Ye, { size: null, strokeWidth: 2 }), lr = () => /* @__PURE__ */ e(Ze, { size: null, strokeWidth: 2 }), cr = () => /* @__PURE__ */ e(Ge, { size: null, strokeWidth: 2 }), Ne = { pending: "info", applied: "success", rejected: "neutral", stale: "warning", undone: "neutral" };
90
+ function ir({ status: r, undone: s = !1, labels: l, size: i = "sm", className: u = "" }) {
91
+ const o = { ...Z.status, ...l?.status || l }, c = s ? "undone" : r in Ne ? r : "pending";
92
+ return /* @__PURE__ */ e(Be, { tone: Ne[c], dot: !0, size: i, className: `proposal-status proposal-status--${c} ${u}`.trim(), children: o[c] });
92
93
  }
93
- function ir({ changes: r = [], labels: n, className: c = "" }) {
94
- const i = { ...Z, ...n }, u = (o) => q(o) && typeof o != "object" ? /* @__PURE__ */ e("span", { className: "proposal-card__empty", children: i.empty }) : o;
95
- return /* @__PURE__ */ e("div", { className: "proposal-card__table-wrap", children: /* @__PURE__ */ s("table", { className: `proposal-card__table proposal-card__diff ${c}`.trim(), children: [
96
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ s("tr", { children: [
94
+ function dr({ changes: r = [], labels: s, className: l = "" }) {
95
+ const i = { ...Z, ...s }, u = (o) => q(o) && typeof o != "object" ? /* @__PURE__ */ e("span", { className: "proposal-card__empty", children: i.empty }) : o;
96
+ return /* @__PURE__ */ e("div", { className: "proposal-card__table-wrap", children: /* @__PURE__ */ a("table", { className: `proposal-card__table proposal-card__diff ${l}`.trim(), children: [
97
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
97
98
  /* @__PURE__ */ e("th", { scope: "col", children: i.field }),
98
99
  /* @__PURE__ */ e("th", { scope: "col", children: i.was }),
99
100
  /* @__PURE__ */ e("th", { scope: "col", "aria-hidden": "true" }),
100
101
  /* @__PURE__ */ e("th", { scope: "col", children: i.now })
101
102
  ] }) }),
102
- /* @__PURE__ */ e("tbody", { children: r.map((o, l) => /* @__PURE__ */ s("tr", { children: [
103
+ /* @__PURE__ */ e("tbody", { children: r.map((o, c) => /* @__PURE__ */ a("tr", { children: [
103
104
  /* @__PURE__ */ e("th", { scope: "row", children: o.label ?? o.field }),
104
- /* @__PURE__ */ s("td", { className: "proposal-card__old", children: [
105
- /* @__PURE__ */ s("span", { className: "proposal-card__sr", children: [
105
+ /* @__PURE__ */ a("td", { className: "proposal-card__old", children: [
106
+ /* @__PURE__ */ a("span", { className: "proposal-card__sr", children: [
106
107
  i.was,
107
108
  ": "
108
109
  ] }),
109
110
  u(o.from)
110
111
  ] }),
111
- /* @__PURE__ */ e("td", { className: "proposal-card__arrow", "aria-hidden": "true", children: /* @__PURE__ */ e(ye, {}) }),
112
- /* @__PURE__ */ s("td", { className: "proposal-card__new", children: [
113
- /* @__PURE__ */ s("span", { className: "proposal-card__sr", children: [
112
+ /* @__PURE__ */ e("td", { className: "proposal-card__arrow", "aria-hidden": "true", children: /* @__PURE__ */ e(fe, {}) }),
113
+ /* @__PURE__ */ a("td", { className: "proposal-card__new", children: [
114
+ /* @__PURE__ */ a("span", { className: "proposal-card__sr", children: [
114
115
  i.now,
115
116
  ": "
116
117
  ] }),
117
118
  u(o.to)
118
119
  ] })
119
- ] }, o.field ?? l)) })
120
+ ] }, o.field ?? c)) })
120
121
  ] }) });
121
122
  }
122
- function G(r, n, c, i, u) {
123
- if (q(n)) return /* @__PURE__ */ e("span", { className: "proposal-card__empty", children: i.empty });
123
+ function G(r, s, l, i, u) {
124
+ if (q(s)) return /* @__PURE__ */ e("span", { className: "proposal-card__empty", children: i.empty });
124
125
  switch (r.type) {
125
126
  case "money":
126
- return c.money(n, r.currency || u);
127
+ return l.money(s, r.currency || u);
127
128
  case "date":
128
- return c.date(n);
129
+ return l.date(s);
129
130
  case "yesno":
130
- return /^(true|yes|1|y)$/i.test(String(n)) ? i.yes : i.no;
131
+ return /^(true|yes|1|y)$/i.test(String(s)) ? i.yes : i.no;
131
132
  case "enum": {
132
- const o = (r.options || []).find((l) => (typeof l == "object" ? l.value : l) === n);
133
- return o ? typeof o == "object" ? o.label : o : n;
133
+ const o = (r.options || []).find((c) => (typeof c == "object" ? c.value : c) === s);
134
+ return o ? typeof o == "object" ? o.label : o : s;
134
135
  }
135
136
  case "number": {
136
- const o = F(n);
137
- return Number.isNaN(o) ? n : o.toLocaleString("en-US");
137
+ const o = F(s);
138
+ return Number.isNaN(o) ? s : o.toLocaleString("en-US");
138
139
  }
139
140
  default:
140
- return n;
141
+ return s;
141
142
  }
142
143
  }
143
- function dr({ f: r, value: n, onChange: c, problem: i, labels: u, currency: o, uid: l }) {
144
- const y = i === "required" ? u.required : i === "number" ? u.notNumber : void 0, t = `${l}-${r.key}`, g = { id: t, "aria-label": typeof r.label == "string" ? r.label : void 0, error: y, required: !!r.required, size: "sm", className: "proposal-card__input" };
144
+ function pr({ f: r, value: s, onChange: l, problem: i, labels: u, currency: o, uid: c }) {
145
+ const f = i === "required" ? u.required : i === "number" ? u.notNumber : void 0, t = `${c}-${r.key}`, g = { id: t, "aria-label": typeof r.label == "string" ? r.label : void 0, error: f, required: !!r.required, size: "sm", className: "proposal-card__input" };
145
146
  switch (r.type) {
146
147
  case "longtext":
147
- return /* @__PURE__ */ e(K, { ...g, multiline: !0, rows: 2, maxRows: 6, value: n ?? "", onChange: (h) => c(h) });
148
+ return /* @__PURE__ */ e(K, { ...g, multiline: !0, rows: 2, maxRows: 6, value: s ?? "", onChange: (h) => l(h) });
148
149
  case "number":
149
150
  case "money":
150
151
  return /* @__PURE__ */ e(
@@ -153,12 +154,12 @@ function dr({ f: r, value: n, onChange: c, problem: i, labels: u, currency: o, u
153
154
  ...g,
154
155
  inputMode: "decimal",
155
156
  suffix: r.type === "money" ? r.currency || o : r.unit,
156
- value: n ?? "",
157
- onChange: (h) => c(h)
157
+ value: s ?? "",
158
+ onChange: (h) => l(h)
158
159
  }
159
160
  );
160
161
  case "date":
161
- return /* @__PURE__ */ e(K, { ...g, type: "date", value: n ?? "", onChange: (h) => c(h) });
162
+ return /* @__PURE__ */ e(K, { ...g, type: "date", value: s ?? "", onChange: (h) => l(h) });
162
163
  case "enum":
163
164
  return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
164
165
  Ee,
@@ -166,128 +167,128 @@ function dr({ f: r, value: n, onChange: c, problem: i, labels: u, currency: o, u
166
167
  id: t,
167
168
  size: "sm",
168
169
  options: r.options || [],
169
- value: n ?? null,
170
+ value: s ?? null,
170
171
  placeholder: u.choose,
171
172
  ariaLabel: typeof r.label == "string" ? r.label : void 0,
172
173
  required: r.required !== !1,
173
- error: y,
174
- onChange: (h) => c(h)
174
+ error: f,
175
+ onChange: (h) => l(h)
175
176
  }
176
177
  ) });
177
178
  case "yesno": {
178
- const h = /^(true|yes|1|y)$/i.test(String(n)), x = !q(n) && !h;
179
- return /* @__PURE__ */ s("div", { className: "proposal-card__yesno", role: "group", "aria-label": typeof r.label == "string" ? r.label : void 0, children: [
180
- /* @__PURE__ */ e("button", { type: "button", "aria-pressed": h, onClick: () => c("yes"), children: u.yes }),
181
- /* @__PURE__ */ e("button", { type: "button", "aria-pressed": x, onClick: () => c("no"), children: u.no })
179
+ const h = /^(true|yes|1|y)$/i.test(String(s)), x = !q(s) && !h;
180
+ return /* @__PURE__ */ a("div", { className: "proposal-card__yesno", role: "group", "aria-label": typeof r.label == "string" ? r.label : void 0, children: [
181
+ /* @__PURE__ */ e("button", { type: "button", "aria-pressed": h, onClick: () => l("yes"), children: u.yes }),
182
+ /* @__PURE__ */ e("button", { type: "button", "aria-pressed": x, onClick: () => l("no"), children: u.no })
182
183
  ] });
183
184
  }
184
185
  default:
185
- return /* @__PURE__ */ e(K, { ...g, value: n ?? "", onChange: (h) => c(h) });
186
+ return /* @__PURE__ */ e(K, { ...g, value: s ?? "", onChange: (h) => l(h) });
186
187
  }
187
188
  }
188
- function pr({ body: r, values: n, setValue: c, editing: i, problems: u, fmt: o, labels: l, uid: y }) {
189
+ function ur({ body: r, values: s, setValue: l, editing: i, problems: u, fmt: o, labels: c, uid: f }) {
189
190
  return /* @__PURE__ */ e("div", { className: "proposal-card__table-wrap", children: /* @__PURE__ */ e("table", { className: "proposal-card__table proposal-card__fields", children: /* @__PURE__ */ e("tbody", { children: (r.fields || []).map((t) => {
190
- const g = n[t.key] !== void 0 ? n[t.key] : t.value, h = i && t.editable, x = t.from !== void 0 && t.from !== null && String(t.from) !== String(t.value), _ = t.required || t.editable && t.type === "enum" && t.required !== !1;
191
- return /* @__PURE__ */ s("tr", { children: [
192
- /* @__PURE__ */ s("th", { scope: "row", children: [
193
- h && t.type !== "yesno" && t.type !== "enum" ? /* @__PURE__ */ e("label", { htmlFor: `${y}-${t.key}`, children: t.label }) : t.label,
191
+ const g = s[t.key] !== void 0 ? s[t.key] : t.value, h = i && t.editable, x = t.from !== void 0 && t.from !== null && String(t.from) !== String(t.value), _ = t.required || t.editable && t.type === "enum" && t.required !== !1;
192
+ return /* @__PURE__ */ a("tr", { children: [
193
+ /* @__PURE__ */ a("th", { scope: "row", children: [
194
+ h && t.type !== "yesno" && t.type !== "enum" ? /* @__PURE__ */ e("label", { htmlFor: `${f}-${t.key}`, children: t.label }) : t.label,
194
195
  h && _ ? /* @__PURE__ */ e("span", { className: "proposal-card__req", "aria-hidden": "true", children: "*" }) : null
195
196
  ] }),
196
- /* @__PURE__ */ s("td", { children: [
197
- h ? /* @__PURE__ */ s(D, { children: [
198
- /* @__PURE__ */ e(dr, { f: t, value: g, onChange: (k) => c(t.key, k), problem: u[t.key], labels: l, currency: r.currency, uid: y }),
199
- x ? /* @__PURE__ */ e("span", { className: "proposal-card__was-hint", children: P(l.wasValue, G(t, t.from, o, l, r.currency)) }) : null
200
- ] }) : x ? /* @__PURE__ */ s("span", { className: "proposal-card__was", children: [
201
- /* @__PURE__ */ s("span", { className: "proposal-card__old", children: [
202
- /* @__PURE__ */ s("span", { className: "proposal-card__sr", children: [
203
- l.was,
197
+ /* @__PURE__ */ a("td", { children: [
198
+ h ? /* @__PURE__ */ a(D, { children: [
199
+ /* @__PURE__ */ e(pr, { f: t, value: g, onChange: (k) => l(t.key, k), problem: u[t.key], labels: c, currency: r.currency, uid: f }),
200
+ x ? /* @__PURE__ */ e("span", { className: "proposal-card__was-hint", children: P(c.wasValue, G(t, t.from, o, c, r.currency)) }) : null
201
+ ] }) : x ? /* @__PURE__ */ a("span", { className: "proposal-card__was", children: [
202
+ /* @__PURE__ */ a("span", { className: "proposal-card__old", children: [
203
+ /* @__PURE__ */ a("span", { className: "proposal-card__sr", children: [
204
+ c.was,
204
205
  ": "
205
206
  ] }),
206
- G(t, t.from, o, l, r.currency)
207
+ G(t, t.from, o, c, r.currency)
207
208
  ] }),
208
- /* @__PURE__ */ e(ye, {}),
209
- /* @__PURE__ */ s("span", { className: "proposal-card__new", children: [
210
- /* @__PURE__ */ s("span", { className: "proposal-card__sr", children: [
211
- l.now,
209
+ /* @__PURE__ */ e(fe, {}),
210
+ /* @__PURE__ */ a("span", { className: "proposal-card__new", children: [
211
+ /* @__PURE__ */ a("span", { className: "proposal-card__sr", children: [
212
+ c.now,
212
213
  ": "
213
214
  ] }),
214
- G(t, g, o, l, r.currency)
215
+ G(t, g, o, c, r.currency)
215
216
  ] })
216
- ] }) : G(t, g, o, l, r.currency),
217
- u[t.key] && h && t.type === "yesno" ? /* @__PURE__ */ e("span", { className: "proposal-card__field-error", children: l.required }) : null
217
+ ] }) : G(t, g, o, c, r.currency),
218
+ u[t.key] && h && t.type === "yesno" ? /* @__PURE__ */ e("span", { className: "proposal-card__field-error", children: c.required }) : null
218
219
  ] })
219
220
  ] }, t.key);
220
221
  }) }) }) });
221
222
  }
222
- const E = (r) => String(r ?? "").split(/[,;\n]/).map((n) => n.trim()).filter(Boolean);
223
- function ur({ body: r, draft: n, setDraft: c, editing: i, problems: u, labels: o, uid: l }) {
224
- const y = n.to ?? (r.to || []).join(", "), t = n.cc ?? (r.cc || []).join(", "), g = n.subject ?? r.subject ?? "", h = n.text ?? r.text ?? "", x = (_) => /* @__PURE__ */ e("span", { className: "proposal-card__recipients", children: _.map((k, f) => /* @__PURE__ */ e("span", { className: "proposal-card__chip", children: k }, f)) });
225
- return /* @__PURE__ */ s(D, { children: [
226
- r.replyTo ? /* @__PURE__ */ s("p", { className: "proposal-card__reply-to", children: [
223
+ const E = (r) => String(r ?? "").split(/[,;\n]/).map((s) => s.trim()).filter(Boolean);
224
+ function mr({ body: r, draft: s, setDraft: l, editing: i, problems: u, labels: o, uid: c }) {
225
+ const f = s.to ?? (r.to || []).join(", "), t = s.cc ?? (r.cc || []).join(", "), g = s.subject ?? r.subject ?? "", h = s.text ?? r.text ?? "", x = (_) => /* @__PURE__ */ e("span", { className: "proposal-card__recipients", children: _.map((k, y) => /* @__PURE__ */ e("span", { className: "proposal-card__chip", children: k }, y)) });
226
+ return /* @__PURE__ */ a(D, { children: [
227
+ r.replyTo ? /* @__PURE__ */ a("p", { className: "proposal-card__reply-to", children: [
227
228
  o.replyTo,
228
229
  ": ",
229
230
  r.replyTo
230
231
  ] }) : null,
231
- /* @__PURE__ */ e("div", { className: "proposal-card__message", children: i ? /* @__PURE__ */ s(D, { children: [
232
- /* @__PURE__ */ s("div", { className: "proposal-card__msg-row", children: [
233
- /* @__PURE__ */ e("label", { htmlFor: `${l}-to`, children: o.to }),
232
+ /* @__PURE__ */ e("div", { className: "proposal-card__message", children: i ? /* @__PURE__ */ a(D, { children: [
233
+ /* @__PURE__ */ a("div", { className: "proposal-card__msg-row", children: [
234
+ /* @__PURE__ */ e("label", { htmlFor: `${c}-to`, children: o.to }),
234
235
  /* @__PURE__ */ e(
235
236
  "input",
236
237
  {
237
- id: `${l}-to`,
238
+ id: `${c}-to`,
238
239
  className: "proposal-card__msg-input",
239
240
  type: "text",
240
241
  inputMode: "email",
241
- value: y,
242
+ value: f,
242
243
  "aria-invalid": u.to ? !0 : void 0,
243
- "aria-describedby": `${l}-to-hint`,
244
- onChange: (_) => c({ to: _.target.value })
244
+ "aria-describedby": `${c}-to-hint`,
245
+ onChange: (_) => l({ to: _.target.value })
245
246
  }
246
247
  ),
247
- /* @__PURE__ */ s("span", { id: `${l}-to-hint`, className: "proposal-card__sr", children: [
248
+ /* @__PURE__ */ a("span", { id: `${c}-to-hint`, className: "proposal-card__sr", children: [
248
249
  o.recipientsHint,
249
250
  u.to ? `. ${o.required}` : ""
250
251
  ] })
251
252
  ] }),
252
- /* @__PURE__ */ s("div", { className: "proposal-card__msg-row", children: [
253
- /* @__PURE__ */ e("label", { htmlFor: `${l}-cc`, children: o.cc }),
254
- /* @__PURE__ */ e("input", { id: `${l}-cc`, className: "proposal-card__msg-input", type: "text", inputMode: "email", value: t, onChange: (_) => c({ cc: _.target.value }) })
253
+ /* @__PURE__ */ a("div", { className: "proposal-card__msg-row", children: [
254
+ /* @__PURE__ */ e("label", { htmlFor: `${c}-cc`, children: o.cc }),
255
+ /* @__PURE__ */ e("input", { id: `${c}-cc`, className: "proposal-card__msg-input", type: "text", inputMode: "email", value: t, onChange: (_) => l({ cc: _.target.value }) })
255
256
  ] }),
256
- /* @__PURE__ */ s("div", { className: "proposal-card__msg-row", children: [
257
- /* @__PURE__ */ e("label", { htmlFor: `${l}-subject`, children: o.subject }),
257
+ /* @__PURE__ */ a("div", { className: "proposal-card__msg-row", children: [
258
+ /* @__PURE__ */ e("label", { htmlFor: `${c}-subject`, children: o.subject }),
258
259
  /* @__PURE__ */ e(
259
260
  "input",
260
261
  {
261
- id: `${l}-subject`,
262
+ id: `${c}-subject`,
262
263
  className: "proposal-card__msg-input proposal-card__msg-subject",
263
264
  type: "text",
264
265
  value: g,
265
- onChange: (_) => c({ subject: _.target.value })
266
+ onChange: (_) => l({ subject: _.target.value })
266
267
  }
267
268
  )
268
269
  ] }),
269
- /* @__PURE__ */ e("label", { htmlFor: `${l}-text`, className: "proposal-card__sr", children: o.text }),
270
+ /* @__PURE__ */ e("label", { htmlFor: `${c}-text`, className: "proposal-card__sr", children: o.text }),
270
271
  /* @__PURE__ */ e(
271
272
  "textarea",
272
273
  {
273
- id: `${l}-text`,
274
+ id: `${c}-text`,
274
275
  className: "proposal-card__msg-text",
275
276
  value: h,
276
277
  rows: 7,
277
278
  "aria-invalid": u.text ? !0 : void 0,
278
- onChange: (_) => c({ text: _.target.value })
279
+ onChange: (_) => l({ text: _.target.value })
279
280
  }
280
281
  )
281
- ] }) : /* @__PURE__ */ s(D, { children: [
282
- /* @__PURE__ */ s("div", { className: "proposal-card__msg-row", children: [
282
+ ] }) : /* @__PURE__ */ a(D, { children: [
283
+ /* @__PURE__ */ a("div", { className: "proposal-card__msg-row", children: [
283
284
  /* @__PURE__ */ e("span", { children: o.to }),
284
- x(E(y))
285
+ x(E(f))
285
286
  ] }),
286
- E(t).length ? /* @__PURE__ */ s("div", { className: "proposal-card__msg-row", children: [
287
+ E(t).length ? /* @__PURE__ */ a("div", { className: "proposal-card__msg-row", children: [
287
288
  /* @__PURE__ */ e("span", { children: o.cc }),
288
289
  x(E(t))
289
290
  ] }) : null,
290
- /* @__PURE__ */ s("div", { className: "proposal-card__msg-row", children: [
291
+ /* @__PURE__ */ a("div", { className: "proposal-card__msg-row", children: [
291
292
  /* @__PURE__ */ e("span", { children: o.subject }),
292
293
  /* @__PURE__ */ e("span", { className: "proposal-card__msg-subject", children: g })
293
294
  ] }),
@@ -295,138 +296,138 @@ function ur({ body: r, draft: n, setDraft: c, editing: i, problems: u, labels: o
295
296
  ] }) })
296
297
  ] });
297
298
  }
298
- function mr({ body: r, prices: n, setPrice: c, editing: i, problems: u, fmt: o, labels: l, uid: y }) {
299
+ function hr({ body: r, prices: s, setPrice: l, editing: i, problems: u, fmt: o, labels: c, uid: f }) {
299
300
  const t = r.currency;
300
301
  let g = 0, h = !0;
301
302
  const x = (r.lines || []).map((_, k) => {
302
- const f = n[k] !== void 0 ? n[k] : _.unitPrice, d = q(f) ? NaN : F(f), m = F(_.quantity), I = Number.isNaN(d) || Number.isNaN(m) ? NaN : d * m;
303
- return Number.isNaN(I) ? h = !1 : g += I, { l: _, i: k, raw: f, lineTotal: I, needsInput: _.unitPrice == null || _.unitPrice === "" };
303
+ const y = s[k] !== void 0 ? s[k] : _.unitPrice, d = q(y) ? NaN : F(y), m = F(_.quantity), I = Number.isNaN(d) || Number.isNaN(m) ? NaN : d * m;
304
+ return Number.isNaN(I) ? h = !1 : g += I, { l: _, i: k, raw: y, lineTotal: I, needsInput: _.unitPrice == null || _.unitPrice === "" };
304
305
  });
305
- return /* @__PURE__ */ s(D, { children: [
306
- /* @__PURE__ */ e("div", { className: "proposal-card__table-wrap", tabIndex: 0, role: "region", "aria-label": l.item, children: /* @__PURE__ */ s("table", { className: "proposal-card__table proposal-card__lines", children: [
307
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ s("tr", { children: [
308
- /* @__PURE__ */ e("th", { scope: "col", children: l.item }),
309
- /* @__PURE__ */ e("th", { scope: "col", className: "num", children: l.quantity }),
310
- /* @__PURE__ */ e("th", { scope: "col", className: "num", children: l.unitPrice }),
311
- /* @__PURE__ */ e("th", { scope: "col", className: "num", children: l.lineTotal })
306
+ return /* @__PURE__ */ a(D, { children: [
307
+ /* @__PURE__ */ e("div", { className: "proposal-card__table-wrap", tabIndex: 0, role: "region", "aria-label": c.item, children: /* @__PURE__ */ a("table", { className: "proposal-card__table proposal-card__lines", children: [
308
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { children: [
309
+ /* @__PURE__ */ e("th", { scope: "col", children: c.item }),
310
+ /* @__PURE__ */ e("th", { scope: "col", className: "num", children: c.quantity }),
311
+ /* @__PURE__ */ e("th", { scope: "col", className: "num", children: c.unitPrice }),
312
+ /* @__PURE__ */ e("th", { scope: "col", className: "num", children: c.lineTotal })
312
313
  ] }) }),
313
- /* @__PURE__ */ e("tbody", { children: x.map(({ l: _, i: k, raw: f, lineTotal: d, needsInput: m }) => /* @__PURE__ */ s("tr", { children: [
314
+ /* @__PURE__ */ e("tbody", { children: x.map(({ l: _, i: k, raw: y, lineTotal: d, needsInput: m }) => /* @__PURE__ */ a("tr", { children: [
314
315
  /* @__PURE__ */ e("td", { children: _.description }),
315
- /* @__PURE__ */ s("td", { className: "num", children: [
316
+ /* @__PURE__ */ a("td", { className: "num", children: [
316
317
  _.quantity,
317
318
  " ",
318
319
  _.unit ? /* @__PURE__ */ e("span", { className: "proposal-card__unit", children: _.unit }) : null
319
320
  ] }),
320
- /* @__PURE__ */ e("td", { className: "num", children: m && i ? /* @__PURE__ */ s("span", { className: "proposal-card__price-input", "data-filled": !q(f) && !Number.isNaN(F(f)) ? "" : void 0, children: [
321
+ /* @__PURE__ */ e("td", { className: "num", children: m && i ? /* @__PURE__ */ a("span", { className: "proposal-card__price-input", "data-filled": !q(y) && !Number.isNaN(F(y)) ? "" : void 0, children: [
321
322
  /* @__PURE__ */ e(
322
323
  "input",
323
324
  {
324
- id: `${y}-price-${k}`,
325
+ id: `${f}-price-${k}`,
325
326
  type: "text",
326
327
  inputMode: "decimal",
327
- value: f ?? "",
328
+ value: y ?? "",
328
329
  placeholder: "0.00",
329
- "aria-label": P(l.addPrice, _.description),
330
- "aria-invalid": q(f) || Number.isNaN(F(f)) ? !0 : void 0,
331
- onChange: (I) => c(k, I.target.value)
330
+ "aria-label": P(c.addPrice, _.description),
331
+ "aria-invalid": q(y) || Number.isNaN(F(y)) ? !0 : void 0,
332
+ onChange: (I) => l(k, I.target.value)
332
333
  }
333
334
  ),
334
335
  t ? /* @__PURE__ */ e("span", { "aria-hidden": "true", children: t }) : null
335
- ] }) : q(f) ? /* @__PURE__ */ e("span", { className: "proposal-card__empty", children: "—" }) : o.money(f, t) }),
336
+ ] }) : q(y) ? /* @__PURE__ */ e("span", { className: "proposal-card__empty", children: "—" }) : o.money(y, t) }),
336
337
  /* @__PURE__ */ e("td", { className: "num", children: Number.isNaN(d) ? /* @__PURE__ */ e("span", { className: "proposal-card__empty", children: "—" }) : o.money(d, t) })
337
338
  ] }, k)) }),
338
- /* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ s("tr", { children: [
339
- /* @__PURE__ */ e("th", { scope: "row", colSpan: 3, children: l.total }),
339
+ /* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ a("tr", { children: [
340
+ /* @__PURE__ */ e("th", { scope: "row", colSpan: 3, children: c.total }),
340
341
  /* @__PURE__ */ e("td", { className: "num", children: h ? o.money(g, t) : /* @__PURE__ */ e("span", { className: "proposal-card__empty", children: "—" }) })
341
342
  ] }) })
342
343
  ] }) }),
343
- i && u.lines ? /* @__PURE__ */ s("p", { className: "proposal-card__missing", id: `${y}-missing`, children: [
344
+ i && u.lines ? /* @__PURE__ */ a("p", { className: "proposal-card__missing", id: `${f}-missing`, children: [
344
345
  /* @__PURE__ */ e(ge, { size: 14 }),
345
- P(l.missingPrices, u.lines)
346
+ P(c.missingPrices, u.lines)
346
347
  ] }) : null
347
348
  ] });
348
349
  }
349
- function hr({ body: r, labels: n }) {
350
- const c = r.sample || [], i = Math.max(0, (r.count || 0) - c.length);
351
- return /* @__PURE__ */ s("div", { className: "proposal-card__bulk", children: [
352
- /* @__PURE__ */ s("p", { className: "proposal-card__bulk-count", children: [
350
+ function _r({ body: r, labels: s }) {
351
+ const l = r.sample || [], i = Math.max(0, (r.count || 0) - l.length);
352
+ return /* @__PURE__ */ a("div", { className: "proposal-card__bulk", children: [
353
+ /* @__PURE__ */ a("p", { className: "proposal-card__bulk-count", children: [
353
354
  /* @__PURE__ */ e("strong", { children: (r.count ?? 0).toLocaleString("en-US") }),
354
- /* @__PURE__ */ e("span", { children: P(n.records, r.count ?? 0) })
355
+ /* @__PURE__ */ e("span", { children: P(s.records, r.count ?? 0) })
355
356
  ] }),
356
357
  r.preview ? /* @__PURE__ */ e("div", { children: r.preview }) : null,
357
- c.length ? /* @__PURE__ */ s("ul", { className: "proposal-card__sample", children: [
358
- c.map((u, o) => /* @__PURE__ */ e("li", { className: "proposal-card__chip", children: u }, o)),
359
- i ? /* @__PURE__ */ e("li", { className: "proposal-card__more", children: P(n.more, i) }) : null
358
+ l.length ? /* @__PURE__ */ a("ul", { className: "proposal-card__sample", children: [
359
+ l.map((u, o) => /* @__PURE__ */ e("li", { className: "proposal-card__chip", children: u }, o)),
360
+ i ? /* @__PURE__ */ e("li", { className: "proposal-card__more", children: P(s.more, i) }) : null
360
361
  ] }) : null,
361
- r.skipped ? /* @__PURE__ */ e("p", { className: "proposal-card__skipped", children: P(n.skipped, r.skipped, r.skippedReason) }) : null
362
+ r.skipped ? /* @__PURE__ */ e("p", { className: "proposal-card__skipped", children: P(s.skipped, r.skipped, r.skippedReason) }) : null
362
363
  ] });
363
364
  }
364
- function _r({ body: r }) {
365
- return /* @__PURE__ */ e("div", { className: "proposal-card__table-wrap", tabIndex: 0, role: "region", "aria-label": typeof r.caption == "string" ? r.caption : "Table", children: /* @__PURE__ */ s("table", { className: "proposal-card__table", children: [
365
+ function Nr({ body: r }) {
366
+ return /* @__PURE__ */ e("div", { className: "proposal-card__table-wrap", tabIndex: 0, role: "region", "aria-label": typeof r.caption == "string" ? r.caption : "Table", children: /* @__PURE__ */ a("table", { className: "proposal-card__table", children: [
366
367
  r.caption ? /* @__PURE__ */ e("caption", { className: "proposal-card__sr", children: r.caption }) : null,
367
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: (r.columns || []).map((n, c) => /* @__PURE__ */ e("th", { scope: "col", children: n }, c)) }) }),
368
- /* @__PURE__ */ e("tbody", { children: (r.rows || []).map((n, c) => /* @__PURE__ */ e("tr", { children: n.map((i, u) => /* @__PURE__ */ e("td", { children: i }, u)) }, c)) })
368
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { children: (r.columns || []).map((s, l) => /* @__PURE__ */ e("th", { scope: "col", children: s }, l)) }) }),
369
+ /* @__PURE__ */ e("tbody", { children: (r.rows || []).map((s, l) => /* @__PURE__ */ e("tr", { children: s.map((i, u) => /* @__PURE__ */ e("td", { children: i }, u)) }, l)) })
369
370
  ] }) });
370
371
  }
371
- const ne = (r) => `${r?.id}|${r?.status}|${r?.undoneAt || ""}|${r?.undoUntil || ""}`;
372
- function Fr({
372
+ const se = (r) => `${r?.id}|${r?.status}|${r?.undoneAt || ""}|${r?.undoUntil || ""}`;
373
+ function Br({
373
374
  proposal: r,
374
- decide: n,
375
- undo: c,
375
+ decide: s,
376
+ undo: l,
376
377
  onDecided: i,
377
378
  onNavigate: u,
378
379
  onAskAgain: o,
379
- onError: l,
380
- formatMoney: y = er,
381
- formatDate: t = rr,
382
- formatTime: g = nr,
380
+ onError: c,
381
+ formatMoney: f = rr,
382
+ formatDate: t = sr,
383
+ formatTime: g = ar,
383
384
  labels: h,
384
385
  index: x = 0,
385
386
  rise: _ = !0,
386
387
  className: k = "",
387
- ...f
388
+ ...y
388
389
  }) {
389
- const d = { ...Z, ...h, status: { ...Z.status, ...h?.status } }, [m, I] = C(r), [fe, be] = C(() => ne(r));
390
- ne(r) !== fe && (be(ne(r)), I(r));
391
- const S = `pc-${Fe().replace(/:/g, "")}`, [U, Q] = C({}), [b, se] = C({}), [X, ae] = C({}), [ve, ke] = C(!0), [Y, te] = C(() => new Set((r?.closes || []).filter((a) => !a.closed).map((a) => a.id))), [w, oe] = C(null), [J, O] = C(null), [ce, le] = C(null), R = me(!0), M = We(), we = typeof M?.toast == "function" && M.toast.info !== M.toast;
390
+ const d = { ...Z, ...h, status: { ...Z.status, ...h?.status } }, [m, I] = C(r), [ye, be] = C(() => se(r));
391
+ se(r) !== ye && (be(se(r)), I(r));
392
+ const S = `pc-${Fe().replace(/:/g, "")}`, [U, Q] = C({}), [b, ae] = C({}), [X, ne] = C({}), [ve, ke] = C(!0), [Y, te] = C(() => new Set((r?.closes || []).filter((n) => !n.closed).map((n) => n.id))), [w, oe] = C(null), [J, O] = C(null), [le, ce] = C(null), R = me(!0), M = We(), we = typeof M?.toast == "function" && M.toast.info !== M.toast;
392
393
  re(() => (R.current = !0, () => {
393
394
  R.current = !1;
394
395
  }), []);
395
396
  const ie = me(r?.id);
396
397
  re(() => {
397
- ie.current !== r?.id && (ie.current = r?.id, Q({}), se({}), ae({}), te(new Set((r?.closes || []).filter((a) => !a.closed).map((a) => a.id))), O(null));
398
+ ie.current !== r?.id && (ie.current = r?.id, Q({}), ae({}), ne({}), te(new Set((r?.closes || []).filter((n) => !n.closed).map((n) => n.id))), O(null));
398
399
  }, [r]);
399
400
  const B = m?.undoUntil;
400
401
  re(() => {
401
- if (le(Date.now()), !B) return;
402
- const a = Date.parse(B) - Date.now();
403
- if (!(a > 0)) return;
404
- const p = setTimeout(() => R.current && le(Date.now()), Math.min(a + 50, 2 ** 31 - 1));
402
+ if (ce(Date.now()), !B) return;
403
+ const n = Date.parse(B) - Date.now();
404
+ if (!(n > 0)) return;
405
+ const p = setTimeout(() => R.current && ce(Date.now()), Math.min(n + 50, 2 ** 31 - 1));
405
406
  return () => clearTimeout(p);
406
407
  }, [B, m?.status]);
407
- const de = Re(() => ({ money: y, date: t }), [y, t]);
408
+ const de = Re(() => ({ money: f, date: t }), [f, t]);
408
409
  if (!m) return null;
409
410
  const N = m.body || { kind: "custom", render: () => null }, j = m.status || "pending", A = !!m.undoneAt, $e = j === "pending" && !A && !w, z = j === "pending" && !A, xe = N.kind === "fields" ? U : N.kind === "message" ? {
410
411
  ...b.to !== void 0 ? { to: E(b.to) } : null,
411
412
  ...b.text !== void 0 ? { text: b.text } : null
412
413
  } : N.kind === "lines" ? { unitPrices: X } : {}, W = Ve(m, xe), Se = Object.keys(W).length === 0 && (N.kind !== "custom" || ve), je = () => {
413
- let a = {};
414
+ let n = {};
414
415
  if (N.kind === "fields")
415
- for (const p of N.fields || []) U[p.key] !== void 0 && String(U[p.key]) !== String(p.value ?? "") && (a[p.key] = U[p.key]);
416
+ for (const p of N.fields || []) U[p.key] !== void 0 && String(U[p.key]) !== String(p.value ?? "") && (n[p.key] = U[p.key]);
416
417
  else if (N.kind === "message")
417
- b.to !== void 0 && (a.to = E(b.to)), b.cc !== void 0 && (a.cc = E(b.cc)), b.subject !== void 0 && b.subject !== N.subject && (a.subject = b.subject), b.text !== void 0 && b.text !== N.text && (a.text = b.text);
418
+ b.to !== void 0 && (n.to = E(b.to)), b.cc !== void 0 && (n.cc = E(b.cc)), b.subject !== void 0 && b.subject !== N.subject && (n.subject = b.subject), b.text !== void 0 && b.text !== N.text && (n.text = b.text);
418
419
  else if (N.kind === "lines") {
419
420
  const p = {};
420
421
  for (const [v, $] of Object.entries(X)) q($) || (p[v] = String(F($)));
421
- Object.keys(p).length && (a.unitPrices = p);
422
- } else N.kind === "custom" && (a = { ...U });
423
- return m.closes?.length && (a.closes = m.closes.filter((p) => Y.has(p.id)).map((p) => p.id)), Object.keys(a).length ? a : void 0;
424
- }, Ce = (a, p) => {
425
- const v = a?.message || String(a || "");
426
- l?.(a), we ? M.toast({ tone: "error", title: p, description: v || void 0 }) : O({ title: p, message: v });
427
- }, ee = async (a, p, v) => {
422
+ Object.keys(p).length && (n.unitPrices = p);
423
+ } else N.kind === "custom" && (n = { ...U });
424
+ return m.closes?.length && (n.closes = m.closes.filter((p) => Y.has(p.id)).map((p) => p.id)), Object.keys(n).length ? n : void 0;
425
+ }, Ce = (n, p) => {
426
+ const v = n?.message || String(n || "");
427
+ c?.(n), we ? M.toast({ tone: "error", title: p, description: v || void 0 }) : O({ title: p, message: v });
428
+ }, ee = async (n, p, v) => {
428
429
  if (!w) {
429
- oe(a), O(null);
430
+ oe(n), O(null);
430
431
  try {
431
432
  const $ = await p();
432
433
  $ && R.current && I($), $ && i?.($);
@@ -436,27 +437,27 @@ function Fr({
436
437
  R.current && oe(null);
437
438
  }
438
439
  }
439
- }, Te = () => n && ee("approve", () => n(m.id, !0, je()), d.error), Pe = () => n && ee("reject", () => n(m.id, !1), d.error), Ie = () => c && ee("undo", () => c(m.id), d.undoError), V = m.record || (m.href ? { href: m.href, label: d.openRecord } : null), Ae = !!c && j === "applied" && !A && !!B && ce != null && Date.parse(B) > ce, qe = {
440
+ }, Te = () => s && ee("approve", () => s(m.id, !0, je()), d.error), Pe = () => s && ee("reject", () => s(m.id, !1), d.error), Ie = () => l && ee("undo", () => l(m.id), d.undoError), V = m.record || (m.href ? { href: m.href, label: d.openRecord } : null), Ae = !!l && j === "applied" && !A && !!B && le != null && Date.parse(B) > le, qe = {
440
441
  edits: U,
441
- set: (a, p) => Q((v) => ({ ...v, [a]: p })),
442
+ set: (n, p) => Q((v) => ({ ...v, [n]: p })),
442
443
  setValid: ke,
443
444
  editing: $e,
444
445
  status: j,
445
- formatMoney: y,
446
+ formatMoney: f,
446
447
  formatDate: t
447
448
  };
448
449
  let T = null;
449
450
  switch (N.kind) {
450
451
  case "diff":
451
- T = /* @__PURE__ */ e(ir, { changes: N.changes, labels: d });
452
+ T = /* @__PURE__ */ e(dr, { changes: N.changes, labels: d });
452
453
  break;
453
454
  case "fields":
454
455
  T = /* @__PURE__ */ e(
455
- pr,
456
+ ur,
456
457
  {
457
458
  body: N,
458
459
  values: U,
459
- setValue: (a, p) => Q((v) => ({ ...v, [a]: p })),
460
+ setValue: (n, p) => Q((v) => ({ ...v, [n]: p })),
460
461
  editing: z,
461
462
  problems: W,
462
463
  fmt: de,
@@ -467,11 +468,11 @@ function Fr({
467
468
  break;
468
469
  case "message":
469
470
  T = /* @__PURE__ */ e(
470
- ur,
471
+ mr,
471
472
  {
472
473
  body: N,
473
474
  draft: b,
474
- setDraft: (a) => se((p) => ({ ...p, ...a })),
475
+ setDraft: (n) => ae((p) => ({ ...p, ...n })),
475
476
  editing: z,
476
477
  problems: W,
477
478
  labels: d,
@@ -480,13 +481,13 @@ function Fr({
480
481
  );
481
482
  break;
482
483
  case "lines":
483
- T = /* @__PURE__ */ e(mr, { body: N, prices: X, setPrice: (a, p) => ae((v) => ({ ...v, [a]: p })), editing: z, problems: W, fmt: de, labels: d, uid: S });
484
+ T = /* @__PURE__ */ e(hr, { body: N, prices: X, setPrice: (n, p) => ne((v) => ({ ...v, [n]: p })), editing: z, problems: W, fmt: de, labels: d, uid: S });
484
485
  break;
485
486
  case "bulk":
486
- T = /* @__PURE__ */ e(hr, { body: N, labels: d });
487
+ T = /* @__PURE__ */ e(_r, { body: N, labels: d });
487
488
  break;
488
489
  case "table":
489
- T = /* @__PURE__ */ e(_r, { body: N });
490
+ T = /* @__PURE__ */ e(Nr, { body: N });
490
491
  break;
491
492
  case "custom":
492
493
  T = typeof N.render == "function" ? N.render(qe) : null;
@@ -494,10 +495,10 @@ function Fr({
494
495
  default:
495
496
  T = null;
496
497
  }
497
- const L = m.closes || [], pe = (a) => a.closed ?? (j === "applied" && !A && Y.has(a.id)), ue = _ ? Me(x) : { className: "", style: void 0 }, De = ["proposal-card", Ke.has(N.kind) ? "proposal-card--wide" : "", ue.className, k].filter(Boolean).join(" "), Ue = (a) => {
498
- !u || a.defaultPrevented || a.metaKey || a.ctrlKey || a.shiftKey || a.button > 0 || (a.preventDefault(), u(V.href));
498
+ const L = m.closes || [], pe = (n) => n.closed ?? (j === "applied" && !A && Y.has(n.id)), ue = _ ? Me(x) : { className: "", style: void 0 }, De = ["proposal-card", Ke.has(N.kind) ? "proposal-card--wide" : "", ue.className, k].filter(Boolean).join(" "), Ue = (n) => {
499
+ !u || n.defaultPrevented || n.metaKey || n.ctrlKey || n.shiftKey || n.button > 0 || (n.preventDefault(), u(V.href));
499
500
  };
500
- return /* @__PURE__ */ s(
501
+ return /* @__PURE__ */ a(
501
502
  "div",
502
503
  {
503
504
  role: "group",
@@ -508,21 +509,21 @@ function Fr({
508
509
  "data-status": j,
509
510
  "data-kind": N.kind,
510
511
  "data-undone": A ? "" : void 0,
511
- ...f,
512
+ ...y,
512
513
  children: [
513
- /* @__PURE__ */ s("div", { className: "proposal-card__header", children: [
514
+ /* @__PURE__ */ a("div", { className: "proposal-card__header", children: [
514
515
  /* @__PURE__ */ e("span", { className: "proposal-card__mark", "aria-hidden": "true", children: /* @__PURE__ */ e(Oe, { size: 15 }) }),
515
- /* @__PURE__ */ s("p", { className: "proposal-card__heading", children: [
516
+ /* @__PURE__ */ a("p", { className: "proposal-card__heading", children: [
516
517
  /* @__PURE__ */ e("span", { id: `${S}-title`, className: "proposal-card__title", children: m.title }),
517
518
  /* @__PURE__ */ e("span", { id: `${S}-label`, className: "proposal-card__label", children: m.label })
518
519
  ] }),
519
- /* @__PURE__ */ e("span", { className: "proposal-card__badge", "aria-live": "polite", children: /* @__PURE__ */ e(lr, { status: j, undone: A, labels: d.status }) })
520
+ /* @__PURE__ */ e("span", { className: "proposal-card__badge", "aria-live": "polite", children: /* @__PURE__ */ e(ir, { status: j, undone: A, labels: d.status }) })
520
521
  ] }),
521
- /* @__PURE__ */ s("div", { className: "proposal-card__body", children: [
522
- m.reason ? /* @__PURE__ */ s("p", { className: "proposal-card__reason", children: [
523
- /* @__PURE__ */ e(ar, {}),
524
- /* @__PURE__ */ s("span", { children: [
525
- /* @__PURE__ */ s("span", { className: "proposal-card__reason-label", children: [
522
+ /* @__PURE__ */ a("div", { className: "proposal-card__body", children: [
523
+ m.reason ? /* @__PURE__ */ a("p", { className: "proposal-card__reason", children: [
524
+ /* @__PURE__ */ e(tr, {}),
525
+ /* @__PURE__ */ a("span", { children: [
526
+ /* @__PURE__ */ a("span", { className: "proposal-card__reason-label", children: [
526
527
  d.reason,
527
528
  ": "
528
529
  ] }),
@@ -530,37 +531,36 @@ function Fr({
530
531
  ] })
531
532
  ] }) : null,
532
533
  T,
533
- L.length && z ? /* @__PURE__ */ s("fieldset", { className: "proposal-card__closes", children: [
534
+ L.length && z ? /* @__PURE__ */ a("fieldset", { className: "proposal-card__closes", children: [
534
535
  /* @__PURE__ */ e("legend", { children: d.alsoCloses }),
535
- /* @__PURE__ */ e("ul", { children: L.map((a) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s("label", { className: "proposal-card__close-item", "data-disabled": w ? "" : void 0, children: [
536
+ /* @__PURE__ */ e("ul", { children: L.map((n) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ a("label", { className: "proposal-card__close-item", "data-disabled": w ? "" : void 0, children: [
536
537
  /* @__PURE__ */ e(
537
- "input",
538
+ er,
538
539
  {
539
- type: "checkbox",
540
- checked: Y.has(a.id),
540
+ checked: Y.has(n.id),
541
541
  disabled: !!w,
542
542
  onChange: (p) => te((v) => {
543
543
  const $ = new Set(v);
544
- return p.target.checked ? $.add(a.id) : $.delete(a.id), $;
544
+ return p.target.checked ? $.add(n.id) : $.delete(n.id), $;
545
545
  })
546
546
  }
547
547
  ),
548
- /* @__PURE__ */ s("span", { children: [
549
- a.title,
550
- a.due ? /* @__PURE__ */ e("span", { className: "proposal-card__close-due", children: P(d.due, t(a.due)) }) : null
548
+ /* @__PURE__ */ a("span", { children: [
549
+ n.title,
550
+ n.due ? /* @__PURE__ */ e("span", { className: "proposal-card__close-due", children: P(d.due, t(n.due)) }) : null
551
551
  ] })
552
- ] }) }, a.id)) })
552
+ ] }) }, n.id)) })
553
553
  ] }) : null,
554
- L.length && j === "applied" && !A && L.some(pe) ? /* @__PURE__ */ e("ul", { className: "proposal-card__closed-list", "aria-label": d.alsoCloses, children: L.filter(pe).map((a) => /* @__PURE__ */ s("li", { className: "proposal-card__closed", children: [
554
+ L.length && j === "applied" && !A && L.some(pe) ? /* @__PURE__ */ e("ul", { className: "proposal-card__closed-list", "aria-label": d.alsoCloses, children: L.filter(pe).map((n) => /* @__PURE__ */ a("li", { className: "proposal-card__closed", children: [
555
555
  /* @__PURE__ */ e(he, { size: 14 }),
556
- P(d.closed, a.title)
557
- ] }, a.id)) }) : null
556
+ P(d.closed, n.title)
557
+ ] }, n.id)) }) : null
558
558
  ] }),
559
559
  J ? /* @__PURE__ */ e("div", { className: "proposal-card__error", children: /* @__PURE__ */ e(ze, { tone: "danger", title: J.title, dismissible: !0, onDismiss: () => O(null), children: J.message }) }) : null,
560
- /* @__PURE__ */ e("div", { className: "proposal-card__footer", children: z ? /* @__PURE__ */ s(D, { children: [
560
+ /* @__PURE__ */ e("div", { className: "proposal-card__footer", children: z ? /* @__PURE__ */ a(D, { children: [
561
561
  /* @__PURE__ */ e("p", { className: "proposal-card__note", id: `${S}-note`, children: m.pendingNote ?? d.pendingNote }),
562
- /* @__PURE__ */ s("div", { className: "proposal-card__actions", children: [
563
- /* @__PURE__ */ e(H, { shape: "pill", className: "proposal-card__btn", onClick: Pe, disabled: !!w || !n, loading: w === "reject", children: d.reject }),
562
+ /* @__PURE__ */ a("div", { className: "proposal-card__actions", children: [
563
+ /* @__PURE__ */ e(H, { shape: "pill", className: "proposal-card__btn", onClick: Pe, disabled: !!w || !s, loading: w === "reject", children: d.reject }),
564
564
  /* @__PURE__ */ e(
565
565
  Le,
566
566
  {
@@ -568,24 +568,24 @@ function Fr({
568
568
  className: "proposal-card__approve",
569
569
  icon: w === "approve" ? /* @__PURE__ */ e("span", { className: "proposal-card__spinner", "aria-hidden": "true" }) : /* @__PURE__ */ e(he, { size: 14 }),
570
570
  loading: w === "approve",
571
- disabled: !Se || !!w || !n,
571
+ disabled: !Se || !!w || !s,
572
572
  "aria-describedby": W.lines ? `${S}-missing` : `${S}-note`,
573
573
  onClick: Te,
574
574
  children: m.approveLabel ?? d.approve
575
575
  }
576
576
  )
577
577
  ] })
578
- ] }) : A ? /* @__PURE__ */ s("p", { className: "proposal-card__outcome", role: "status", children: [
578
+ ] }) : A ? /* @__PURE__ */ a("p", { className: "proposal-card__outcome", role: "status", children: [
579
579
  /* @__PURE__ */ e(_e, {}),
580
580
  d.undone
581
- ] }) : j === "applied" ? /* @__PURE__ */ s(D, { children: [
582
- /* @__PURE__ */ s("p", { className: "proposal-card__outcome proposal-card__outcome--applied", role: "status", children: [
581
+ ] }) : j === "applied" ? /* @__PURE__ */ a(D, { children: [
582
+ /* @__PURE__ */ a("p", { className: "proposal-card__outcome proposal-card__outcome--applied", role: "status", children: [
583
583
  /* @__PURE__ */ e(cr, {}),
584
584
  d.applied
585
585
  ] }),
586
- /* @__PURE__ */ s("div", { className: "proposal-card__actions", children: [
587
- V ? /* @__PURE__ */ e(H, { variant: "ghost", shape: "pill", icon: /* @__PURE__ */ e(sr, {}), className: "proposal-card__btn proposal-card__btn--ghost", href: V.href, onClick: Ue, children: V.label ?? d.openRecord }) : null,
588
- Ae ? /* @__PURE__ */ s(
586
+ /* @__PURE__ */ a("div", { className: "proposal-card__actions", children: [
587
+ V ? /* @__PURE__ */ e(H, { variant: "ghost", shape: "pill", icon: /* @__PURE__ */ e(nr, {}), className: "proposal-card__btn proposal-card__btn--ghost", href: V.href, onClick: Ue, children: V.label ?? d.openRecord }) : null,
588
+ Ae ? /* @__PURE__ */ a(
589
589
  H,
590
590
  {
591
591
  shape: "pill",
@@ -601,14 +601,14 @@ function Fr({
601
601
  }
602
602
  ) : null
603
603
  ] })
604
- ] }) : j === "stale" ? /* @__PURE__ */ s(D, { children: [
605
- /* @__PURE__ */ s("p", { className: "proposal-card__outcome proposal-card__outcome--stale", role: "status", children: [
604
+ ] }) : j === "stale" ? /* @__PURE__ */ a(D, { children: [
605
+ /* @__PURE__ */ a("p", { className: "proposal-card__outcome proposal-card__outcome--stale", role: "status", children: [
606
606
  /* @__PURE__ */ e(ge, { size: 16 }),
607
607
  d.stale
608
608
  ] }),
609
- o ? /* @__PURE__ */ e("div", { className: "proposal-card__actions", children: /* @__PURE__ */ e(H, { shape: "pill", icon: /* @__PURE__ */ e(tr, {}), className: "proposal-card__btn", onClick: () => o(m), children: d.askAgain }) }) : null
610
- ] }) : /* @__PURE__ */ s("p", { className: "proposal-card__outcome", role: "status", children: [
611
- /* @__PURE__ */ e(or, {}),
609
+ o ? /* @__PURE__ */ e("div", { className: "proposal-card__actions", children: /* @__PURE__ */ e(H, { shape: "pill", icon: /* @__PURE__ */ e(or, {}), className: "proposal-card__btn", onClick: () => o(m), children: d.askAgain }) }) : null
610
+ ] }) : /* @__PURE__ */ a("p", { className: "proposal-card__outcome", role: "status", children: [
611
+ /* @__PURE__ */ e(lr, {}),
612
612
  d.rejected
613
613
  ] }) })
614
614
  ]
@@ -616,14 +616,14 @@ function Fr({
616
616
  );
617
617
  }
618
618
  export {
619
- ir as DiffTable,
619
+ dr as DiffTable,
620
620
  Z as PROPOSAL_LABELS,
621
- lr as ProposalStatusBadge,
622
- Er as approveEach,
623
- zr as canApproveTogether,
624
- Fr as default,
625
- rr as defaultFormatDate,
626
- er as defaultFormatMoney,
621
+ ir as ProposalStatusBadge,
622
+ Wr as approveEach,
623
+ Lr as canApproveTogether,
624
+ Br as default,
625
+ sr as defaultFormatDate,
626
+ rr as defaultFormatMoney,
627
627
  F as parseAmount,
628
628
  Ve as proposalProblems
629
629
  };