@tellescope/react-components 1.249.0 → 1.249.2
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/lib/cjs/Forms/forms.d.ts.map +1 -1
- package/lib/cjs/Forms/forms.js +13 -5
- package/lib/cjs/Forms/forms.js.map +1 -1
- package/lib/cjs/Forms/forms.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/forms.v2.js +13 -5
- package/lib/cjs/Forms/forms.v2.js.map +1 -1
- package/lib/cjs/Forms/hooks.d.ts +2 -1
- package/lib/cjs/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/hooks.js +50 -27
- package/lib/cjs/Forms/hooks.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts +19 -4
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +224 -173
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/Forms/inputs.v2.d.ts +7 -3
- package/lib/cjs/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.v2.js +42 -32
- package/lib/cjs/Forms/inputs.v2.js.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioControls.d.ts.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioControls.js +12 -2
- package/lib/cjs/TwilioVideo/TwilioControls.js.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioLocalPreview.d.ts.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioLocalPreview.js +154 -2
- package/lib/cjs/TwilioVideo/TwilioLocalPreview.js.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioVideoContext.d.ts +7 -0
- package/lib/cjs/TwilioVideo/TwilioVideoContext.d.ts.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioVideoContext.js +148 -1
- package/lib/cjs/TwilioVideo/TwilioVideoContext.js.map +1 -1
- package/lib/esm/CMS/components.d.ts +0 -1
- package/lib/esm/CMS/components.d.ts.map +1 -1
- package/lib/esm/Forms/forms.d.ts +3 -3
- package/lib/esm/Forms/forms.d.ts.map +1 -1
- package/lib/esm/Forms/forms.js +13 -5
- package/lib/esm/Forms/forms.js.map +1 -1
- package/lib/esm/Forms/forms.v2.d.ts +3 -3
- package/lib/esm/Forms/forms.v2.d.ts.map +1 -1
- package/lib/esm/Forms/forms.v2.js +13 -5
- package/lib/esm/Forms/forms.v2.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts +2 -1
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/hooks.js +50 -27
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +21 -6
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +69 -20
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/Forms/inputs.native.d.ts +0 -1
- package/lib/esm/Forms/inputs.native.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.v2.d.ts +7 -3
- package/lib/esm/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.v2.js +27 -17
- package/lib/esm/Forms/inputs.v2.js.map +1 -1
- package/lib/esm/TwilioVideo/TwilioControls.d.ts.map +1 -1
- package/lib/esm/TwilioVideo/TwilioControls.js +14 -4
- package/lib/esm/TwilioVideo/TwilioControls.js.map +1 -1
- package/lib/esm/TwilioVideo/TwilioLocalPreview.d.ts.map +1 -1
- package/lib/esm/TwilioVideo/TwilioLocalPreview.js +155 -3
- package/lib/esm/TwilioVideo/TwilioLocalPreview.js.map +1 -1
- package/lib/esm/TwilioVideo/TwilioVideoContext.d.ts +7 -0
- package/lib/esm/TwilioVideo/TwilioVideoContext.d.ts.map +1 -1
- package/lib/esm/TwilioVideo/TwilioVideoContext.js +146 -0
- package/lib/esm/TwilioVideo/TwilioVideoContext.js.map +1 -1
- package/lib/esm/TwilioVideo/hooks.d.ts +1 -1
- package/lib/esm/controls.d.ts +2 -2
- package/lib/esm/inputs.d.ts +1 -1
- package/lib/esm/inputs.native.d.ts +0 -1
- package/lib/esm/inputs.native.d.ts.map +1 -1
- package/lib/esm/state.d.ts +330 -330
- package/lib/esm/theme.native.d.ts +0 -1
- package/lib/esm/theme.native.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -10
- package/src/Forms/forms.tsx +18 -2
- package/src/Forms/forms.v2.tsx +18 -2
- package/src/Forms/hooks.tsx +69 -32
- package/src/Forms/inputs.tsx +143 -18
- package/src/Forms/inputs.v2.tsx +58 -8
- package/src/TwilioVideo/TwilioControls.tsx +27 -1
- package/src/TwilioVideo/TwilioLocalPreview.tsx +136 -1
- package/src/TwilioVideo/TwilioVideoContext.tsx +126 -0
package/lib/esm/Forms/inputs.js
CHANGED
|
@@ -69,6 +69,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
69
69
|
}
|
|
70
70
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
71
71
|
};
|
|
72
|
+
import { createElement as _createElement } from "react";
|
|
72
73
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
73
74
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
74
75
|
import axios from "axios";
|
|
@@ -82,7 +83,7 @@ import Slider from '@mui/material/Slider';
|
|
|
82
83
|
import LinearProgress from '@mui/material/LinearProgress';
|
|
83
84
|
import DatePicker from "react-datepicker";
|
|
84
85
|
import { datepickerCSS } from "./css/react-datepicker"; // avoids build issue with RN
|
|
85
|
-
import { CancelIcon, IconButton, LabeledIconButton, LoadingButton, form_display_text_for_language, isDateString, useResolvedSession } from "..";
|
|
86
|
+
import { CancelIcon, IconButton, LabeledIconButton, LoadingButton, form_display_text_for_language, isDateString, useFiles, useResolvedSession, value_is_loaded } from "..";
|
|
86
87
|
import { css } from '@emotion/css';
|
|
87
88
|
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
|
|
88
89
|
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
|
|
@@ -435,8 +436,11 @@ export var InsuranceInput = function (_a) {
|
|
|
435
436
|
return function () { clearTimeout(t); };
|
|
436
437
|
}, [session, (_d = field === null || field === void 0 ? void 0 : field.options) === null || _d === void 0 ? void 0 : _d.dataSource, query]);
|
|
437
438
|
return (_jsxs(Grid, __assign({ container: true, spacing: 2, sx: { mt: '0' } }, { children: [_jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(Autocomplete, { freeSolo: !((_e = field.options) === null || _e === void 0 ? void 0 : _e.requirePredefinedInsurer), options: payers.map(function (p) { return p.name; }), value: (value === null || value === void 0 ? void 0 : value.payerName) || '', onChange: function (e, v) {
|
|
438
|
-
var
|
|
439
|
-
|
|
439
|
+
var matched = payers.find(function (p) { return p.name === v; });
|
|
440
|
+
if (matched === null || matched === void 0 ? void 0 : matched.databaseRecord) {
|
|
441
|
+
onDatabaseSelect === null || onDatabaseSelect === void 0 ? void 0 : onDatabaseSelect([matched.databaseRecord]);
|
|
442
|
+
}
|
|
443
|
+
onChange(__assign(__assign({}, value), { payerName: v || '', payerId: (matched === null || matched === void 0 ? void 0 : matched.id) || '', payerType: (matched === null || matched === void 0 ? void 0 : matched.type) || '' }), field.id);
|
|
440
444
|
}, onInputChange: ((_f = field.options) === null || _f === void 0 ? void 0 : _f.requirePredefinedInsurer)
|
|
441
445
|
? function (e, v) { if (v) {
|
|
442
446
|
setQuery(v);
|
|
@@ -1235,11 +1239,47 @@ export function convertHEIC(file) {
|
|
|
1235
1239
|
}
|
|
1236
1240
|
;
|
|
1237
1241
|
var value_is_image = function (f) { var _a; return (_a = f === null || f === void 0 ? void 0 : f.type) === null || _a === void 0 ? void 0 : _a.includes('image'); };
|
|
1242
|
+
var fileMatchesValidTypes = function (file, validFileTypes) {
|
|
1243
|
+
if (!(validFileTypes === null || validFileTypes === void 0 ? void 0 : validFileTypes.length))
|
|
1244
|
+
return true;
|
|
1245
|
+
if (!file.type)
|
|
1246
|
+
return false;
|
|
1247
|
+
return !!validFileTypes.find(function (t) { return file.type.includes(t.toLowerCase()); });
|
|
1248
|
+
};
|
|
1249
|
+
export var ExistingFilePicker = function (_a) {
|
|
1250
|
+
var enduserId = _a.enduserId, excludedSecureNames = _a.excludedSecureNames, validFileTypes = _a.validFileTypes, onSelect = _a.onSelect, form = _a.form, label = _a.label;
|
|
1251
|
+
var session = useResolvedSession();
|
|
1252
|
+
var isEnduserSession = session.type === 'enduser';
|
|
1253
|
+
var _b = useFiles({
|
|
1254
|
+
loadFilter: { enduserId: enduserId },
|
|
1255
|
+
dontFetch: !enduserId || isEnduserSession,
|
|
1256
|
+
}), getFiltered = _b[1].filtered;
|
|
1257
|
+
var filesLoading = getFiltered(function (e) { return (!!enduserId) && (e.enduserId === enduserId); });
|
|
1258
|
+
var filtered = useMemo(function () {
|
|
1259
|
+
if (!value_is_loaded(filesLoading))
|
|
1260
|
+
return [];
|
|
1261
|
+
return filesLoading.value.filter(function (f) { return (!!f.confirmedAt
|
|
1262
|
+
&& fileMatchesValidTypes(f, validFileTypes)
|
|
1263
|
+
&& !(excludedSecureNames === null || excludedSecureNames === void 0 ? void 0 : excludedSecureNames.includes(f.secureName))); });
|
|
1264
|
+
}, [filesLoading, validFileTypes, excludedSecureNames]);
|
|
1265
|
+
// Only available in User (staff) sessions — endusers must upload.
|
|
1266
|
+
if (isEnduserSession)
|
|
1267
|
+
return null;
|
|
1268
|
+
if (!enduserId)
|
|
1269
|
+
return null;
|
|
1270
|
+
if (filtered.length === 0)
|
|
1271
|
+
return null;
|
|
1272
|
+
return (_jsx(Grid, __assign({ item: true, sx: { mt: 1 } }, { children: _jsx(Autocomplete, { size: "small", options: filtered, getOptionLabel: function (f) { return f.name; }, renderOption: function (props, option) { return (_createElement("li", __assign({}, props, { key: option.id }),
|
|
1273
|
+
_jsxs(Grid, __assign({ container: true, direction: "column" }, { children: [_jsx(Typography, __assign({ sx: { fontSize: 14 } }, { children: option.name })), option.timestamp && (_jsx(Typography, __assign({ sx: { fontSize: 12, color: '#666' } }, { children: new Date(option.timestamp).toLocaleDateString() })))] })))); }, onChange: function (_, value) {
|
|
1274
|
+
if (value)
|
|
1275
|
+
onSelect(value);
|
|
1276
|
+
}, value: null, blurOnSelect: true, clearOnBlur: true, renderInput: function (params) { return (_jsx(TextField, __assign({}, params, { label: label || form_display_text_for_language(form, "Or select an existing file from this patient") }))); } }) })));
|
|
1277
|
+
};
|
|
1238
1278
|
export var FileInput = function (_a) {
|
|
1239
|
-
var _b;
|
|
1240
|
-
var value = _a.value, onChange = _a.onChange, field = _a.field, existingFileName = _a.existingFileName, uploadingFiles = _a.uploadingFiles, handleFileUpload = _a.handleFileUpload, setUploadingFiles = _a.setUploadingFiles, form = _a.form;
|
|
1241
|
-
var
|
|
1242
|
-
var
|
|
1279
|
+
var _b, _d;
|
|
1280
|
+
var value = _a.value, onChange = _a.onChange, field = _a.field, existingFileName = _a.existingFileName, uploadingFiles = _a.uploadingFiles, handleFileUpload = _a.handleFileUpload, setUploadingFiles = _a.setUploadingFiles, form = _a.form, enduserId = _a.enduserId, onSelectExistingFile = _a.onSelectExistingFile;
|
|
1281
|
+
var _e = useState(''), error = _e[0], setError = _e[1];
|
|
1282
|
+
var _f = useDropzone({
|
|
1243
1283
|
onDrop: useCallback(function (acceptedFiles) {
|
|
1244
1284
|
var _a, _b, _d, _e;
|
|
1245
1285
|
var file = acceptedFiles.pop();
|
|
@@ -1262,8 +1302,8 @@ export var FileInput = function (_a) {
|
|
|
1262
1302
|
.finally(function () { return setUploadingFiles === null || setUploadingFiles === void 0 ? void 0 : setUploadingFiles(function (fs) { return fs.filter(function (f) { return f.fieldId !== field.id; }); }); });
|
|
1263
1303
|
}
|
|
1264
1304
|
}, [onChange, (_b = field.options) === null || _b === void 0 ? void 0 : _b.validFileTypes, handleFileUpload, setUploadingFiles]),
|
|
1265
|
-
}), getRootProps =
|
|
1266
|
-
var
|
|
1305
|
+
}), getRootProps = _f.getRootProps, getInputProps = _f.getInputProps, isDragActive = _f.isDragActive;
|
|
1306
|
+
var _g = useState(''), preview = _g[0], setPreview = _g[1];
|
|
1267
1307
|
useEffect(function () {
|
|
1268
1308
|
if (!value_is_image(value))
|
|
1269
1309
|
return;
|
|
@@ -1298,7 +1338,10 @@ export var FileInput = function (_a) {
|
|
|
1298
1338
|
: capture_is_supported()
|
|
1299
1339
|
? (_jsxs(Grid, __assign({ container: true, direction: "column", alignItems: "center" }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsx(AddPhotoAlternateIcon, { color: "primary" }) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ sx: { fontSize: 14, textAlign: 'center' } }, { children: form_display_text_for_language(form, "Select file or take picture") })) }))] })))
|
|
1300
1340
|
: form_display_text_for_language(form, "Select a File") })] })), _jsx(Grid, __assign({ item: true, alignSelf: "center", sx: { mt: 0.5 } }, { children: (!(value === null || value === void 0 ? void 0 : value.name) && existingFileName) &&
|
|
1301
|
-
_jsxs(Typography, { children: [existingFileName, " selected!"] }) })),
|
|
1341
|
+
_jsxs(Typography, { children: [existingFileName, " selected!"] }) })), !value && onSelectExistingFile && (_jsx(ExistingFilePicker, { enduserId: enduserId, validFileTypes: (_d = field.options) === null || _d === void 0 ? void 0 : _d.validFileTypes, form: form, onSelect: function (file) {
|
|
1342
|
+
setError('');
|
|
1343
|
+
onSelectExistingFile({ secureName: file.secureName, name: file.name, type: file.type });
|
|
1344
|
+
} })), error &&
|
|
1302
1345
|
_jsx(Grid, __assign({ item: true, alignSelf: "center", sx: { mt: 0.5 } }, { children: _jsx(Typography, __assign({ color: "error" }, { children: error })) }))] })));
|
|
1303
1346
|
};
|
|
1304
1347
|
export var safe_create_url = function (file) {
|
|
@@ -1311,10 +1354,12 @@ export var safe_create_url = function (file) {
|
|
|
1311
1354
|
}
|
|
1312
1355
|
};
|
|
1313
1356
|
export var FilesInput = function (_a) {
|
|
1314
|
-
var _b;
|
|
1315
|
-
var value = _a.value, onChange = _a.onChange, field = _a.field, existingFileName = _a.existingFileName, uploadingFiles = _a.uploadingFiles, handleFileUpload = _a.handleFileUpload, setUploadingFiles = _a.setUploadingFiles, form = _a.form;
|
|
1316
|
-
var
|
|
1317
|
-
var
|
|
1357
|
+
var _b, _d;
|
|
1358
|
+
var value = _a.value, onChange = _a.onChange, field = _a.field, existingFileName = _a.existingFileName, uploadingFiles = _a.uploadingFiles, handleFileUpload = _a.handleFileUpload, setUploadingFiles = _a.setUploadingFiles, form = _a.form, enduserId = _a.enduserId, existingSelections = _a.existingSelections, onSelectExistingFile = _a.onSelectExistingFile, onRemoveExistingFile = _a.onRemoveExistingFile;
|
|
1359
|
+
var _e = useState(''), error = _e[0], setError = _e[1];
|
|
1360
|
+
var safeExistingSelections = Array.isArray(existingSelections) ? existingSelections : undefined;
|
|
1361
|
+
var excludedSecureNames = useMemo(function () { return (safeExistingSelections === null || safeExistingSelections === void 0 ? void 0 : safeExistingSelections.map(function (s) { return s.secureName; })); }, [safeExistingSelections]);
|
|
1362
|
+
var _f = useDropzone({
|
|
1318
1363
|
onDrop: useCallback(function (acceptedFiles) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1319
1364
|
var _loop_1, _a, acceptedFiles_1, file, state_1;
|
|
1320
1365
|
var _b, _d, _e;
|
|
@@ -1364,7 +1409,7 @@ export var FilesInput = function (_a) {
|
|
|
1364
1409
|
}
|
|
1365
1410
|
});
|
|
1366
1411
|
}); }, [onChange, value, (_b = field.options) === null || _b === void 0 ? void 0 : _b.validFileTypes, handleFileUpload, setUploadingFiles]),
|
|
1367
|
-
}), getRootProps =
|
|
1412
|
+
}), getRootProps = _f.getRootProps, getInputProps = _f.getInputProps, isDragActive = _f.isDragActive;
|
|
1368
1413
|
var previews = useMemo(function () { return ((value !== null && value !== void 0 ? value : []).map(function (v) {
|
|
1369
1414
|
return value_is_image(v) ? safe_create_url(v) : null;
|
|
1370
1415
|
})); }, [value]);
|
|
@@ -1384,11 +1429,15 @@ export var FilesInput = function (_a) {
|
|
|
1384
1429
|
? form_display_text_for_language(form, "Drop to select files")
|
|
1385
1430
|
: capture_is_supported()
|
|
1386
1431
|
? (_jsxs(Grid, __assign({ container: true, direction: "column", alignItems: "center" }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsx(AddPhotoAlternateIcon, { color: "primary" }) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ sx: { fontSize: 14, textAlign: 'center' } }, { children: form_display_text_for_language(form, "Select files or take pictures") })) }))] })))
|
|
1387
|
-
: form_display_text_for_language(form, "Select Files") })] })),
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1432
|
+
: form_display_text_for_language(form, "Select Files") })] })), _jsxs(Grid, __assign({ container: true, direction: "column", sx: { overflowY: 'auto', maxHeight: '250px', mt: 1 }, wrap: "nowrap" }, { children: [value === null || value === void 0 ? void 0 : value.map(function (file, i) {
|
|
1433
|
+
var _a;
|
|
1434
|
+
return (_jsx(Grid, __assign({ item: true, sx: { mt: 0.5 } }, { children: _jsxs(Grid, __assign({ container: true, alignItems: "center", justifyContent: "space-between", wrap: "nowrap" }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsxs(Grid, __assign({ container: true, alignItems: "center" }, { children: [_jsx(Typography, __assign({ sx: { mr: 1 } }, { children: file.name })), ((_a = file.type) === null || _a === void 0 ? void 0 : _a.includes('image')) && previews[i] &&
|
|
1435
|
+
_jsx(Grid, __assign({ item: true }, { children: _jsx("img", { src: previews[i], style: { maxWidth: '45%', maxHeight: 80, height: '100%' } }) }))] })) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(LabeledIconButton, { label: form_display_text_for_language(form, "Remove"), Icon: Delete, onClick: function () { return onChange(value.filter(function (f, _i) { return i !== _i; }), field.id); } }) }))] })) }), i));
|
|
1436
|
+
}), safeExistingSelections === null || safeExistingSelections === void 0 ? void 0 : safeExistingSelections.map(function (selection, i) { return (_jsx(Grid, __assign({ item: true, sx: { mt: 0.5 } }, { children: _jsxs(Grid, __assign({ container: true, alignItems: "center", justifyContent: "space-between", wrap: "nowrap" }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ sx: { mr: 1 } }, { children: selection.name })) })), onRemoveExistingFile &&
|
|
1437
|
+
_jsx(Grid, __assign({ item: true }, { children: _jsx(LabeledIconButton, { label: form_display_text_for_language(form, "Remove"), Icon: Delete, onClick: function () { return onRemoveExistingFile(selection.secureName); } }) }))] })) }), "existing-".concat(selection.secureName, "-").concat(i))); })] })), onSelectExistingFile && (_jsx(ExistingFilePicker, { enduserId: enduserId, excludedSecureNames: excludedSecureNames, validFileTypes: (_d = field.options) === null || _d === void 0 ? void 0 : _d.validFileTypes, form: form, onSelect: function (file) {
|
|
1438
|
+
setError('');
|
|
1439
|
+
onSelectExistingFile({ secureName: file.secureName, name: file.name, type: file.type });
|
|
1440
|
+
} })), error &&
|
|
1392
1441
|
_jsx(Grid, __assign({ item: true, alignSelf: "center", sx: { mt: 0.5 } }, { children: _jsx(Typography, __assign({ color: "error" }, { children: error })) }))] })));
|
|
1393
1442
|
};
|
|
1394
1443
|
var multipleChoiceItemSx = {
|