@medplum/react 2.0.9 → 2.0.11

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.
@@ -1285,10 +1285,17 @@
1285
1285
  const medplum = useMedplum();
1286
1286
  const [outcome, setOutcome] = React.useState();
1287
1287
  const issues = getIssuesForExpression(outcome, undefined);
1288
- React.useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);
1288
+ React.useEffect(() => {
1289
+ if (recaptchaSiteKey) {
1290
+ initRecaptcha(recaptchaSiteKey);
1291
+ }
1292
+ }, [recaptchaSiteKey]);
1289
1293
  return (React.createElement(Form, { style: { maxWidth: 400 }, onSubmit: async (formData) => {
1290
1294
  try {
1291
- const recaptchaToken = await getRecaptcha(recaptchaSiteKey);
1295
+ let recaptchaToken = '';
1296
+ if (recaptchaSiteKey) {
1297
+ recaptchaToken = await getRecaptcha(recaptchaSiteKey);
1298
+ }
1292
1299
  props.handleAuthResponse(await medplum.startNewUser({
1293
1300
  projectId: props.projectId,
1294
1301
  firstName: formData.firstName,
@@ -1792,6 +1799,9 @@
1792
1799
  React.createElement(ResourcePropertyDisplay, { arrayElement: true, property: property, propertyType: propertyType, value: v, ignoreMissingValues: props.ignoreMissingValues, link: props.link }))))));
1793
1800
  }
1794
1801
 
1802
+ /**
1803
+ * Low-level component that renders a property from a given resource, given type information
1804
+ */
1795
1805
  function ResourcePropertyDisplay(props) {
1796
1806
  const { property, propertyType, value } = props;
1797
1807
  if (property?.max === '*' && !props.arrayElement) {
@@ -2059,6 +2069,9 @@
2059
2069
  display: input,
2060
2070
  };
2061
2071
  }
2072
+ /**
2073
+ * A low-level component to autocomplete based on a FHIR Valueset.
2074
+ */
2062
2075
  function ValueSetAutocomplete(props) {
2063
2076
  const medplum = useMedplum();
2064
2077
  const { elementDefinition, ...rest } = props;
@@ -2290,7 +2303,7 @@
2290
2303
  }
2291
2304
 
2292
2305
  function ExtensionInput(props) {
2293
- return (React.createElement(core$1.JsonInput, { id: props.name, name: props.name, "data-testid": "extension-input", defaultValue: core.stringify(props.defaultValue), onChange: (newValue) => {
2306
+ return (React.createElement(core$1.JsonInput, { id: props.name, name: props.name, "data-testid": "extension-input", defaultValue: core.stringify(props.defaultValue), deserialize: JSON.parse, onChange: (newValue) => {
2294
2307
  if (props.onChange) {
2295
2308
  props.onChange(JSON.parse(newValue));
2296
2309
  }
@@ -2335,11 +2348,11 @@
2335
2348
  });
2336
2349
  }
2337
2350
  return (React.createElement(core$1.Group, { spacing: "xs", grow: true, noWrap: true },
2338
- React.createElement(core$1.NativeSelect, { defaultValue: value?.use, "data-testid": "use", onChange: (e) => setUse(e.currentTarget.value), data: ['', 'temp', 'old', 'usual', 'official', 'nickname', 'anonymous', 'maiden'] }),
2339
- React.createElement(core$1.TextInput, { placeholder: "Prefix", defaultValue: value?.prefix?.join(' '), onChange: (e) => setPrefix(e.currentTarget.value) }),
2340
- React.createElement(core$1.TextInput, { placeholder: "Given", defaultValue: value?.given?.join(' '), onChange: (e) => setGiven(e.currentTarget.value) }),
2341
- React.createElement(core$1.TextInput, { placeholder: "Family", defaultValue: value?.family, onChange: (e) => setFamily(e.currentTarget.value) }),
2342
- React.createElement(core$1.TextInput, { placeholder: "Suffix", defaultValue: value?.suffix?.join(' '), onChange: (e) => setSuffix(e.currentTarget.value) })));
2351
+ React.createElement(core$1.NativeSelect, { defaultValue: value?.use, name: props.name + '-use', "data-testid": "use", onChange: (e) => setUse(e.currentTarget.value), data: ['', 'temp', 'old', 'usual', 'official', 'nickname', 'anonymous', 'maiden'] }),
2352
+ React.createElement(core$1.TextInput, { placeholder: "Prefix", name: props.name + '-prefix', defaultValue: value?.prefix?.join(' '), onChange: (e) => setPrefix(e.currentTarget.value) }),
2353
+ React.createElement(core$1.TextInput, { placeholder: "Given", name: props.name + '-given', defaultValue: value?.given?.join(' '), onChange: (e) => setGiven(e.currentTarget.value) }),
2354
+ React.createElement(core$1.TextInput, { name: props.name + '-family', placeholder: "Family", defaultValue: value?.family, onChange: (e) => setFamily(e.currentTarget.value) }),
2355
+ React.createElement(core$1.TextInput, { placeholder: "Suffix", name: props.name + '-suffix', defaultValue: value?.suffix?.join(' '), onChange: (e) => setSuffix(e.currentTarget.value) })));
2343
2356
  }
2344
2357
 
2345
2358
  function IdentifierInput(props) {
@@ -3053,6 +3066,11 @@
3053
3066
  return (React.createElement(core$1.Stack, { justify: "flex-start", spacing: "xs" }, value.map((note, index) => note.text && (React.createElement(core$1.Blockquote, { key: `note-${index}`, classNames: { cite: classes.noteCite, body: classes.noteBody, root: classes.noteRoot }, cite: note.authorReference?.display || note.authorString, icon: null }, note.text)))));
3054
3067
  }
3055
3068
 
3069
+ /**
3070
+ * Renders the name of a resource, given either the resource itself or a reference to the resource.
3071
+ * @param props
3072
+ * @returns
3073
+ */
3056
3074
  function ResourceName(props) {
3057
3075
  const { value, link, ...rest } = props;
3058
3076
  const [outcome, setOutcome] = React.useState();
@@ -3757,7 +3775,7 @@
3757
3775
  return `Uploaded: ${formatFileSize(e.loaded)}`;
3758
3776
  }
3759
3777
  function formatFileSize(bytes) {
3760
- if (bytes == 0) {
3778
+ if (bytes === 0) {
3761
3779
  return '0.00 B';
3762
3780
  }
3763
3781
  const e = Math.floor(Math.log(bytes) / Math.log(1024));
@@ -6158,7 +6176,7 @@
6158
6176
  setIntervalGroups((groups) => {
6159
6177
  groups = [...groups];
6160
6178
  const currentGroupIndex = groups.findIndex((g) => g.id === groupId);
6161
- if (currentGroupIndex != -1) {
6179
+ if (currentGroupIndex !== -1) {
6162
6180
  const currentGroup = { ...groups[currentGroupIndex] };
6163
6181
  addedInterval = { ...addedInterval, ...currentGroup.filters };
6164
6182
  currentGroup.intervals = [...currentGroup.intervals, addedInterval];