@tellescope/react-components 1.158.0 → 1.160.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 (42) hide show
  1. package/lib/cjs/Forms/forms.js +1 -1
  2. package/lib/cjs/Forms/forms.js.map +1 -1
  3. package/lib/cjs/Forms/inputs.d.ts +2 -1
  4. package/lib/cjs/Forms/inputs.d.ts.map +1 -1
  5. package/lib/cjs/Forms/inputs.js +158 -33
  6. package/lib/cjs/Forms/inputs.js.map +1 -1
  7. package/lib/cjs/mui.d.ts +2 -1
  8. package/lib/cjs/mui.d.ts.map +1 -1
  9. package/lib/cjs/mui.js +2 -2
  10. package/lib/cjs/mui.js.map +1 -1
  11. package/lib/esm/CMS/components.d.ts +1 -0
  12. package/lib/esm/CMS/components.d.ts.map +1 -1
  13. package/lib/esm/Forms/form_responses.d.ts +1 -0
  14. package/lib/esm/Forms/form_responses.d.ts.map +1 -1
  15. package/lib/esm/Forms/forms.d.ts +3 -3
  16. package/lib/esm/Forms/forms.js +1 -1
  17. package/lib/esm/Forms/forms.js.map +1 -1
  18. package/lib/esm/Forms/hooks.d.ts +1 -0
  19. package/lib/esm/Forms/hooks.d.ts.map +1 -1
  20. package/lib/esm/Forms/inputs.d.ts +3 -2
  21. package/lib/esm/Forms/inputs.d.ts.map +1 -1
  22. package/lib/esm/Forms/inputs.js +156 -32
  23. package/lib/esm/Forms/inputs.js.map +1 -1
  24. package/lib/esm/Forms/inputs.native.d.ts +1 -0
  25. package/lib/esm/Forms/inputs.native.d.ts.map +1 -1
  26. package/lib/esm/controls.d.ts +2 -2
  27. package/lib/esm/inputs.d.ts +1 -1
  28. package/lib/esm/inputs.native.d.ts +1 -0
  29. package/lib/esm/inputs.native.d.ts.map +1 -1
  30. package/lib/esm/layout.d.ts +1 -1
  31. package/lib/esm/mui.d.ts +2 -1
  32. package/lib/esm/mui.d.ts.map +1 -1
  33. package/lib/esm/mui.js +2 -2
  34. package/lib/esm/mui.js.map +1 -1
  35. package/lib/esm/state.d.ts +52 -52
  36. package/lib/esm/theme.native.d.ts +1 -0
  37. package/lib/esm/theme.native.d.ts.map +1 -1
  38. package/lib/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +9 -9
  40. package/src/Forms/forms.tsx +1 -1
  41. package/src/Forms/inputs.tsx +278 -39
  42. package/src/mui.tsx +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellescope/react-components",
