@tellescope/react-components 1.237.6 → 1.239.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.d.ts.map +1 -1
- package/lib/cjs/Forms/forms.js +29 -27
- 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 +29 -27
- package/lib/cjs/Forms/forms.v2.js.map +1 -1
- package/lib/cjs/Forms/hooks.d.ts +25 -1
- package/lib/cjs/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/hooks.js +40 -2
- package/lib/cjs/Forms/hooks.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts +6 -2
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +138 -23
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/Forms/inputs.v2.d.ts +2 -1
- package/lib/cjs/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.v2.js +26 -9
- package/lib/cjs/Forms/inputs.v2.js.map +1 -1
- package/lib/cjs/Forms/localization.d.ts.map +1 -1
- package/lib/cjs/Forms/localization.js +7 -0
- package/lib/cjs/Forms/localization.js.map +1 -1
- package/lib/cjs/inputs_shared.d.ts +6 -2
- package/lib/cjs/inputs_shared.d.ts.map +1 -1
- package/lib/cjs/inputs_shared.js +4 -3
- package/lib/cjs/inputs_shared.js.map +1 -1
- package/lib/esm/Forms/forms.d.ts.map +1 -1
- package/lib/esm/Forms/forms.js +30 -28
- 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 +30 -28
- package/lib/esm/Forms/forms.v2.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts +25 -1
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/hooks.js +38 -1
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +6 -2
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +136 -22
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/Forms/inputs.v2.d.ts +2 -1
- package/lib/esm/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.v2.js +25 -9
- package/lib/esm/Forms/inputs.v2.js.map +1 -1
- package/lib/esm/Forms/localization.d.ts.map +1 -1
- package/lib/esm/Forms/localization.js +7 -0
- package/lib/esm/Forms/localization.js.map +1 -1
- package/lib/esm/inputs_shared.d.ts +6 -2
- package/lib/esm/inputs_shared.d.ts.map +1 -1
- package/lib/esm/inputs_shared.js +4 -3
- package/lib/esm/inputs_shared.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/forms.tsx +9 -2
- package/src/Forms/forms.v2.tsx +9 -2
- package/src/Forms/hooks.tsx +57 -2
- package/src/Forms/inputs.tsx +246 -17
- package/src/Forms/inputs.v2.tsx +29 -11
- package/src/Forms/localization.ts +8 -0
- package/src/inputs_shared.tsx +6 -5
package/src/Forms/inputs.v2.tsx
CHANGED
|
@@ -23,6 +23,7 @@ import LanguageIcon from '@mui/icons-material/Language';
|
|
|
23
23
|
|
|
24
24
|
import { CheckCircleOutline, Delete, Edit, UploadFile } from "@mui/icons-material"
|
|
25
25
|
import { WYSIWYG } from "./wysiwyg"
|
|
26
|
+
import { useConditionalChoices, Response } from "./hooks"
|
|
26
27
|
|
|
27
28
|
export const LanguageSelect = ({ value, ...props }: { value: string, onChange: (s: string) => void}) => (
|
|
28
29
|
<Grid container alignItems="center" justifyContent={"center"} wrap="nowrap" spacing={1}>
|
|
@@ -544,8 +545,8 @@ export const NumberInput = ({ field, value, onChange, form, ...props }: FormInpu
|
|
|
544
545
|
)
|
|
545
546
|
}
|
|
546
547
|
|
|
547
|
-
// InsuranceInput, BridgeEligibilityInput, and AppointmentBookingInput logic is shared with inputs.tsx to avoid duplication
|
|
548
|
-
import { InsuranceInput as SharedInsuranceInput, BridgeEligibilityInput as SharedBridgeEligibilityInput, AppointmentBookingInput as SharedAppointmentBookingInput } from './inputs'
|
|
548
|
+
// InsuranceInput, BridgeEligibilityInput, PharmacySearchInput, and AppointmentBookingInput logic is shared with inputs.tsx to avoid duplication
|
|
549
|
+
import { InsuranceInput as SharedInsuranceInput, BridgeEligibilityInput as SharedBridgeEligibilityInput, PharmacySearchInput as SharedPharmacySearchInput, AppointmentBookingInput as SharedAppointmentBookingInput } from './inputs'
|
|
549
550
|
|
|
550
551
|
// Wrap the shared InsuranceInput component with v2-specific props
|
|
551
552
|
export const InsuranceInput = (props: FormInputProps<'Insurance'>) => {
|
|
@@ -557,6 +558,11 @@ export const BridgeEligibilityInput = (props: FormInputProps<'Bridge Eligibility
|
|
|
557
558
|
return <SharedBridgeEligibilityInput {...props} inputProps={defaultInputProps} />
|
|
558
559
|
}
|
|
559
560
|
|
|
561
|
+
// Wrap the shared PharmacySearchInput component with v2-specific props
|
|
562
|
+
export const PharmacySearchInput = (props: FormInputProps<'Pharmacy Search'>) => {
|
|
563
|
+
return <SharedPharmacySearchInput {...props} />
|
|
564
|
+
}
|
|
565
|
+
|
|
560
566
|
|
|
561
567
|
const StringSelector = ({ options, value, onChange, required, getDisplayValue, ...props } : {
|
|
562
568
|
options: string[]
|
|
@@ -1154,7 +1160,7 @@ export const FilesInput = ({ value, onChange, field, existingFileName, uploading
|
|
|
1154
1160
|
)
|
|
1155
1161
|
}
|
|
1156
1162
|
|
|
1157
|
-
export const MultipleChoiceInput = ({ field, form, value: _value, onChange }: FormInputProps<'multiple_choice'>) => {
|
|
1163
|
+
export const MultipleChoiceInput = ({ field, form, value: _value, onChange, responses, enduser }: FormInputProps<'multiple_choice'>) => {
|
|
1158
1164
|
const value = typeof _value === 'string' ? [_value] : _value // if loading existingResponses, allows them to be a string
|
|
1159
1165
|
const { choices, radio, other, optionDetails } = field.options as MultipleChoiceOptions
|
|
1160
1166
|
|
|
@@ -1162,6 +1168,18 @@ export const MultipleChoiceInput = ({ field, form, value: _value, onChange }: Fo
|
|
|
1162
1168
|
const enteringOtherStringRef = React.useRef('') // if typing otherString as prefix of a checkbox value, don't auto-select
|
|
1163
1169
|
const otherString = value?.find(v => v === enteringOtherStringRef.current || !(choices ?? [])?.find(c => c === v)) ?? ''
|
|
1164
1170
|
|
|
1171
|
+
// Conditional visibility for choices
|
|
1172
|
+
const { visibleChoices, handleChange } = useConditionalChoices({
|
|
1173
|
+
choices,
|
|
1174
|
+
optionDetails,
|
|
1175
|
+
responses: responses as Response[] | undefined,
|
|
1176
|
+
enduser,
|
|
1177
|
+
form,
|
|
1178
|
+
onChange,
|
|
1179
|
+
fieldId: field.id,
|
|
1180
|
+
otherString,
|
|
1181
|
+
})
|
|
1182
|
+
|
|
1165
1183
|
// Get primary color from form customization or use default
|
|
1166
1184
|
const primaryColor = form?.customization?.primaryColor ?? '#798ED0'
|
|
1167
1185
|
|
|
@@ -1179,7 +1197,7 @@ export const MultipleChoiceInput = ({ field, form, value: _value, onChange }: Fo
|
|
|
1179
1197
|
defaultValue="female"
|
|
1180
1198
|
name={`radio-group-${field.id}`}
|
|
1181
1199
|
>
|
|
1182
|
-
{
|
|
1200
|
+
{visibleChoices.map((c, i) => {
|
|
1183
1201
|
const description = getDescriptionForChoice(c)
|
|
1184
1202
|
const hasDescription = !!description
|
|
1185
1203
|
const isSelected = !!value?.includes(c) && c !== otherString
|
|
@@ -1203,7 +1221,7 @@ export const MultipleChoiceInput = ({ field, form, value: _value, onChange }: Fo
|
|
|
1203
1221
|
backgroundColor: (theme: any) => `${theme.palette.primary.main}14`,
|
|
1204
1222
|
},
|
|
1205
1223
|
}}
|
|
1206
|
-
onClick={() =>
|
|
1224
|
+
onClick={() => handleChange(value?.includes(c) ? [] : [c], field.id)}
|
|
1207
1225
|
>
|
|
1208
1226
|
<Typography component="span" sx={{ flex: 1, color: 'primary.main', fontSize: 13, fontWeight: 600 }}>{c}</Typography>
|
|
1209
1227
|
</Box>
|
|
@@ -1216,11 +1234,11 @@ export const MultipleChoiceInput = ({ field, form, value: _value, onChange }: Fo
|
|
|
1216
1234
|
)}
|
|
1217
1235
|
</Box>
|
|
1218
1236
|
)
|
|
1219
|
-
})}
|
|
1237
|
+
})}
|
|
1220
1238
|
</RadioGroup>
|
|
1221
1239
|
</FormControl>
|
|
1222
1240
|
) : (
|
|
1223
|
-
|
|
1241
|
+
visibleChoices.map((c, i) => {
|
|
1224
1242
|
const description = getDescriptionForChoice(c)
|
|
1225
1243
|
const hasDescription = !!description
|
|
1226
1244
|
|
|
@@ -1236,7 +1254,7 @@ export const MultipleChoiceInput = ({ field, form, value: _value, onChange }: Fo
|
|
|
1236
1254
|
boxSizing: 'border-box'
|
|
1237
1255
|
}}
|
|
1238
1256
|
onClick={(e) => {
|
|
1239
|
-
|
|
1257
|
+
handleChange(
|
|
1240
1258
|
(
|
|
1241
1259
|
value?.includes(c)
|
|
1242
1260
|
? (
|
|
@@ -1287,9 +1305,9 @@ export const MultipleChoiceInput = ({ field, form, value: _value, onChange }: Fo
|
|
|
1287
1305
|
// onClick={() => !otherChecked && handleOtherChecked()} // allow click to enable when disabled
|
|
1288
1306
|
onChange={e => {
|
|
1289
1307
|
enteringOtherStringRef.current = e.target.value
|
|
1290
|
-
|
|
1308
|
+
handleChange(
|
|
1291
1309
|
(
|
|
1292
|
-
radio
|
|
1310
|
+
radio
|
|
1293
1311
|
? (
|
|
1294
1312
|
e.target.value.trim()
|
|
1295
1313
|
? [e.target.value]
|
|
@@ -1299,7 +1317,7 @@ export const MultipleChoiceInput = ({ field, form, value: _value, onChange }: Fo
|
|
|
1299
1317
|
e.target.value.trim()
|
|
1300
1318
|
// remove existing other string (if exists) and append new one
|
|
1301
1319
|
? [...(value ?? []).filter(v => v !== otherString), e.target.value]
|
|
1302
|
-
: value
|
|
1320
|
+
: (value ?? []).filter(v => v !== otherString)
|
|
1303
1321
|
)
|
|
1304
1322
|
),
|
|
1305
1323
|
field.id,
|
|
@@ -112,9 +112,17 @@ const SPANISH_TRANSLATIONS: Record<string, string> = {
|
|
|
112
112
|
|
|
113
113
|
// Medications Search
|
|
114
114
|
'Search': 'Buscar',
|
|
115
|
+
'Searching...': 'Buscando...',
|
|
115
116
|
'Drug Select': 'Seleccionar Medicamento',
|
|
116
117
|
'Other Drug': 'Otro Medicamento',
|
|
117
118
|
|
|
119
|
+
// Pharmacy Search
|
|
120
|
+
'pharmacies found': 'farmacias encontradas',
|
|
121
|
+
'pharmacy found': 'farmacia encontrada',
|
|
122
|
+
'Please enter a valid 5-digit ZIP code': 'Por favor ingrese un código postal válido de 5 dígitos',
|
|
123
|
+
'No pharmacies found for this ZIP code': 'No se encontraron farmacias para este código postal',
|
|
124
|
+
'Failed to search pharmacies': 'Error al buscar farmacias',
|
|
125
|
+
|
|
118
126
|
// Height Input
|
|
119
127
|
'Feet': 'Pies',
|
|
120
128
|
'Inches': 'Pulgadas',
|
package/src/inputs_shared.tsx
CHANGED
|
@@ -876,16 +876,17 @@ export const ModelSearchInput = <T,>({
|
|
|
876
876
|
}
|
|
877
877
|
|
|
878
878
|
|
|
879
|
-
export const EnduserSearch = (props: Omit<GenericSearchProps<Enduser>, 'filterKey'> & { filterKey?: string }) => {
|
|
879
|
+
export const EnduserSearch = (props: Omit<GenericSearchProps<Enduser>, 'filterKey'> & { filterKey?: string, excludeCareTeamFromSearch?: boolean }) => {
|
|
880
|
+
const { excludeCareTeamFromSearch, ...restProps } = props
|
|
880
881
|
const session = useResolvedSession()
|
|
881
882
|
const [, { addLocalElements }] = useEndusers()
|
|
882
|
-
const [usersLoading, { findById: findUser }] = useUsers()
|
|
883
|
+
const [usersLoading, { findById: findUser }] = useUsers()
|
|
883
884
|
|
|
884
885
|
// wait for users to load, so that a saved query is able to match attachSearchableFields
|
|
885
886
|
// only wait when users have ALL_ACCESS to ensures users can actually load
|
|
886
887
|
if (((session.userInfo as any)?.access as AccessPermissions)?.users?.read === ALL_ACCESS && !value_is_loaded(usersLoading)) return null
|
|
887
888
|
return (
|
|
888
|
-
<ModelSearchInput filterKey="endusers" {...
|
|
889
|
+
<ModelSearchInput filterKey="endusers" {...restProps}
|
|
889
890
|
searchAPI={async ({ search }) => {
|
|
890
891
|
// handle case of formatted phone number in search bar by parsing to standard phone format and searching explicitly by phone
|
|
891
892
|
// in this case, also search by generic search term in case user is intending to search by something else (e.g. externalId)
|
|
@@ -903,7 +904,7 @@ export const EnduserSearch = (props: Omit<GenericSearchProps<Enduser>, 'filterKe
|
|
|
903
904
|
return session.api.endusers.getSome({ search })
|
|
904
905
|
}}
|
|
905
906
|
onLoad={addLocalElements}
|
|
906
|
-
attachSearchableFields={t => {
|
|
907
|
+
attachSearchableFields={excludeCareTeamFromSearch ? undefined : (t => {
|
|
907
908
|
const users = t.assignedTo?.map(userId => findUser(userId, { batch: true })).filter(u => u) as User[]
|
|
908
909
|
if (!users?.length) return undefined
|
|
909
910
|
|
|
@@ -915,7 +916,7 @@ export const EnduserSearch = (props: Omit<GenericSearchProps<Enduser>, 'filterKe
|
|
|
915
916
|
})
|
|
916
917
|
|
|
917
918
|
return toJoin
|
|
918
|
-
}}
|
|
919
|
+
})}
|
|
919
920
|
/>
|
|
920
921
|
)
|
|
921
922
|
}
|