@medplum/react 2.0.7 → 2.0.9

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.
@@ -1929,11 +1929,11 @@
1929
1929
  return (React.createElement(core$1.Group, { noWrap: true },
1930
1930
  React.createElement("div", null, props.children),
1931
1931
  React.createElement("div", null,
1932
- React.createElement(core$1.Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description }, (() => null)()))));
1932
+ React.createElement(core$1.Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, withAsterisk: props.withAsterisk }, (() => null)()))));
1933
1933
  }
1934
1934
 
1935
1935
  function FormSection(props) {
1936
- return (React.createElement(core$1.Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, error: getErrorsForInput(props.outcome, props.htmlFor) }, props.children));
1936
+ return (React.createElement(core$1.Input.Wrapper, { id: props.htmlFor, label: props.title, description: props.description, withAsterisk: props.withAsterisk, error: getErrorsForInput(props.outcome, props.htmlFor) }, props.children));
1937
1937
  }
1938
1938
 
1939
1939
  /**
@@ -2235,7 +2235,7 @@
2235
2235
  * @returns The JSX element to render.
2236
2236
  */
2237
2237
  function DateTimeInput(props) {
2238
- return (React.createElement(core$1.TextInput, { id: props.name, name: props.name, "data-testid": props.name, placeholder: props.placeholder, type: getInputType(), defaultValue: convertIsoToLocal(props.defaultValue), error: getErrorsForInput(props.outcome, props.name), onChange: (e) => {
2238
+ return (React.createElement(core$1.TextInput, { id: props.name, name: props.name, "data-testid": props.name, placeholder: props.placeholder, required: props.required, type: getInputType(), defaultValue: convertIsoToLocal(props.defaultValue), error: getErrorsForInput(props.outcome, props.name), onChange: (e) => {
2239
2239
  if (props.onChange) {
2240
2240
  const newValue = e.currentTarget.value;
2241
2241
  props.onChange(convertLocalToIso(newValue));
@@ -2777,6 +2777,7 @@
2777
2777
  const propertyType = props.elementDefinitionType.code;
2778
2778
  const name = props.name;
2779
2779
  const value = props.defaultValue;
2780
+ const required = property.min !== undefined && property.min > 0;
2780
2781
  switch (propertyType) {
2781
2782
  // 2.24.0.1 Primitive Types
2782
2783
  // https://www.hl7.org/fhir/datatypes.html#primitive
@@ -2786,13 +2787,13 @@
2786
2787
  case core.PropertyType.time:
2787
2788
  case core.PropertyType.uri:
2788
2789
  case core.PropertyType.url:
2789
- return (React.createElement(core$1.TextInput, { id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
2790
+ return (React.createElement(core$1.TextInput, { id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
2790
2791
  if (props.onChange) {
2791
2792
  props.onChange(e.currentTarget.value);
2792
2793
  }
2793
2794
  }, error: getErrorsForInput(props.outcome, name) }));
2794
2795
  case core.PropertyType.date:
2795
- return (React.createElement(core$1.TextInput, { type: "date", id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
2796
+ return (React.createElement(core$1.TextInput, { type: "date", id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
2796
2797
  if (props.onChange) {
2797
2798
  props.onChange(e.currentTarget.value);
2798
2799
  }
@@ -2804,7 +2805,7 @@
2804
2805
  case core.PropertyType.integer:
2805
2806
  case core.PropertyType.positiveInt:
2806
2807
  case core.PropertyType.unsignedInt:
2807
- return (React.createElement(core$1.TextInput, { type: "number", step: propertyType === core.PropertyType.decimal ? 'any' : '1', id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
2808
+ return (React.createElement(core$1.TextInput, { type: "number", step: propertyType === core.PropertyType.decimal ? 'any' : '1', id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
2808
2809
  if (props.onChange) {
2809
2810
  props.onChange(e.currentTarget.valueAsNumber);
2810
2811
  }
@@ -2818,7 +2819,7 @@
2818
2819
  }
2819
2820
  } }));
2820
2821
  case core.PropertyType.markdown:
2821
- return (React.createElement(core$1.Textarea, { id: name, name: name, "data-testid": name, defaultValue: value, onChange: (e) => {
2822
+ return (React.createElement(core$1.Textarea, { id: name, name: name, "data-testid": name, defaultValue: value, required: required, onChange: (e) => {
2822
2823
  if (props.onChange) {
2823
2824
  props.onChange(e.currentTarget.value);
2824
2825
  }
@@ -2897,14 +2898,15 @@
2897
2898
  return null;
2898
2899
  }
2899
2900
  const [propertyValue, propertyType] = getValueAndType(typedValue, key);
2901
+ const required = property.min !== undefined && property.min > 0;
2900
2902
  if (property.type.length === 1 && property.type[0].code === 'boolean') {
2901
2903
  return (React.createElement(CheckboxFormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, htmlFor: key },
2902
2904
  React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
2903
2905
  setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));
2904
2906
  } })));
2905
2907
  }
2906
- return (React.createElement(FormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, htmlFor: key, outcome: props.outcome },
2907
- React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, outcome: props.outcome, onChange: (newValue, propName) => {
2908
+ return (React.createElement(FormSection, { key: key, title: core.getPropertyDisplayName(key), description: property.definition, withAsterisk: required, htmlFor: key, outcome: props.outcome },
2909
+ React.createElement(ResourcePropertyInput, { property: property, name: key, defaultValue: propertyValue, defaultPropertyType: propertyType, onChange: (newValue, propName) => {
2908
2910
  setValueWrapper(setPropertyValue(value, key, propName ?? key, entry[1], newValue));
2909
2911
  } })));
2910
2912
  })));
@@ -3875,6 +3877,7 @@
3875
3877
  'not-in': 'not in',
3876
3878
  'of-type': 'of type',
3877
3879
  missing: 'missing',
3880
+ identifier: 'identifier',
3878
3881
  };
3879
3882
  /**
3880
3883
  * Sets the array of filters.