@tellescope/react-components 1.230.1 → 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.
Files changed (48) hide show
  1. package/lib/cjs/Forms/forms.d.ts.map +1 -1
  2. package/lib/cjs/Forms/forms.js +30 -28
  3. package/lib/cjs/Forms/forms.js.map +1 -1
  4. package/lib/cjs/Forms/forms.v2.d.ts.map +1 -1
  5. package/lib/cjs/Forms/forms.v2.js +32 -30
  6. package/lib/cjs/Forms/forms.v2.js.map +1 -1
  7. package/lib/cjs/Forms/hooks.d.ts +111 -3
  8. package/lib/cjs/Forms/hooks.d.ts.map +1 -1
  9. package/lib/cjs/Forms/hooks.js +26 -8
  10. package/lib/cjs/Forms/hooks.js.map +1 -1
  11. package/lib/cjs/Forms/inputs.d.ts +1 -0
  12. package/lib/cjs/Forms/inputs.d.ts.map +1 -1
  13. package/lib/cjs/Forms/inputs.js +28 -1
  14. package/lib/cjs/Forms/inputs.js.map +1 -1
  15. package/lib/cjs/Forms/inputs.v2.d.ts +1 -0
  16. package/lib/cjs/Forms/inputs.v2.d.ts.map +1 -1
  17. package/lib/cjs/Forms/inputs.v2.js +32 -32
  18. package/lib/cjs/Forms/inputs.v2.js.map +1 -1
  19. package/lib/esm/Forms/forms.d.ts +3 -3
  20. package/lib/esm/Forms/forms.d.ts.map +1 -1
  21. package/lib/esm/Forms/forms.js +31 -29
  22. package/lib/esm/Forms/forms.js.map +1 -1
  23. package/lib/esm/Forms/forms.v2.d.ts +3 -3
  24. package/lib/esm/Forms/forms.v2.d.ts.map +1 -1
  25. package/lib/esm/Forms/forms.v2.js +33 -31
  26. package/lib/esm/Forms/forms.v2.js.map +1 -1
  27. package/lib/esm/Forms/hooks.d.ts +111 -3
  28. package/lib/esm/Forms/hooks.d.ts.map +1 -1
  29. package/lib/esm/Forms/hooks.js +28 -10
  30. package/lib/esm/Forms/hooks.js.map +1 -1
  31. package/lib/esm/Forms/inputs.d.ts +2 -1
  32. package/lib/esm/Forms/inputs.d.ts.map +1 -1
  33. package/lib/esm/Forms/inputs.js +26 -0
  34. package/lib/esm/Forms/inputs.js.map +1 -1
  35. package/lib/esm/Forms/inputs.v2.d.ts +2 -1
  36. package/lib/esm/Forms/inputs.v2.d.ts.map +1 -1
  37. package/lib/esm/Forms/inputs.v2.js +32 -33
  38. package/lib/esm/Forms/inputs.v2.js.map +1 -1
  39. package/lib/esm/controls.d.ts +2 -2
  40. package/lib/esm/inputs.d.ts +1 -1
  41. package/lib/esm/state.d.ts +319 -319
  42. package/lib/tsconfig.tsbuildinfo +1 -1
  43. package/package.json +9 -9
  44. package/src/Forms/forms.tsx +6 -2
  45. package/src/Forms/forms.v2.tsx +16 -12
  46. package/src/Forms/hooks.tsx +46 -12
  47. package/src/Forms/inputs.tsx +158 -0
  48. package/src/Forms/inputs.v2.tsx +179 -65
