@ordinatio/ui 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +34 -0
- package/dist/board-dnd.d.mts +119 -0
- package/dist/board-dnd.mjs +219 -0
- package/dist/board-types-MZA9M0cR.d.mts +200 -0
- package/dist/index.d.mts +160 -1
- package/dist/index.mjs +644 -0
- package/package.json +18 -2
package/dist/index.mjs
CHANGED
|
@@ -3053,16 +3053,655 @@ var ACTIVITY_ICONS = {
|
|
|
3053
3053
|
function resolveActivityIcon(name) {
|
|
3054
3054
|
return ACTIVITY_ICONS[name] ?? Activity;
|
|
3055
3055
|
}
|
|
3056
|
+
|
|
3057
|
+
// src/components/pipeline-board.tsx
|
|
3058
|
+
import { useEffect as useEffect22, useMemo as useMemo2, useRef as useRef19, useState as useState24 } from "react";
|
|
3059
|
+
|
|
3060
|
+
// src/lib/board-scroll.ts
|
|
3061
|
+
function nearestColumnIndex(scrollLeft, offsets) {
|
|
3062
|
+
if (offsets.length === 0) return 0;
|
|
3063
|
+
const at = Number.isFinite(scrollLeft) && scrollLeft > 0 ? scrollLeft : 0;
|
|
3064
|
+
let best = 0;
|
|
3065
|
+
let bestDistance = Math.abs((offsets[0] ?? 0) - at);
|
|
3066
|
+
for (let i = 1; i < offsets.length; i++) {
|
|
3067
|
+
const distance = Math.abs((offsets[i] ?? 0) - at);
|
|
3068
|
+
if (distance < bestDistance) {
|
|
3069
|
+
best = i;
|
|
3070
|
+
bestDistance = distance;
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
return best;
|
|
3074
|
+
}
|
|
3075
|
+
|
|
3076
|
+
// src/components/board-column.tsx
|
|
3077
|
+
import { useId as useId5 } from "react";
|
|
3078
|
+
|
|
3079
|
+
// src/components/add-card-box.tsx
|
|
3080
|
+
import { useEffect as useEffect19, useId as useId4, useRef as useRef16, useState as useState20 } from "react";
|
|
3081
|
+
|
|
3082
|
+
// src/components/board-styles.ts
|
|
3083
|
+
var STRUCTURE = {
|
|
3084
|
+
root: { maxWidth: "100%", minWidth: 0, overflow: "hidden" },
|
|
3085
|
+
row: { display: "flex", alignItems: "flex-start", gap: "12px", overflowX: "auto", overflowY: "hidden", scrollSnapType: "x mandatory", overscrollBehaviorX: "contain", maxWidth: "100%", boxSizing: "border-box" },
|
|
3086
|
+
// About 85% of the screen on a phone (so the next column peeks in), at most 22rem on a wide screen.
|
|
3087
|
+
column: { flex: "0 0 min(85vw, 22rem)", scrollSnapAlign: "start", minWidth: 0, boxSizing: "border-box" },
|
|
3088
|
+
cardList: { listStyle: "none", margin: 0, padding: 0, display: "flex", flexDirection: "column", gap: "8px" },
|
|
3089
|
+
card: { minWidth: 0, overflowWrap: "anywhere" }
|
|
3090
|
+
};
|
|
3091
|
+
var LOOK = {
|
|
3092
|
+
root: { fontSize: "16px", color: "#171717" },
|
|
3093
|
+
position: { margin: "0 0 8px", fontSize: "16px", color: "#525252" },
|
|
3094
|
+
column: { background: "#f4f4f5", borderRadius: "12px", padding: "12px" },
|
|
3095
|
+
columnDropOver: { background: "#e0e7ff" },
|
|
3096
|
+
columnHeader: { display: "flex", flexWrap: "wrap", alignItems: "baseline", gap: "4px 8px", marginBottom: "8px" },
|
|
3097
|
+
columnName: { margin: 0, fontSize: "18px", fontWeight: 700 },
|
|
3098
|
+
columnCount: { fontSize: "16px", color: "#525252" },
|
|
3099
|
+
columnTotals: { width: "100%", margin: 0, fontSize: "16px", color: "#404040" },
|
|
3100
|
+
empty: { margin: "8px 0", fontSize: "16px", color: "#525252" },
|
|
3101
|
+
card: { background: "#ffffff", borderRadius: "8px", padding: "12px", boxShadow: "0 1px 3px rgba(0,0,0,0.2)", fontSize: "16px" },
|
|
3102
|
+
cardPending: { opacity: 0.55 },
|
|
3103
|
+
cardDragging: { opacity: 0.4 },
|
|
3104
|
+
cardTitle: { margin: 0, fontSize: "16px", fontWeight: 600 },
|
|
3105
|
+
cardMeta: { margin: "4px 0 0", fontSize: "16px", color: "#404040" },
|
|
3106
|
+
overdue: { color: "#b91c1c", fontWeight: 700 },
|
|
3107
|
+
ownerMark: { display: "inline-flex", alignItems: "center", justifyContent: "center", minWidth: "28px", height: "28px", borderRadius: "14px", background: "#e5e5e5", fontSize: "14px", fontWeight: 700 },
|
|
3108
|
+
tagChip: { display: "inline-block", padding: "2px 8px", borderRadius: "999px", background: "#e5e7eb", fontSize: "14px" },
|
|
3109
|
+
badgeWon: { display: "inline-block", padding: "2px 8px", borderRadius: "6px", background: "#dcfce7", color: "#166534", fontSize: "14px", fontWeight: 700 },
|
|
3110
|
+
badgeLost: { display: "inline-block", padding: "2px 8px", borderRadius: "6px", background: "#fee2e2", color: "#991b1b", fontSize: "14px", fontWeight: 700 },
|
|
3111
|
+
cardError: { margin: "8px 0 0", fontSize: "16px", color: "#b91c1c" },
|
|
3112
|
+
showMore: { marginTop: "8px", minHeight: "44px", padding: "8px 12px", fontSize: "16px", border: "1px solid #d4d4d4", borderRadius: "8px", background: "#ffffff", cursor: "pointer" },
|
|
3113
|
+
addButton: { marginTop: "8px", minHeight: "44px", width: "100%", textAlign: "left", padding: "8px 12px", fontSize: "16px", border: "1px dashed #a3a3a3", borderRadius: "8px", background: "transparent", color: "#404040", cursor: "pointer" },
|
|
3114
|
+
addForm: { marginTop: "8px", display: "flex", flexDirection: "column", gap: "8px" },
|
|
3115
|
+
input: { minHeight: "44px", padding: "8px 12px", fontSize: "16px", border: "1px solid #a3a3a3", borderRadius: "8px", boxSizing: "border-box", width: "100%" },
|
|
3116
|
+
select: { minHeight: "44px", padding: "8px 12px", fontSize: "16px", border: "1px solid #a3a3a3", borderRadius: "8px", background: "#ffffff" },
|
|
3117
|
+
primaryButton: { minHeight: "44px", padding: "8px 16px", fontSize: "16px", border: "1px solid #1d4ed8", borderRadius: "8px", background: "#1d4ed8", color: "#ffffff", cursor: "pointer" },
|
|
3118
|
+
secondaryButton: { minHeight: "44px", padding: "8px 16px", fontSize: "16px", border: "1px solid #a3a3a3", borderRadius: "8px", background: "#ffffff", color: "#171717", cursor: "pointer" },
|
|
3119
|
+
error: { margin: 0, fontSize: "16px", color: "#b91c1c" },
|
|
3120
|
+
panel: { display: "flex", flexDirection: "column", gap: "8px", marginTop: "8px", padding: "12px", border: "1px solid #a3a3a3", borderRadius: "8px", background: "#ffffff" },
|
|
3121
|
+
panelTitle: { margin: 0, fontSize: "16px", fontWeight: 700 },
|
|
3122
|
+
choice: { minHeight: "44px", padding: "8px 12px", fontSize: "16px", border: "1px solid #a3a3a3", borderRadius: "8px", background: "#ffffff", cursor: "pointer" },
|
|
3123
|
+
choiceActive: { background: "#dbeafe", border: "1px solid #1d4ed8" },
|
|
3124
|
+
note: { margin: "8px 0 0", fontSize: "16px", color: "#525252" }
|
|
3125
|
+
};
|
|
3126
|
+
var DISABLED = { opacity: 0.6, cursor: "not-allowed" };
|
|
3127
|
+
function boardPart(classNames, key, options = {}) {
|
|
3128
|
+
const structure = Object.hasOwn(STRUCTURE, key) ? STRUCTURE[key] : void 0;
|
|
3129
|
+
const injected = classNames?.[key];
|
|
3130
|
+
const stateClasses = [];
|
|
3131
|
+
let stateLook = {};
|
|
3132
|
+
for (const state of options.states ?? []) {
|
|
3133
|
+
const name = classNames?.[state];
|
|
3134
|
+
if (name) stateClasses.push(name);
|
|
3135
|
+
else if (Object.hasOwn(LOOK, state)) stateLook = { ...stateLook, ...LOOK[state] };
|
|
3136
|
+
}
|
|
3137
|
+
const className = [injected, ...stateClasses].filter(Boolean).join(" ");
|
|
3138
|
+
const style = {
|
|
3139
|
+
...injected ? {} : Object.hasOwn(LOOK, key) ? LOOK[key] : {},
|
|
3140
|
+
...stateLook,
|
|
3141
|
+
...structure ?? {},
|
|
3142
|
+
...options.disabled ? DISABLED : {}
|
|
3143
|
+
};
|
|
3144
|
+
const result = {};
|
|
3145
|
+
if (className) result.className = className;
|
|
3146
|
+
if (Object.keys(style).length > 0) result.style = style;
|
|
3147
|
+
return result;
|
|
3148
|
+
}
|
|
3149
|
+
|
|
3150
|
+
// src/components/add-card-box.tsx
|
|
3151
|
+
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3152
|
+
function AddCardBox({ columnName, texts, classNames, currencies = [], defaultCurrency = "", closeOnAdd = false, onAdd }) {
|
|
3153
|
+
const initialCurrency = currencies.includes(defaultCurrency) ? defaultCurrency : "";
|
|
3154
|
+
const [open, setOpen] = useState20(false);
|
|
3155
|
+
const [title, setTitle] = useState20("");
|
|
3156
|
+
const [amount, setAmount] = useState20("");
|
|
3157
|
+
const [currency, setCurrency] = useState20(initialCurrency);
|
|
3158
|
+
const [error, setError] = useState20();
|
|
3159
|
+
const [pending, setPending] = useState20(false);
|
|
3160
|
+
const buttonRef = useRef16(null);
|
|
3161
|
+
const titleRef = useRef16(null);
|
|
3162
|
+
const inFlight = useRef16(false);
|
|
3163
|
+
const restore = useRef16(false);
|
|
3164
|
+
const ids = { title: useId4(), amount: useId4(), currency: useId4() };
|
|
3165
|
+
useEffect19(() => {
|
|
3166
|
+
if (open) titleRef.current?.focus();
|
|
3167
|
+
else if (restore.current) {
|
|
3168
|
+
restore.current = false;
|
|
3169
|
+
buttonRef.current?.focus();
|
|
3170
|
+
}
|
|
3171
|
+
}, [open]);
|
|
3172
|
+
const cancel = () => {
|
|
3173
|
+
restore.current = true;
|
|
3174
|
+
setOpen(false);
|
|
3175
|
+
setTitle("");
|
|
3176
|
+
setAmount("");
|
|
3177
|
+
setCurrency(initialCurrency);
|
|
3178
|
+
setError(void 0);
|
|
3179
|
+
};
|
|
3180
|
+
const submit = async (event) => {
|
|
3181
|
+
event.preventDefault();
|
|
3182
|
+
if (inFlight.current) return;
|
|
3183
|
+
if (title.trim() === "") {
|
|
3184
|
+
setError(texts.addTitleRequired);
|
|
3185
|
+
titleRef.current?.focus();
|
|
3186
|
+
return;
|
|
3187
|
+
}
|
|
3188
|
+
inFlight.current = true;
|
|
3189
|
+
setPending(true);
|
|
3190
|
+
setError(void 0);
|
|
3191
|
+
try {
|
|
3192
|
+
const result = await onAdd({ title: title.trim(), amount: amount.trim(), currency: amount.trim() === "" ? "" : currency });
|
|
3193
|
+
if (result && typeof result.error === "string" && result.error !== "") {
|
|
3194
|
+
setError(result.error);
|
|
3195
|
+
} else if (closeOnAdd) {
|
|
3196
|
+
cancel();
|
|
3197
|
+
} else {
|
|
3198
|
+
setTitle("");
|
|
3199
|
+
setAmount("");
|
|
3200
|
+
titleRef.current?.focus();
|
|
3201
|
+
}
|
|
3202
|
+
} catch {
|
|
3203
|
+
setError(texts.unexpectedError);
|
|
3204
|
+
} finally {
|
|
3205
|
+
inFlight.current = false;
|
|
3206
|
+
setPending(false);
|
|
3207
|
+
}
|
|
3208
|
+
};
|
|
3209
|
+
const onKeyDown = (event) => {
|
|
3210
|
+
if (event.key !== "Escape") return;
|
|
3211
|
+
event.stopPropagation();
|
|
3212
|
+
cancel();
|
|
3213
|
+
};
|
|
3214
|
+
if (!open) {
|
|
3215
|
+
return /* @__PURE__ */ jsx16("button", { type: "button", ref: buttonRef, onClick: () => setOpen(true), "aria-label": `${texts.addCard} (${columnName})`, ...boardPart(classNames, "addButton"), children: texts.addCard });
|
|
3216
|
+
}
|
|
3217
|
+
return /* @__PURE__ */ jsxs15("form", { onSubmit: submit, onKeyDown, "aria-label": `${texts.addCard} (${columnName})`, ...boardPart(classNames, "addForm"), children: [
|
|
3218
|
+
/* @__PURE__ */ jsx16("label", { htmlFor: ids.title, ...boardPart(classNames, "note"), children: texts.addTitleLabel }),
|
|
3219
|
+
/* @__PURE__ */ jsx16("input", { id: ids.title, ref: titleRef, type: "text", value: title, disabled: pending, onChange: (e) => setTitle(e.target.value), autoComplete: "off", ...boardPart(classNames, "input") }),
|
|
3220
|
+
/* @__PURE__ */ jsx16("label", { htmlFor: ids.amount, ...boardPart(classNames, "note"), children: texts.addAmountLabel }),
|
|
3221
|
+
/* @__PURE__ */ jsx16("input", { id: ids.amount, type: "text", inputMode: "decimal", value: amount, disabled: pending, onChange: (e) => setAmount(e.target.value), autoComplete: "off", ...boardPart(classNames, "input") }),
|
|
3222
|
+
currencies.length > 0 ? /* @__PURE__ */ jsxs15(Fragment5, { children: [
|
|
3223
|
+
/* @__PURE__ */ jsx16("label", { htmlFor: ids.currency, ...boardPart(classNames, "note"), children: texts.addCurrencyLabel }),
|
|
3224
|
+
/* @__PURE__ */ jsxs15("select", { id: ids.currency, value: currency, disabled: pending, onChange: (e) => setCurrency(e.target.value), ...boardPart(classNames, "select"), children: [
|
|
3225
|
+
/* @__PURE__ */ jsx16("option", { value: "", children: " " }),
|
|
3226
|
+
currencies.map((code) => /* @__PURE__ */ jsx16("option", { value: code, children: code }, code))
|
|
3227
|
+
] })
|
|
3228
|
+
] }) : null,
|
|
3229
|
+
error ? /* @__PURE__ */ jsx16("p", { ...boardPart(classNames, "error"), role: "alert", children: error }) : null,
|
|
3230
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: [
|
|
3231
|
+
/* @__PURE__ */ jsx16("button", { type: "submit", disabled: pending, ...boardPart(classNames, "primaryButton", { disabled: pending }), children: pending ? texts.addPending : texts.addSubmit }),
|
|
3232
|
+
/* @__PURE__ */ jsx16("button", { type: "button", onClick: cancel, disabled: pending, ...boardPart(classNames, "secondaryButton", { disabled: pending }), children: texts.addCancel })
|
|
3233
|
+
] })
|
|
3234
|
+
] });
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
// src/components/board-column.tsx
|
|
3238
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3239
|
+
function BoardColumn({ column, texts, classNames, renderCard, onAddCard, currencies, defaultCurrency, closeOnAdd, incoming, onShowMore, dnd }) {
|
|
3240
|
+
const headingId = useId5();
|
|
3241
|
+
const body = (shell, over) => /* @__PURE__ */ jsxs16("section", { "aria-labelledby": headingId, "data-column-id": column.id, "data-kind": column.kind, ...shell, ...boardPart(classNames, "column", { states: over ? ["columnDropOver"] : [] }), children: [
|
|
3242
|
+
/* @__PURE__ */ jsxs16("div", { ...boardPart(classNames, "columnHeader"), children: [
|
|
3243
|
+
/* @__PURE__ */ jsx17("h3", { id: headingId, ...boardPart(classNames, "columnName"), children: column.name }),
|
|
3244
|
+
/* @__PURE__ */ jsx17("span", { ...boardPart(classNames, "columnCount"), children: texts.columnCount(column.count) }),
|
|
3245
|
+
column.totals.length > 0 ? /* @__PURE__ */ jsx17("p", { ...boardPart(classNames, "columnTotals"), children: column.totals.join(" \xB7 ") }) : null
|
|
3246
|
+
] }),
|
|
3247
|
+
column.cards.length === 0 && !incoming ? /* @__PURE__ */ jsx17("p", { ...boardPart(classNames, "empty"), children: texts.emptyColumn }) : /* @__PURE__ */ jsxs16("ul", { ...boardPart(classNames, "cardList"), children: [
|
|
3248
|
+
incoming,
|
|
3249
|
+
column.cards.map((card) => renderCard(card))
|
|
3250
|
+
] }),
|
|
3251
|
+
column.hasMore && onShowMore ? /* @__PURE__ */ jsx17("button", { type: "button", onClick: () => onShowMore(column.id), ...boardPart(classNames, "showMore"), children: texts.showMore }) : null,
|
|
3252
|
+
column.kind === "open" && column.canAdd !== false && onAddCard ? /* @__PURE__ */ jsx17(AddCardBox, { columnName: column.name, texts, classNames, currencies, defaultCurrency, closeOnAdd, onAdd: (input) => onAddCard(column.id, input) }) : null
|
|
3253
|
+
] });
|
|
3254
|
+
if (!dnd) return body({}, false);
|
|
3255
|
+
const Shell = dnd.Column;
|
|
3256
|
+
return /* @__PURE__ */ jsx17(Shell, { column, children: (shellProps, over) => body(shellProps, over) });
|
|
3257
|
+
}
|
|
3258
|
+
|
|
3259
|
+
// src/components/deal-card.tsx
|
|
3260
|
+
import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3261
|
+
function DealCard({ card, texts, classNames, pending = false, dragging = false, error, renderTitle, controls, keepControls = false, waiting = false, shellProps }) {
|
|
3262
|
+
const allTags = card.tags ?? [];
|
|
3263
|
+
const tags = allTags.slice(0, 2);
|
|
3264
|
+
const hiddenTags = allTags.length - tags.length;
|
|
3265
|
+
const states = [...pending || waiting ? ["cardPending"] : [], ...dragging ? ["cardDragging"] : []];
|
|
3266
|
+
const title = /* @__PURE__ */ jsx18("span", { children: card.title });
|
|
3267
|
+
const badge = card.badge === "won" ? texts.won : card.badge === "lost" ? texts.lost : null;
|
|
3268
|
+
return /* @__PURE__ */ jsxs17("li", { tabIndex: -1, ...shellProps, ...boardPart(classNames, "card", { states }), "aria-busy": pending || void 0, "data-card-id": card.id, "data-pending": pending || void 0, children: [
|
|
3269
|
+
/* @__PURE__ */ jsx18("p", { ...boardPart(classNames, "cardTitle"), children: renderTitle ? renderTitle(card, title) : title }),
|
|
3270
|
+
card.amountLine ? /* @__PURE__ */ jsx18("p", { ...boardPart(classNames, "cardMeta"), children: card.amountLine }) : null,
|
|
3271
|
+
card.closeDateLine ? /* @__PURE__ */ jsxs17("p", { ...boardPart(classNames, "cardMeta"), children: [
|
|
3272
|
+
card.closeDateLine,
|
|
3273
|
+
card.overdue ? /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
3274
|
+
" ",
|
|
3275
|
+
/* @__PURE__ */ jsx18("strong", { ...boardPart(classNames, "overdue"), children: texts.overdue })
|
|
3276
|
+
] }) : null
|
|
3277
|
+
] }) : null,
|
|
3278
|
+
card.ownerInitials || tags.length > 0 || badge ? /* @__PURE__ */ jsxs17("p", { ...boardPart(classNames, "cardMeta"), style: { ...boardPart(classNames, "cardMeta").style, display: "flex", flexWrap: "wrap", alignItems: "center", gap: "6px" }, children: [
|
|
3279
|
+
card.ownerInitials ? /* @__PURE__ */ jsx18("span", { ...boardPart(classNames, "ownerMark"), "aria-label": card.ownerFormer && texts.ownerFormer ? `${texts.owner} ${card.ownerInitials} (${texts.ownerFormer})` : `${texts.owner} ${card.ownerInitials}`, role: "img", children: card.ownerInitials }) : null,
|
|
3280
|
+
tags.map((tag) => /* @__PURE__ */ jsx18("span", { ...boardPart(classNames, "tagChip"), children: tag.label }, tag.id)),
|
|
3281
|
+
hiddenTags > 0 ? /* @__PURE__ */ jsx18("span", { ...boardPart(classNames, "tagChip"), children: texts.moreTags ? texts.moreTags(hiddenTags) : `+${hiddenTags}` }) : null,
|
|
3282
|
+
badge ? /* @__PURE__ */ jsx18("span", { ...boardPart(classNames, card.badge === "won" ? "badgeWon" : "badgeLost"), children: badge }) : null
|
|
3283
|
+
] }) : null,
|
|
3284
|
+
pending ? /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
3285
|
+
keepControls ? controls : null,
|
|
3286
|
+
/* @__PURE__ */ jsx18("p", { ...boardPart(classNames, "note"), role: "status", children: texts.moving })
|
|
3287
|
+
] }) : controls,
|
|
3288
|
+
error ? /* @__PURE__ */ jsx18("p", { ...boardPart(classNames, "cardError"), role: "alert", children: error }) : null
|
|
3289
|
+
] });
|
|
3290
|
+
}
|
|
3291
|
+
|
|
3292
|
+
// src/components/lost-step.tsx
|
|
3293
|
+
import { useEffect as useEffect20, useId as useId6, useRef as useRef17, useState as useState21 } from "react";
|
|
3294
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3295
|
+
function LostStep({ suggestions, used, validateReason, humanize, texts, classNames, error, busy = false, stageName, onConfirm, onCancel }) {
|
|
3296
|
+
const [picked, setPicked] = useState21(null);
|
|
3297
|
+
const [own, setOwn] = useState21("");
|
|
3298
|
+
const [missing, setMissing] = useState21(false);
|
|
3299
|
+
const firstRef = useRef17(null);
|
|
3300
|
+
const ownRef = useRef17(null);
|
|
3301
|
+
const sent = useRef17(false);
|
|
3302
|
+
const titleId = useId6();
|
|
3303
|
+
const ownId = useId6();
|
|
3304
|
+
useEffect20(() => {
|
|
3305
|
+
if (firstRef.current) firstRef.current.focus();
|
|
3306
|
+
else ownRef.current?.focus();
|
|
3307
|
+
}, []);
|
|
3308
|
+
const known = new Set(suggestions.map((s) => s.code));
|
|
3309
|
+
const usedOnly = used.filter((u) => !known.has(u.code));
|
|
3310
|
+
const code = own.trim() !== "" ? validateReason(own) : picked;
|
|
3311
|
+
const confirm = () => {
|
|
3312
|
+
if (busy || sent.current) return;
|
|
3313
|
+
if (code === null || code === "") {
|
|
3314
|
+
setMissing(true);
|
|
3315
|
+
return;
|
|
3316
|
+
}
|
|
3317
|
+
sent.current = true;
|
|
3318
|
+
onConfirm(code);
|
|
3319
|
+
queueMicrotask(() => {
|
|
3320
|
+
sent.current = false;
|
|
3321
|
+
});
|
|
3322
|
+
};
|
|
3323
|
+
const onKeyDown = (event) => {
|
|
3324
|
+
if (event.key !== "Escape") return;
|
|
3325
|
+
event.stopPropagation();
|
|
3326
|
+
if (busy) return;
|
|
3327
|
+
onCancel();
|
|
3328
|
+
};
|
|
3329
|
+
const choice = (item, index) => {
|
|
3330
|
+
const active = own.trim() === "" && picked === item.code;
|
|
3331
|
+
return /* @__PURE__ */ jsx19(
|
|
3332
|
+
"button",
|
|
3333
|
+
{
|
|
3334
|
+
type: "button",
|
|
3335
|
+
ref: index === 0 ? firstRef : void 0,
|
|
3336
|
+
"aria-pressed": active,
|
|
3337
|
+
disabled: busy,
|
|
3338
|
+
onClick: () => {
|
|
3339
|
+
setPicked(item.code);
|
|
3340
|
+
setOwn("");
|
|
3341
|
+
setMissing(false);
|
|
3342
|
+
},
|
|
3343
|
+
...boardPart(classNames, "choice", { states: active ? ["choiceActive"] : [], disabled: busy }),
|
|
3344
|
+
children: item.label ?? humanize(item.code)
|
|
3345
|
+
},
|
|
3346
|
+
item.code
|
|
3347
|
+
);
|
|
3348
|
+
};
|
|
3349
|
+
return (
|
|
3350
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
3351
|
+
/* @__PURE__ */ jsxs18("div", { role: "group", "aria-labelledby": titleId, onKeyDown, ...boardPart(classNames, "panel"), children: [
|
|
3352
|
+
/* @__PURE__ */ jsx19("p", { id: titleId, ...boardPart(classNames, "panelTitle"), children: stageName !== void 0 && texts.lostTitleFor ? texts.lostTitleFor(stageName) : texts.lostTitle }),
|
|
3353
|
+
texts.lostHelp ? /* @__PURE__ */ jsx19("p", { ...boardPart(classNames, "note"), children: texts.lostHelp }) : null,
|
|
3354
|
+
suggestions.length > 0 ? /* @__PURE__ */ jsx19("div", { role: "group", "aria-label": texts.lostSuggested, style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: suggestions.map((s, i) => choice(s, i)) }) : null,
|
|
3355
|
+
usedOnly.length > 0 ? /* @__PURE__ */ jsx19("div", { role: "group", "aria-label": texts.lostUsed, style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: usedOnly.map((u, i) => choice(u, suggestions.length + i)) }) : null,
|
|
3356
|
+
/* @__PURE__ */ jsx19("label", { htmlFor: ownId, ...boardPart(classNames, "note"), children: texts.lostOwnLabel }),
|
|
3357
|
+
/* @__PURE__ */ jsx19(
|
|
3358
|
+
"input",
|
|
3359
|
+
{
|
|
3360
|
+
id: ownId,
|
|
3361
|
+
ref: ownRef,
|
|
3362
|
+
type: "text",
|
|
3363
|
+
value: own,
|
|
3364
|
+
disabled: busy,
|
|
3365
|
+
onChange: (e) => {
|
|
3366
|
+
setOwn(e.target.value);
|
|
3367
|
+
setMissing(false);
|
|
3368
|
+
},
|
|
3369
|
+
onKeyDown: (e) => {
|
|
3370
|
+
if (e.key === "Enter") {
|
|
3371
|
+
e.preventDefault();
|
|
3372
|
+
confirm();
|
|
3373
|
+
}
|
|
3374
|
+
},
|
|
3375
|
+
...boardPart(classNames, "input")
|
|
3376
|
+
}
|
|
3377
|
+
),
|
|
3378
|
+
missing || error ? /* @__PURE__ */ jsx19("p", { ...boardPart(classNames, "error"), role: "alert", children: error ?? texts.lostRequired }) : null,
|
|
3379
|
+
/* @__PURE__ */ jsxs18("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: [
|
|
3380
|
+
/* @__PURE__ */ jsx19("button", { type: "button", onClick: confirm, disabled: busy, ...boardPart(classNames, "primaryButton", { disabled: busy }), children: busy ? texts.movePending : texts.lostConfirm }),
|
|
3381
|
+
/* @__PURE__ */ jsx19("button", { type: "button", onClick: onCancel, disabled: busy, ...boardPart(classNames, "secondaryButton", { disabled: busy }), children: texts.lostCancel })
|
|
3382
|
+
] })
|
|
3383
|
+
] })
|
|
3384
|
+
);
|
|
3385
|
+
}
|
|
3386
|
+
|
|
3387
|
+
// src/components/move-menu.tsx
|
|
3388
|
+
import { useId as useId7, useState as useState22 } from "react";
|
|
3389
|
+
import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3390
|
+
function MoveMenu({ cardTitle, targets, texts, classNames, busy = false, onChoose }) {
|
|
3391
|
+
const [value, setValue] = useState22("");
|
|
3392
|
+
const id = useId7();
|
|
3393
|
+
if (targets.length === 0) return null;
|
|
3394
|
+
const chosen = targets.some((t) => t.stageId === value) ? value : "";
|
|
3395
|
+
return /* @__PURE__ */ jsxs19("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px", marginTop: "8px" }, children: [
|
|
3396
|
+
/* @__PURE__ */ jsx20("label", { htmlFor: id, style: { position: "absolute", width: "1px", height: "1px", overflow: "hidden", clip: "rect(0 0 0 0)" }, children: `${texts.moveLabel} ${cardTitle}` }),
|
|
3397
|
+
/* @__PURE__ */ jsxs19("select", { id, value: chosen, onChange: (e) => setValue(e.target.value), disabled: busy, ...boardPart(classNames, "select", { disabled: busy }), children: [
|
|
3398
|
+
/* @__PURE__ */ jsx20("option", { value: "", children: texts.moveChoose }),
|
|
3399
|
+
targets.map((t) => /* @__PURE__ */ jsx20("option", { value: t.stageId, children: t.label }, t.stageId))
|
|
3400
|
+
] }),
|
|
3401
|
+
/* @__PURE__ */ jsx20(
|
|
3402
|
+
"button",
|
|
3403
|
+
{
|
|
3404
|
+
type: "button",
|
|
3405
|
+
disabled: busy || chosen === "",
|
|
3406
|
+
onClick: () => {
|
|
3407
|
+
if (chosen === "") return;
|
|
3408
|
+
onChoose(chosen);
|
|
3409
|
+
setValue("");
|
|
3410
|
+
},
|
|
3411
|
+
...boardPart(classNames, "secondaryButton", { disabled: busy || chosen === "" }),
|
|
3412
|
+
children: busy ? texts.movePending : texts.moveSubmit
|
|
3413
|
+
}
|
|
3414
|
+
)
|
|
3415
|
+
] });
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
// src/components/reopen-step.tsx
|
|
3419
|
+
import { useEffect as useEffect21, useId as useId8, useRef as useRef18, useState as useState23 } from "react";
|
|
3420
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3421
|
+
function ReopenStep({ needsStage, stages, texts, classNames, error, busy = false, onConfirm, onCancel }) {
|
|
3422
|
+
const [stage, setStage] = useState23("");
|
|
3423
|
+
const confirmRef = useRef18(null);
|
|
3424
|
+
const selectRef = useRef18(null);
|
|
3425
|
+
const titleId = useId8();
|
|
3426
|
+
const selectId = useId8();
|
|
3427
|
+
const chosen = stages.some((s) => s.stageId === stage) ? stage : "";
|
|
3428
|
+
useEffect21(() => {
|
|
3429
|
+
if (needsStage) selectRef.current?.focus();
|
|
3430
|
+
else confirmRef.current?.focus();
|
|
3431
|
+
}, [needsStage]);
|
|
3432
|
+
const blocked = busy || needsStage && chosen === "";
|
|
3433
|
+
const onKeyDown = (event) => {
|
|
3434
|
+
if (event.key !== "Escape") return;
|
|
3435
|
+
event.stopPropagation();
|
|
3436
|
+
onCancel();
|
|
3437
|
+
};
|
|
3438
|
+
return (
|
|
3439
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
3440
|
+
/* @__PURE__ */ jsxs20("div", { role: "group", "aria-labelledby": titleId, onKeyDown, ...boardPart(classNames, "panel"), children: [
|
|
3441
|
+
/* @__PURE__ */ jsx21("p", { id: titleId, ...boardPart(classNames, "panelTitle"), children: texts.reopenTitle }),
|
|
3442
|
+
needsStage ? /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
3443
|
+
/* @__PURE__ */ jsx21("label", { htmlFor: selectId, ...boardPart(classNames, "note"), children: texts.reopenStageLabel }),
|
|
3444
|
+
/* @__PURE__ */ jsxs20("select", { id: selectId, ref: selectRef, value: chosen, disabled: busy, onChange: (e) => setStage(e.target.value), ...boardPart(classNames, "select", { disabled: busy }), children: [
|
|
3445
|
+
/* @__PURE__ */ jsx21("option", { value: "", children: texts.moveChoose }),
|
|
3446
|
+
stages.map((s) => /* @__PURE__ */ jsx21("option", { value: s.stageId, children: s.label }, s.stageId))
|
|
3447
|
+
] })
|
|
3448
|
+
] }) : null,
|
|
3449
|
+
error ? /* @__PURE__ */ jsx21("p", { ...boardPart(classNames, "error"), role: "alert", children: error }) : null,
|
|
3450
|
+
/* @__PURE__ */ jsxs20("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: [
|
|
3451
|
+
/* @__PURE__ */ jsx21(
|
|
3452
|
+
"button",
|
|
3453
|
+
{
|
|
3454
|
+
type: "button",
|
|
3455
|
+
ref: confirmRef,
|
|
3456
|
+
disabled: blocked,
|
|
3457
|
+
onClick: () => {
|
|
3458
|
+
if (blocked) return;
|
|
3459
|
+
if (needsStage) onConfirm(chosen);
|
|
3460
|
+
else onConfirm();
|
|
3461
|
+
},
|
|
3462
|
+
...boardPart(classNames, "primaryButton", { disabled: blocked }),
|
|
3463
|
+
children: busy ? texts.movePending : texts.reopenConfirm
|
|
3464
|
+
}
|
|
3465
|
+
),
|
|
3466
|
+
/* @__PURE__ */ jsx21("button", { type: "button", onClick: onCancel, disabled: busy, ...boardPart(classNames, "secondaryButton", { disabled: busy }), children: texts.reopenCancel })
|
|
3467
|
+
] })
|
|
3468
|
+
] })
|
|
3469
|
+
);
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
// src/components/pipeline-board.tsx
|
|
3473
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3474
|
+
var errorOf2 = (result) => {
|
|
3475
|
+
if (result && typeof result === "object" && "error" in result) {
|
|
3476
|
+
const e = result.error;
|
|
3477
|
+
if (typeof e === "string" && e !== "") return e;
|
|
3478
|
+
}
|
|
3479
|
+
return void 0;
|
|
3480
|
+
};
|
|
3481
|
+
function PipelineBoard(props) {
|
|
3482
|
+
const { columns, texts, classNames, pendingDealIds = [], cardErrors, onMove, legalTargets, reopenFor, onReopen, lost, onAddCard, currencies, defaultCurrency, closeOnAdd, stretchColumns = true, onShowMore, renderCardTitle, endSlot, dnd } = props;
|
|
3483
|
+
const [placed, setPlaced] = useState24({});
|
|
3484
|
+
const [errors, setErrors] = useState24({});
|
|
3485
|
+
const [step, setStep] = useState24(null);
|
|
3486
|
+
const [stepError, setStepError] = useState24();
|
|
3487
|
+
const [lostBusy, setLostBusy] = useState24(false);
|
|
3488
|
+
const [position, setPosition] = useState24(0);
|
|
3489
|
+
const rowRef = useRef19(null);
|
|
3490
|
+
const running = useRef19(/* @__PURE__ */ new Set());
|
|
3491
|
+
const focusAfter = useRef19(null);
|
|
3492
|
+
useEffect22(() => {
|
|
3493
|
+
const id = focusAfter.current;
|
|
3494
|
+
if (id === null || placed[id]?.running) return;
|
|
3495
|
+
for (const el of Array.from(rowRef.current?.querySelectorAll("[data-card-id]") ?? [])) {
|
|
3496
|
+
if (el.getAttribute("data-card-id") === id) {
|
|
3497
|
+
focusAfter.current = null;
|
|
3498
|
+
el.focus();
|
|
3499
|
+
return;
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
});
|
|
3503
|
+
useEffect22(() => {
|
|
3504
|
+
setPlaced((prev) => {
|
|
3505
|
+
const keep = {};
|
|
3506
|
+
for (const [id, value] of Object.entries(prev)) if (value.running) keep[id] = value;
|
|
3507
|
+
return Object.keys(keep).length === Object.keys(prev).length ? prev : keep;
|
|
3508
|
+
});
|
|
3509
|
+
}, [columns]);
|
|
3510
|
+
const view = useMemo2(() => {
|
|
3511
|
+
const moved = Object.entries(placed);
|
|
3512
|
+
if (moved.length === 0) return columns;
|
|
3513
|
+
const byId = /* @__PURE__ */ new Map();
|
|
3514
|
+
for (const column of columns) for (const card of column.cards) byId.set(card.id, card);
|
|
3515
|
+
return columns.map((column) => {
|
|
3516
|
+
const stay = column.cards.filter((card) => {
|
|
3517
|
+
const move = placed[card.id];
|
|
3518
|
+
return !Object.hasOwn(placed, card.id) || move?.toStageId === column.id || move?.running === true && !columns.some((c) => c.id === move.toStageId);
|
|
3519
|
+
});
|
|
3520
|
+
const arriving = moved.filter(([, value]) => value.toStageId === column.id).map(([id]) => byId.get(id)).filter((card) => card !== void 0 && !column.cards.some((c) => c.id === card.id));
|
|
3521
|
+
return arriving.length === 0 && stay.length === column.cards.length ? column : { ...column, cards: [...arriving, ...stay] };
|
|
3522
|
+
});
|
|
3523
|
+
}, [columns, placed]);
|
|
3524
|
+
const cardOf = (id) => {
|
|
3525
|
+
for (const column of columns) for (const card of column.cards) if (card.id === id) return card;
|
|
3526
|
+
return void 0;
|
|
3527
|
+
};
|
|
3528
|
+
const send = async (card, toStageId, reason, hold = false) => {
|
|
3529
|
+
if (!onMove || running.current.has(card.id)) return void 0;
|
|
3530
|
+
running.current.add(card.id);
|
|
3531
|
+
setErrors((prev) => withoutKey(prev, card.id));
|
|
3532
|
+
if (!hold) setPlaced((prev) => ({ ...prev, [card.id]: { toStageId, running: true } }));
|
|
3533
|
+
const request = { dealId: card.id, toStageId, expectedVersion: card.version, ...reason !== void 0 ? { reason } : {} };
|
|
3534
|
+
let message;
|
|
3535
|
+
try {
|
|
3536
|
+
message = errorOf2(await onMove(request));
|
|
3537
|
+
} catch {
|
|
3538
|
+
message = texts.unexpectedError;
|
|
3539
|
+
}
|
|
3540
|
+
running.current.delete(card.id);
|
|
3541
|
+
if (message && hold) {
|
|
3542
|
+
} else if (message) {
|
|
3543
|
+
setPlaced((prev) => withoutKey(prev, card.id));
|
|
3544
|
+
setErrors((prev) => ({ ...prev, [card.id]: message }));
|
|
3545
|
+
} else {
|
|
3546
|
+
focusAfter.current = card.id;
|
|
3547
|
+
setPlaced((prev) => ({ ...prev, [card.id]: { toStageId, running: false } }));
|
|
3548
|
+
}
|
|
3549
|
+
return message;
|
|
3550
|
+
};
|
|
3551
|
+
const kindOf = (card, toStageId) => columns.find((c) => c.id === toStageId)?.kind ?? legalTargets?.(card).find((t) => t.stageId === toStageId)?.kind ?? (legalTargets?.(card).some((t) => t.stageId === toStageId) ? "open" : void 0);
|
|
3552
|
+
const requestMove = (card, toStageId) => {
|
|
3553
|
+
if (lostBusy) return;
|
|
3554
|
+
const kind = kindOf(card, toStageId);
|
|
3555
|
+
if (kind === void 0 || card.stageId === toStageId) return;
|
|
3556
|
+
if (kind === "lost" && !lost) return;
|
|
3557
|
+
if (kind === "lost" && lost) {
|
|
3558
|
+
setStepError(void 0);
|
|
3559
|
+
setStep({ kind: "lost", card, toStageId });
|
|
3560
|
+
return;
|
|
3561
|
+
}
|
|
3562
|
+
void send(card, toStageId);
|
|
3563
|
+
};
|
|
3564
|
+
const pendingIds = new Set(pendingDealIds);
|
|
3565
|
+
const isPending = (id) => pendingIds.has(id) || placed[id]?.running === true;
|
|
3566
|
+
const controlsFor = (card) => {
|
|
3567
|
+
if (step && step.card.id === card.id) {
|
|
3568
|
+
if (step.kind === "lost" && lost) {
|
|
3569
|
+
return /* @__PURE__ */ jsx22(
|
|
3570
|
+
LostStep,
|
|
3571
|
+
{
|
|
3572
|
+
suggestions: lost.suggestions,
|
|
3573
|
+
used: lost.used,
|
|
3574
|
+
validateReason: lost.validateReason,
|
|
3575
|
+
humanize: lost.humanize,
|
|
3576
|
+
texts,
|
|
3577
|
+
classNames,
|
|
3578
|
+
error: stepError,
|
|
3579
|
+
busy: lostBusy,
|
|
3580
|
+
stageName: legalTargets?.(card).find((t) => t.stageId === step.toStageId)?.label ?? columns.find((c) => c.id === step.toStageId)?.name,
|
|
3581
|
+
onCancel: () => {
|
|
3582
|
+
if (!lostBusy) setStep(null);
|
|
3583
|
+
},
|
|
3584
|
+
onConfirm: async (reason) => {
|
|
3585
|
+
if (!onMove || running.current.has(card.id)) return;
|
|
3586
|
+
const target = step.toStageId;
|
|
3587
|
+
setStepError(void 0);
|
|
3588
|
+
setLostBusy(true);
|
|
3589
|
+
const message = await send(card, target, reason, true);
|
|
3590
|
+
setLostBusy(false);
|
|
3591
|
+
if (message) setStepError(message);
|
|
3592
|
+
else setStep(null);
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
);
|
|
3596
|
+
}
|
|
3597
|
+
const options = reopenFor?.(card);
|
|
3598
|
+
if (step.kind === "reopen" && options) {
|
|
3599
|
+
return /* @__PURE__ */ jsx22(
|
|
3600
|
+
ReopenStep,
|
|
3601
|
+
{
|
|
3602
|
+
needsStage: options.needsStage,
|
|
3603
|
+
stages: options.stages,
|
|
3604
|
+
texts,
|
|
3605
|
+
classNames,
|
|
3606
|
+
error: stepError,
|
|
3607
|
+
onCancel: () => setStep(null),
|
|
3608
|
+
onConfirm: async (toStageId) => {
|
|
3609
|
+
if (!onReopen) return;
|
|
3610
|
+
try {
|
|
3611
|
+
const message = errorOf2(await onReopen({ dealId: card.id, expectedVersion: card.version, ...toStageId !== void 0 ? { toStageId } : {} }));
|
|
3612
|
+
if (message) setStepError(message);
|
|
3613
|
+
else setStep(null);
|
|
3614
|
+
} catch {
|
|
3615
|
+
setStepError(texts.unexpectedError);
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
);
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
const reopen = card.badge && reopenFor && onReopen ? reopenFor(card) : null;
|
|
3623
|
+
return /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
3624
|
+
onMove && legalTargets ? /* @__PURE__ */ jsx22(MoveMenu, { cardTitle: card.title, targets: legalTargets(card).filter((t) => lost || kindOf(card, t.stageId) !== "lost"), texts, classNames, onChoose: (stageId) => requestMove(card, stageId) }) : null,
|
|
3625
|
+
reopen ? /* @__PURE__ */ jsx22(
|
|
3626
|
+
"button",
|
|
3627
|
+
{
|
|
3628
|
+
type: "button",
|
|
3629
|
+
onClick: () => {
|
|
3630
|
+
setStepError(void 0);
|
|
3631
|
+
setStep({ kind: "reopen", card });
|
|
3632
|
+
},
|
|
3633
|
+
...boardPart(classNames, "secondaryButton"),
|
|
3634
|
+
children: texts.reopen
|
|
3635
|
+
}
|
|
3636
|
+
) : null
|
|
3637
|
+
] });
|
|
3638
|
+
};
|
|
3639
|
+
const renderCard = (card) => {
|
|
3640
|
+
const error = errors[card.id] ?? cardErrors?.[card.id];
|
|
3641
|
+
const lostOpen = step?.kind === "lost" && step.card.id === card.id;
|
|
3642
|
+
const build = (shellProps, dragging) => /* @__PURE__ */ jsx22(DealCard, { card, texts, classNames, pending: isPending(card.id), waiting: lostOpen, keepControls: lostOpen, dragging, error, renderTitle: renderCardTitle, controls: controlsFor(card), shellProps }, card.id);
|
|
3643
|
+
if (!dnd || isPending(card.id) || card.draggable === false || lostOpen) return build({}, false);
|
|
3644
|
+
const Shell = dnd.Card;
|
|
3645
|
+
return /* @__PURE__ */ jsx22(Shell, { card, children: (shellProps, dragging) => build(shellProps, dragging) }, card.id);
|
|
3646
|
+
};
|
|
3647
|
+
const onScroll = () => {
|
|
3648
|
+
const row = rowRef.current;
|
|
3649
|
+
if (!row) return;
|
|
3650
|
+
const offsets = Array.from(row.querySelectorAll("[data-column-id]")).map((el) => el.offsetLeft - row.offsetLeft);
|
|
3651
|
+
setPosition(nearestColumnIndex(row.scrollLeft, offsets));
|
|
3652
|
+
};
|
|
3653
|
+
if (columns.length === 0) {
|
|
3654
|
+
return /* @__PURE__ */ jsx22("div", { ...boardPart(classNames, "root"), children: /* @__PURE__ */ jsx22("p", { ...boardPart(classNames, "empty"), children: texts.emptyBoard }) });
|
|
3655
|
+
}
|
|
3656
|
+
const content = /* @__PURE__ */ jsxs21("div", { ...boardPart(classNames, "root"), children: [
|
|
3657
|
+
columns.length > 1 ? /* @__PURE__ */ jsx22("p", { ...boardPart(classNames, "position"), role: "status", "aria-live": "polite", children: texts.stagePosition(Math.min(position, columns.length - 1) + 1, columns.length) }) : null,
|
|
3658
|
+
/* @__PURE__ */ jsxs21("div", { ref: rowRef, role: "region", "aria-label": texts.boardLabel, tabIndex: 0, onScroll, ...boardPart(classNames, "row"), style: { ...boardPart(classNames, "row").style, alignItems: stretchColumns ? "stretch" : "flex-start" }, children: [
|
|
3659
|
+
view.map((column) => /* @__PURE__ */ jsx22(
|
|
3660
|
+
BoardColumn,
|
|
3661
|
+
{
|
|
3662
|
+
column,
|
|
3663
|
+
texts,
|
|
3664
|
+
classNames,
|
|
3665
|
+
renderCard,
|
|
3666
|
+
onAddCard,
|
|
3667
|
+
currencies,
|
|
3668
|
+
defaultCurrency,
|
|
3669
|
+
closeOnAdd,
|
|
3670
|
+
incoming: step?.kind === "lost" && step.toStageId === column.id && texts.lostIncoming ? /* @__PURE__ */ jsx22("li", { "data-incoming": step.card.id, ...boardPart(classNames, "note"), children: texts.lostIncoming(step.card.title) }) : void 0,
|
|
3671
|
+
onShowMore,
|
|
3672
|
+
dnd
|
|
3673
|
+
},
|
|
3674
|
+
column.id
|
|
3675
|
+
)),
|
|
3676
|
+
endSlot ? /* @__PURE__ */ jsx22("div", { style: { flex: "0 0 auto", scrollSnapAlign: "end" }, children: endSlot }) : null
|
|
3677
|
+
] })
|
|
3678
|
+
] });
|
|
3679
|
+
if (!dnd) return content;
|
|
3680
|
+
const Provider = dnd.Provider;
|
|
3681
|
+
return /* @__PURE__ */ jsx22(Provider, { columns: view, onDrop: (cardId, toStageId) => {
|
|
3682
|
+
const card = cardOf(cardId);
|
|
3683
|
+
if (card) requestMove(card, toStageId);
|
|
3684
|
+
}, config: dnd.config, allow: (cardId, toStageId) => lost !== void 0 || columns.find((c) => c.id === toStageId)?.kind !== "lost", children: content });
|
|
3685
|
+
}
|
|
3686
|
+
function withoutKey(record, key) {
|
|
3687
|
+
if (!Object.hasOwn(record, key)) return record;
|
|
3688
|
+
const next = { ...record };
|
|
3689
|
+
delete next[key];
|
|
3690
|
+
return next;
|
|
3691
|
+
}
|
|
3056
3692
|
export {
|
|
3057
3693
|
ACTIVITY_ICONS,
|
|
3058
3694
|
ALL_SHORTCUT_CONTEXTS,
|
|
3059
3695
|
ARRIVAL_FADE_MS,
|
|
3060
3696
|
ActivityFeedRow,
|
|
3697
|
+
AddCardBox,
|
|
3061
3698
|
ArchiveButton,
|
|
3699
|
+
BoardColumn,
|
|
3062
3700
|
CLIENT_PROFILE_SHORTCUTS,
|
|
3063
3701
|
COPY_NOTE_COPIED,
|
|
3064
3702
|
COPY_NOTE_FAILED,
|
|
3065
3703
|
ConfirmAction,
|
|
3704
|
+
DealCard,
|
|
3066
3705
|
EmailBodyRenderer,
|
|
3067
3706
|
EmailThreadView,
|
|
3068
3707
|
EntityPicker,
|
|
@@ -3072,10 +3711,14 @@ export {
|
|
|
3072
3711
|
GUARDED_ACTION_FAILURE,
|
|
3073
3712
|
INBOX_SHORTCUTS,
|
|
3074
3713
|
KeyboardShortcutsPanel,
|
|
3714
|
+
LostStep,
|
|
3715
|
+
MoveMenu,
|
|
3075
3716
|
PICKER_SEARCH_FAILURE,
|
|
3076
3717
|
Pager,
|
|
3718
|
+
PipelineBoard,
|
|
3077
3719
|
RENDER_ERRORS,
|
|
3078
3720
|
REPLY_LAYOUT_OPTIONS,
|
|
3721
|
+
ReopenStep,
|
|
3079
3722
|
ReplyPanel,
|
|
3080
3723
|
RestoreButton,
|
|
3081
3724
|
RichTextEditor,
|
|
@@ -3109,6 +3752,7 @@ export {
|
|
|
3109
3752
|
isTypingContext,
|
|
3110
3753
|
isValidScheduleDate,
|
|
3111
3754
|
isVideo,
|
|
3755
|
+
nearestColumnIndex,
|
|
3112
3756
|
opensInNewTab,
|
|
3113
3757
|
parseCustomSchedule,
|
|
3114
3758
|
prefetch,
|