@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.
- package/COPY-PASTE.md +109 -0
- package/README.md +9 -75
- package/dist/app/components/Dashboard/dashboardRegistry.cjs +1 -1
- package/dist/app/components/Dashboard/dashboardRegistry.mjs +202 -201
- package/dist/app/components/Table/DataTable.cjs +1 -1
- package/dist/app/components/Table/DataTable.mjs +46 -49
- package/dist/app/components/ai/ConfidenceSuggestions/ConfidenceSuggestions.cjs +1 -1
- package/dist/app/components/ai/ConfidenceSuggestions/ConfidenceSuggestions.mjs +53 -53
- package/dist/app/components/ai/ProposalCard/ProposalCard.cjs +1 -1
- package/dist/app/components/ai/ProposalCard/ProposalCard.mjs +227 -227
- package/dist/app/components/ai/ReviewTable/ReviewTable.cjs +1 -1
- package/dist/app/components/ai/ReviewTable/ReviewTable.mjs +81 -81
- package/dist/app/components/ai/SuggestionChecklist/SuggestionChecklist.cjs +1 -1
- package/dist/app/components/ai/SuggestionChecklist/SuggestionChecklist.mjs +15 -14
- package/dist/app/components/ui/AuthSection/AuthSection.cjs +1 -1
- package/dist/app/components/ui/AuthSection/AuthSection.mjs +19 -18
- package/dist/app/components/ui/Checkbox/Checkbox.cjs +1 -0
- package/dist/app/components/ui/Checkbox/Checkbox.css +1 -0
- package/dist/app/components/ui/Checkbox/Checkbox.mjs +87 -0
- package/dist/app/components/ui/DataGrid/DataGrid.cjs +1 -1
- package/dist/app/components/ui/DataGrid/DataGrid.mjs +196 -199
- package/dist/app/components/ui/PreviewConfirmDialog/PreviewConfirmDialog.cjs +1 -1
- package/dist/app/components/ui/PreviewConfirmDialog/PreviewConfirmDialog.mjs +47 -48
- package/dist/browser/pixstella.esm.js +70 -70
- package/dist/browser/pixstella.standalone.js +72 -72
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.mjs +2886 -2884
- package/dist/registry/files/174512e8f294ad2f +101 -0
- package/dist/registry/files/4c7e419c8caf02c3 +119 -0
- package/dist/registry/files/{f23e788832b45fc0 → 67ac8b4abe3fc564} +2 -1
- package/dist/registry/files/{e84f443f3fc3f261 → 995feaa023211faf} +4 -8
- package/dist/registry/files/{5ba71aa83263995e → a27872a7d58aeb58} +4 -5
- package/dist/registry/files/{162078d04cb26276 → df919b524be27e88} +4 -5
- package/dist/registry/index.json +1 -1
- package/dist/styles.css +3 -0
- package/package.json +3 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
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
|
|
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,
|
|
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
|
|
69
|
-
const
|
|
70
|
-
if (Number.isNaN(
|
|
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:
|
|
73
|
+
return new Intl.NumberFormat("en-US", { style: "currency", currency: s || "USD" }).format(l);
|
|
73
74
|
} catch {
|
|
74
|
-
return `${
|
|
75
|
+
return `${l.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })} ${s || ""}`.trim();
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function sr(r) {
|
|
78
79
|
if (!r) return "";
|
|
79
|
-
const
|
|
80
|
-
return Number.isNaN(i.getTime()) ?
|
|
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
|
|
83
|
-
const
|
|
84
|
-
if (Number.isNaN(
|
|
85
|
-
const
|
|
86
|
-
return new Intl.DateTimeFormat("en-GB",
|
|
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, ...
|
|
89
|
-
function
|
|
90
|
-
const o = { ...Z.status, ...
|
|
91
|
-
return /* @__PURE__ */ e(Be, { tone: Ne[
|
|
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
|
|
94
|
-
const i = { ...Z, ...
|
|
95
|
-
return /* @__PURE__ */ e("div", { className: "proposal-card__table-wrap", children: /* @__PURE__ */
|
|
96
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
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,
|
|
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__ */
|
|
105
|
-
/* @__PURE__ */
|
|
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(
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
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 ??
|
|
120
|
+
] }, o.field ?? c)) })
|
|
120
121
|
] }) });
|
|
121
122
|
}
|
|
122
|
-
function G(r,
|
|
123
|
-
if (q(
|
|
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
|
|
127
|
+
return l.money(s, r.currency || u);
|
|
127
128
|
case "date":
|
|
128
|
-
return
|
|
129
|
+
return l.date(s);
|
|
129
130
|
case "yesno":
|
|
130
|
-
return /^(true|yes|1|y)$/i.test(String(
|
|
131
|
+
return /^(true|yes|1|y)$/i.test(String(s)) ? i.yes : i.no;
|
|
131
132
|
case "enum": {
|
|
132
|
-
const o = (r.options || []).find((
|
|
133
|
-
return o ? typeof o == "object" ? o.label : o :
|
|
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(
|
|
137
|
-
return Number.isNaN(o) ?
|
|
137
|
+
const o = F(s);
|
|
138
|
+
return Number.isNaN(o) ? s : o.toLocaleString("en-US");
|
|
138
139
|
}
|
|
139
140
|
default:
|
|
140
|
-
return
|
|
141
|
+
return s;
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
|
-
function
|
|
144
|
-
const
|
|
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:
|
|
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:
|
|
157
|
-
onChange: (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:
|
|
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:
|
|
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:
|
|
174
|
-
onChange: (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(
|
|
179
|
-
return /* @__PURE__ */
|
|
180
|
-
/* @__PURE__ */ e("button", { type: "button", "aria-pressed": h, onClick: () =>
|
|
181
|
-
/* @__PURE__ */ e("button", { type: "button", "aria-pressed": x, onClick: () =>
|
|
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:
|
|
186
|
+
return /* @__PURE__ */ e(K, { ...g, value: s ?? "", onChange: (h) => l(h) });
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
|
-
function
|
|
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 =
|
|
191
|
-
return /* @__PURE__ */
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
-
h && t.type !== "yesno" && t.type !== "enum" ? /* @__PURE__ */ e("label", { htmlFor: `${
|
|
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__ */
|
|
197
|
-
h ? /* @__PURE__ */
|
|
198
|
-
/* @__PURE__ */ e(
|
|
199
|
-
x ? /* @__PURE__ */ e("span", { className: "proposal-card__was-hint", children: P(
|
|
200
|
-
] }) : x ? /* @__PURE__ */
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
|
|
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,
|
|
207
|
+
G(t, t.from, o, c, r.currency)
|
|
207
208
|
] }),
|
|
208
|
-
/* @__PURE__ */ e(
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
|
|
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,
|
|
215
|
+
G(t, g, o, c, r.currency)
|
|
215
216
|
] })
|
|
216
|
-
] }) : G(t, g, o,
|
|
217
|
-
u[t.key] && h && t.type === "yesno" ? /* @__PURE__ */ e("span", { className: "proposal-card__field-error", children:
|
|
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((
|
|
223
|
-
function
|
|
224
|
-
const
|
|
225
|
-
return /* @__PURE__ */
|
|
226
|
-
r.replyTo ? /* @__PURE__ */
|
|
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__ */
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
/* @__PURE__ */ e("label", { htmlFor: `${
|
|
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: `${
|
|
238
|
+
id: `${c}-to`,
|
|
238
239
|
className: "proposal-card__msg-input",
|
|
239
240
|
type: "text",
|
|
240
241
|
inputMode: "email",
|
|
241
|
-
value:
|
|
242
|
+
value: f,
|
|
242
243
|
"aria-invalid": u.to ? !0 : void 0,
|
|
243
|
-
"aria-describedby": `${
|
|
244
|
-
onChange: (_) =>
|
|
244
|
+
"aria-describedby": `${c}-to-hint`,
|
|
245
|
+
onChange: (_) => l({ to: _.target.value })
|
|
245
246
|
}
|
|
246
247
|
),
|
|
247
|
-
/* @__PURE__ */
|
|
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__ */
|
|
253
|
-
/* @__PURE__ */ e("label", { htmlFor: `${
|
|
254
|
-
/* @__PURE__ */ e("input", { id: `${
|
|
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__ */
|
|
257
|
-
/* @__PURE__ */ e("label", { htmlFor: `${
|
|
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: `${
|
|
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: (_) =>
|
|
266
|
+
onChange: (_) => l({ subject: _.target.value })
|
|
266
267
|
}
|
|
267
268
|
)
|
|
268
269
|
] }),
|
|
269
|
-
/* @__PURE__ */ e("label", { htmlFor: `${
|
|
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: `${
|
|
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: (_) =>
|
|
279
|
+
onChange: (_) => l({ text: _.target.value })
|
|
279
280
|
}
|
|
280
281
|
)
|
|
281
|
-
] }) : /* @__PURE__ */
|
|
282
|
-
/* @__PURE__ */
|
|
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(
|
|
285
|
+
x(E(f))
|
|
285
286
|
] }),
|
|
286
|
-
E(t).length ? /* @__PURE__ */
|
|
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__ */
|
|
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
|
|
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
|
|
303
|
-
return Number.isNaN(I) ? h = !1 : g += I, { l: _, i: k, raw:
|
|
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__ */
|
|
306
|
-
/* @__PURE__ */ e("div", { className: "proposal-card__table-wrap", tabIndex: 0, role: "region", "aria-label":
|
|
307
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
308
|
-
/* @__PURE__ */ e("th", { scope: "col", children:
|
|
309
|
-
/* @__PURE__ */ e("th", { scope: "col", className: "num", children:
|
|
310
|
-
/* @__PURE__ */ e("th", { scope: "col", className: "num", children:
|
|
311
|
-
/* @__PURE__ */ e("th", { scope: "col", className: "num", children:
|
|
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:
|
|
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__ */
|
|
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__ */
|
|
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: `${
|
|
325
|
+
id: `${f}-price-${k}`,
|
|
325
326
|
type: "text",
|
|
326
327
|
inputMode: "decimal",
|
|
327
|
-
value:
|
|
328
|
+
value: y ?? "",
|
|
328
329
|
placeholder: "0.00",
|
|
329
|
-
"aria-label": P(
|
|
330
|
-
"aria-invalid": q(
|
|
331
|
-
onChange: (I) =>
|
|
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(
|
|
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__ */
|
|
339
|
-
/* @__PURE__ */ e("th", { scope: "row", colSpan: 3, children:
|
|
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__ */
|
|
344
|
+
i && u.lines ? /* @__PURE__ */ a("p", { className: "proposal-card__missing", id: `${f}-missing`, children: [
|
|
344
345
|
/* @__PURE__ */ e(ge, { size: 14 }),
|
|
345
|
-
P(
|
|
346
|
+
P(c.missingPrices, u.lines)
|
|
346
347
|
] }) : null
|
|
347
348
|
] });
|
|
348
349
|
}
|
|
349
|
-
function
|
|
350
|
-
const
|
|
351
|
-
return /* @__PURE__ */
|
|
352
|
-
/* @__PURE__ */
|
|
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(
|
|
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
|
-
|
|
358
|
-
|
|
359
|
-
i ? /* @__PURE__ */ e("li", { className: "proposal-card__more", children: P(
|
|
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(
|
|
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
|
|
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__ */
|
|
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((
|
|
368
|
-
/* @__PURE__ */ e("tbody", { children: (r.rows || []).map((
|
|
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
|
|
372
|
-
function
|
|
372
|
+
const se = (r) => `${r?.id}|${r?.status}|${r?.undoneAt || ""}|${r?.undoUntil || ""}`;
|
|
373
|
+
function Br({
|
|
373
374
|
proposal: r,
|
|
374
|
-
decide:
|
|
375
|
-
undo:
|
|
375
|
+
decide: s,
|
|
376
|
+
undo: l,
|
|
376
377
|
onDecided: i,
|
|
377
378
|
onNavigate: u,
|
|
378
379
|
onAskAgain: o,
|
|
379
|
-
onError:
|
|
380
|
-
formatMoney:
|
|
381
|
-
formatDate: t =
|
|
382
|
-
formatTime: g =
|
|
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
|
-
...
|
|
388
|
+
...y
|
|
388
389
|
}) {
|
|
389
|
-
const d = { ...Z, ...h, status: { ...Z.status, ...h?.status } }, [m, I] = C(r), [
|
|
390
|
-
|
|
391
|
-
const S = `pc-${Fe().replace(/:/g, "")}`, [U, Q] = C({}), [b,
|
|
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({}),
|
|
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 (
|
|
402
|
-
const
|
|
403
|
-
if (!(
|
|
404
|
-
const p = setTimeout(() => R.current &&
|
|
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:
|
|
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
|
|
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 ?? "") && (
|
|
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 && (
|
|
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 && (
|
|
422
|
-
} else N.kind === "custom" && (
|
|
423
|
-
return m.closes?.length && (
|
|
424
|
-
}, Ce = (
|
|
425
|
-
const v =
|
|
426
|
-
|
|
427
|
-
}, ee = async (
|
|
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(
|
|
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 = () =>
|
|
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: (
|
|
442
|
+
set: (n, p) => Q((v) => ({ ...v, [n]: p })),
|
|
442
443
|
setValid: ke,
|
|
443
444
|
editing: $e,
|
|
444
445
|
status: j,
|
|
445
|
-
formatMoney:
|
|
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(
|
|
452
|
+
T = /* @__PURE__ */ e(dr, { changes: N.changes, labels: d });
|
|
452
453
|
break;
|
|
453
454
|
case "fields":
|
|
454
455
|
T = /* @__PURE__ */ e(
|
|
455
|
-
|
|
456
|
+
ur,
|
|
456
457
|
{
|
|
457
458
|
body: N,
|
|
458
459
|
values: U,
|
|
459
|
-
setValue: (
|
|
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
|
-
|
|
471
|
+
mr,
|
|
471
472
|
{
|
|
472
473
|
body: N,
|
|
473
474
|
draft: b,
|
|
474
|
-
setDraft: (
|
|
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(
|
|
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(
|
|
487
|
+
T = /* @__PURE__ */ e(_r, { body: N, labels: d });
|
|
487
488
|
break;
|
|
488
489
|
case "table":
|
|
489
|
-
T = /* @__PURE__ */ e(
|
|
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 = (
|
|
498
|
-
!u ||
|
|
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__ */
|
|
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
|
-
...
|
|
512
|
+
...y,
|
|
512
513
|
children: [
|
|
513
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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(
|
|
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__ */
|
|
522
|
-
m.reason ? /* @__PURE__ */
|
|
523
|
-
/* @__PURE__ */ e(
|
|
524
|
-
/* @__PURE__ */
|
|
525
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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((
|
|
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
|
-
|
|
538
|
+
er,
|
|
538
539
|
{
|
|
539
|
-
|
|
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(
|
|
544
|
+
return p.target.checked ? $.add(n.id) : $.delete(n.id), $;
|
|
545
545
|
})
|
|
546
546
|
}
|
|
547
547
|
),
|
|
548
|
-
/* @__PURE__ */
|
|
549
|
-
|
|
550
|
-
|
|
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
|
-
] }) },
|
|
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((
|
|
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,
|
|
557
|
-
] },
|
|
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__ */
|
|
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__ */
|
|
563
|
-
/* @__PURE__ */ e(H, { shape: "pill", className: "proposal-card__btn", onClick: Pe, disabled: !!w || !
|
|
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 || !
|
|
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__ */
|
|
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__ */
|
|
582
|
-
/* @__PURE__ */
|
|
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__ */
|
|
587
|
-
V ? /* @__PURE__ */ e(H, { variant: "ghost", shape: "pill", icon: /* @__PURE__ */ e(
|
|
588
|
-
Ae ? /* @__PURE__ */
|
|
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__ */
|
|
605
|
-
/* @__PURE__ */
|
|
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(
|
|
610
|
-
] }) : /* @__PURE__ */
|
|
611
|
-
/* @__PURE__ */ e(
|
|
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
|
-
|
|
619
|
+
dr as DiffTable,
|
|
620
620
|
Z as PROPOSAL_LABELS,
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
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
|
};
|