@@ -20,7 +20,7 @@ export declare const RatingInput: ({ field, value, onChange }: FormInputProps<'r
20
20
  export declare const RankingInput: ({ field, value, onChange }: FormInputProps<'ranking'>) => JSX.Element;
21
21
  export declare const DateInput: ({ field, value, onChange, placement, ...props }: {
22
22
  field: FormField;
23
- placement?: "left" | "right" | "bottom" | "top" | undefined;
23
+ placement?: "bottom" | "left" | "right" | "top" | undefined;
24
24
  } & FormInputProps<"date"> & Styled) => JSX.Element;
25
25
  export declare const TableInput: ({ field, value, onChange, ...props }: FormInputProps<'Input Table'>) => JSX.Element;
26
26
  export declare const AutoFocusTextField: (props: TextFieldProps) => JSX.Element;
@@ -64,6 +64,7 @@ export declare const DatabaseSelectInput: ({ AddToDatabase, field, value: _value
64
64
  }) => JSX.Element;
65
65
  export declare const CanvasMedicationsInput: ({ field, value, onChange }: FormInputProps<'Medications'>) => JSX.Element;
66
66
  export declare const MedicationsInput: ({ field, value, onChange, ...props }: FormInputProps<'Medications'>) => JSX.Element;
67
+ export declare const BelugaPatientPreferenceInput: ({ field, value: _value, onChange }: FormInputProps<'Beluga Patient Preference'>) => JSX.Element;
67
68
  export declare const contact_is_valid: (e: Partial<Enduser>) => "Email is invalid" | "Phone is invalid" | "Date of birth should be MM-DD-YYYY" | undefined;
68
69
  export declare const RelatedContactsInput: ({ field, value: _value, onChange, ...props }: FormInputProps<'Related Contacts'>) => JSX.Element;
69
70
  export declare const AppointmentBookingInput: ({ formResponseId, field, value, onChange, form, responses, goToPreviousField, isPreviousDisabled, enduserId, ...props }: FormInputProps<'Appointment Booking'>) => JSX.Element;
@@ -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,EAA8L,OAAO,EAAa,cAAc,EAAc,MAAM,eAAe,CAAA;AAC1Q,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,eAAO,MAAM,UAAU,yCAA6C,eAAe,aAAa,CAA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B,EAAE;;iBAuL/B,CAAA;AAgID,eAAO,MAAM,sBAAsB,+BAAmC,eAAe,aAAa,CAAC,gBAyGlG,CAAA;AAED,eAAO,MAAM,gBAAgB,yCAA0C,eAAe,aAAa,CAAC,gBAySnG,CAAA;AAED,eAAO,MAAM,4BAA4B,uCAAwC,eAAe,2BAA2B,CAAC,gBAoK3H,CAAA;AAED,eAAO,MAAM,gBAAgB,MAAO,QAAQ,OAAO,CAAC,+FAkBnD,CAAA;AAED,eAAO,MAAM,oBAAoB,iDAAkD,eAAe,kBAAkB,CAAC,gBAiLpH,CAAA;AAED,eAAO,MAAM,uBAAuB,4HAA6H,eAAe,qBAAqB,CAAC,gBAyOrM,CAAA;AAED,eAAO,MAAM,WAAW,yCAAoD,eAAe,QAAQ,CAAC,gBAenG,CAAA;AAED,eAAO,MAAM,2CAA2C,QAAS,MAAM,WAetE,CAAA;AAED,eAAO,MAAM,aAAa,uIAAkJ,eAAe,UAAU,CAAC,uBAkGrM,CAAA;AAED,eAAO,MAAM,gBAAgB,4FAA6F,eAAe,OAAO,CAAC,gBA+ChJ,CAAA;AAED,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;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, Collapse, Divider, FormControl, FormControlLabel, Grid, IconButton as MuiIconButton, InputLabel, MenuItem, Radio, RadioGroup, Select, TextField, Typography } from "@mui/material";
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, ExpandMore, UploadFile } from "@mui/icons-material";
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: [_jsxs(Box, __assign({ sx: {
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: [_jsx(Typography, __assign({ component: "span", sx: { flex: 1, color: 'primary.main', fontSize: 13, fontWeight: 600 } }, { children: c })), hasDescription && (_jsx(MuiIconButton, __assign({ className: "expand-button", size: "small", onClick: function (e) {
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(MuiIconButton, __assign({ className: "expand-button", size: "small", onClick: function (e) {
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",
@@ -1641,6 +1614,32 @@ export var MedicationsInput = function (_a) {
1641
1614
  _jsxs(Grid, __assign({ item: true, sx: { mt: 3 } }, { children: [_jsx("strong", { children: "DEBUG:" }), " ", _jsx("br", {}), _jsx("pre", __assign({ style: { wordWrap: 'break-word' } }, { children: JSON.stringify(value !== null && value !== void 0 ? value : {}, null, 2) }))] })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Grid, { container: true }) }))] })) })) })) }), i), _jsx(Grid, __assign({ item: true }, { children: _jsx(Divider, { flexItem: true, sx: { my: 1 } }) }))] }));
1642
1615
  }), _jsx(Grid, __assign({ item: true }, { children: _jsx(Button, __assign({ color: "primary", variant: "outlined", onClick: function () { return onChange(__spreadArray(__spreadArray([], (value !== null && value !== void 0 ? value : []), true), [{ displayTerm: '', drugName: '' }], false), field.id); } }, { children: "Add Medication" })) }))] })));
1643
1616
  };
