@tellescope/react-components 1.243.1 → 1.244.1
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 +1 -0
- package/lib/cjs/Forms/forms.d.ts.map +1 -1
- package/lib/cjs/Forms/forms.js +39 -37
- package/lib/cjs/Forms/forms.js.map +1 -1
- package/lib/cjs/Forms/forms.v2.d.ts +1 -0
- package/lib/cjs/Forms/forms.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/forms.v2.js +47 -40
- package/lib/cjs/Forms/forms.v2.js.map +1 -1
- 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 +71 -28
- package/lib/cjs/Forms/hooks.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts +5 -0
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +202 -12
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/Forms/inputs.v2.d.ts +1 -0
- package/lib/cjs/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.v2.js +16 -6
- package/lib/cjs/Forms/inputs.v2.js.map +1 -1
- package/lib/cjs/forms.d.ts +2 -1
- package/lib/cjs/forms.d.ts.map +1 -1
- package/lib/cjs/forms.js +2 -2
- package/lib/cjs/forms.js.map +1 -1
- package/lib/cjs/inputs_shared.d.ts +1 -0
- package/lib/cjs/inputs_shared.d.ts.map +1 -1
- package/lib/cjs/inputs_shared.js +27 -3
- package/lib/cjs/inputs_shared.js.map +1 -1
- package/lib/esm/Forms/forms.d.ts +1 -0
- package/lib/esm/Forms/forms.d.ts.map +1 -1
- package/lib/esm/Forms/forms.js +40 -38
- package/lib/esm/Forms/forms.js.map +1 -1
- package/lib/esm/Forms/forms.v2.d.ts +1 -0
- package/lib/esm/Forms/forms.v2.d.ts.map +1 -1
- package/lib/esm/Forms/forms.v2.js +48 -41
- package/lib/esm/Forms/forms.v2.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 +70 -28
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +5 -0
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +202 -13
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/Forms/inputs.v2.d.ts +1 -0
- package/lib/esm/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.v2.js +16 -7
- package/lib/esm/Forms/inputs.v2.js.map +1 -1
- package/lib/esm/forms.d.ts +2 -1
- package/lib/esm/forms.d.ts.map +1 -1
- package/lib/esm/forms.js +2 -2
- package/lib/esm/forms.js.map +1 -1
- package/lib/esm/inputs_shared.d.ts +1 -0
- package/lib/esm/inputs_shared.d.ts.map +1 -1
- package/lib/esm/inputs_shared.js +28 -4
- 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 +10 -2
- package/src/Forms/forms.v2.tsx +29 -3
- package/src/Forms/hooks.tsx +46 -1
- package/src/Forms/inputs.tsx +304 -6
- package/src/Forms/inputs.v2.tsx +19 -4
- package/src/forms.tsx +3 -1
- package/src/inputs_shared.tsx +39 -5
package/src/Forms/inputs.v2.tsx
CHANGED
|
@@ -23,7 +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
|
+
import { useConditionalChoices, Response, dateFromOffsetMs } from "./hooks"
|
|
27
27
|
|
|
28
28
|
export const LanguageSelect = ({ value, ...props }: { value: string, onChange: (s: string) => void}) => (
|
|
29
29
|
<Grid container alignItems="center" justifyContent={"center"} wrap="nowrap" spacing={1}>
|
|
@@ -264,6 +264,9 @@ export const DateInput = ({
|
|
|
264
264
|
} & FormInputProps<'date'> & Styled) => {
|
|
265
265
|
const inputRef = useRef(null);
|
|
266
266
|
|
|
267
|
+
const minDate = field.options?.minDateOffsetMs !== undefined ? dateFromOffsetMs(field.options.minDateOffsetMs) : undefined
|
|
268
|
+
const maxDate = field.options?.maxDateOffsetMs !== undefined ? dateFromOffsetMs(field.options.maxDateOffsetMs) : undefined
|
|
269
|
+
|
|
267
270
|
return (
|
|
268
271
|
<DatePicker // wrap in item to prevent movement on focused
|
|
269
272
|
selected={value}
|
|
@@ -277,6 +280,8 @@ export const DateInput = ({
|
|
|
277
280
|
customInput={<CustomDateInput inputRef={inputRef} {...props} />}
|
|
278
281
|
// className={css`width: 100%;`}
|
|
279
282
|
className={css`${datepickerCSS}`}
|
|
283
|
+
minDate={minDate}
|
|
284
|
+
maxDate={maxDate}
|
|
280
285
|
/>
|
|
281
286
|
)
|
|
282
287
|
}
|
|
@@ -423,6 +428,9 @@ const CustomDateStringInput = forwardRef((props: TextFieldProps, ref) => (
|
|
|
423
428
|
export const DateStringInput = ({ field, value, onChange, form, ...props }: FormInputProps<'string'>) => {
|
|
424
429
|
const inputRef = useRef(null);
|
|
425
430
|
|
|
431
|
+
const minDate = field.options?.minDateOffsetMs !== undefined ? dateFromOffsetMs(field.options.minDateOffsetMs) : undefined
|
|
432
|
+
const maxDate = field.options?.maxDateOffsetMs !== undefined ? dateFromOffsetMs(field.options.maxDateOffsetMs) : undefined
|
|
433
|
+
|
|
426
434
|
// if (value && isDateString(value)) {
|
|
427
435
|
// console.log(value, new Date(
|
|
428
436
|
// new Date(MM_DD_YYYY_to_YYYY_MM_DD(value)).getTime()
|
|
@@ -446,11 +454,13 @@ export const DateStringInput = ({ field, value, onChange, form, ...props }: Form
|
|
|
446
454
|
required={!field.isOptional}
|
|
447
455
|
autoComplete="off"
|
|
448
456
|
dateFormat={"MM-dd-yyyy"}
|
|
449
|
-
customInput={<CustomDateStringInput inputRef={inputRef} {...props}
|
|
450
|
-
label={(!field.title && field.placeholder) ? field.placeholder : props.label}
|
|
457
|
+
customInput={<CustomDateStringInput inputRef={inputRef} {...props}
|
|
458
|
+
label={(!field.title && field.placeholder) ? field.placeholder : props.label}
|
|
451
459
|
/>}
|
|
452
460
|
// className={css`width: 100%;`}
|
|
453
461
|
className={css`${datepickerCSS}`}
|
|
462
|
+
minDate={minDate}
|
|
463
|
+
maxDate={maxDate}
|
|
454
464
|
/>
|
|
455
465
|
)
|
|
456
466
|
: (
|
|
@@ -546,7 +556,7 @@ export const NumberInput = ({ field, value, onChange, form, ...props }: FormInpu
|
|
|
546
556
|
}
|
|
547
557
|
|
|
548
558
|
// 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'
|
|
559
|
+
import { InsuranceInput as SharedInsuranceInput, BridgeEligibilityInput as SharedBridgeEligibilityInput, CandidEligibilityInput as SharedCandidEligibilityInput, PharmacySearchInput as SharedPharmacySearchInput, AppointmentBookingInput as SharedAppointmentBookingInput } from './inputs'
|
|
550
560
|
|
|
551
561
|
// Wrap the shared InsuranceInput component with v2-specific props
|
|
552
562
|
export const InsuranceInput = (props: FormInputProps<'Insurance'>) => {
|
|
@@ -558,6 +568,11 @@ export const BridgeEligibilityInput = (props: FormInputProps<'Bridge Eligibility
|
|
|
558
568
|
return <SharedBridgeEligibilityInput {...props} inputProps={defaultInputProps} />
|
|
559
569
|
}
|
|
560
570
|
|
|
571
|
+
// Wrap the shared CandidEligibilityInput component with v2-specific props
|
|
572
|
+
export const CandidEligibilityInput = (props: FormInputProps<'Candid Eligibility'>) => {
|
|
573
|
+
return <SharedCandidEligibilityInput {...props} inputProps={defaultInputProps} />
|
|
574
|
+
}
|
|
575
|
+
|
|
561
576
|
// Wrap the shared PharmacySearchInput component with v2-specific props
|
|
562
577
|
export const PharmacySearchInput = (props: FormInputProps<'Pharmacy Search'>) => {
|
|
563
578
|
return <SharedPharmacySearchInput {...props} />
|
package/src/forms.tsx
CHANGED
|
@@ -210,11 +210,13 @@ interface FormikSubmitButtonProps extends SubmitButtonOptions, Styled {
|
|
|
210
210
|
enabled?: boolean,
|
|
211
211
|
onClick?: () => void, // to handle submit in environment where html form type handleSubmit is not supported
|
|
212
212
|
disabledIfUnchanged?: boolean,
|
|
213
|
+
muiColor?: string,
|
|
213
214
|
}
|
|
214
|
-
export const FormikSubmitButton = ({ formik, enabled, disabledIfUnchanged=true, disabled, onClick, submitText, submittingText, style, ...props }: FormikSubmitButtonProps) => (
|
|
215
|
+
export const FormikSubmitButton = ({ formik, enabled, disabledIfUnchanged=true, disabled, onClick, submitText, submittingText, style, muiColor, ...props }: FormikSubmitButtonProps) => (
|
|
215
216
|
<SubmitButton onClick={onClick} submitText={submitText} submittingText={submittingText}
|
|
216
217
|
disabled={!enabled && (disabled || !formik.isValid || (disabledIfUnchanged && !formik.dirty))} style={style}
|
|
217
218
|
submitting={formik.isSubmitting}
|
|
219
|
+
muiColor={muiColor}
|
|
218
220
|
{...props}
|
|
219
221
|
/>
|
|
220
222
|
)
|
package/src/inputs_shared.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useCallback, useMemo, useState, useRef } from "react"
|
|
2
2
|
import { Indexable, ScoreFilter } from "@tellescope/types-utilities"
|
|
3
|
-
import { is_full_iso_string_heuristic, object_is_empty, objects_equivalent, read_local_storage, replace_keys_and_values_in_object, safeJSONParse, update_local_storage, user_display_name, value_for_dotted_key } from "@tellescope/utilities"
|
|
4
|
-
import { LoadFunction, LoadFunctionArguments } from "@tellescope/sdk"
|
|
3
|
+
import { is_full_iso_string_heuristic, object_is_empty, objects_equivalent, read_local_storage, replace_keys_and_values_in_object, safeJSONParse, to_human_readable_phone_number, update_local_storage, user_display_name, value_for_dotted_key } from "@tellescope/utilities"
|
|
4
|
+
import { LoadFunction, LoadFunctionArguments, Session } from "@tellescope/sdk"
|
|
5
5
|
import { ALL_ACCESS, HEALTHIE_TITLE, UNSEARCHABLE_FIELDS } from "@tellescope/constants"
|
|
6
6
|
import { SearchAPIProps, useSearchAPI } from "./hooks"
|
|
7
7
|
import { TextFieldProps } from "./mui"
|
|
@@ -1398,6 +1398,7 @@ export interface UserAndEnduserSelectorProps {
|
|
|
1398
1398
|
dontIncludeSelf: boolean,
|
|
1399
1399
|
virtualizationHeight?: number,
|
|
1400
1400
|
showEntityType?: boolean,
|
|
1401
|
+
showEnduserDetails?: boolean,
|
|
1401
1402
|
}
|
|
1402
1403
|
export const UserAndEnduserSelector: React.JSXElementConstructor<UserAndEnduserSelectorProps> = ({
|
|
1403
1404
|
titleInput,
|
|
@@ -1419,6 +1420,7 @@ export const UserAndEnduserSelector: React.JSXElementConstructor<UserAndEnduserS
|
|
|
1419
1420
|
dontIncludeSelf,
|
|
1420
1421
|
virtualizationHeight,
|
|
1421
1422
|
showEntityType,
|
|
1423
|
+
showEnduserDetails,
|
|
1422
1424
|
}) => {
|
|
1423
1425
|
const session = useResolvedSession()
|
|
1424
1426
|
const [endusersLoading, { loadMore: loadMoreEndusers, doneLoading: doneLoadingEndusers }] = useEndusers()
|
|
@@ -1513,7 +1515,7 @@ export const UserAndEnduserSelector: React.JSXElementConstructor<UserAndEnduserS
|
|
|
1513
1515
|
virtualizationHeight ? {
|
|
1514
1516
|
virtualize: true,
|
|
1515
1517
|
height: virtualizationHeight,
|
|
1516
|
-
rowHeight: 45,
|
|
1518
|
+
rowHeight: showEnduserDetails ? 65 : 45,
|
|
1517
1519
|
width: '100%',
|
|
1518
1520
|
hideHorizontalScroll: true,
|
|
1519
1521
|
} : undefined
|
|
@@ -1571,13 +1573,45 @@ export const UserAndEnduserSelector: React.JSXElementConstructor<UserAndEnduserS
|
|
|
1571
1573
|
</Typography>
|
|
1572
1574
|
|
|
1573
1575
|
{showEntityType && (user as Enduser).customTypeId &&
|
|
1574
|
-
<Typography style={{
|
|
1576
|
+
<Typography style={{
|
|
1575
1577
|
fontWeight: selected.includes(user.id) ? 'bold' : undefined,
|
|
1576
1578
|
fontSize: 12.5,
|
|
1577
1579
|
}}>
|
|
1578
1580
|
{entityTypes.find(t => t.id === (user as Enduser).customTypeId)?.title}
|
|
1579
|
-
</Typography>
|
|
1581
|
+
</Typography>
|
|
1580
1582
|
}
|
|
1583
|
+
|
|
1584
|
+
{showEnduserDetails && !users.find(u => u.id === user.id) && (() => {
|
|
1585
|
+
const enduser = user as Enduser
|
|
1586
|
+
const hiddenFields = session.type === 'user' ? (session as Session).userInfo.uiRestrictions?.hiddenFields : undefined
|
|
1587
|
+
const customTypeId = enduser.customTypeId
|
|
1588
|
+
|
|
1589
|
+
const isHidden = (field: string) =>
|
|
1590
|
+
hiddenFields?.find(v => v.field === field && ((v.type || '') === (customTypeId || '')))
|
|
1591
|
+
|
|
1592
|
+
const details: string[] = []
|
|
1593
|
+
|
|
1594
|
+
if (enduser.dateOfBirth && !isHidden('dateOfBirth')) {
|
|
1595
|
+
const d = new Date(enduser.dateOfBirth)
|
|
1596
|
+
if (!isNaN(d.getTime())) {
|
|
1597
|
+
details.push(`DOB: ${(d.getUTCMonth() + 1).toString().padStart(2, '0')}-${d.getUTCDate().toString().padStart(2, '0')}-${d.getUTCFullYear()}`)
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
if (enduser.email && !isHidden('email')) {
|
|
1601
|
+
details.push(enduser.email)
|
|
1602
|
+
}
|
|
1603
|
+
if (enduser.phone && !isHidden('phone')) {
|
|
1604
|
+
details.push(to_human_readable_phone_number(enduser.phone) || enduser.phone)
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
if (details.length === 0) return null
|
|
1608
|
+
|
|
1609
|
+
return (
|
|
1610
|
+
<Typography style={{ fontSize: 11.5, color: '#888' }}>
|
|
1611
|
+
{details.join(' | ')}
|
|
1612
|
+
</Typography>
|
|
1613
|
+
)
|
|
1614
|
+
})()}
|
|
1581
1615
|
</Flex>
|
|
1582
1616
|
</Flex>
|
|
1583
1617
|
</HoverPaper>
|