@alfadocs/ui-kit 1.148.0 → 1.149.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{calendar-appointment-editor-dialog-Cz8F2H4M.js → calendar-appointment-editor-dialog-fQleWmJE.js} +5 -5
- package/dist/_chunks/{calendar-waiting-list-panel-C4T85b4q.js → calendar-waiting-list-panel-BKBHfBpn.js} +2 -2
- package/dist/_chunks/{calendar.sheets-DsgPdycU.js → calendar.sheets-lgAqJB34.js} +2 -2
- package/dist/_chunks/notes-panel-Cw06dLDm.js +1135 -0
- package/dist/_chunks/rich-text-editor-eGdYDPK2.js +4405 -0
- package/dist/_chunks/task-editor-C-4I2sBa.js +1162 -0
- package/dist/_chunks/{tasks-panel-DufAoAxG.js → tasks-panel-BDPQPOP6.js} +475 -461
- package/dist/_chunks/{use-appointment-details-read-kYp-gfhb.js → use-appointment-details-read-Bl1DHXQ2.js} +568 -554
- package/dist/agent-catalog.json +9 -7
- package/dist/agent-i18n/en.json +4 -4
- package/dist/appointment-editor-panel/index.js +1 -1
- package/dist/aws-transcribe/index.js +287 -181
- package/dist/browser-support.js +1 -1
- package/dist/components/_shared/save-outcome.d.ts +23 -0
- package/dist/components/appointment-details-panel/index.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/notes-panel/index.js +1 -1
- package/dist/components/rich-text-editor/help-me-write-overlay.d.ts +12 -1
- package/dist/components/rich-text-editor/index.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.d.ts +5 -3
- package/dist/components/task-editor/index.js +1 -1
- package/dist/components/task-editor/use-task-editor-form.d.ts +7 -1
- package/dist/components/tasks-panel/index.js +1 -1
- package/dist/core.css +1 -1
- package/dist/find-free-slots-panel/index.js +1 -1
- package/dist/i18n/locales/ar.d.ts +1 -0
- package/dist/i18n/locales/ar.js +2 -1
- package/dist/i18n/locales/de.d.ts +1 -0
- package/dist/i18n/locales/de.js +2 -1
- package/dist/i18n/locales/el.d.ts +1 -0
- package/dist/i18n/locales/el.js +2 -1
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/en.js +2 -1
- package/dist/i18n/locales/es.d.ts +1 -0
- package/dist/i18n/locales/es.js +2 -1
- package/dist/i18n/locales/fr.d.ts +1 -0
- package/dist/i18n/locales/fr.js +2 -1
- package/dist/i18n/locales/hi.d.ts +1 -0
- package/dist/i18n/locales/hi.js +2 -1
- package/dist/i18n/locales/it.d.ts +1 -0
- package/dist/i18n/locales/it.js +2 -1
- package/dist/i18n/locales/ja.d.ts +1 -0
- package/dist/i18n/locales/ja.js +2 -1
- package/dist/i18n/locales/nl.d.ts +1 -0
- package/dist/i18n/locales/nl.js +2 -1
- package/dist/i18n/locales/pl.d.ts +1 -0
- package/dist/i18n/locales/pl.js +2 -1
- package/dist/i18n/locales/pt.d.ts +1 -0
- package/dist/i18n/locales/pt.js +2 -1
- package/dist/i18n/locales/ro.d.ts +1 -0
- package/dist/i18n/locales/ro.js +2 -1
- package/dist/i18n/locales/ru.d.ts +1 -0
- package/dist/i18n/locales/ru.js +2 -1
- package/dist/i18n/locales/sq.d.ts +1 -0
- package/dist/i18n/locales/sq.js +2 -1
- package/dist/i18n/locales/sv.d.ts +1 -0
- package/dist/i18n/locales/sv.js +2 -1
- package/dist/i18n/locales/tr.d.ts +1 -0
- package/dist/i18n/locales/tr.js +2 -1
- package/dist/i18n/locales/zh.d.ts +1 -0
- package/dist/i18n/locales/zh.js +2 -1
- package/dist/index.js +1407 -1403
- package/dist/locales/ar.json +2 -1
- package/dist/locales/de.json +2 -1
- package/dist/locales/el.json +2 -1
- package/dist/locales/en.json +2 -1
- package/dist/locales/es.json +2 -1
- package/dist/locales/fr.json +2 -1
- package/dist/locales/hi.json +2 -1
- package/dist/locales/it.json +2 -1
- package/dist/locales/ja.json +2 -1
- package/dist/locales/nl.json +2 -1
- package/dist/locales/pl.json +2 -1
- package/dist/locales/pt.json +2 -1
- package/dist/locales/ro.json +2 -1
- package/dist/locales/ru.json +2 -1
- package/dist/locales/sq.json +2 -1
- package/dist/locales/sv.json +2 -1
- package/dist/locales/tr.json +2 -1
- package/dist/locales/zh.json +2 -1
- package/dist/online-bookings-panel/index.js +1 -1
- package/dist/patterns/calendar/index.js +2 -2
- package/dist/save-outcome/index.js +20 -0
- package/dist/speech/aws-transcribe.d.ts +30 -6
- package/dist/tokens.css +1 -1
- package/dist/waiting-list-panel/index.js +2 -2
- package/package.json +5 -1
- package/dist/_chunks/notes-panel-BHMnLbEH.js +0 -1116
- package/dist/_chunks/rich-text-editor-BAcJq1PO.js +0 -4359
- package/dist/_chunks/task-editor-B9YpfwcW.js +0 -1095
|
@@ -1,1095 +0,0 @@
|
|
|
1
|
-
import { jsxs as b, jsx as n, Fragment as Ee } from "react/jsx-runtime";
|
|
2
|
-
import { useState as K, useRef as k, useEffect as He, forwardRef as Nt, useId as Rt, useMemo as Ae } from "react";
|
|
3
|
-
import { c as ft } from "./index-D2ZczOXr.js";
|
|
4
|
-
import { useTranslation as At } from "react-i18next";
|
|
5
|
-
import { A as T } from "./alert-C4WKViaS.js";
|
|
6
|
-
import { B as We } from "./button-Dp4j9ygh.js";
|
|
7
|
-
import { I as Ke } from "./icon-button-u9VMQn3x.js";
|
|
8
|
-
import { C as Bt } from "./combobox-BYl6mY4c.js";
|
|
9
|
-
import { D as J } from "./dialog-239Geb7Z.js";
|
|
10
|
-
import { D as Ft } from "./date-picker-CD-PBzXM.js";
|
|
11
|
-
import { F } from "./form-field-CyHfOVKF.js";
|
|
12
|
-
import { I as Pt } from "./icon-button-group-DEAx9M5v.js";
|
|
13
|
-
import { P as Ot } from "./panel-header-CbtlTe85.js";
|
|
14
|
-
import { P as xt } from "./panel-subview-DjBwNV16.js";
|
|
15
|
-
import { R as Be } from "./radio-BZQs6_36.js";
|
|
16
|
-
import { R as jt } from "./radio-group-ChIKyeSJ.js";
|
|
17
|
-
import { S as $t } from "./scroll-area-CY5SLYNw.js";
|
|
18
|
-
import { S as Le } from "./select-Bw5FvGJ7.js";
|
|
19
|
-
import { S as ze } from "./skeleton-tTWJpvAq.js";
|
|
20
|
-
import { S as Mt } from "./switch-DO6uC4HJ.js";
|
|
21
|
-
import { T as qt } from "./text-area-COMVJ1yE.js";
|
|
22
|
-
import { T as Fe } from "./text-input-B6iAgCr3.js";
|
|
23
|
-
import { T as _t } from "./time-picker-DDr5vhwQ.js";
|
|
24
|
-
import { u as Vt } from "./registry-DvAUVLHh.js";
|
|
25
|
-
import { u as Ut } from "./use-isomorphic-layout-effect-BGfaCOP1.js";
|
|
26
|
-
import { c as Wt } from "./compose-refs-C0k0tdqF.js";
|
|
27
|
-
import { E as Kt, a as Lt } from "./compact-editor-fields-cP6yh7xv.js";
|
|
28
|
-
import { P as zt } from "./patient-picker-Dm74jHIk.js";
|
|
29
|
-
import { b as Gt } from "./privacy-mask-zVh0ntm0.js";
|
|
30
|
-
import { g as Pe } from "./get-error-message-DbFUzuja.js";
|
|
31
|
-
import { h as Ht } from "./handled-rejection-C-6Dq0As.js";
|
|
32
|
-
import { L as Yt } from "./lock-ClAFG1gy.js";
|
|
33
|
-
import { X as Xt } from "./x-B5YnXwCz.js";
|
|
34
|
-
import { C as Jt } from "./circle-off-DuT9pVy2.js";
|
|
35
|
-
import { U as Qt } from "./user-B12p7bVF.js";
|
|
36
|
-
import { B as Zt } from "./building-2-D33bLCWL.js";
|
|
37
|
-
import { S as en } from "./stethoscope-sZXGC43m.js";
|
|
38
|
-
import { T as st } from "./trash-2-uumy3fy1.js";
|
|
39
|
-
import { S as dt } from "./square-check-big-dj0o8yA3.js";
|
|
40
|
-
import { p as tn } from "./privacy-mask-text-B8YfzB7L.js";
|
|
41
|
-
import { L as nn } from "./loader-circle-BECIU_8N.js";
|
|
42
|
-
import { S as on } from "./save-Dn8uje3f.js";
|
|
43
|
-
const rn = {
|
|
44
|
-
id: "task-editor",
|
|
45
|
-
// set_value backs set_fields and set_done; submit backs save; dismiss
|
|
46
|
-
// backs cancel.
|
|
47
|
-
capabilities: ["set_value", "submit", "dismiss"],
|
|
48
|
-
state: {
|
|
49
|
-
status: {
|
|
50
|
-
type: "'loading' | 'ready' | 'error' | 'locked' | 'withheld'",
|
|
51
|
-
descriptionKey: "ui.agent.taskEditor.state.status",
|
|
52
|
-
description: "Where the form is: loading the task, ready, failed to load, locked (edit mode with nothing to load) or withheld behind the privacy notice. Writes need 'ready'.",
|
|
53
|
-
read: (r) => r.getStatus()
|
|
54
|
-
},
|
|
55
|
-
draft: {
|
|
56
|
-
type: "{ mode: string; dateIso: string | null; about: string; patientId: string | null; companyId: string | null; operatorId: string | null; typeId: string | null; assigneeId: string | null; done: boolean; hasNote: boolean; noteLength: number }",
|
|
57
|
-
descriptionKey: "ui.agent.taskEditor.state.draft",
|
|
58
|
-
description: "The draft as Save would send it: ids and structure only, never the note body. done is the last value the host confirmed.",
|
|
59
|
-
read: (r) => r.getDraft()
|
|
60
|
-
},
|
|
61
|
-
canSave: {
|
|
62
|
-
type: "boolean",
|
|
63
|
-
descriptionKey: "ui.agent.taskEditor.state.canSave",
|
|
64
|
-
description: "Whether save would reach the host now: the form is ready, the note is filled, a chosen counterpart has an id and no write is pending.",
|
|
65
|
-
read: (r) => r.canSave()
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
actions: {
|
|
69
|
-
set_fields: {
|
|
70
|
-
safety: "phi",
|
|
71
|
-
argsType: "{ dateIso?: string; note?: string; typeId?: string; assigneeId?: string | null; about?: 'nobody' | 'patient' | 'company' | 'operator'; patientId?: string; companyId?: string; operatorId?: string }",
|
|
72
|
-
argsSchema: {
|
|
73
|
-
type: "object",
|
|
74
|
-
properties: {
|
|
75
|
-
dateIso: { type: "string", format: "date-time" },
|
|
76
|
-
note: { type: "string" },
|
|
77
|
-
typeId: { type: "string" },
|
|
78
|
-
assigneeId: { type: ["string", "null"] },
|
|
79
|
-
about: {
|
|
80
|
-
type: "string",
|
|
81
|
-
enum: ["nobody", "patient", "company", "operator"]
|
|
82
|
-
},
|
|
83
|
-
patientId: { type: "string" },
|
|
84
|
-
companyId: { type: "string" },
|
|
85
|
-
operatorId: { type: "string" }
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
idempotent: !0,
|
|
89
|
-
errors: [
|
|
90
|
-
"An id the host lists, its patient search or the stored task do not resolve.",
|
|
91
|
-
"More than one of patientId, companyId and operatorId.",
|
|
92
|
-
"The form is not ready, is read-only or is withheld."
|
|
93
|
-
],
|
|
94
|
-
descriptionKey: "ui.agent.taskEditor.actions.setFields",
|
|
95
|
-
description: "Set draft fields. Ids must come from the host lists, a patient the host search returned, or equal the stored one. At most one counterpart per call, and it selects its branch; assigneeId null is nobody. Nothing is saved.",
|
|
96
|
-
invoke: (r, u) => {
|
|
97
|
-
r.setFields(u);
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
save: {
|
|
101
|
-
safety: "phi",
|
|
102
|
-
// Reaches the host's data source; the result is the host's promise.
|
|
103
|
-
openWorld: !0,
|
|
104
|
-
descriptionKey: "ui.agent.taskEditor.actions.save",
|
|
105
|
-
description: "Save the task through the host. Resolves once the write lands and rejects with the host error, which the form also shows.",
|
|
106
|
-
invoke: (r) => r.save()
|
|
107
|
-
},
|
|
108
|
-
set_done: {
|
|
109
|
-
safety: "write",
|
|
110
|
-
argsType: "{ done: boolean }",
|
|
111
|
-
argsSchema: {
|
|
112
|
-
type: "object",
|
|
113
|
-
properties: { done: { type: "boolean" } },
|
|
114
|
-
required: ["done"]
|
|
115
|
-
},
|
|
116
|
-
openWorld: !0,
|
|
117
|
-
errors: [
|
|
118
|
-
"The form is not ready, is read-only or has no Done seam.",
|
|
119
|
-
"A save, a delete or another Done change is in flight.",
|
|
120
|
-
"The task was already saved or deleted in this session."
|
|
121
|
-
],
|
|
122
|
-
descriptionKey: "ui.agent.taskEditor.actions.setDone",
|
|
123
|
-
description: "Mark an existing task done or not done through the host. A rejection rolls the switch back.",
|
|
124
|
-
invoke: (r, u) => r.setDone(u.done)
|
|
125
|
-
},
|
|
126
|
-
delete: {
|
|
127
|
-
safety: "destructive",
|
|
128
|
-
idempotent: !0,
|
|
129
|
-
openWorld: !0,
|
|
130
|
-
descriptionKey: "ui.agent.taskEditor.actions.delete",
|
|
131
|
-
description: "Delete the task through the host, without the confirmation dialog. Resolves once the delete lands.",
|
|
132
|
-
invoke: (r) => r.deleteTask()
|
|
133
|
-
},
|
|
134
|
-
cancel: {
|
|
135
|
-
safety: "destructive",
|
|
136
|
-
errors: ["A save or delete is in flight: wait for it to settle."],
|
|
137
|
-
descriptionKey: "ui.agent.taskEditor.actions.cancel",
|
|
138
|
-
description: "Close the editor without saving. Anything typed since the last save is lost. Refused while a save or delete is in flight.",
|
|
139
|
-
invoke: (r) => {
|
|
140
|
-
r.cancel();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
domHooks: {
|
|
145
|
-
root: {
|
|
146
|
-
attr: "data-component",
|
|
147
|
-
value: "task-editor",
|
|
148
|
-
description: "Marks the TaskEditor body. It also carries data-variant and data-status. In the subview variant it sits inside the panel-subview section, which repeats data-component-id, data-variant and data-status and holds the heading and footer."
|
|
149
|
-
},
|
|
150
|
-
instanceId: {
|
|
151
|
-
attr: "data-component-id",
|
|
152
|
-
sourceProp: "id",
|
|
153
|
-
description: "Sourced from the id prop, or generated. Addresses one editor from the agent. [data-component-id] reaches the footer actions in both variants."
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}, N = "none", lt = {
|
|
157
|
-
showError: !1,
|
|
158
|
-
saving: !1,
|
|
159
|
-
saveError: void 0,
|
|
160
|
-
done: !1,
|
|
161
|
-
confirmedDone: !1,
|
|
162
|
-
donePending: !1,
|
|
163
|
-
doneError: void 0,
|
|
164
|
-
deleting: !1,
|
|
165
|
-
deleteError: void 0,
|
|
166
|
-
confirmDeleteOpen: !1,
|
|
167
|
-
accepted: !1
|
|
168
|
-
};
|
|
169
|
-
function an(r) {
|
|
170
|
-
return r.patientId ? "patient" : r.companyId ? "company" : r.operatorId ? "operator" : "nobody";
|
|
171
|
-
}
|
|
172
|
-
function Ye(r) {
|
|
173
|
-
return { hours: r.getHours(), minutes: r.getMinutes() };
|
|
174
|
-
}
|
|
175
|
-
function ct(r) {
|
|
176
|
-
const u = r ?? /* @__PURE__ */ new Date();
|
|
177
|
-
return {
|
|
178
|
-
date: u,
|
|
179
|
-
time: Ye(u),
|
|
180
|
-
note: "",
|
|
181
|
-
operatorId: N,
|
|
182
|
-
typeId: "",
|
|
183
|
-
assigneeId: N,
|
|
184
|
-
about: "nobody",
|
|
185
|
-
patientId: "",
|
|
186
|
-
companyId: ""
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
function sn(r) {
|
|
190
|
-
const u = new Date(r.dateIso);
|
|
191
|
-
return {
|
|
192
|
-
date: u,
|
|
193
|
-
time: Ye(u),
|
|
194
|
-
note: r.note,
|
|
195
|
-
/* `||`, not `??`: a host's '' is unset, like patient and company. */
|
|
196
|
-
operatorId: r.operatorId || N,
|
|
197
|
-
/* A stored type wins. With none, '' falls through to the first entry. */
|
|
198
|
-
typeId: r.typeId ?? "",
|
|
199
|
-
/* `||` too: '' would become a Select option with an empty value. */
|
|
200
|
-
assigneeId: r.assigneeId || N,
|
|
201
|
-
about: an(r),
|
|
202
|
-
patientId: r.patientId ?? "",
|
|
203
|
-
companyId: r.companyId ?? ""
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
const dn = [
|
|
207
|
-
["patientId", "patient"],
|
|
208
|
-
["companyId", "company"],
|
|
209
|
-
["operatorId", "operator"]
|
|
210
|
-
];
|
|
211
|
-
function ln({
|
|
212
|
-
mode: r,
|
|
213
|
-
taskId: u,
|
|
214
|
-
initialDate: C,
|
|
215
|
-
active: P,
|
|
216
|
-
taskTypes: M,
|
|
217
|
-
assignees: j,
|
|
218
|
-
companies: Oe,
|
|
219
|
-
operators: L,
|
|
220
|
-
patients: oe,
|
|
221
|
-
searchedPatients: Q,
|
|
222
|
-
resolvePatientLabel: z,
|
|
223
|
-
loadTask: G,
|
|
224
|
-
onCreateTask: H,
|
|
225
|
-
onUpdateTask: re,
|
|
226
|
-
onDeleteTask: Y,
|
|
227
|
-
onSetTaskDone: ae,
|
|
228
|
-
onSaved: q,
|
|
229
|
-
onDeleted: he,
|
|
230
|
-
readOnly: _,
|
|
231
|
-
withheld: Se,
|
|
232
|
-
maskPatient: xe,
|
|
233
|
-
fallbackError: ie
|
|
234
|
-
}) {
|
|
235
|
-
var be;
|
|
236
|
-
const $ = r === "edit", [ge, je] = K(0), [$e, Z] = K(P);
|
|
237
|
-
$e !== P && (Z(P), P && je((e) => e + 1));
|
|
238
|
-
const R = `${r}|${u ?? ""}|${ge}`, [p, se] = K(
|
|
239
|
-
() => ct(C)
|
|
240
|
-
), [O, ve] = K(lt), [v, o] = K(), y = (e) => ve((i) => ({ ...i, ...e })), de = (e) => se((i) => ({ ...i, ...e })), [le, V] = K(R);
|
|
241
|
-
le !== R && (V(R), se(ct(C)), ve(lt), o(void 0));
|
|
242
|
-
const S = k({
|
|
243
|
-
subject: R,
|
|
244
|
-
saving: !1,
|
|
245
|
-
deleting: !1,
|
|
246
|
-
donePending: !1,
|
|
247
|
-
accepted: !1
|
|
248
|
-
});
|
|
249
|
-
S.current.subject !== R && (S.current = {
|
|
250
|
-
subject: R,
|
|
251
|
-
saving: !1,
|
|
252
|
-
deleting: !1,
|
|
253
|
-
donePending: !1,
|
|
254
|
-
accepted: !1
|
|
255
|
-
});
|
|
256
|
-
const ce = k(!0);
|
|
257
|
-
He(() => (ce.current = !0, () => {
|
|
258
|
-
ce.current = !1;
|
|
259
|
-
}), []);
|
|
260
|
-
const w = (e) => ce.current && S.current === e, ee = k(G);
|
|
261
|
-
ee.current = G;
|
|
262
|
-
const d = !!G, [E, l] = K(0), [s, m] = K(null), ye = k(s);
|
|
263
|
-
ye.current = s;
|
|
264
|
-
const ue = P && $ && !!u && d && !Se;
|
|
265
|
-
He(() => {
|
|
266
|
-
const e = ee.current;
|
|
267
|
-
if (!ue || !u || !e) return;
|
|
268
|
-
const i = S.current, f = ye.current;
|
|
269
|
-
if ((f == null ? void 0 : f.subject) === i.subject && f.status === "ready")
|
|
270
|
-
return;
|
|
271
|
-
const c = new AbortController();
|
|
272
|
-
return Promise.resolve().then(
|
|
273
|
-
() => (
|
|
274
|
-
/* Cleaned up before this ran (StrictMode's replay, a quick re-run):
|
|
275
|
-
never call the host with a signal already aborted. */
|
|
276
|
-
c.signal.aborted ? Promise.reject(c.signal.reason) : e(u, { signal: c.signal })
|
|
277
|
-
)
|
|
278
|
-
).then(
|
|
279
|
-
(h) => {
|
|
280
|
-
c.signal.aborted || !w(i) || (se(sn(h)), y({ done: h.done, confirmedDone: h.done }), o(h), m({ subject: i.subject, status: "ready" }));
|
|
281
|
-
},
|
|
282
|
-
(h) => {
|
|
283
|
-
c.signal.aborted || !w(i) || m({
|
|
284
|
-
subject: i.subject,
|
|
285
|
-
status: "error",
|
|
286
|
-
message: Pe(h, ie)
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
), () => c.abort();
|
|
290
|
-
}, [ue, R, E]);
|
|
291
|
-
const D = $ ? !u || !d ? "locked" : Se ? "withheld" : (s == null ? void 0 : s.subject) === R ? s.status : "loading" : "ready", x = () => {
|
|
292
|
-
D === "error" && (m(null), l((e) => e + 1));
|
|
293
|
-
}, te = p.typeId || (((be = M[0]) == null ? void 0 : be.id) ?? ""), Me = p.about === "nobody" || p.about === "patient" && p.patientId !== "" || p.about === "company" && p.companyId !== "" || p.about === "operator" && p.operatorId !== N, ne = !_ && p.note.trim() !== "" && p.date !== void 0 && Me && /* Required whenever the host offers a list. */
|
|
294
|
-
(M.length === 0 || te !== "") && !O.saving && !O.donePending, pe = $ ? re : H, Ie = () => {
|
|
295
|
-
const { date: e, time: i } = p;
|
|
296
|
-
return e ? {
|
|
297
|
-
dateIso: new Date(
|
|
298
|
-
e.getFullYear(),
|
|
299
|
-
e.getMonth(),
|
|
300
|
-
e.getDate(),
|
|
301
|
-
i.hours,
|
|
302
|
-
i.minutes,
|
|
303
|
-
0,
|
|
304
|
-
0
|
|
305
|
-
).toISOString(),
|
|
306
|
-
note: p.note.trim(),
|
|
307
|
-
/* Sent whatever the host's list says, including a value the list no
|
|
308
|
-
longer resolves: a real link must survive a Save that never
|
|
309
|
-
offered to change it. */
|
|
310
|
-
typeId: te === "" ? void 0 : te,
|
|
311
|
-
assigneeId: p.assigneeId === N ? void 0 : p.assigneeId,
|
|
312
|
-
/* ONE counterpart, decided by `about` alone: the platform refuses a
|
|
313
|
-
task carrying two. Never gated on a list being loaded, or a list
|
|
314
|
-
that empties mid-edit would unlink the task on Save. */
|
|
315
|
-
patientId: p.about === "patient" && p.patientId ? p.patientId : void 0,
|
|
316
|
-
companyId: p.about === "company" && p.companyId ? p.companyId : void 0,
|
|
317
|
-
operatorId: p.about === "operator" && p.operatorId !== N ? p.operatorId : void 0,
|
|
318
|
-
/* The last CONFIRMED value only, never an optimistic or rolled-back
|
|
319
|
-
toggle. */
|
|
320
|
-
done: O.confirmedDone
|
|
321
|
-
} : void 0;
|
|
322
|
-
}, I = (e) => Ht(new Error(`TaskEditor: ${e}`)), Ce = () => {
|
|
323
|
-
const e = S.current;
|
|
324
|
-
if (D !== "ready") return I(`cannot save while ${D}.`);
|
|
325
|
-
if (!pe) return I("the host gave no save seam.");
|
|
326
|
-
if (e.accepted) return I("this task was already saved.");
|
|
327
|
-
if (e.deleting) return I("a delete is in flight.");
|
|
328
|
-
if (e.saving || !ne) return I("the task cannot be saved.");
|
|
329
|
-
const i = Ie();
|
|
330
|
-
if (!i)
|
|
331
|
-
return y({ showError: !0 }), I("the task has no date.");
|
|
332
|
-
const f = u;
|
|
333
|
-
e.saving = !0, y({ saving: !0, saveError: void 0 });
|
|
334
|
-
const c = (async () => {
|
|
335
|
-
try {
|
|
336
|
-
if ($)
|
|
337
|
-
await (re == null ? void 0 : re(f, i)), e.accepted = !0, w(e) && (y({ accepted: !0 }), q == null || q({
|
|
338
|
-
...i,
|
|
339
|
-
id: f,
|
|
340
|
-
done: i.done ?? !1
|
|
341
|
-
}));
|
|
342
|
-
else {
|
|
343
|
-
const h = await (H == null ? void 0 : H(i));
|
|
344
|
-
e.accepted = !0, w(e) && (y({ accepted: !0 }), h && (q == null || q(h)));
|
|
345
|
-
}
|
|
346
|
-
} catch (h) {
|
|
347
|
-
throw w(e) && y({ saveError: Pe(h, ie) }), h;
|
|
348
|
-
} finally {
|
|
349
|
-
e.saving = !1, w(e) && y({ saving: !1 });
|
|
350
|
-
}
|
|
351
|
-
})();
|
|
352
|
-
return c.catch(() => {
|
|
353
|
-
}), c;
|
|
354
|
-
}, De = (e) => {
|
|
355
|
-
const i = S.current;
|
|
356
|
-
if (D !== "ready")
|
|
357
|
-
return I(`cannot change Done while ${D}.`);
|
|
358
|
-
if (!$ || !u || !ae || _)
|
|
359
|
-
return I("the host gave no Done seam.");
|
|
360
|
-
if (i.donePending) return I("a Done change is already pending.");
|
|
361
|
-
if (i.saving || i.deleting)
|
|
362
|
-
return I("a save or delete is in flight.");
|
|
363
|
-
if (i.accepted)
|
|
364
|
-
return I("this task was already saved or deleted.");
|
|
365
|
-
if (e === O.done) return Promise.resolve();
|
|
366
|
-
const f = O.confirmedDone, c = u;
|
|
367
|
-
i.donePending = !0, y({ done: e, donePending: !0, doneError: void 0 });
|
|
368
|
-
const h = (async () => {
|
|
369
|
-
try {
|
|
370
|
-
await ae(c, e), w(i) && y({ confirmedDone: e });
|
|
371
|
-
} catch (A) {
|
|
372
|
-
throw w(i) && y({
|
|
373
|
-
done: f,
|
|
374
|
-
doneError: Pe(A, ie)
|
|
375
|
-
}), A;
|
|
376
|
-
} finally {
|
|
377
|
-
i.donePending = !1, w(i) && y({ donePending: !1 });
|
|
378
|
-
}
|
|
379
|
-
})();
|
|
380
|
-
return h.catch(() => {
|
|
381
|
-
}), h;
|
|
382
|
-
}, Te = () => {
|
|
383
|
-
const e = S.current;
|
|
384
|
-
if (D !== "ready") return I(`cannot delete while ${D}.`);
|
|
385
|
-
if (!$ || !u || !Y || _)
|
|
386
|
-
return I("the host gave no delete seam.");
|
|
387
|
-
if (e.saving || e.accepted || e.deleting)
|
|
388
|
-
return I("the task cannot be deleted now.");
|
|
389
|
-
const i = u;
|
|
390
|
-
e.deleting = !0, y({ deleting: !0, deleteError: void 0 });
|
|
391
|
-
const f = (async () => {
|
|
392
|
-
try {
|
|
393
|
-
await Y(i), e.accepted = !0, w(e) && (y({ accepted: !0, confirmDeleteOpen: !1 }), he == null || he(i));
|
|
394
|
-
} catch (c) {
|
|
395
|
-
throw w(e) && y({ deleteError: Pe(c, ie) }), c;
|
|
396
|
-
} finally {
|
|
397
|
-
e.deleting = !1, w(e) && y({ deleting: !1 });
|
|
398
|
-
}
|
|
399
|
-
})();
|
|
400
|
-
return f.catch(() => {
|
|
401
|
-
}), f;
|
|
402
|
-
}, X = (e, i, f) => (
|
|
403
|
-
/* '' is never an id, even when the stored record holds one. */
|
|
404
|
-
i !== "" && (i === f || e.some((c) => c.id === i))
|
|
405
|
-
), me = (e) => {
|
|
406
|
-
var h;
|
|
407
|
-
if (D !== "ready")
|
|
408
|
-
throw new Error(`TaskEditor: cannot set fields while ${D}.`);
|
|
409
|
-
if (_) throw new Error("TaskEditor: the task is read-only.");
|
|
410
|
-
const i = dn.filter(([A]) => e[A] !== void 0);
|
|
411
|
-
if (i.length > 1)
|
|
412
|
-
throw new Error(
|
|
413
|
-
"TaskEditor: set at most one of patientId, companyId and operatorId."
|
|
414
|
-
);
|
|
415
|
-
const f = (h = i[0]) == null ? void 0 : h[1];
|
|
416
|
-
if (e.about !== void 0 && f && e.about !== f)
|
|
417
|
-
throw new Error(
|
|
418
|
-
`TaskEditor: about "${e.about}" does not match the ${f} id.`
|
|
419
|
-
);
|
|
420
|
-
if (e.typeId !== void 0 && !X(M, e.typeId, v == null ? void 0 : v.typeId))
|
|
421
|
-
throw new Error(`TaskEditor: unknown typeId "${e.typeId}".`);
|
|
422
|
-
if (e.assigneeId !== void 0 && e.assigneeId !== null && !X(j, e.assigneeId, v == null ? void 0 : v.assigneeId))
|
|
423
|
-
throw new Error(`TaskEditor: unknown assigneeId "${e.assigneeId}".`);
|
|
424
|
-
if (e.companyId !== void 0 && !X(Oe, e.companyId, v == null ? void 0 : v.companyId))
|
|
425
|
-
throw new Error(`TaskEditor: unknown companyId "${e.companyId}".`);
|
|
426
|
-
if (e.operatorId !== void 0 && !X(L, e.operatorId, v == null ? void 0 : v.operatorId))
|
|
427
|
-
throw new Error(`TaskEditor: unknown operatorId "${e.operatorId}".`);
|
|
428
|
-
if (e.patientId !== void 0) {
|
|
429
|
-
if (xe)
|
|
430
|
-
throw new Error("TaskEditor: no patient can be set in privacy mode.");
|
|
431
|
-
if (!(X(oe, e.patientId, v == null ? void 0 : v.patientId) || Q.has(e.patientId) || (z == null ? void 0 : z(e.patientId)) !== void 0))
|
|
432
|
-
throw new Error(`TaskEditor: unknown patientId "${e.patientId}".`);
|
|
433
|
-
}
|
|
434
|
-
const c = {};
|
|
435
|
-
if (e.dateIso !== void 0) {
|
|
436
|
-
const A = new Date(e.dateIso);
|
|
437
|
-
if (Number.isNaN(A.getTime()))
|
|
438
|
-
throw new Error(`TaskEditor: "${e.dateIso}" is not a date.`);
|
|
439
|
-
c.date = A, c.time = Ye(A);
|
|
440
|
-
}
|
|
441
|
-
e.note !== void 0 && (c.note = e.note), e.typeId !== void 0 && (c.typeId = e.typeId), e.assigneeId !== void 0 && (c.assigneeId = e.assigneeId ?? N), e.about !== void 0 && (c.about = e.about), e.patientId !== void 0 && (c.patientId = e.patientId, c.about = "patient"), e.companyId !== void 0 && (c.companyId = e.companyId, c.about = "company"), e.operatorId !== void 0 && (c.operatorId = e.operatorId, c.about = "operator"), de(c);
|
|
442
|
-
}, Ne = () => {
|
|
443
|
-
const e = Ie();
|
|
444
|
-
return {
|
|
445
|
-
mode: r,
|
|
446
|
-
dateIso: (e == null ? void 0 : e.dateIso) ?? null,
|
|
447
|
-
about: p.about,
|
|
448
|
-
patientId: (e == null ? void 0 : e.patientId) ?? null,
|
|
449
|
-
companyId: (e == null ? void 0 : e.companyId) ?? null,
|
|
450
|
-
operatorId: (e == null ? void 0 : e.operatorId) ?? null,
|
|
451
|
-
typeId: (e == null ? void 0 : e.typeId) ?? null,
|
|
452
|
-
assigneeId: (e == null ? void 0 : e.assigneeId) ?? null,
|
|
453
|
-
done: O.confirmedDone,
|
|
454
|
-
hasNote: p.note.trim() !== "",
|
|
455
|
-
noteLength: p.note.trim().length
|
|
456
|
-
};
|
|
457
|
-
};
|
|
458
|
-
return {
|
|
459
|
-
status: D,
|
|
460
|
-
loadError: (s == null ? void 0 : s.subject) === R ? s.message : void 0,
|
|
461
|
-
retry: x,
|
|
462
|
-
fields: p,
|
|
463
|
-
patchFields: de,
|
|
464
|
-
stored: v,
|
|
465
|
-
chosenTypeId: te,
|
|
466
|
-
canSave: ne,
|
|
467
|
-
/** What the agent's `canSave` reports: the button's rule plus the
|
|
468
|
-
* status, the seam and a save that has not landed yet. */
|
|
469
|
-
agentCanSave: D === "ready" && !!pe && ne && !O.accepted,
|
|
470
|
-
showSave: !_ && !!pe,
|
|
471
|
-
showDelete: $ && !_ && !!Y && !!u,
|
|
472
|
-
showDone: $ && !_ && !!ae,
|
|
473
|
-
ui: O,
|
|
474
|
-
patchUi: y,
|
|
475
|
-
/** True once a save or delete landed in this session. */
|
|
476
|
-
isAccepted: () => S.current.accepted,
|
|
477
|
-
/** A save or delete is in flight: closing now would lose its outcome. */
|
|
478
|
-
isBusy: () => S.current.saving || S.current.deleting,
|
|
479
|
-
submit: Ce,
|
|
480
|
-
setDone: De,
|
|
481
|
-
remove: Te,
|
|
482
|
-
applyPatch: me,
|
|
483
|
-
draftState: Ne
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
const ut = ft("ds:flex ds:min-h-0 ds:flex-col", {
|
|
487
|
-
variants: {
|
|
488
|
-
/** The panel fills its box; the subview body sits in its scroll area. */
|
|
489
|
-
variant: {
|
|
490
|
-
/* Focusable from script only, as the subview section is: where focus
|
|
491
|
-
waits when a control takes itself away. */
|
|
492
|
-
panel: "ds:h-full ds:focus-visible:outline-none",
|
|
493
|
-
/* The states pad themselves, so the subview's ring inset is cancelled. */
|
|
494
|
-
subview: "ds:-m-[var(--panel-subview-inset)]"
|
|
495
|
-
}
|
|
496
|
-
},
|
|
497
|
-
defaultVariants: { variant: "panel" }
|
|
498
|
-
}), pt = ft(
|
|
499
|
-
`ds:m-0 ds:min-w-0 ds:border-0 ds:p-[var(--spacing-md)] ${Lt}`,
|
|
500
|
-
{
|
|
501
|
-
variants: {
|
|
502
|
-
/** 'form': the fields in a column. 'notice': the locked notice. */
|
|
503
|
-
layout: {
|
|
504
|
-
form: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
505
|
-
notice: "ds:flex-1"
|
|
506
|
-
}
|
|
507
|
-
},
|
|
508
|
-
defaultVariants: { layout: "form" }
|
|
509
|
-
}
|
|
510
|
-
), a = (r) => `calendarWorkspace.taskEditor.${r}`, cn = (r, u, C) => C.includes(u) ? 1 : 0, ke = [], Ge = (r, u) => Array.from(r.querySelectorAll("[data-task-id]")).filter(
|
|
511
|
-
(C) => !u.contains(C)
|
|
512
|
-
), un = 'button:not([disabled]), a[href], input:not([disabled]), [tabindex]:not([tabindex="-1"])', mt = (r, u) => {
|
|
513
|
-
if (!r) return [];
|
|
514
|
-
const C = Array.from(
|
|
515
|
-
r.querySelectorAll("[data-action]")
|
|
516
|
-
);
|
|
517
|
-
return [
|
|
518
|
-
...C.filter((P) => u && P.dataset.action === u),
|
|
519
|
-
...C.filter((P) => P.dataset.action === "open-task"),
|
|
520
|
-
...Array.from(r.querySelectorAll(un))
|
|
521
|
-
];
|
|
522
|
-
}, pn = Nt(
|
|
523
|
-
({
|
|
524
|
-
id: r,
|
|
525
|
-
mode: u,
|
|
526
|
-
taskId: C,
|
|
527
|
-
initialDate: P,
|
|
528
|
-
variant: M = "panel",
|
|
529
|
-
open: j = !0,
|
|
530
|
-
onExited: Oe,
|
|
531
|
-
taskTypes: L = ke,
|
|
532
|
-
assignees: oe = ke,
|
|
533
|
-
companies: Q = ke,
|
|
534
|
-
operators: z = ke,
|
|
535
|
-
patients: G = ke,
|
|
536
|
-
searchPatients: H,
|
|
537
|
-
patientLabel: re,
|
|
538
|
-
resolvePatientLabel: Y,
|
|
539
|
-
companyLabel: ae,
|
|
540
|
-
operatorLabel: q,
|
|
541
|
-
backLabel: he,
|
|
542
|
-
loadTask: _,
|
|
543
|
-
onCreateTask: Se,
|
|
544
|
-
onUpdateTask: xe,
|
|
545
|
-
onDeleteTask: ie,
|
|
546
|
-
onSetTaskDone: $,
|
|
547
|
-
onCancel: ge,
|
|
548
|
-
onSaved: je,
|
|
549
|
-
onDeleted: $e,
|
|
550
|
-
readOnly: Z = !1,
|
|
551
|
-
privacy: R = !1,
|
|
552
|
-
privacyMode: p = "notice",
|
|
553
|
-
onPrivacyOff: se,
|
|
554
|
-
className: O,
|
|
555
|
-
...ve
|
|
556
|
-
}, v) => {
|
|
557
|
-
const { t: o } = At("ui"), y = Rt(), de = r ?? y, le = u === "edit", V = M === "subview", S = !V || j, ce = R && le && p === "notice", w = R && !ce, [ee] = K(() => /* @__PURE__ */ new Map()), d = ln({
|
|
558
|
-
mode: u,
|
|
559
|
-
taskId: C,
|
|
560
|
-
initialDate: P,
|
|
561
|
-
active: S,
|
|
562
|
-
taskTypes: L,
|
|
563
|
-
assignees: oe,
|
|
564
|
-
companies: Q,
|
|
565
|
-
operators: z,
|
|
566
|
-
patients: G,
|
|
567
|
-
searchedPatients: ee,
|
|
568
|
-
resolvePatientLabel: Y,
|
|
569
|
-
loadTask: _,
|
|
570
|
-
onCreateTask: Se,
|
|
571
|
-
onUpdateTask: xe,
|
|
572
|
-
onDeleteTask: ie,
|
|
573
|
-
onSetTaskDone: $,
|
|
574
|
-
onSaved: je,
|
|
575
|
-
onDeleted: $e,
|
|
576
|
-
readOnly: Z,
|
|
577
|
-
withheld: ce,
|
|
578
|
-
maskPatient: w,
|
|
579
|
-
fallbackError: o("emptyState.error.title")
|
|
580
|
-
}), { status: E, fields: l, ui: s, stored: m } = d, ye = k(H);
|
|
581
|
-
ye.current = H;
|
|
582
|
-
const ue = !!H, D = Ae(
|
|
583
|
-
() => ue ? async (t, g) => {
|
|
584
|
-
const B = await ye.current(t, g);
|
|
585
|
-
for (const W of B)
|
|
586
|
-
ee.set(W.id, W.name);
|
|
587
|
-
return B;
|
|
588
|
-
} : void 0,
|
|
589
|
-
[ue, ee]
|
|
590
|
-
), x = k(d);
|
|
591
|
-
x.current = d;
|
|
592
|
-
const te = k(ge);
|
|
593
|
-
te.current = ge;
|
|
594
|
-
const Me = Ae(
|
|
595
|
-
() => ({
|
|
596
|
-
getStatus: () => x.current.status,
|
|
597
|
-
getDraft: () => x.current.draftState(),
|
|
598
|
-
canSave: () => x.current.agentCanSave,
|
|
599
|
-
setFields: (t) => x.current.applyPatch(t),
|
|
600
|
-
save: () => x.current.submit(),
|
|
601
|
-
setDone: (t) => x.current.setDone(t),
|
|
602
|
-
deleteTask: () => x.current.remove(),
|
|
603
|
-
cancel: () => {
|
|
604
|
-
if (x.current.isBusy())
|
|
605
|
-
throw new Error("TaskEditor: a save or delete is in flight.");
|
|
606
|
-
te.current();
|
|
607
|
-
}
|
|
608
|
-
}),
|
|
609
|
-
[]
|
|
610
|
-
);
|
|
611
|
-
Vt(rn, S ? Me : null, de);
|
|
612
|
-
const ne = k(null), pe = Ae(
|
|
613
|
-
() => Wt(v, ne),
|
|
614
|
-
[v]
|
|
615
|
-
), Ie = k(null), I = k(null), Ce = k(!1);
|
|
616
|
-
V && j && !Ce.current && (I.current = typeof document < "u" && document.activeElement instanceof HTMLElement ? document.activeElement : null), Ce.current = V && j;
|
|
617
|
-
const De = k(j);
|
|
618
|
-
De.current = j;
|
|
619
|
-
const Te = k(C);
|
|
620
|
-
Te.current = le ? C : void 0, He(() => {
|
|
621
|
-
var it;
|
|
622
|
-
const t = ne.current, g = t == null ? void 0 : t.parentElement;
|
|
623
|
-
if (!V || !j || !t || !g) return;
|
|
624
|
-
const B = I.current, W = B && g.contains(B) && !t.contains(B) ? B : null, Dt = Te.current, we = (W == null ? void 0 : W.closest("[data-task-id]")) ?? Ge(g, t).find((Re) => Re.dataset.taskId === Dt), ot = we == null ? void 0 : we.dataset.taskId, rt = (it = W == null ? void 0 : W.closest("[data-action]")) == null ? void 0 : it.dataset.action, at = we ? Ge(g, t).indexOf(we) : -1;
|
|
625
|
-
return () => {
|
|
626
|
-
if (De.current && t.isConnected) return;
|
|
627
|
-
const Re = document.activeElement;
|
|
628
|
-
if (!g.isConnected || Re && Re !== document.body) return;
|
|
629
|
-
const Ue = Ge(g, t), Tt = [
|
|
630
|
-
...mt(
|
|
631
|
-
Ue.find((fe) => ot !== void 0 && fe.dataset.taskId === ot),
|
|
632
|
-
rt
|
|
633
|
-
),
|
|
634
|
-
/* The row that took its place, or the last row when it was last. */
|
|
635
|
-
...at >= 0 ? mt(Ue[Math.min(at, Ue.length - 1)], rt) : [],
|
|
636
|
-
g.querySelector('[data-action="add-task"]'),
|
|
637
|
-
g.querySelector("[data-tasks-panel-region]")
|
|
638
|
-
];
|
|
639
|
-
for (const fe of Tt)
|
|
640
|
-
if (!(!fe || t.contains(fe)) && (fe.focus(), document.activeElement === fe))
|
|
641
|
-
return;
|
|
642
|
-
};
|
|
643
|
-
}, [j, V]);
|
|
644
|
-
const X = k(null), me = k(!1), Ne = (t) => () => {
|
|
645
|
-
me.current = !0, t();
|
|
646
|
-
};
|
|
647
|
-
Ut(() => {
|
|
648
|
-
var B;
|
|
649
|
-
if (!me.current) return;
|
|
650
|
-
const t = ne.current, g = document.activeElement;
|
|
651
|
-
if (g && g !== document.body && g !== t) {
|
|
652
|
-
me.current = !1;
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
655
|
-
E !== "loading" && (me.current = !1), (B = E === "error" ? X.current : t) == null || B.focus({
|
|
656
|
-
preventScroll: !0
|
|
657
|
-
});
|
|
658
|
-
}, [E]);
|
|
659
|
-
const be = o(a(le ? "editTitle" : "title")), e = Q.length > 0, i = z.length > 0, f = ue || G.length > 0, c = Ae(
|
|
660
|
-
() => Q.map((t) => ({ value: t.id, label: t.label })),
|
|
661
|
-
[Q]
|
|
662
|
-
), h = (t) => {
|
|
663
|
-
var g;
|
|
664
|
-
return (Y == null ? void 0 : Y(t)) ?? ((g = G.find((B) => B.id === t)) == null ? void 0 : g.name) ?? ee.get(t) ?? (t === (m == null ? void 0 : m.patientId) ? re : void 0) ?? o("calendarWorkspace.details.patientNotLoaded");
|
|
665
|
-
}, A = (t) => t === (m == null ? void 0 : m.operatorId) && q ? q : o(a("operatorUnresolved"), { id: t }), ht = [
|
|
666
|
-
{ value: N, label: o(a("operatorNone")) },
|
|
667
|
-
...z.map((t) => ({ value: t.id, label: t.label })),
|
|
668
|
-
/* An operator the roster no longer lists is still a real link, so it
|
|
669
|
-
stays pickable and survives a Save. */
|
|
670
|
-
...l.operatorId !== N && !z.some((t) => t.id === l.operatorId) ? [
|
|
671
|
-
{
|
|
672
|
-
value: l.operatorId,
|
|
673
|
-
label: A(l.operatorId)
|
|
674
|
-
}
|
|
675
|
-
] : []
|
|
676
|
-
], gt = L.some((t) => t.custom) && L.some((t) => !t.custom), vt = [
|
|
677
|
-
...L.map((t) => ({
|
|
678
|
-
value: t.id,
|
|
679
|
-
label: t.label,
|
|
680
|
-
group: gt ? o(a(t.custom ? "typeGroupCustom" : "typeGroupStandard")) : void 0
|
|
681
|
-
})),
|
|
682
|
-
/* An id the list no longer resolves is still a real link: offered as
|
|
683
|
-
its own option so Save re-sends it. */
|
|
684
|
-
...d.chosenTypeId && !L.some((t) => t.id === d.chosenTypeId) ? [
|
|
685
|
-
{
|
|
686
|
-
value: d.chosenTypeId,
|
|
687
|
-
label: o(a("typeUnresolved"), { id: d.chosenTypeId })
|
|
688
|
-
}
|
|
689
|
-
] : []
|
|
690
|
-
], yt = [
|
|
691
|
-
{ value: N, label: o(a("assigneeNone")) },
|
|
692
|
-
...oe.map((t) => ({ value: t.id, label: t.label })),
|
|
693
|
-
...l.assigneeId !== N && !oe.some((t) => t.id === l.assigneeId) ? [
|
|
694
|
-
{
|
|
695
|
-
value: l.assigneeId,
|
|
696
|
-
label: o(a("assigneeUnresolved"), { id: l.assigneeId })
|
|
697
|
-
}
|
|
698
|
-
] : []
|
|
699
|
-
], U = l.about === "company" && l.companyId && !Q.some((t) => t.id === l.companyId) ? l.companyId : void 0, It = U && U === (m == null ? void 0 : m.companyId) && ae ? ae : o(a("companyUnresolved"), { id: U }), Xe = /* @__PURE__ */ b(T, { variant: "info", announce: "off", icon: /* @__PURE__ */ n(Yt, { "aria-hidden": "true" }), children: [
|
|
700
|
-
/* @__PURE__ */ n(T.Title, { as: "p", children: o("calendarWorkspace.details.readOnlyTitle") }),
|
|
701
|
-
/* @__PURE__ */ n(T.Description, { children: o(a("readOnlyBody")) })
|
|
702
|
-
] }), qe = s.saving || s.deleting, Je = () => {
|
|
703
|
-
d.isBusy() || ge();
|
|
704
|
-
}, bt = /* @__PURE__ */ n(
|
|
705
|
-
Ke,
|
|
706
|
-
{
|
|
707
|
-
size: "sm",
|
|
708
|
-
intent: "outline",
|
|
709
|
-
icon: /* @__PURE__ */ n(Xt, { "aria-hidden": "true" }),
|
|
710
|
-
"aria-label": o(a("cancel")),
|
|
711
|
-
tooltip: o(a("cancel")),
|
|
712
|
-
"data-action": "cancel-task",
|
|
713
|
-
disabled: qe,
|
|
714
|
-
onClick: Je
|
|
715
|
-
}
|
|
716
|
-
), _e = s.saving || s.accepted, Qe = (t) => /* @__PURE__ */ b(Ee, { children: [
|
|
717
|
-
t && d.showDelete ? /* @__PURE__ */ n(
|
|
718
|
-
Ke,
|
|
719
|
-
{
|
|
720
|
-
ref: Ie,
|
|
721
|
-
size: "sm",
|
|
722
|
-
intent: "destructiveOutline",
|
|
723
|
-
icon: /* @__PURE__ */ n(st, { "aria-hidden": "true" }),
|
|
724
|
-
"aria-label": o(a("delete")),
|
|
725
|
-
tooltip: o(a("delete")),
|
|
726
|
-
"data-action": "delete-task",
|
|
727
|
-
disabled: qe || s.accepted,
|
|
728
|
-
onClick: () => d.patchUi({ confirmDeleteOpen: !0, deleteError: void 0 })
|
|
729
|
-
}
|
|
730
|
-
) : null,
|
|
731
|
-
/* @__PURE__ */ b(
|
|
732
|
-
Pt,
|
|
733
|
-
{
|
|
734
|
-
role: "toolbar",
|
|
735
|
-
"aria-label": o(a("actionsLabel")),
|
|
736
|
-
className: "ds:ms-auto",
|
|
737
|
-
children: [
|
|
738
|
-
bt,
|
|
739
|
-
t && d.showSave ? /* @__PURE__ */ n(
|
|
740
|
-
Ke,
|
|
741
|
-
{
|
|
742
|
-
size: "sm",
|
|
743
|
-
intent: "primary",
|
|
744
|
-
icon: s.saving ? /* @__PURE__ */ n(
|
|
745
|
-
nn,
|
|
746
|
-
{
|
|
747
|
-
"aria-hidden": "true",
|
|
748
|
-
className: "ds:animate-spin ds:motion-reduce:animate-none"
|
|
749
|
-
}
|
|
750
|
-
) : /* @__PURE__ */ n(on, { "aria-hidden": "true" }),
|
|
751
|
-
"aria-label": o(a("save")),
|
|
752
|
-
tooltip: o(a("save")),
|
|
753
|
-
disabled: !_e && !d.canSave,
|
|
754
|
-
"aria-disabled": _e || void 0,
|
|
755
|
-
"aria-busy": s.saving || void 0,
|
|
756
|
-
"data-action": "save-task",
|
|
757
|
-
onClick: () => {
|
|
758
|
-
_e || d.submit();
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
) : null
|
|
762
|
-
]
|
|
763
|
-
}
|
|
764
|
-
),
|
|
765
|
-
t && d.showSave ? (
|
|
766
|
-
/* Out of flow, so it never moves the footer's two ends. */
|
|
767
|
-
/* @__PURE__ */ n("span", { role: "status", className: "ds:sr-only", children: s.saving ? o(a("saving")) : "" })
|
|
768
|
-
) : null
|
|
769
|
-
] }), wt = /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
|
|
770
|
-
/* @__PURE__ */ n("span", { role: "status", className: "ds:sr-only", children: o("common.loading") }),
|
|
771
|
-
/* @__PURE__ */ b(
|
|
772
|
-
"div",
|
|
773
|
-
{
|
|
774
|
-
"aria-hidden": "true",
|
|
775
|
-
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
776
|
-
children: [
|
|
777
|
-
/* @__PURE__ */ n(
|
|
778
|
-
ze,
|
|
779
|
-
{
|
|
780
|
-
variant: "rounded",
|
|
781
|
-
height: "calc(var(--spacing-xl) + var(--spacing-sm))"
|
|
782
|
-
}
|
|
783
|
-
),
|
|
784
|
-
/* @__PURE__ */ n(
|
|
785
|
-
ze,
|
|
786
|
-
{
|
|
787
|
-
variant: "rounded",
|
|
788
|
-
height: "calc(var(--spacing-xl) * 3)",
|
|
789
|
-
stagger: 1
|
|
790
|
-
}
|
|
791
|
-
),
|
|
792
|
-
/* @__PURE__ */ n(
|
|
793
|
-
ze,
|
|
794
|
-
{
|
|
795
|
-
variant: "rounded",
|
|
796
|
-
height: "calc(var(--spacing-xl) + var(--spacing-sm))",
|
|
797
|
-
stagger: 2
|
|
798
|
-
}
|
|
799
|
-
)
|
|
800
|
-
]
|
|
801
|
-
}
|
|
802
|
-
)
|
|
803
|
-
] }), Et = /* @__PURE__ */ b("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: [
|
|
804
|
-
/* @__PURE__ */ n(T, { variant: "error", children: /* @__PURE__ */ n(T.Description, { children: d.loadError }) }),
|
|
805
|
-
/* @__PURE__ */ n(
|
|
806
|
-
We,
|
|
807
|
-
{
|
|
808
|
-
ref: X,
|
|
809
|
-
intent: "outline",
|
|
810
|
-
"data-action": "retry-load",
|
|
811
|
-
onClick: Ne(d.retry),
|
|
812
|
-
children: o("emptyState.error.cta")
|
|
813
|
-
}
|
|
814
|
-
)
|
|
815
|
-
] }), kt = /* @__PURE__ */ n("fieldset", { disabled: !0, className: pt({ layout: "notice" }), children: Xe }), St = () => l.about !== "patient" ? null : w ? /* @__PURE__ */ n(F, { label: o(a("aboutPatient")), children: /* @__PURE__ */ n(Fe, { value: tn(), disabled: !0, readOnly: !0 }) }) : f ? /* @__PURE__ */ n(F, { label: o(a("aboutPatient")), children: /* @__PURE__ */ n(
|
|
816
|
-
zt,
|
|
817
|
-
{
|
|
818
|
-
value: l.patientId,
|
|
819
|
-
onValueChange: (t) => d.patchFields({ patientId: t }),
|
|
820
|
-
patients: G,
|
|
821
|
-
searchPatients: D,
|
|
822
|
-
selectedLabel: l.patientId ? h(l.patientId) : void 0,
|
|
823
|
-
placeholder: o("calendarWorkspace.editor.patientSearch"),
|
|
824
|
-
disabled: Z
|
|
825
|
-
}
|
|
826
|
-
) }) : l.patientId ? /* @__PURE__ */ n(F, { label: o(a("aboutPatient")), children: /* @__PURE__ */ n(Fe, { value: h(l.patientId), disabled: !0, readOnly: !0 }) }) : null, Ze = /* @__PURE__ */ b("fieldset", { disabled: Z, className: pt(), children: [
|
|
827
|
-
Z ? Xe : null,
|
|
828
|
-
/* @__PURE__ */ n(F, { label: o(a("date")), children: /* @__PURE__ */ n(
|
|
829
|
-
Ft,
|
|
830
|
-
{
|
|
831
|
-
value: l.date,
|
|
832
|
-
onChange: (t) => d.patchFields({ date: t })
|
|
833
|
-
}
|
|
834
|
-
) }),
|
|
835
|
-
/* @__PURE__ */ n(F, { label: o(a("time")), children: /* @__PURE__ */ n(
|
|
836
|
-
_t,
|
|
837
|
-
{
|
|
838
|
-
value: l.time,
|
|
839
|
-
onChange: (t) => d.patchFields({ time: t })
|
|
840
|
-
}
|
|
841
|
-
) }),
|
|
842
|
-
/* @__PURE__ */ n(
|
|
843
|
-
F,
|
|
844
|
-
{
|
|
845
|
-
label: o(a("note")),
|
|
846
|
-
required: !0,
|
|
847
|
-
error: s.showError && l.note.trim() === "" ? o(a("noteRequired")) : void 0,
|
|
848
|
-
children: /* @__PURE__ */ n(
|
|
849
|
-
qt,
|
|
850
|
-
{
|
|
851
|
-
value: l.note,
|
|
852
|
-
onChange: (t) => {
|
|
853
|
-
d.patchFields({ note: t.target.value }), d.patchUi({ showError: !1 });
|
|
854
|
-
},
|
|
855
|
-
minRows: 3,
|
|
856
|
-
autoResize: !0
|
|
857
|
-
}
|
|
858
|
-
)
|
|
859
|
-
}
|
|
860
|
-
),
|
|
861
|
-
L.length > 0 ? /* @__PURE__ */ n(F, { label: o(a("type")), required: !0, children: /* @__PURE__ */ n(
|
|
862
|
-
Le,
|
|
863
|
-
{
|
|
864
|
-
options: vt,
|
|
865
|
-
value: d.chosenTypeId,
|
|
866
|
-
onValueChange: (t) => t && d.patchFields({ typeId: t })
|
|
867
|
-
}
|
|
868
|
-
) }) : null,
|
|
869
|
-
oe.length > 0 ? /* @__PURE__ */ n(F, { label: o(a("assignee")), children: /* @__PURE__ */ n(
|
|
870
|
-
Le,
|
|
871
|
-
{
|
|
872
|
-
options: yt,
|
|
873
|
-
value: l.assigneeId,
|
|
874
|
-
onValueChange: (t) => t && d.patchFields({ assigneeId: t })
|
|
875
|
-
}
|
|
876
|
-
) }) : null,
|
|
877
|
-
/* @__PURE__ */ b(
|
|
878
|
-
jt,
|
|
879
|
-
{
|
|
880
|
-
label: o(a("about")),
|
|
881
|
-
variant: "segmented",
|
|
882
|
-
className: Kt,
|
|
883
|
-
value: l.about,
|
|
884
|
-
onValueChange: (t) => d.patchFields({ about: t }),
|
|
885
|
-
children: [
|
|
886
|
-
/* @__PURE__ */ n(
|
|
887
|
-
Be,
|
|
888
|
-
{
|
|
889
|
-
value: "nobody",
|
|
890
|
-
label: o(a("aboutNobody")),
|
|
891
|
-
icon: /* @__PURE__ */ n(Jt, { "aria-hidden": "true" })
|
|
892
|
-
}
|
|
893
|
-
),
|
|
894
|
-
f || l.about === "patient" || m != null && m.patientId ? /* @__PURE__ */ n(
|
|
895
|
-
Be,
|
|
896
|
-
{
|
|
897
|
-
value: "patient",
|
|
898
|
-
label: o(a("aboutPatient")),
|
|
899
|
-
icon: /* @__PURE__ */ n(Qt, { "aria-hidden": "true" })
|
|
900
|
-
}
|
|
901
|
-
) : null,
|
|
902
|
-
e || l.about === "company" || m != null && m.companyId ? /* @__PURE__ */ n(
|
|
903
|
-
Be,
|
|
904
|
-
{
|
|
905
|
-
value: "company",
|
|
906
|
-
label: o(a("aboutCompany")),
|
|
907
|
-
icon: /* @__PURE__ */ n(Zt, { "aria-hidden": "true" })
|
|
908
|
-
}
|
|
909
|
-
) : null,
|
|
910
|
-
i || l.about === "operator" || m != null && m.operatorId ? /* @__PURE__ */ n(
|
|
911
|
-
Be,
|
|
912
|
-
{
|
|
913
|
-
value: "operator",
|
|
914
|
-
label: o(a("aboutOperator")),
|
|
915
|
-
icon: /* @__PURE__ */ n(en, { "aria-hidden": "true" })
|
|
916
|
-
}
|
|
917
|
-
) : null
|
|
918
|
-
]
|
|
919
|
-
}
|
|
920
|
-
),
|
|
921
|
-
St(),
|
|
922
|
-
l.about === "company" ? /* @__PURE__ */ b(Ee, { children: [
|
|
923
|
-
U ? /* @__PURE__ */ n(F, { label: o(a("companyName")), children: /* @__PURE__ */ n(Fe, { value: It, disabled: !0, readOnly: !0 }) }) : null,
|
|
924
|
-
e ? /* @__PURE__ */ n(
|
|
925
|
-
F,
|
|
926
|
-
{
|
|
927
|
-
label: o(
|
|
928
|
-
a(U ? "companyReplace" : "companyName")
|
|
929
|
-
),
|
|
930
|
-
children: /* @__PURE__ */ n(
|
|
931
|
-
Bt,
|
|
932
|
-
{
|
|
933
|
-
options: c,
|
|
934
|
-
value: U ? "" : l.companyId,
|
|
935
|
-
onValueChange: (t) => U ? t && d.patchFields({ companyId: t }) : d.patchFields({ companyId: t }),
|
|
936
|
-
clearable: !U && !Z,
|
|
937
|
-
filter: cn,
|
|
938
|
-
placeholder: o(a("companySearch")),
|
|
939
|
-
"aria-label": o(
|
|
940
|
-
a(U ? "companyReplace" : "companyName")
|
|
941
|
-
)
|
|
942
|
-
}
|
|
943
|
-
)
|
|
944
|
-
}
|
|
945
|
-
) : null
|
|
946
|
-
] }) : null,
|
|
947
|
-
l.about === "operator" ? i ? /* @__PURE__ */ n(F, { label: o(a("operator")), children: /* @__PURE__ */ n(
|
|
948
|
-
Le,
|
|
949
|
-
{
|
|
950
|
-
options: ht,
|
|
951
|
-
value: l.operatorId,
|
|
952
|
-
onValueChange: (t) => t && d.patchFields({ operatorId: t })
|
|
953
|
-
}
|
|
954
|
-
) }) : l.operatorId !== N ? (
|
|
955
|
-
/* No roster to pick from: name the link read-only. */
|
|
956
|
-
/* @__PURE__ */ n(F, { label: o(a("operator")), children: /* @__PURE__ */ n(
|
|
957
|
-
Fe,
|
|
958
|
-
{
|
|
959
|
-
value: A(l.operatorId),
|
|
960
|
-
disabled: !0,
|
|
961
|
-
readOnly: !0
|
|
962
|
-
}
|
|
963
|
-
) })
|
|
964
|
-
) : null : null,
|
|
965
|
-
d.showDone ? /* @__PURE__ */ b(Ee, { children: [
|
|
966
|
-
/* @__PURE__ */ n(
|
|
967
|
-
Mt,
|
|
968
|
-
{
|
|
969
|
-
label: o(a("done")),
|
|
970
|
-
checked: s.done,
|
|
971
|
-
disabled: qe || s.accepted,
|
|
972
|
-
"aria-disabled": s.donePending || void 0,
|
|
973
|
-
"aria-busy": s.donePending || void 0,
|
|
974
|
-
className: "ds:aria-disabled:cursor-progress",
|
|
975
|
-
onCheckedChange: (t) => {
|
|
976
|
-
s.donePending || d.setDone(t);
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
),
|
|
980
|
-
s.doneError ? /* @__PURE__ */ n(T, { variant: "error", children: /* @__PURE__ */ n(T.Description, { children: s.doneError }) }) : null
|
|
981
|
-
] }) : null,
|
|
982
|
-
s.saveError ? /* @__PURE__ */ n(T, { variant: "error", children: /* @__PURE__ */ n(T.Description, { children: s.saveError }) }) : null,
|
|
983
|
-
s.deleteError && !s.confirmDeleteOpen ? /* @__PURE__ */ n(T, { variant: "error", children: /* @__PURE__ */ n(T.Description, { children: s.deleteError }) }) : null
|
|
984
|
-
] }), et = E === "loading" ? wt : E === "error" ? Et : E === "locked" ? kt : E === "withheld" ? /* @__PURE__ */ n(
|
|
985
|
-
Gt,
|
|
986
|
-
{
|
|
987
|
-
onTurnOff: se ? Ne(se) : void 0
|
|
988
|
-
}
|
|
989
|
-
) : V ? Ze : /* @__PURE__ */ n($t, { orientation: "vertical", className: "ds:min-h-0 ds:flex-1", children: Ze }), Ve = E === "ready" ? Qe(!0) : E === "locked" || E === "withheld" ? Qe(!1) : null, Ct = E === "ready" && d.showDelete, tt = le ? /* @__PURE__ */ n(
|
|
990
|
-
J,
|
|
991
|
-
{
|
|
992
|
-
scope: "container",
|
|
993
|
-
open: s.confirmDeleteOpen && S,
|
|
994
|
-
onOpenChange: (t) => {
|
|
995
|
-
s.deleting || d.patchUi(
|
|
996
|
-
t ? { confirmDeleteOpen: !0 } : { confirmDeleteOpen: !1, deleteError: void 0 }
|
|
997
|
-
);
|
|
998
|
-
},
|
|
999
|
-
children: /* @__PURE__ */ b(
|
|
1000
|
-
J.Content,
|
|
1001
|
-
{
|
|
1002
|
-
size: "sm",
|
|
1003
|
-
variant: "alert",
|
|
1004
|
-
onCloseAutoFocus: (t) => {
|
|
1005
|
-
var g;
|
|
1006
|
-
t.defaultPrevented || (t.preventDefault(), d.isAccepted() || (g = Ie.current) == null || g.focus());
|
|
1007
|
-
},
|
|
1008
|
-
children: [
|
|
1009
|
-
/* @__PURE__ */ b(J.Header, { children: [
|
|
1010
|
-
/* @__PURE__ */ n(J.Title, { children: o(a("deleteConfirmTitle")) }),
|
|
1011
|
-
/* @__PURE__ */ n(J.Description, { children: o(a("deleteConfirmBody")) })
|
|
1012
|
-
] }),
|
|
1013
|
-
s.deleteError ? /* @__PURE__ */ n(J.Body, { children: /* @__PURE__ */ n(T, { variant: "error", children: /* @__PURE__ */ n(T.Description, { children: s.deleteError }) }) }) : null,
|
|
1014
|
-
/* @__PURE__ */ b(J.Footer, { divider: !0, children: [
|
|
1015
|
-
/* @__PURE__ */ n(J.Close, { asChild: !0, children: /* @__PURE__ */ n(We, { intent: "outline", "aria-disabled": s.deleting || void 0, children: o(a("deleteCancel")) }) }),
|
|
1016
|
-
/* @__PURE__ */ n(
|
|
1017
|
-
We,
|
|
1018
|
-
{
|
|
1019
|
-
intent: "destructive",
|
|
1020
|
-
startIcon: /* @__PURE__ */ n(st, { "aria-hidden": "true" }),
|
|
1021
|
-
"aria-disabled": s.deleting || void 0,
|
|
1022
|
-
"aria-busy": s.deleting || void 0,
|
|
1023
|
-
onClick: () => {
|
|
1024
|
-
s.deleting || d.remove();
|
|
1025
|
-
},
|
|
1026
|
-
children: o(a("deleteConfirm"))
|
|
1027
|
-
}
|
|
1028
|
-
)
|
|
1029
|
-
] })
|
|
1030
|
-
]
|
|
1031
|
-
}
|
|
1032
|
-
)
|
|
1033
|
-
}
|
|
1034
|
-
) : null, nt = {
|
|
1035
|
-
"data-component": "task-editor",
|
|
1036
|
-
"data-component-id": de,
|
|
1037
|
-
"data-variant": M,
|
|
1038
|
-
"data-status": E
|
|
1039
|
-
};
|
|
1040
|
-
return V ? /* @__PURE__ */ b(Ee, { children: [
|
|
1041
|
-
/* @__PURE__ */ n(
|
|
1042
|
-
xt,
|
|
1043
|
-
{
|
|
1044
|
-
...ve,
|
|
1045
|
-
"data-component-id": de,
|
|
1046
|
-
"data-variant": M,
|
|
1047
|
-
"data-status": E,
|
|
1048
|
-
ref: pe,
|
|
1049
|
-
open: j,
|
|
1050
|
-
onBack: Je,
|
|
1051
|
-
onExited: Oe,
|
|
1052
|
-
title: be,
|
|
1053
|
-
icon: /* @__PURE__ */ n(dt, { "aria-hidden": "true" }),
|
|
1054
|
-
backLabel: he ?? o(a("back")),
|
|
1055
|
-
footer: Ve,
|
|
1056
|
-
footerAlign: Ct ? "between" : "end",
|
|
1057
|
-
className: O,
|
|
1058
|
-
children: /* @__PURE__ */ n("div", { ...nt, className: ut({ variant: M }), children: et })
|
|
1059
|
-
}
|
|
1060
|
-
),
|
|
1061
|
-
tt
|
|
1062
|
-
] }) : /* @__PURE__ */ b(Ee, { children: [
|
|
1063
|
-
/* @__PURE__ */ b(
|
|
1064
|
-
"div",
|
|
1065
|
-
{
|
|
1066
|
-
tabIndex: -1,
|
|
1067
|
-
...ve,
|
|
1068
|
-
...nt,
|
|
1069
|
-
ref: pe,
|
|
1070
|
-
className: ut({ variant: M, className: O }),
|
|
1071
|
-
children: [
|
|
1072
|
-
/* @__PURE__ */ n(
|
|
1073
|
-
Ot,
|
|
1074
|
-
{
|
|
1075
|
-
title: be,
|
|
1076
|
-
icon: /* @__PURE__ */ n(dt, { "aria-hidden": "true" }),
|
|
1077
|
-
sticky: !0,
|
|
1078
|
-
divider: !0
|
|
1079
|
-
}
|
|
1080
|
-
),
|
|
1081
|
-
et,
|
|
1082
|
-
Ve ? /* @__PURE__ */ n("div", { className: "ds:relative ds:z-[var(--z-sticky)] ds:shrink-0 ds:border-t ds:border-[color:var(--border)] ds:bg-[var(--background)]", children: /* @__PURE__ */ n("div", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: Ve }) }) : null
|
|
1083
|
-
]
|
|
1084
|
-
}
|
|
1085
|
-
),
|
|
1086
|
-
tt
|
|
1087
|
-
] });
|
|
1088
|
-
}
|
|
1089
|
-
);
|
|
1090
|
-
pn.displayName = "TaskEditor";
|
|
1091
|
-
export {
|
|
1092
|
-
pn as T,
|
|
1093
|
-
rn as t
|
|
1094
|
-
};
|
|
1095
|
-
//# sourceMappingURL=task-editor-B9YpfwcW.js.map
|