@tellescope/react-components 1.230.2 → 1.231.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Forms/forms.js +1 -1
- package/lib/cjs/Forms/forms.js.map +1 -1
- package/lib/cjs/Forms/forms.v2.js +3 -3
- package/lib/cjs/Forms/forms.v2.js.map +1 -1
- package/lib/cjs/Forms/hooks.d.ts +111 -3
- package/lib/cjs/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/hooks.js +30 -38
- package/lib/cjs/Forms/hooks.js.map +1 -1
- package/lib/cjs/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.v2.js +4 -31
- package/lib/cjs/Forms/inputs.v2.js.map +1 -1
- package/lib/esm/CMS/components.d.ts +1 -0
- package/lib/esm/CMS/components.d.ts.map +1 -1
- package/lib/esm/Forms/form_responses.d.ts +1 -0
- package/lib/esm/Forms/form_responses.d.ts.map +1 -1
- package/lib/esm/Forms/forms.d.ts +3 -3
- package/lib/esm/Forms/forms.js +1 -1
- 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.js +3 -3
- package/lib/esm/Forms/forms.v2.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts +112 -3
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/hooks.js +31 -39
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +1 -1
- package/lib/esm/Forms/inputs.v2.d.ts +1 -1
- package/lib/esm/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.v2.js +6 -33
- package/lib/esm/Forms/inputs.v2.js.map +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 +1 -0
- package/lib/esm/inputs.native.d.ts.map +1 -1
- package/lib/esm/state.d.ts +315 -315
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/forms.tsx +1 -1
- package/src/Forms/forms.v2.tsx +11 -11
- package/src/Forms/hooks.tsx +49 -62
- package/src/Forms/inputs.v2.tsx +13 -65
|
@@ -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,
|
|
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,EAAuJ,OAAO,EAAa,cAAc,EAAc,MAAM,eAAe,CAAA;AACnO,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIxC,OAAO,EAAmC,OAAO,EAAuB,iBAAiB,EAA6H,MAAM,0BAA0B,CAAA;AAOtP,OAAO,EAAc,QAAQ,EAAgD,MAAM,EAAiF,MAAM,IAAI,CAAA;AAC9K,OAAO,EAAiB,cAAc,EAAE,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,aAEvC,CAAA;AAED,eAAO,MAAM,SAAS;SAAiC,MAAM;;iBAoE5D,CAAA;AAED,eAAO,MAAM,WAAW,+BAAgC,eAAe,QAAQ,CAAC,gBA0B/E,CAAA;AAkCD,eAAO,MAAM,YAAY,+BAAgC,eAAe,SAAS,CAAC,gBAuDjF,CAAA;AAOD,eAAO,MAAM,SAAS;WAGb,SAAS;;mDAoBjB,CAAA;AAED,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,WAAW,CAAC,gBAEpF,CAAA;AAED,eAAO,MAAM,eAAe;mBACX,MAAM,QAAQ,CAAC,MAAM,cAAc,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;iBA6CxE,CAAA"}
|
|
@@ -72,7 +72,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
72
72
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
73
73
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
74
74
|
import axios from "axios";
|
|
75
|
-
import { Autocomplete, Box, Button, Checkbox, Chip,
|
|
75
|
+
import { Autocomplete, Box, Button, Checkbox, Chip, Divider, FormControl, FormControlLabel, Grid, InputLabel, MenuItem, Radio, RadioGroup, Select, TextField, Typography } from "@mui/material";
|
|
76
76
|
import { useDropzone } from "react-dropzone";
|
|
77
77
|
import { CANVAS_TITLE, EMOTII_TITLE, INSURANCE_RELATIONSHIPS, INSURANCE_RELATIONSHIPS_CANVAS, PRIMARY_HEX, RELATIONSHIP_TYPES, TELLESCOPE_GENDERS } from "@tellescope/constants";
|
|
78
78
|
import { MM_DD_YYYY_to_YYYY_MM_DD, capture_is_supported, downloadFile, emit_gtm_event, first_letter_capitalized, form_response_value_to_string, format_stripe_subscription_interval, getLocalTimezone, getPublicFileURL, mm_dd_yyyy, replace_enduser_template_values, truncate_string, update_local_storage, user_display_name } from "@tellescope/utilities";
|
|
@@ -91,7 +91,7 @@ import AddPhotoAlternateIcon from '@mui/icons-material/AddPhotoAlternate';
|
|
|
91
91
|
import LanguageIcon from '@mui/icons-material/Language';
|
|
92
92
|
import { Elements, PaymentElement, useStripe, useElements, EmbeddedCheckout, EmbeddedCheckoutProvider } from '@stripe/react-stripe-js';
|
|
93
93
|
import { loadStripe } from '@stripe/stripe-js';
|
|
94
|
-
import { CheckCircleOutline, Delete, Edit,
|
|
94
|
+
import { CheckCircleOutline, Delete, Edit, UploadFile } from "@mui/icons-material";
|
|
95
95
|
import { WYSIWYG } from "./wysiwyg";
|
|
96
96
|
export var LanguageSelect = function (_a) {
|
|
97
97
|
var value = _a.value, props = __rest(_a, ["value"]);
|
|
@@ -741,7 +741,6 @@ export var MultipleChoiceInput = function (_a) {
|
|
|
741
741
|
var field = _a.field, form = _a.form, _value = _a.value, onChange = _a.onChange;
|
|
742
742
|
var value = typeof _value === 'string' ? [_value] : _value; // if loading existingResponses, allows them to be a string
|
|
743
743
|
var _f = field.options, choices = _f.choices, radio = _f.radio, other = _f.other, optionDetails = _f.optionDetails;
|
|
744
|
-
var _g = useState({}), expandedDescriptions = _g[0], setExpandedDescriptions = _g[1];
|
|
745
744
|
// current other string
|
|
746
745
|
var enteringOtherStringRef = React.useRef(''); // if typing otherString as prefix of a checkbox value, don't auto-select
|
|
747
746
|
var otherString = (_b = value === null || value === void 0 ? void 0 : value.find(function (v) { var _a; return v === enteringOtherStringRef.current || !((_a = (choices !== null && choices !== void 0 ? choices : [])) === null || _a === void 0 ? void 0 : _a.find(function (c) { return c === v; })); })) !== null && _b !== void 0 ? _b : '';
|
|
@@ -751,19 +750,12 @@ export var MultipleChoiceInput = function (_a) {
|
|
|
751
750
|
var _a;
|
|
752
751
|
return (_a = optionDetails === null || optionDetails === void 0 ? void 0 : optionDetails.find(function (detail) { return detail.option === choice; })) === null || _a === void 0 ? void 0 : _a.description;
|
|
753
752
|
}, [optionDetails]);
|
|
754
|
-
var toggleDescription = useCallback(function (index) {
|
|
755
|
-
setExpandedDescriptions(function (prev) {
|
|
756
|
-
var _a;
|
|
757
|
-
return (__assign(__assign({}, prev), (_a = {}, _a[index] = !prev[index], _a)));
|
|
758
|
-
});
|
|
759
|
-
}, []);
|
|
760
753
|
return (_jsxs(Grid, __assign({ container: true, alignItems: "center", rowGap: 1.5 }, { children: [radio
|
|
761
754
|
? (_jsx(FormControl, __assign({ fullWidth: true }, { children: _jsx(RadioGroup, __assign({ "aria-labelledby": "radio-group-".concat(field.id, "-label"), defaultValue: "female", name: "radio-group-".concat(field.id) }, { children: (choices !== null && choices !== void 0 ? choices : []).map(function (c, i) {
|
|
762
755
|
var description = getDescriptionForChoice(c);
|
|
763
756
|
var hasDescription = !!description;
|
|
764
|
-
var isExpanded = expandedDescriptions[i];
|
|
765
757
|
var isSelected = !!(value === null || value === void 0 ? void 0 : value.includes(c)) && c !== otherString;
|
|
766
|
-
return (_jsxs(Box, __assign({ sx: { width: '100%' } }, { children: [
|
|
758
|
+
return (_jsxs(Box, __assign({ sx: { width: '100%' } }, { children: [_jsx(Box, __assign({ sx: {
|
|
767
759
|
display: 'flex',
|
|
768
760
|
alignItems: 'center',
|
|
769
761
|
width: '100%',
|
|
@@ -771,25 +763,17 @@ export var MultipleChoiceInput = function (_a) {
|
|
|
771
763
|
borderColor: 'primary.main',
|
|
772
764
|
borderRadius: 1,
|
|
773
765
|
padding: '16px 16px',
|
|
774
|
-
marginBottom: '12px',
|
|
766
|
+
marginBottom: hasDescription ? '8px' : '12px',
|
|
775
767
|
cursor: 'pointer',
|
|
776
768
|
backgroundColor: 'transparent',
|
|
777
769
|
boxSizing: 'border-box',
|
|
778
770
|
'&:hover': {
|
|
779
771
|
backgroundColor: function (theme) { return "".concat(theme.palette.primary.main, "14"); },
|
|
780
772
|
},
|
|
781
|
-
}, onClick: function () { return onChange((value === null || value === void 0 ? void 0 : value.includes(c)) ? [] : [c], field.id); } }, { children:
|
|
782
|
-
e.stopPropagation();
|
|
783
|
-
toggleDescription(i);
|
|
784
|
-
}, sx: {
|
|
785
|
-
transform: isExpanded ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
786
|
-
transition: 'transform 0.2s',
|
|
787
|
-
ml: 1
|
|
788
|
-
} }, { children: _jsx(ExpandMore, { fontSize: "small" }) })))] })), hasDescription && (_jsx(Collapse, __assign({ in: isExpanded }, { children: _jsx(Box, __assign({ sx: { pl: 2, pr: 2, pb: 1, pt: 1 } }, { children: _jsx(Typography, __assign({ variant: "body2", color: "text.secondary" }, { children: description })) })) })))] }), i));
|
|
773
|
+
}, onClick: function () { return onChange((value === null || value === void 0 ? void 0 : value.includes(c)) ? [] : [c], field.id); } }, { children: _jsx(Typography, __assign({ component: "span", sx: { flex: 1, color: 'primary.main', fontSize: 13, fontWeight: 600 } }, { children: c })) })), hasDescription && (_jsx(Box, __assign({ sx: { pl: 2, pr: 2, pb: 1, mb: 1 } }, { children: _jsx(Typography, __assign({ style: { fontSize: 14, color: '#00000099' } }, { children: description })) })))] }), i));
|
|
789
774
|
}) })) }))) : ((choices !== null && choices !== void 0 ? choices : []).map(function (c, i) {
|
|
790
775
|
var description = getDescriptionForChoice(c);
|
|
791
776
|
var hasDescription = !!description;
|
|
792
|
-
var isExpanded = expandedDescriptions[i];
|
|
793
777
|
return (_jsx(Grid, __assign({ xs: 12 }, { children: _jsxs(Box, __assign({ sx: { width: '100%' } }, { children: [_jsxs(Box, __assign({ sx: {
|
|
794
778
|
display: 'flex',
|
|
795
779
|
alignItems: 'center',
|
|
@@ -798,10 +782,6 @@ export var MultipleChoiceInput = function (_a) {
|
|
|
798
782
|
boxSizing: 'border-box'
|
|
799
783
|
}, onClick: function (e) {
|
|
800
784
|
var _a, _b, _d, _e;
|
|
801
|
-
// Don't trigger selection if clicking on the expand button
|
|
802
|
-
if (e.target.closest('.expand-button')) {
|
|
803
|
-
return;
|
|
804
|
-
}
|
|
805
785
|
onChange(((value === null || value === void 0 ? void 0 : value.includes(c))
|
|
806
786
|
? ((radio || ((_b = (_a = field.options) === null || _a === void 0 ? void 0 : _a.radioChoices) === null || _b === void 0 ? void 0 : _b.includes(c)))
|
|
807
787
|
? []
|
|
@@ -809,14 +789,7 @@ export var MultipleChoiceInput = function (_a) {
|
|
|
809
789
|
: ((radio || ((_e = (_d = field.options) === null || _d === void 0 ? void 0 : _d.radioChoices) === null || _e === void 0 ? void 0 : _e.includes(c)))
|
|
810
790
|
? [c]
|
|
811
791
|
: __spreadArray(__spreadArray([], (value !== null && value !== void 0 ? value : []).filter(function (x) { var _a, _b; return !((_b = (_a = field.options) === null || _a === void 0 ? void 0 : _a.radioChoices) === null || _b === void 0 ? void 0 : _b.includes(x)); }), true), [c], false))), field.id);
|
|
812
|
-
} }, { children: [_jsx(Checkbox, { color: "primary", checked: !!(value === null || value === void 0 ? void 0 : value.includes(c)) && c !== otherString, inputProps: { 'aria-label': 'primary checkbox' } }), _jsx(Typography, __assign({ component: "span", sx: { flex: 1 } }, { children: c })), hasDescription && (_jsx(
|
|
813
|
-
e.stopPropagation();
|
|
814
|
-
toggleDescription(i);
|
|
815
|
-
}, sx: {
|
|
816
|
-
transform: isExpanded ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
817
|
-
transition: 'transform 0.2s',
|
|
818
|
-
ml: 1
|
|
819
|
-
} }, { children: _jsx(ExpandMore, { fontSize: "small" }) })))] })), hasDescription && (_jsx(Collapse, __assign({ in: isExpanded }, { children: _jsx(Box, __assign({ sx: { pl: '42px', pr: 2, pb: 1 } }, { children: _jsx(Typography, __assign({ variant: "body2", color: "text.secondary" }, { children: description })) })) })))] })) }), i));
|
|
792
|
+
} }, { children: [_jsx(Checkbox, { color: "primary", checked: !!(value === null || value === void 0 ? void 0 : value.includes(c)) && c !== otherString, inputProps: { 'aria-label': 'primary checkbox' } }), _jsx(Typography, __assign({ component: "span", sx: { flex: 1 } }, { children: c }))] })), hasDescription && (_jsx(Box, __assign({ sx: { pl: '42px', pr: 2, pb: 1 } }, { children: _jsx(Typography, __assign({ style: { fontSize: 14, color: '#00000099' } }, { children: description })) })))] })) }), i));
|
|
820
793
|
})), other &&
|
|
821
794
|
_jsx(Grid, __assign({ item: true, xs: 12 }, { children: _jsx(TextField // className={classes.textField}
|
|
822
795
|
, { InputProps: { sx: { borderRadius: 2.5 } }, sx: { width: radio ? "calc(100% - 15px)" : '100%' }, size: "small", "aria-label": form_display_text_for_language(form, "Other"), value: otherString, placeholder: form_display_text_for_language(form, "Other"), variant: "outlined",
|