@tellescope/react-components 1.249.1 → 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 +49 -26
- 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/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.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 +49 -26
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +19 -4
- 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.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/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 +67 -30
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { SxProps, TextFieldProps } from "@mui/material";
|
|
3
3
|
import { FormInputProps } from "./types";
|
|
4
|
-
import { Enduser, FormResponseValue } from "@tellescope/types-models";
|
|
4
|
+
import { Enduser, FormResponseAnswerFileValue, FormResponseValue } from "@tellescope/types-models";
|
|
5
5
|
import { FileBlob, Styled } from "..";
|
|
6
6
|
import { FormField } from "@tellescope/types-client";
|
|
7
7
|
export declare const LanguageSelect: ({ value, ...props }: {
|
|
@@ -40,12 +40,16 @@ export declare const AddressInput: ({ field, form, value, onChange, ...props }:
|
|
|
40
40
|
export declare const ESignatureTerms: () => JSX.Element;
|
|
41
41
|
export declare const SignatureInput: ({ value, field, autoFocus, enduser, onChange, form }: FormInputProps<'signature'>) => JSX.Element;
|
|
42
42
|
export declare function convertHEIC(file: FileBlob | string): Promise<string>;
|
|
43
|
-
export declare const FileInput: ({ value, onChange, field, existingFileName, uploadingFiles, handleFileUpload, setUploadingFiles, form }: FormInputProps<"file"> & {
|
|
43
|
+
export declare const FileInput: ({ value, onChange, field, existingFileName, uploadingFiles, handleFileUpload, setUploadingFiles, form, enduserId, onSelectExistingFile }: FormInputProps<"file"> & {
|
|
44
44
|
existingFileName?: string | undefined;
|
|
45
|
+
onSelectExistingFile?: ((value: FormResponseAnswerFileValue) => void) | undefined;
|
|
45
46
|
}) => JSX.Element;
|
|
46
47
|
export declare const safe_create_url: (file: any) => string | null;
|
|
47
|
-
export declare const FilesInput: ({ value, onChange, field, existingFileName, uploadingFiles, handleFileUpload, setUploadingFiles, form }: FormInputProps<"files"> & {
|
|
48
|
+
export declare const FilesInput: ({ value, onChange, field, existingFileName, uploadingFiles, handleFileUpload, setUploadingFiles, form, enduserId, existingSelections, onSelectExistingFile, onRemoveExistingFile }: FormInputProps<"files"> & {
|
|
48
49
|
existingFileName?: string | undefined;
|
|
50
|
+
existingSelections?: FormResponseAnswerFileValue[] | undefined;
|
|
51
|
+
onSelectExistingFile?: ((value: FormResponseAnswerFileValue) => void) | undefined;
|
|
52
|
+
onRemoveExistingFile?: ((secureName: string) => void) | undefined;
|
|
49
53
|
}) => JSX.Element;
|
|
50
54
|
export declare const MultipleChoiceInput: ({ field, form, value: _value, onChange, responses, enduser }: FormInputProps<'multiple_choice'>) => JSX.Element;
|
|
51
55
|
export { StripeInput } from './inputs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputs.v2.d.ts","sourceRoot":"","sources":["../../../src/Forms/inputs.v2.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwE,MAAM,OAAO,CAAA;AAE5F,OAAO,EAAmH,OAAO,EAAa,cAAc,EAAc,MAAM,eAAe,CAAA;AAC/L,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIxC,OAAO,EAAE,OAAO,EAAuB,iBAAiB,EAAqG,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"inputs.v2.d.ts","sourceRoot":"","sources":["../../../src/Forms/inputs.v2.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwE,MAAM,OAAO,CAAA;AAE5F,OAAO,EAAmH,OAAO,EAAa,cAAc,EAAc,MAAM,eAAe,CAAA;AAC/L,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIxC,OAAO,EAAE,OAAO,EAAuB,2BAA2B,EAAE,iBAAiB,EAAqG,MAAM,0BAA0B,CAAA;AAO1N,OAAO,EAAc,QAAQ,EAAgD,MAAM,EAAoE,MAAM,IAAI,CAAA;AACjK,OAAO,EAAiC,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAanF,eAAO,MAAM,cAAc;WAAkC,MAAM;kBAAgB,MAAM,KAAK,IAAI;iBAgBjG,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE;IAAE,EAAE,EAAE,OAAO,CAAA;CAgB3C,CAAA;AACF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,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AAe,kBAAkB,CAAC,gBAiL9I,CAAA;AAGD,eAAO,MAAM,uBAAuB,UAAW,eAAe,qBAAqB,CAAC,gBAEnF,CAAA;AAED,eAAO,MAAM,WAAW,+CAA0D,eAAe,QAAQ,CAAC,gBAezG,CAAA;AAGD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE1D,eAAO,MAAM,WAAW,iGAAkG,eAAe,OAAO,CAAC,gBA8ChJ,CAAA;AAMD,eAAO,MAAM,cAAc,iGAAkG,eAAe,WAAW,CAAC,gBAqHvJ,CAAA;AAGD,eAAO,MAAM,eAAe,iGAAkG,eAAe,YAAY,CAAC,gBAsDzJ,CAAA;AAED,eAAO,MAAM,aAAa,+BAAgC,eAAe,WAAW,CAAC,gBAEpF,CAAA;AAGD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -121,6 +121,7 @@ var Language_1 = __importDefault(require("@mui/icons-material/Language"));
|
|
|
121
121
|
var icons_material_1 = require("@mui/icons-material");
|
|
122
122
|
var wysiwyg_1 = require("./wysiwyg");
|
|
123
123
|
var hooks_1 = require("./hooks");
|
|
124
|
+
var inputs_1 = require("./inputs");
|
|
124
125
|
var LanguageSelect = function (_a) {
|
|
125
126
|
var value = _a.value, props = __rest(_a, ["value"]);
|
|
126
127
|
return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, alignItems: "center", justifyContent: "center", wrap: "nowrap", spacing: 1 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(Language_1.default, { color: "primary" }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, style: { width: 150 } }, { children: (0, jsx_runtime_1.jsx)(StringSelector, __assign({}, props, { options: ["English", "Español"], size: "small", value: value === 'Spanish' ? 'Español' : value, label: (value === 'Español' || value === 'Spanish') ? 'Idioma'
|
|
@@ -377,25 +378,25 @@ var NumberInput = function (_a) {
|
|
|
377
378
|
};
|
|
378
379
|
exports.NumberInput = NumberInput;
|
|
379
380
|
// InsuranceInput, BridgeEligibilityInput, PharmacySearchInput, and AppointmentBookingInput logic is shared with inputs.tsx to avoid duplication
|
|
380
|
-
var
|
|
381
|
+
var inputs_2 = require("./inputs");
|
|
381
382
|
// Wrap the shared InsuranceInput component with v2-specific props
|
|
382
383
|
var InsuranceInput = function (props) {
|
|
383
|
-
return (0, jsx_runtime_1.jsx)(
|
|
384
|
+
return (0, jsx_runtime_1.jsx)(inputs_2.InsuranceInput, __assign({}, props, { inputProps: exports.defaultInputProps }));
|
|
384
385
|
};
|
|
385
386
|
exports.InsuranceInput = InsuranceInput;
|
|
386
387
|
// Wrap the shared BridgeEligibilityInput component with v2-specific props
|
|
387
388
|
var BridgeEligibilityInput = function (props) {
|
|
388
|
-
return (0, jsx_runtime_1.jsx)(
|
|
389
|
+
return (0, jsx_runtime_1.jsx)(inputs_2.BridgeEligibilityInput, __assign({}, props, { inputProps: exports.defaultInputProps }));
|
|
389
390
|
};
|
|
390
391
|
exports.BridgeEligibilityInput = BridgeEligibilityInput;
|
|
391
392
|
// Wrap the shared CandidEligibilityInput component with v2-specific props
|
|
392
393
|
var CandidEligibilityInput = function (props) {
|
|
393
|
-
return (0, jsx_runtime_1.jsx)(
|
|
394
|
+
return (0, jsx_runtime_1.jsx)(inputs_2.CandidEligibilityInput, __assign({}, props, { inputProps: exports.defaultInputProps }));
|
|
394
395
|
};
|
|
395
396
|
exports.CandidEligibilityInput = CandidEligibilityInput;
|
|
396
397
|
// Wrap the shared PharmacySearchInput component with v2-specific props
|
|
397
398
|
var PharmacySearchInput = function (props) {
|
|
398
|
-
return (0, jsx_runtime_1.jsx)(
|
|
399
|
+
return (0, jsx_runtime_1.jsx)(inputs_2.PharmacySearchInput, __assign({}, props));
|
|
399
400
|
};
|
|
400
401
|
exports.PharmacySearchInput = PharmacySearchInput;
|
|
401
402
|
var StringSelector = function (_a) {
|
|
@@ -541,10 +542,10 @@ exports.convertHEIC = convertHEIC;
|
|
|
541
542
|
;
|
|
542
543
|
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'); };
|
|
543
544
|
var FileInput = function (_a) {
|
|
544
|
-
var _b;
|
|
545
|
-
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;
|
|
546
|
-
var
|
|
547
|
-
var
|
|
545
|
+
var _b, _d;
|
|
546
|
+
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;
|
|
547
|
+
var _e = (0, react_1.useState)(''), error = _e[0], setError = _e[1];
|
|
548
|
+
var _f = (0, react_dropzone_1.useDropzone)({
|
|
548
549
|
onDrop: (0, react_1.useCallback)(function (acceptedFiles) {
|
|
549
550
|
var _a, _b, _d, _e;
|
|
550
551
|
var file = acceptedFiles.pop();
|
|
@@ -567,8 +568,8 @@ var FileInput = function (_a) {
|
|
|
567
568
|
.finally(function () { return setUploadingFiles === null || setUploadingFiles === void 0 ? void 0 : setUploadingFiles(function (fs) { return fs.filter(function (f) { return f.fieldId !== field.id; }); }); });
|
|
568
569
|
}
|
|
569
570
|
}, [onChange, (_b = field.options) === null || _b === void 0 ? void 0 : _b.validFileTypes, handleFileUpload, setUploadingFiles]),
|
|
570
|
-
}), getRootProps =
|
|
571
|
-
var
|
|
571
|
+
}), getRootProps = _f.getRootProps, getInputProps = _f.getInputProps, isDragActive = _f.isDragActive;
|
|
572
|
+
var _g = (0, react_1.useState)(''), preview = _g[0], setPreview = _g[1];
|
|
572
573
|
(0, react_1.useEffect)(function () {
|
|
573
574
|
if (!value_is_image(value))
|
|
574
575
|
return;
|
|
@@ -602,7 +603,10 @@ var FileInput = function (_a) {
|
|
|
602
603
|
: (0, utilities_1.capture_is_supported)()
|
|
603
604
|
? ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(AddPhotoAlternate_1.default, { color: "primary" }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { fontSize: 14, textAlign: 'center' } }, { children: (0, __1.form_display_text_for_language)(form, "Select file or take picture") })) }))] })))
|
|
604
605
|
: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", alignItems: "center", rowGap: 2 }, { children: [(0, jsx_runtime_1.jsx)(icons_material_1.UploadFile, { color: "primary", sx: { fontSize: 25 } }), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: isDragActive ? (0, __1.form_display_text_for_language)(form, "Drop to select file") : (0, __1.form_display_text_for_language)(form, "Click or drag and drop") })] })) })] })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, alignSelf: "center", sx: { mt: 0.5 } }, { children: (!(value === null || value === void 0 ? void 0 : value.name) && existingFileName) &&
|
|
605
|
-
(0, jsx_runtime_1.jsxs)(material_1.Typography, { children: [existingFileName, " selected!"] }) })),
|
|
606
|
+
(0, jsx_runtime_1.jsxs)(material_1.Typography, { children: [existingFileName, " selected!"] }) })), !value && onSelectExistingFile && ((0, jsx_runtime_1.jsx)(inputs_1.ExistingFilePicker, { enduserId: enduserId, validFileTypes: (_d = field.options) === null || _d === void 0 ? void 0 : _d.validFileTypes, form: form, onSelect: function (file) {
|
|
607
|
+
setError('');
|
|
608
|
+
onSelectExistingFile({ secureName: file.secureName, name: file.name, type: file.type });
|
|
609
|
+
} })), error &&
|
|
606
610
|
(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, alignSelf: "center", sx: { mt: 0.5 } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ color: "error" }, { children: error })) }))] })));
|
|
607
611
|
};
|
|
608
612
|
exports.FileInput = FileInput;
|
|
@@ -617,10 +621,12 @@ var safe_create_url = function (file) {
|
|
|
617
621
|
};
|
|
618
622
|
exports.safe_create_url = safe_create_url;
|
|
619
623
|
var FilesInput = function (_a) {
|
|
620
|
-
var _b;
|
|
621
|
-
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;
|
|
622
|
-
var
|
|
623
|
-
var
|
|
624
|
+
var _b, _d;
|
|
625
|
+
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;
|
|
626
|
+
var _e = (0, react_1.useState)(''), error = _e[0], setError = _e[1];
|
|
627
|
+
var safeExistingSelections = Array.isArray(existingSelections) ? existingSelections : undefined;
|
|
628
|
+
var excludedSecureNames = (0, react_1.useMemo)(function () { return (safeExistingSelections === null || safeExistingSelections === void 0 ? void 0 : safeExistingSelections.map(function (s) { return s.secureName; })); }, [safeExistingSelections]);
|
|
629
|
+
var _f = (0, react_dropzone_1.useDropzone)({
|
|
624
630
|
onDrop: (0, react_1.useCallback)(function (acceptedFiles) { return __awaiter(void 0, void 0, void 0, function () {
|
|
625
631
|
var _loop_1, _a, acceptedFiles_1, file, state_1;
|
|
626
632
|
var _b, _d, _e;
|
|
@@ -670,7 +676,7 @@ var FilesInput = function (_a) {
|
|
|
670
676
|
}
|
|
671
677
|
});
|
|
672
678
|
}); }, [onChange, value, (_b = field.options) === null || _b === void 0 ? void 0 : _b.validFileTypes, handleFileUpload, setUploadingFiles]),
|
|
673
|
-
}), getRootProps =
|
|
679
|
+
}), getRootProps = _f.getRootProps, getInputProps = _f.getInputProps, isDragActive = _f.isDragActive;
|
|
674
680
|
var previews = (0, react_1.useMemo)(function () { return ((value !== null && value !== void 0 ? value : []).map(function (v) {
|
|
675
681
|
return value_is_image(v) ? (0, exports.safe_create_url)(v) : null;
|
|
676
682
|
})); }, [value]);
|
|
@@ -688,11 +694,15 @@ var FilesInput = function (_a) {
|
|
|
688
694
|
}
|
|
689
695
|
}, alignItems: "center", justifyContent: "center" }, { children: [(0, jsx_runtime_1.jsx)("input", __assign({}, getInputProps({ multiple: false }))), (0, jsx_runtime_1.jsx)("p", { children: (0, utilities_1.capture_is_supported)()
|
|
690
696
|
? ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(AddPhotoAlternate_1.default, { color: "primary" }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { fontSize: 14, textAlign: 'center' } }, { children: (0, __1.form_display_text_for_language)(form, "Select files or take pictures") })) }))] })))
|
|
691
|
-
: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", alignItems: "center", rowGap: 2 }, { children: [(0, jsx_runtime_1.jsx)(icons_material_1.UploadFile, { color: "primary", sx: { fontSize: 25 } }), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: isDragActive ? (0, __1.form_display_text_for_language)(form, "Drop to select files") : (0, __1.form_display_text_for_language)(form, "Click or drag and drop") })] })) })] })), (0, jsx_runtime_1.
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
697
|
+
: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", alignItems: "center", rowGap: 2 }, { children: [(0, jsx_runtime_1.jsx)(icons_material_1.UploadFile, { color: "primary", sx: { fontSize: 25 } }), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: isDragActive ? (0, __1.form_display_text_for_language)(form, "Drop to select files") : (0, __1.form_display_text_for_language)(form, "Click or drag and drop") })] })) })] })), (0, jsx_runtime_1.jsxs)(material_1.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) {
|
|
698
|
+
var _a;
|
|
699
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, sx: { mt: 0.5 } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, alignItems: "center", justifyContent: "space-between", wrap: "nowrap" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { mr: 1 } }, { children: file.name })), ((_a = file.type) === null || _a === void 0 ? void 0 : _a.includes('image')) && previews[i] &&
|
|
700
|
+
(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)("img", { src: previews[i], style: { maxWidth: '45%', maxHeight: 80, height: '100%' } }) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(__1.LabeledIconButton, { label: (0, __1.form_display_text_for_language)(form, "Remove"), Icon: icons_material_1.Delete, onClick: function () { return onChange(value.filter(function (f, _i) { return i !== _i; }), field.id); } }) }))] })) }), i));
|
|
701
|
+
}), existingSelections === null || existingSelections === void 0 ? void 0 : existingSelections.map(function (selection, i) { return ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, sx: { mt: 0.5 } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, alignItems: "center", justifyContent: "space-between", wrap: "nowrap" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { mr: 1 } }, { children: selection.name })) })), onRemoveExistingFile &&
|
|
702
|
+
(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(__1.LabeledIconButton, { label: (0, __1.form_display_text_for_language)(form, "Remove"), Icon: icons_material_1.Delete, onClick: function () { return onRemoveExistingFile(selection.secureName); } }) }))] })) }), "existing-".concat(selection.secureName, "-").concat(i))); })] })), onSelectExistingFile && ((0, jsx_runtime_1.jsx)(inputs_1.ExistingFilePicker, { enduserId: enduserId, excludedSecureNames: excludedSecureNames, validFileTypes: (_d = field.options) === null || _d === void 0 ? void 0 : _d.validFileTypes, form: form, onSelect: function (file) {
|
|
703
|
+
setError('');
|
|
704
|
+
onSelectExistingFile({ secureName: file.secureName, name: file.name, type: file.type });
|
|
705
|
+
} })), error &&
|
|
696
706
|
(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, alignSelf: "center", sx: { mt: 0.5 } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ color: "error" }, { children: error })) }))] })));
|
|
697
707
|
};
|
|
698
708
|
exports.FilesInput = FilesInput;
|
|
@@ -781,8 +791,8 @@ exports.MultipleChoiceInput = MultipleChoiceInput;
|
|
|
781
791
|
// Both versions use the same implementation from inputs.tsx to ensure consistent behavior
|
|
782
792
|
// and avoid code duplication. Re-exporting here maintains the pattern where forms.v2.tsx
|
|
783
793
|
// only imports from inputs.v2.tsx
|
|
784
|
-
var
|
|
785
|
-
Object.defineProperty(exports, "StripeInput", { enumerable: true, get: function () { return
|
|
794
|
+
var inputs_3 = require("./inputs");
|
|
795
|
+
Object.defineProperty(exports, "StripeInput", { enumerable: true, get: function () { return inputs_3.StripeInput; } });
|
|
786
796
|
var Progress = function (_a) {
|
|
787
797
|
var numerator = _a.numerator, denominator = _a.denominator, style = _a.style, color = _a.color;
|
|
788
798
|
return ((0, jsx_runtime_1.jsx)(material_1.Box, __assign({ sx: __assign({ display: 'flex', alignItems: 'center' }, style) }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ sx: { width: '100%' } }, { children: (0, jsx_runtime_1.jsx)(LinearProgress_1.default, { variant: "determinate", value: (numerator / (denominator || 1)) * 100, sx: color ? {
|
|
@@ -835,11 +845,11 @@ var DropdownInput = function (_a) {
|
|
|
835
845
|
exports.DropdownInput = DropdownInput;
|
|
836
846
|
// DatabaseSelectInput logic is shared with inputs.tsx to avoid duplication
|
|
837
847
|
// Import the interface and component from the shared implementation
|
|
838
|
-
var
|
|
848
|
+
var inputs_4 = require("./inputs");
|
|
839
849
|
// Wrap the shared DatabaseSelectInput component with v2-specific props
|
|
840
850
|
var DatabaseSelectInput = function (props) {
|
|
841
851
|
// Pass all props plus v2-specific defaultInputProps to the shared component
|
|
842
|
-
return (0, jsx_runtime_1.jsx)(
|
|
852
|
+
return (0, jsx_runtime_1.jsx)(inputs_4.DatabaseSelectInput, __assign({}, props, { inputProps: exports.defaultInputProps }));
|
|
843
853
|
};
|
|
844
854
|
exports.DatabaseSelectInput = DatabaseSelectInput;
|
|
845
855
|
var displayTermsCache = undefined;
|
|
@@ -1263,7 +1273,7 @@ var RelatedContactsInput = function (_a) {
|
|
|
1263
1273
|
exports.RelatedContactsInput = RelatedContactsInput;
|
|
1264
1274
|
// AppointmentBookingInput logic is shared with inputs.tsx to avoid duplication
|
|
1265
1275
|
var AppointmentBookingInput = function (props) {
|
|
1266
|
-
return (0, jsx_runtime_1.jsx)(
|
|
1276
|
+
return (0, jsx_runtime_1.jsx)(inputs_2.AppointmentBookingInput, __assign({}, props));
|
|
1267
1277
|
};
|
|
1268
1278
|
exports.AppointmentBookingInput = AppointmentBookingInput;
|
|
1269
1279
|
var HeightInput = function (_a) {
|
|
@@ -1273,9 +1283,9 @@ var HeightInput = function (_a) {
|
|
|
1273
1283
|
};
|
|
1274
1284
|
exports.HeightInput = HeightInput;
|
|
1275
1285
|
// Re-export from V1 to follow DRY principles
|
|
1276
|
-
var
|
|
1277
|
-
Object.defineProperty(exports, "RedirectInput", { enumerable: true, get: function () { return
|
|
1278
|
-
Object.defineProperty(exports, "HiddenValueInput", { enumerable: true, get: function () { return
|
|
1286
|
+
var inputs_5 = require("./inputs");
|
|
1287
|
+
Object.defineProperty(exports, "RedirectInput", { enumerable: true, get: function () { return inputs_5.RedirectInput; } });
|
|
1288
|
+
Object.defineProperty(exports, "HiddenValueInput", { enumerable: true, get: function () { return inputs_5.HiddenValueInput; } });
|
|
1279
1289
|
var EmotiiInput = function (_a) {
|
|
1280
1290
|
var goToNextField = _a.goToNextField, goToPreviousField = _a.goToPreviousField, field = _a.field, value = _a.value, onChange = _a.onChange, form = _a.form, formResponseId = _a.formResponseId, props = __rest(_a, ["goToNextField", "goToPreviousField", "field", "value", "onChange", "form", "formResponseId"]);
|
|
1281
1291
|
var session = (0, __1.useResolvedSession)();
|
|
@@ -1441,7 +1451,7 @@ var RichTextInput = function (_a) {
|
|
|
1441
1451
|
};
|
|
1442
1452
|
exports.RichTextInput = RichTextInput;
|
|
1443
1453
|
// Re-export from V1 to follow DRY principles
|
|
1444
|
-
var
|
|
1445
|
-
Object.defineProperty(exports, "ChargeebeeInput", { enumerable: true, get: function () { return
|
|
1454
|
+
var inputs_6 = require("./inputs");
|
|
1455
|
+
Object.defineProperty(exports, "ChargeebeeInput", { enumerable: true, get: function () { return inputs_6.ChargeebeeInput; } });
|
|
1446
1456
|
var templateObject_1, templateObject_2;
|
|
1447
1457
|
//# sourceMappingURL=inputs.v2.js.map
|