3
- "version": "1.158.0",
3
+ "version": "1.160.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.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",
50
+ "@tellescope/constants": "^1.160.0",
51
+ "@tellescope/sdk": "^1.160.0",
52
+ "@tellescope/types-client": "^1.160.0",
53
+ "@tellescope/types-models": "^1.160.0",
54
+ "@tellescope/types-utilities": "^1.160.0",
55
+ "@tellescope/utilities": "^1.160.0",
56
+ "@tellescope/validation": "^1.160.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": "0ed357b60dd15c474a84c6eb595eead1b4c33847",
83
+ "gitHead": "ae5e552573b74bf4a478e9054348e43fb5fd3eaa",
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  }
@@ -372,7 +372,7 @@ export const QuestionForField = ({
372
372
 
373
373
  {field.type !== 'Question Group' &&
374
374
  <Typography color="error" style={{ marginTop: 3, height: 10, fontSize: 14, marginBottom: -10 }}>
375
- {(validationMessage === 'A response is required' || validationMessage === 'A value must be checked' || validationMessage === 'A file is required')
375
+ {(validationMessage === 'A response is required' || validationMessage === 'A value must be checked' || validationMessage === 'A file is required' || 'Enter a valid phone number' || 'Insurer is required')
376
376
  ? value.touched
377
377
  ? form_display_text_for_language(form, validationMessage)
378
378
  : null
@@ -5,7 +5,7 @@ import { FormInputProps } from "./types"
5
5
  import { useDropzone } from "react-dropzone"
6
6
  import { CANVAS_TITLE, EMOTII_TITLE, INSURANCE_RELATIONSHIPS, INSURANCE_RELATIONSHIPS_CANVAS, PRIMARY_HEX, RELATIONSHIP_TYPES, TELLESCOPE_GENDERS } from "@tellescope/constants"
7
7
  import { MM_DD_YYYY_to_YYYY_MM_DD, capture_is_supported, downloadFile, first_letter_capitalized, form_response_value_to_string, getLocalTimezone, getPublicFileURL, mm_dd_yyyy, replace_enduser_template_values, truncate_string, user_display_name } from "@tellescope/utilities"
8
- import { DatabaseSelectResponse, Enduser, EnduserRelationship, FormResponseValue, InsuranceRelationship, MultipleChoiceOptions, TellescopeGender } from "@tellescope/types-models"
8
+ import { DatabaseSelectResponse, Enduser, EnduserRelationship, FormResponseValue, InsuranceRelationship, MedicationResponse, MultipleChoiceOptions, TellescopeGender } from "@tellescope/types-models"
9
9
  import { VALID_STATES, emailValidator, phoneValidator } from "@tellescope/validation"
10
10
  import Slider from '@mui/material/Slider';
11
11
  import LinearProgress from '@mui/material/LinearProgress';
@@ -492,6 +492,7 @@ export const InsuranceInput = ({ field, value, onChange, form, responses, enduse
492
492
  const session = useResolvedSession()
493
493
 
494
494
  const [payers, setPayers] = useState<{ id: string, name: string, type?: string, state?: string }[]>([])
495
+ const [query, setQuery] = useState('')
495
496
 
496
497
  const addressQuestion = useMemo(() => responses?.find(r => {
497
498
  if (r.answer.type !== 'Address') return false
@@ -509,6 +510,7 @@ export const InsuranceInput = ({ field, value, onChange, form, responses, enduse
509
510
 
510
511
  const loadRef = useRef(false) // so session changes don't cause
511
512
  useEffect(() => {
513
+ if (field?.options?.dataSource === CANVAS_TITLE) return // instead, look-up while typing against Canvas Search API
512
514
  if (loadRef.current) return
513
515
  loadRef.current = true
514
516
 
@@ -525,7 +527,30 @@ export const InsuranceInput = ({ field, value, onChange, form, responses, enduse
525
527
  .filter(c => !c.state || !state || (c.state === state))
526
528
  ))
527
529
  .catch(console.error)
528
- }, [session, state])
530
+ }, [session, state, field?.options?.dataSource])
531
+
532
+ const searchRef = useRef(query)
533
+ useEffect(() => {
534
+ if (field?.options?.dataSource !== CANVAS_TITLE) { return }
535
+ if (!query) return
536
+ if (searchRef.current === query) return
537
+ searchRef.current = query
538
+
539
+ session.api.integrations.proxy_read({
540
+ integration: CANVAS_TITLE,
541
+ query,
542
+ type: 'organizations',
543
+ })
544
+ .then(({ data }) => {
545
+ try {
546
+ setPayers(data.map((d: any) => ({
547
+ id: d.resource.id,
548
+ name: d.resource.name,
549
+ })))
550
+ } catch(err) { console.error }
551
+ })
552
+ .catch(console.error)
553
+ }, [session, field?.options?.dataSource, query])
529
554
 
530
555
  return (
531
556
  <Grid container spacing={2} sx={{ mt: '0' }}>
@@ -538,12 +563,20 @@ export const InsuranceInput = ({ field, value, onChange, form, responses, enduse
538
563
  payerId: payers.find(p => p.name === v)?.id || '',
539
564
  payerType: payers.find(p => p.name === v)?.type || '',
540
565
  }, field.id)}
541
- onInputChange={field.options?.requirePredefinedInsurer ? undefined : (e, v) => onChange({
542
- ...value,
543
- payerName: v || '',
544
- payerId: payers.find(p => p.name === v)?.id || '',
545
- payerType: payers.find(p => p.name === v)?.type || '',
546
- }, field.id)}
566
+ onInputChange={
567
+ field.options?.requirePredefinedInsurer
568
+ ? (e, v) => { if (v) { setQuery(v) } }
569
+ : (e, v) => {
570
+ if (v) { setQuery(v) }
571
+
572
+ onChange({
573
+ ...value,
574
+ payerName: v || '',
575
+ payerId: payers.find(p => p.name === v)?.id || '',
576
+ payerType: payers.find(p => p.name === v)?.type || '',
577
+ }, field.id)
578
+ }
579
+ }
547
580
  renderInput={(params) => (
548
581
  <TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }}
549
582
  required={!field.isOptional} size="small" label="Insurer"
@@ -596,7 +629,11 @@ export const InsuranceInput = ({ field, value, onChange, form, responses, enduse
596
629
  <Grid item xs={12}>
597
630
  <StringSelector size="small" label="Relationship to Policy Owner"
598
631
  options={
599
- (field.options?.billingProvider === 'Canvas' ? INSURANCE_RELATIONSHIPS_CANVAS : INSURANCE_RELATIONSHIPS)
632
+ (
633
+ (field.options?.billingProvider === CANVAS_TITLE || field.options?.dataSource === CANVAS_TITLE )
634
+ ? INSURANCE_RELATIONSHIPS_CANVAS
635
+ : INSURANCE_RELATIONSHIPS
636
+ )
600
637
  .sort((x, y) => x.localeCompare(y))
601
638
  }
602
639
  value={value?.relationship || 'Self'}
@@ -809,13 +846,14 @@ export const InsuranceInput = ({ field, value, onChange, form, responses, enduse
809
846
  }
810
847
 
811
848
 
812
- const StringSelector = ({ options, value, onChange, required, ...props } : {
849
+ const StringSelector = ({ options, value, onChange, required, getDisplayValue, ...props } : {
813
850
  options: string[]
814
851
  value: string,
815
852
  onChange: (v: string) => void,
816
853
  label?: string,
817
854
  size?: "small",
818
855
  required?: boolean,
856
+ getDisplayValue?: (v: string) => string,
819
857
  }) => (
820
858
  <FormControl fullWidth size={props.size} required={required}>
821
859
  <InputLabel>{props.label}</InputLabel>
@@ -823,7 +861,7 @@ const StringSelector = ({ options, value, onChange, required, ...props } : {
823
861
  sx={defaultInputProps.sx}
824
862
  >
825
863
  {options.map((o, i) => (
826
- <MenuItem value={o} key={o || i}>{o}</MenuItem>
864
+ <MenuItem value={o} key={o || i}>{getDisplayValue?.(o) ?? o}</MenuItem>
827
865
  ))}
828
866
  </Select>
829
867
  </FormControl>
@@ -886,7 +924,9 @@ export const AddressInput = ({ field, form, value, onChange, ...props }: FormInp
886
924
  )}
887
925
  renderInput={(params) => (
888
926
  <TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }}
889
- size={'small'} required={!field.isOptional}
927
+ required={!field.isOptional}
928
+ // don't use 'small' so as to be consistent with other text fields, in case this is used in a group
929
+ // size={'small'}
890
930
  label={form_display_text_for_language(form, "State")}
891
931
  />
892
932
  )}
@@ -1901,11 +1941,12 @@ const DRUGS_FOR_DISPLAY_TERM = {} as Record<string, Drug[]>
1901
1941
  const RX_NORM_CODE_FOR_DRUG = {} as Record<string, string>
1902
1942
  const NDC_CODES_FOR_RX_NORM_CODE = {} as Record<string, string[]>
1903
1943
 
1904
- const useMedications = () => {
1944
+ const useMedications = ({ dontFetch } : { dontFetch?: boolean }) => {
1905
1945
  const [displayTerms, setDisplayTerms] = useState(displayTermsCache)
1906
1946
  const fetchRef = useRef(displayTerms !== undefined)
1907
1947
 
1908
1948
  useEffect(() => {
1949
+ if (dontFetch) return
1909
1950
  if (fetchRef.current) return
1910
1951
  fetchRef.current = true
1911
1952
 
@@ -1932,7 +1973,7 @@ const useMedications = () => {
1932
1973
  })
1933
1974
  )
1934
1975
  .catch(console.error)
1935
- }, [])
1976
+ }, [dontFetch])
1936
1977
 
1937
1978
  const getDrugsForDisplayTerm = useCallback(async (s: string) => {
1938
1979
  const drugs = DRUGS_FOR_DISPLAY_TERM[s] || (
@@ -2010,8 +2051,172 @@ const filterOptions = (options: string[], { inputValue } : { inputValue: string
2010
2051
  .slice(0, 100) // dramatic performance improvement (when not virtualized) to show a subset like this
2011
2052
  )
2012
2053
 
2013
- export const MedicationsInput = ({ field, value, onChange }: FormInputProps<'Medications'>) => {
2014
- const { displayTerms, doneLoading, getCodesForDrug, getDrugsForDisplayTerm } = useMedications()
2054
+ const FDB_URL = "http://www.fdbhealth.com/"
2055
+ type CanvasMedicationResult = {
2056
+ entry?: { resource: { code: { coding: { system: string, code: string, display: string } []}} }[]
2057
+ }
2058
+
2059
+ export const CanvasMedicationsInput = ({ field, value=[], onChange }: FormInputProps<'Medications'>) => {
2060
+ const session = useResolvedSession()
2061
+ const [query, setQuery] = useState('')
2062
+ const [results, setResults] = useState<MedicationResponse[]>([])
2063
+
2064
+ // if two Medications questions shown in a row, reset state
2065
+ useEffect(() => {
2066
+ setQuery('')
2067
+ setResults([])
2068
+ }, [field.id])
2069
+
2070
+ const fetchRef = useRef(query)
2071
+ useEffect(() => {
2072
+ if (fetchRef.current === query) return
2073
+ fetchRef.current = query
2074
+
2075
+ if (!query) return
2076
+
2077
+ const t = setTimeout(() => {
2078
+ session.api.integrations
2079
+ .proxy_read({
2080
+ integration: CANVAS_TITLE,
2081
+ type: 'medications',
2082
+ query,
2083
+ })
2084
+ .then((r : { data: CanvasMedicationResult }) => {
2085
+ setResults(
2086
+ (r.data?.entry || [])
2087
+ .map(v => {
2088
+ const fdbCode = v.resource.code.coding.find(c => c.system === FDB_URL)
2089
+
2090
+ return {
2091
+ displayTerm: fdbCode?.display || '',
2092
+ drugName: fdbCode?.display || '',
2093
+ fdbCode: fdbCode?.code || '',
2094
+ }
2095
+ })
2096
+ )
2097
+ })
2098
+ }, 200)
2099
+
2100
+ return () => { clearTimeout(t) }
2101
+ }, [session, query, field?.options?.dataSource])
2102
+
2103
+ return (
2104
+ <Grid container direction="column" spacing={1}>
2105
+ <Grid item>
2106
+ <Autocomplete multiple value={value} options={results} style={{ marginTop: 5 }}
2107
+ noOptionsText={query.length ? 'No results found' : 'Type to start search'}
2108
+ onChange={(e, v) => {
2109
+ if (!v) { return }
2110
+ onChange(v, field.id)
2111
+ setResults([])
2112
+ }}
2113
+ getOptionLabel={v => first_letter_capitalized(v.displayTerm)} filterOptions={o => o}
2114
+ inputValue={query} onInputChange={(e, v) => e && setQuery(v) }
2115
+ renderInput={(params) => (
2116
+ <TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }}
2117
+ required={!field.isOptional} size="small" label="" placeholder="Search medications..."
2118
+ />
2119
+ )}
2120
+ renderTags={(value, getTagProps) =>
2121
+ value.map((value, index) => (
2122
+ <Chip
2123
+ label={<Typography style={{whiteSpace: 'normal'}}>{value.displayTerm}</Typography>}
2124
+ {...getTagProps({ index })}
2125
+ sx={{height:"100%", py: 0.5 }}
2126
+ />
2127
+ ))
2128
+ }
2129
+ />
2130
+ </Grid>
2131
+
2132
+ {(value || []).map((medication, i) => (
2133
+ <Grid item key={i}>
2134
+ <Grid container direction="column" spacing={0.75}>
2135
+ <Grid item>
2136
+ <Typography noWrap sx={{ fontSize: 14 }}>
2137
+ {medication.drugName}
2138
+ </Typography>
2139
+ </Grid>
2140
+
2141
+ <Grid item>
2142
+ <Grid container alignItems="center" wrap="nowrap" columnGap={0.5} justifyContent={"space-between"}>
2143
+ <Grid item sx={{ width: '50%', mr: 1 }}>
2144
+ <TextField type="number" InputProps={{ sx: defaultInputProps.sx }} fullWidth size="small"
2145
+ label="Units (e.g. capsule, table, puff) per dose?"
2146
+ value={medication.dosage?.quantity || ''}
2147
+ onChange={e => (
2148
+ onChange((value || []).map((v, _i) =>
2149
+ i === _i
2150
+ ? { ...v, dosage: { ...v.dosage!, quantity: e.target.value } }
2151
+ : v
2152
+ ),
2153
+ field.id
2154
+ )
2155
+ )} />
2156
+ </Grid>
2157
+
2158
+ <Grid item sx={{ width: '30%' }}>
2159
+ <StringSelector size="small" label="How many times?"
2160
+ options={["1", "2", "3", "4", "5", "6", "As Needed"]}
2161
+ value={medication.dosage?.frequency ?? ''}
2162
+ onChange={async (frequency) => {
2163
+ onChange(
2164
+ (value ?? []).map((_v, _i) => (
2165
+ i === _i
2166
+ ? {
2167
+ ..._v,
2168
+ dosage: {
2169
+ ..._v.dosage!,
2170
+ frequency: frequency || ''
2171
+ }
2172
+ }
2173
+ : _v
2174
+ )),
2175
+ field.id,
2176
+ )
2177
+ }}
2178
+ />
2179
+ </Grid>
2180
+
2181
+ <Grid item sx={{ width: '20%' }}>
2182
+ <StringSelector options={['Day', 'Week', 'Month', "Year"]} size="small" label="Per"
2183
+ value={medication.dosage?.frequencyDescriptor || 'Day'}
2184
+ onChange={frequencyDescriptor => (
2185
+ onChange((value || []).map((v, _i) =>
2186
+ i === _i
2187
+ ? { ...v, dosage: { ...v.dosage!, frequencyDescriptor } }
2188
+ : v
2189
+ ),
2190
+ field.id
2191
+ )
2192
+ )}
2193
+ getDisplayValue={first_letter_capitalized}
2194
+ />
2195
+ </Grid>
2196
+ </Grid>
2197
+ </Grid>
2198
+
2199
+ <Grid item>
2200
+ <TextField InputProps={{ sx: defaultInputProps.sx }} fullWidth size="small" label="Reason for taking medication"
2201
+ value={medication.reasonForTaking || ''}
2202
+ onChange={e => onChange((value || []).map((v, _i) => i === _i ? { ...v, reasonForTaking: e.target.value } : v), field.id)}
2203
+ />
2204
+ </Grid>
2205
+
2206
+ <Grid item>
2207
+ <Divider flexItem sx={{ my: 0.5 }} />
2208
+ </Grid>
2209
+ </Grid>
2210
+ </Grid>
2211
+ ))}
2212
+ </Grid>
2213
+ )
2214
+ }
2215
+
2216
+ export const MedicationsInput = ({ field, value, onChange, ...props }: FormInputProps<'Medications'>) => {
2217
+ const { displayTerms, doneLoading, getCodesForDrug, getDrugsForDisplayTerm } = useMedications({
2218
+ dontFetch: field.options?.dataSource === CANVAS_TITLE
2219
+ })
2015
2220
  const [drugs, setDrugs] = useState<Record<string, Drug[]>>({})
2016
2221
 
2017
2222
  // uncomment to load data after initial typing
@@ -2040,6 +2245,9 @@ export const MedicationsInput = ({ field, value, onChange }: FormInputProps<'Med
2040
2245
  // .catch(console.error)
2041
2246
  // }, [value, getDrugsForDisplayTerm])
2042
2247
 
2248
+ if (field.options?.dataSource === CANVAS_TITLE) {
2249
+ return <CanvasMedicationsInput field={field} value={value} onChange={onChange} {...props} />
2250
+ }
2043
2251
  return (
2044
2252
  <Grid container direction="column" sx={{ mt: 2 }}>
2045
2253
  {(value ?? []).map((v, i) => (
@@ -2966,30 +3174,61 @@ export const AllergiesInput = ({ goToNextField, goToPreviousField, field, value,
2966
3174
  }, [session, query, field?.options?.dataSource])
2967
3175
 
2968
3176
  return (
2969
- <Autocomplete multiple value={value || []} options={results} style={{ marginTop: 5 }}
2970
- noOptionsText={query.length ? 'No results found' : 'Type to start search'}
2971
- onChange={(e, v) => {
2972
- if (!v) { return }
2973
- onChange(v, field.id)
2974
- setResults([])
2975
- }}
2976
- getOptionLabel={v => first_letter_capitalized(v.display)} filterOptions={o => o}
2977
- inputValue={query} onInputChange={(e, v) => e && setQuery(v) }
2978
- renderInput={(params) => (
2979
- <TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }}
2980
- required={!field.isOptional} size="small" label="" placeholder="Search allergies..."
2981
- />
2982
- )}
2983
- renderTags={(value, getTagProps) =>
2984
- value.map((value, index) => (
2985
- <Chip
2986
- label={<Typography style={{whiteSpace: 'normal'}}>{value.display}</Typography>}
2987
- {...getTagProps({ index })}
2988
- sx={{height:"100%", py: 0.5 }}
3177
+ <Grid container direction="column" spacing={1}>
3178
+ <Grid item>
3179
+ <Autocomplete multiple value={value || []} options={results} style={{ marginTop: 5 }}
3180
+ noOptionsText={query.length ? 'No results found' : 'Type to start search'}
3181
+ onChange={(e, v) => {
3182
+ if (!v) { return }
3183
+ onChange(v, field.id)
3184
+ setResults([])
3185
+ }}
3186
+ getOptionLabel={v => first_letter_capitalized(v.display)} filterOptions={o => o}
3187
+ inputValue={query} onInputChange={(e, v) => e && setQuery(v) }
3188
+ renderInput={(params) => (
3189
+ <TextField {...params} InputProps={{ ...params.InputProps, sx: defaultInputProps.sx }}
3190
+ required={!field.isOptional} size="small" label="" placeholder="Search allergies..."
2989
3191
  />
2990
- ))
2991
- }
2992
- />
3192
+ )}
3193
+ renderTags={(value, getTagProps) =>
3194
+ value.map((value, index) => (
3195
+ <Chip
3196
+ label={<Typography style={{whiteSpace: 'normal'}}>{value.display}</Typography>}
3197
+ {...getTagProps({ index })}
3198
+ sx={{height:"100%", py: 0.5 }}
3199
+ />
3200
+ ))
3201
+ }
3202
+ />
3203
+ </Grid>
3204
+
3205
+ {(value || []).map((allergy, i) => (
3206
+ <Grid item key={i}>
3207
+ <Grid container alignItems="center" wrap="nowrap" columnGap={0.5} justifyContent={"space-between"}>
3208
+ <Grid item>
3209
+ <Typography noWrap sx={{ width: 85, fontSize: 14 }}>
3210
+ {allergy.display}
3211
+ </Typography>
3212
+ </Grid>
3213
+
3214
+ <Grid item sx={{ width: 140 }}>
3215
+ <StringSelector options={['mild', 'moderate', 'severe']} size="small" label="Severity"
3216
+ value={allergy.severity || ''}
3217
+ onChange={severity => onChange((value || []).map((v, _i) => i === _i ? { ...v, severity } : v), field.id)}
3218
+ getDisplayValue={first_letter_capitalized}
3219
+ />
3220
+ </Grid>
3221
+
3222
+ <Grid item sx={{ width: "50%" }}>
3223
+ <TextField InputProps={{ sx: defaultInputProps.sx }} fullWidth size="small" label="Note"
3224
+ value={allergy.note || ''}
3225
+ onChange={e => onChange((value || []).map((v, _i) => i === _i ? { ...v, note: e.target.value } : v), field.id)}
3226
+ />
3227
+ </Grid>
3228
+ </Grid>
3229
+ </Grid>
3230
+ ))}
3231
+ </Grid>
2993
3232
  )
2994
3233
  }
2995
3234
  const display_with_code = (v: { code: string, display: string }) => `${v.code}: ${first_letter_capitalized(v.display)}`
package/src/mui.tsx CHANGED
@@ -340,9 +340,10 @@ export interface ModalProps extends Styled {
340
340
  setOpen: (b: boolean) => void,
341
341
  onClick?: () => void,
342
342
  ref?: any,
343
+ zIndex?: number,
343
344
  }
344
- export const Modal = ({ children, onClick, open, setOpen, style=defaultModalStyle }: ModalProps) => (
345
- <MuiModal open={open} onClick={onClick} onClose={() => setOpen(false)}>
345
+ export const Modal = ({ children, onClick, open, setOpen, style=defaultModalStyle, zIndex }: ModalProps) => (
346
+ <MuiModal open={open} onClick={onClick} onClose={() => setOpen(false)} style={{ zIndex }}>
346
347
  <Grid container style={style}>
347
348
  {children}
348
349
  </Grid>