@tellescope/react-components 1.157.1 → 1.158.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/hooks.d.ts +1 -0
- package/lib/cjs/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/hooks.js +11 -3
- package/lib/cjs/Forms/hooks.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +3 -2
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/state.js +1 -1
- package/lib/cjs/state.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts +1 -0
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/hooks.js +11 -3
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +3 -2
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/state.js +1 -1
- package/lib/esm/state.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/hooks.tsx +8 -0
- package/src/Forms/inputs.tsx +4 -3
- package/src/state.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.158.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"@reduxjs/toolkit": "^1.6.2",
|
|
48
48
|
"@stripe/react-stripe-js": "^2.9.0",
|
|
49
49
|
"@stripe/stripe-js": "^1.52.1",
|
|
50
|
-
"@tellescope/constants": "^1.
|
|
51
|
-
"@tellescope/sdk": "^1.
|
|
52
|
-
"@tellescope/types-client": "^1.
|
|
53
|
-
"@tellescope/types-models": "^1.
|
|
54
|
-
"@tellescope/types-utilities": "^1.
|
|
55
|
-
"@tellescope/utilities": "^1.
|
|
56
|
-
"@tellescope/validation": "^1.
|
|
50
|
+
"@tellescope/constants": "^1.158.0",
|
|
51
|
+
"@tellescope/sdk": "^1.158.0",
|
|
52
|
+
"@tellescope/types-client": "^1.158.0",
|
|
53
|
+
"@tellescope/types-models": "^1.158.0",
|
|
54
|
+
"@tellescope/types-utilities": "^1.158.0",
|
|
55
|
+
"@tellescope/utilities": "^1.158.0",
|
|
56
|
+
"@tellescope/validation": "^1.158.0",
|
|
57
57
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
58
58
|
"@typescript-eslint/parser": "^4.33.0",
|
|
59
59
|
"css-to-react-native": "^3.0.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
81
81
|
"react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "0ed357b60dd15c474a84c6eb595eead1b4c33847",
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
86
86
|
}
|
package/src/Forms/hooks.tsx
CHANGED
|
@@ -198,6 +198,7 @@ export const getNextField = (activeField: FormFieldNode, currentValue: Response,
|
|
|
198
198
|
urlLogicValue?: string,
|
|
199
199
|
dateOfBirth?: string,
|
|
200
200
|
gender?: string,
|
|
201
|
+
state?: string,
|
|
201
202
|
form?: Form,
|
|
202
203
|
activeResponses?: FormResponseValue[], // current and previous answers (not future answers)
|
|
203
204
|
}) => {
|
|
@@ -600,6 +601,7 @@ export const useTellescopeForm = ({ form, urlLogicValue, customization, carePlan
|
|
|
600
601
|
disabled: !!(existingResponses?.find(r => r.fieldId === f.id)?.answer?.value && f.disabledWhenPrepopulated),
|
|
601
602
|
// keep consistent with onFieldChange
|
|
602
603
|
computedValueKey: (
|
|
604
|
+
// the height typeof is unnecessary (no actual type comparison), but don't change without testing both number and height question types
|
|
603
605
|
f?.intakeField === 'height' && typeof existingResponses?.find(r => r.fieldId === f.id)?.answer?.value
|
|
604
606
|
? 'Height'
|
|
605
607
|
: f?.intakeField === 'weight' && typeof existingResponses?.find(r => r.fieldId === f.id)?.answer?.value === 'number'
|
|
@@ -608,6 +610,8 @@ export const useTellescopeForm = ({ form, urlLogicValue, customization, carePlan
|
|
|
608
610
|
? 'Date of Birth'
|
|
609
611
|
: f?.intakeField === 'gender' && ['multiple_choice', 'Dropdown'].includes(existingResponses?.find(r => r.fieldId === f.id)?.answer?.type || '')
|
|
610
612
|
? 'Gender'
|
|
613
|
+
: f?.intakeField === 'Address' && existingResponses?.find(r => r.fieldId === f.id && r.answer.type === 'Address')
|
|
614
|
+
? 'State'
|
|
611
615
|
: undefined
|
|
612
616
|
) as any,
|
|
613
617
|
answer: {
|
|
@@ -1060,6 +1064,7 @@ export const useTellescopeForm = ({ form, urlLogicValue, customization, carePlan
|
|
|
1060
1064
|
activeResponses: responses.filter(r => r.includeInSubmit),
|
|
1061
1065
|
dateOfBirth: enduser?.dateOfBirth,
|
|
1062
1066
|
gender: enduser?.gender,
|
|
1067
|
+
state: enduser?.state,
|
|
1063
1068
|
})
|
|
1064
1069
|
)
|
|
1065
1070
|
)
|
|
@@ -1275,6 +1280,7 @@ export const useTellescopeForm = ({ form, urlLogicValue, customization, carePlan
|
|
|
1275
1280
|
activeResponses: responses.filter(r => r.includeInSubmit),
|
|
1276
1281
|
dateOfBirth: enduser?.dateOfBirth,
|
|
1277
1282
|
gender: enduser?.gender,
|
|
1283
|
+
state: enduser?.state,
|
|
1278
1284
|
})
|
|
1279
1285
|
|
|
1280
1286
|
// when autoadvancing, prevent adding duplicates by checking whether already on stack
|
|
@@ -1341,6 +1347,8 @@ export const useTellescopeForm = ({ form, urlLogicValue, customization, carePlan
|
|
|
1341
1347
|
? 'Date of Birth'
|
|
1342
1348
|
: field?.intakeField === 'gender' && (r.answer.type === 'Dropdown' || r.answer.type === 'multiple_choice')
|
|
1343
1349
|
? 'Gender'
|
|
1350
|
+
: field?.intakeField === 'Address' && r.answer.type === 'Address'
|
|
1351
|
+
? 'State'
|
|
1344
1352
|
: undefined
|
|
1345
1353
|
)
|
|
1346
1354
|
})))
|
package/src/Forms/inputs.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import LinearProgress from '@mui/material/LinearProgress';
|
|
|
13
13
|
import DatePicker from "react-datepicker";
|
|
14
14
|
import { datepickerCSS } from "./css/react-datepicker" // avoids build issue with RN
|
|
15
15
|
import { CancelIcon, FileBlob, IconButton, LabeledIconButton, LoadingButton, Styled, form_display_text_for_language, isDateString, useProducts, useResolvedSession } from ".."
|
|
16
|
-
import { CalendarEvent, DatabaseRecord, FormField } from "@tellescope/types-client"
|
|
16
|
+
import { AllergyCode, CalendarEvent, DatabaseRecord, FormField } from "@tellescope/types-client"
|
|
17
17
|
import { css } from '@emotion/css'
|
|
18
18
|
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
|
|
19
19
|
import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
|
|
@@ -2992,6 +2992,7 @@ export const AllergiesInput = ({ goToNextField, goToPreviousField, field, value,
|
|
|
2992
2992
|
/>
|
|
2993
2993
|
)
|
|
2994
2994
|
}
|
|
2995
|
+
const display_with_code = (v: { code: string, display: string }) => `${v.code}: ${first_letter_capitalized(v.display)}`
|
|
2995
2996
|
|
|
2996
2997
|
export const ConditionsInput = ({ goToNextField, goToPreviousField, field, value, onChange, form, formResponseId, ...props }: FormInputProps<'Conditions'>) => {
|
|
2997
2998
|
const session = useResolvedSession()
|
|
@@ -3029,7 +3030,7 @@ export const ConditionsInput = ({ goToNextField, goToPreviousField, field, value
|
|
|
3029
3030
|
onChange(v, field.id)
|
|
3030
3031
|
setResults([])
|
|
3031
3032
|
}}
|
|
3032
|
-
getOptionLabel={
|
|
3033
|
+
getOptionLabel={display_with_code} filterOptions={o => o}
|
|
3033
3034
|
inputValue={query} onInputChange={(e, v) => e && setQuery(v) }
|
|
3034
3035
|
renderInput={(params) => (
|
|
3035
3036
|
<TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }}
|
|
@@ -3039,7 +3040,7 @@ export const ConditionsInput = ({ goToNextField, goToPreviousField, field, value
|
|
|
3039
3040
|
renderTags={(value, getTagProps) =>
|
|
3040
3041
|
value.map((value, index) => (
|
|
3041
3042
|
<Chip
|
|
3042
|
-
label={<Typography style={{whiteSpace: 'normal'}}>{value
|
|
3043
|
+
label={<Typography style={{whiteSpace: 'normal'}}>{display_with_code(value)}</Typography>}
|
|
3043
3044
|
{...getTagProps({ index })}
|
|
3044
3045
|
sx={{height:"100%", py: 0.5 }}
|
|
3045
3046
|
/>
|
package/src/state.tsx
CHANGED
|
@@ -1985,7 +1985,7 @@ export const useTemplates = (options={} as HookOptions<Template>) => {
|
|
|
1985
1985
|
)
|
|
1986
1986
|
}
|
|
1987
1987
|
export const useForms = (options={} as HookOptions<Form>) => {
|
|
1988
|
-
const session =
|
|
1988
|
+
const session = useResolvedSession()
|
|
1989
1989
|
return useListStateHook(
|
|
1990
1990
|
'forms', useTypedSelector(s => s.forms), session, formsSlice,
|
|
1991
1991
|
{
|