1617
+ export var BelugaPatientPreferenceInput = function (_a) {
1618
+ var field = _a.field, _value = _a.value, onChange = _a.onChange;
1619
+ var value = Array.isArray(_value) ? _value : [];
1620
+ return (_jsxs(Grid, __assign({ container: true, direction: "column", sx: { mt: 2 } }, { children: [value.map(function (v, i) {
1621
+ var _a, _b, _d, _e, _f, _g, _h, _j;
1622
+ return (_jsxs(_Fragment, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsx(Grid, __assign({ container: true, alignItems: "center", wrap: "nowrap" }, { children: _jsx(Grid, __assign({ item: true, sx: { width: '100%' } }, { children: _jsxs(Grid, __assign({ container: true, direction: "column", spacing: 1.5 }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsx(TextField, { label: "Medication Name", size: "small", fullWidth: true, required: true, InputProps: defaultInputProps, value: (_a = v.name) !== null && _a !== void 0 ? _a : '', onChange: function (e) {
1623
+ return onChange(value.map(function (_v, _i) { return (i === _i ? __assign(__assign({}, _v), { name: e.target.value }) : _v); }), field.id);
1624
+ } }) })), _jsx(Grid, __assign({ item: true }, { children: _jsxs(Grid, __assign({ container: true, spacing: 1 }, { children: [_jsx(Grid, __assign({ item: true, xs: 12, md: 6 }, { children: _jsx(TextField, { label: "Strength", size: "small", fullWidth: true, required: true, InputProps: defaultInputProps, value: (_b = v.strength) !== null && _b !== void 0 ? _b : '', onChange: function (e) {
1625
+ return onChange(value.map(function (_v, _i) { return (i === _i ? __assign(__assign({}, _v), { strength: e.target.value }) : _v); }), field.id);
1626
+ } }) })), _jsx(Grid, __assign({ item: true, xs: 12, md: 6 }, { children: _jsx(TextField, { label: "Dispense Unit", size: "small", fullWidth: true, required: true, InputProps: defaultInputProps, value: (_d = v.dispenseUnit) !== null && _d !== void 0 ? _d : '', onChange: function (e) {
1627
+ return onChange(value.map(function (_v, _i) { return (i === _i ? __assign(__assign({}, _v), { dispenseUnit: e.target.value }) : _v); }), field.id);
1628
+ } }) }))] })) })), _jsx(Grid, __assign({ item: true }, { children: _jsxs(Grid, __assign({ container: true, spacing: 1 }, { children: [_jsx(Grid, __assign({ item: true, xs: 12, md: 4 }, { children: _jsx(TextField, { label: "Quantity", size: "small", fullWidth: true, required: true, InputProps: defaultInputProps, value: (_e = v.quantity) !== null && _e !== void 0 ? _e : '', onChange: function (e) {
1629
+ return onChange(value.map(function (_v, _i) { return (i === _i ? __assign(__assign({}, _v), { quantity: e.target.value }) : _v); }), field.id);
1630
+ } }) })), _jsx(Grid, __assign({ item: true, xs: 12, md: 4 }, { children: _jsx(TextField, { label: "Refills", size: "small", fullWidth: true, required: true, InputProps: defaultInputProps, value: (_f = v.refills) !== null && _f !== void 0 ? _f : '', onChange: function (e) {
1631
+ return onChange(value.map(function (_v, _i) { return (i === _i ? __assign(__assign({}, _v), { refills: e.target.value }) : _v); }), field.id);
1632
+ } }) })), _jsx(Grid, __assign({ item: true, xs: 12, md: 4 }, { children: _jsx(TextField, { label: "Days Supply", size: "small", fullWidth: true, required: true, InputProps: defaultInputProps, value: (_g = v.daysSupply) !== null && _g !== void 0 ? _g : '', onChange: function (e) {
1633
+ return onChange(value.map(function (_v, _i) { return (i === _i ? __assign(__assign({}, _v), { daysSupply: e.target.value }) : _v); }), field.id);
1634
+ } }) }))] })) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(TextField, { label: "Sig (Instructions)", size: "small", fullWidth: true, required: true, multiline: true, rows: 2, InputProps: defaultInputProps, value: (_h = v.sig) !== null && _h !== void 0 ? _h : '', onChange: function (e) {
1635
+ return onChange(value.map(function (_v, _i) { return (i === _i ? __assign(__assign({}, _v), { sig: e.target.value }) : _v); }), field.id);
1636
+ } }) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(TextField, { label: "Med ID (NDC11)", size: "small", fullWidth: true, required: true, InputProps: defaultInputProps, value: (_j = v.medId) !== null && _j !== void 0 ? _j : '', onChange: function (e) {
1637
+ return onChange(value.map(function (_v, _i) { return (i === _i ? __assign(__assign({}, _v), { medId: e.target.value }) : _v); }), field.id);
1638
+ } }) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ color: "primary", sx: { textDecoration: 'underline', cursor: 'pointer' }, onClick: function () { return onChange(value.filter(function (_, _i) { return i !== _i; }), field.id); } }, { children: "Remove medication" })) }))] })) })) })) }), i), _jsx(Grid, __assign({ item: true }, { children: _jsx(Divider, { flexItem: true, sx: { my: 1 } }) }))] }));
1639
+ }), _jsx(Grid, __assign({ item: true }, { children: _jsx(Button, __assign({ color: "primary", variant: "outlined", onClick: function () { return onChange(__spreadArray(__spreadArray([], value, true), [
1640
+ { name: '', strength: '', quantity: '', refills: '', daysSupply: '', sig: '', dispenseUnit: '', medId: '' }
1641
+ ], false), field.id); } }, { children: "Add Medication" })) }))] })));
1642
+ };
1644
1643
  export var contact_is_valid = function (e) {
1645
1644
  if (e.email) {
1646
1645
  try {