@medplum/react 0.9.38 → 0.10.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.
Files changed (291) hide show
  1. package/dist/cjs/AttachmentButton.d.ts +9 -0
  2. package/dist/cjs/CodeInput.d.ts +2 -1
  3. package/dist/cjs/CodeableConceptInput.d.ts +2 -1
  4. package/dist/cjs/CodingInput.d.ts +2 -1
  5. package/dist/cjs/DateTimeInput.d.ts +9 -2
  6. package/dist/cjs/DiagnosticReportDisplay.d.ts +0 -1
  7. package/dist/cjs/ReferenceInput.d.ts +1 -0
  8. package/dist/cjs/ResourceAvatar.d.ts +8 -0
  9. package/dist/cjs/ResourceBadge.d.ts +0 -1
  10. package/dist/cjs/ResourceHistoryTable.d.ts +0 -1
  11. package/dist/cjs/ResourceInput.d.ts +2 -3
  12. package/dist/cjs/SearchPopupMenu.d.ts +0 -4
  13. package/dist/cjs/SearchUtils.d.ts +5 -5
  14. package/dist/cjs/StatusBadge.d.ts +0 -1
  15. package/dist/cjs/ValueSetAutocomplete.d.ts +10 -0
  16. package/dist/cjs/auth/RegisterForm.d.ts +0 -1
  17. package/dist/cjs/auth/SignInForm.d.ts +0 -1
  18. package/dist/cjs/defaulttheme.css +0 -51
  19. package/dist/cjs/index.d.ts +3 -21
  20. package/dist/cjs/index.js +859 -1560
  21. package/dist/cjs/index.js.map +1 -1
  22. package/dist/cjs/index.min.js +1 -1
  23. package/dist/cjs/index.min.js.map +1 -1
  24. package/dist/cjs/stories/{UploadButton.stories.d.ts → AttachmentButton.stories.d.ts} +1 -0
  25. package/dist/cjs/stories/{FormSection.stories.d.ts → CodeInput.stories.d.ts} +0 -0
  26. package/dist/cjs/stories/{Input.stories.d.ts → CodeableConceptInput.stories.d.ts} +0 -0
  27. package/dist/cjs/stories/PeriodInput.stories.d.ts +6 -0
  28. package/dist/cjs/stories/{Avatar.stories.d.ts → ResourceAvatar.stories.d.ts} +0 -0
  29. package/dist/cjs/stories/ResourceForm.stories.d.ts +1 -0
  30. package/dist/cjs/stories/{Loading.stories.d.ts → ResourceInput.stories.d.ts} +2 -1
  31. package/dist/cjs/stories/SearchControl.stories.d.ts +1 -0
  32. package/dist/cjs/styles.css +35 -1206
  33. package/dist/cjs/utils/outcomes.d.ts +1 -0
  34. package/dist/esm/AddressInput.js +9 -21
  35. package/dist/esm/AddressInput.js.map +1 -1
  36. package/dist/esm/AnnotationInput.js +2 -2
  37. package/dist/esm/AnnotationInput.js.map +1 -1
  38. package/dist/esm/AttachmentArrayInput.js +11 -8
  39. package/dist/esm/AttachmentArrayInput.js.map +1 -1
  40. package/dist/esm/AttachmentButton.d.ts +9 -0
  41. package/dist/esm/{UploadButton.js → AttachmentButton.js} +9 -9
  42. package/dist/esm/AttachmentButton.js.map +1 -0
  43. package/dist/esm/AttachmentInput.js +3 -3
  44. package/dist/esm/AttachmentInput.js.map +1 -1
  45. package/dist/esm/CalendarInput.js +6 -7
  46. package/dist/esm/CalendarInput.js.map +1 -1
  47. package/dist/esm/CodeInput.d.ts +2 -1
  48. package/dist/esm/CodeInput.js +16 -21
  49. package/dist/esm/CodeInput.js.map +1 -1
  50. package/dist/esm/CodeableConceptInput.d.ts +2 -1
  51. package/dist/esm/CodeableConceptInput.js +18 -33
  52. package/dist/esm/CodeableConceptInput.js.map +1 -1
  53. package/dist/esm/CodingInput.d.ts +2 -1
  54. package/dist/esm/CodingInput.js +24 -23
  55. package/dist/esm/CodingInput.js.map +1 -1
  56. package/dist/esm/ContactDetailInput.js +3 -4
  57. package/dist/esm/ContactDetailInput.js.map +1 -1
  58. package/dist/esm/ContactPointInput.js +5 -21
  59. package/dist/esm/ContactPointInput.js.map +1 -1
  60. package/dist/esm/DateTimeInput.d.ts +9 -2
  61. package/dist/esm/DateTimeInput.js +13 -3
  62. package/dist/esm/DateTimeInput.js.map +1 -1
  63. package/dist/esm/DiagnosticReportDisplay.d.ts +0 -1
  64. package/dist/esm/DiagnosticReportDisplay.js +21 -2
  65. package/dist/esm/DiagnosticReportDisplay.js.map +1 -1
  66. package/dist/esm/EncounterTimeline.js +2 -0
  67. package/dist/esm/EncounterTimeline.js.map +1 -1
  68. package/dist/esm/ExtensionInput.js +2 -2
  69. package/dist/esm/ExtensionInput.js.map +1 -1
  70. package/dist/esm/FhirPathTable.js +4 -5
  71. package/dist/esm/FhirPathTable.js.map +1 -1
  72. package/dist/esm/HumanNameInput.js +7 -17
  73. package/dist/esm/HumanNameInput.js.map +1 -1
  74. package/dist/esm/IdentifierInput.js +4 -5
  75. package/dist/esm/IdentifierInput.js.map +1 -1
  76. package/dist/esm/Logo.js +4 -4
  77. package/dist/esm/Logo.js.map +1 -1
  78. package/dist/esm/PatientTimeline.js +2 -0
  79. package/dist/esm/PatientTimeline.js.map +1 -1
  80. package/dist/esm/PeriodInput.js +5 -5
  81. package/dist/esm/PeriodInput.js.map +1 -1
  82. package/dist/esm/PlanDefinitionBuilder.js +17 -29
  83. package/dist/esm/PlanDefinitionBuilder.js.map +1 -1
  84. package/dist/esm/QuantityInput.js +5 -12
  85. package/dist/esm/QuantityInput.js.map +1 -1
  86. package/dist/esm/QuestionnaireBuilder.js +22 -25
  87. package/dist/esm/QuestionnaireBuilder.js.map +1 -1
  88. package/dist/esm/QuestionnaireForm.js +35 -29
  89. package/dist/esm/QuestionnaireForm.js.map +1 -1
  90. package/dist/esm/RangeInput.js +2 -2
  91. package/dist/esm/RangeInput.js.map +1 -1
  92. package/dist/esm/RatioInput.js +2 -2
  93. package/dist/esm/RatioInput.js.map +1 -1
  94. package/dist/esm/ReferenceInput.d.ts +1 -0
  95. package/dist/esm/ReferenceInput.js +4 -6
  96. package/dist/esm/ReferenceInput.js.map +1 -1
  97. package/dist/esm/RequestGroupDisplay.js +1 -1
  98. package/dist/esm/RequestGroupDisplay.js.map +1 -1
  99. package/dist/esm/ResourceArrayInput.js +10 -7
  100. package/dist/esm/ResourceArrayInput.js.map +1 -1
  101. package/dist/esm/ResourceAvatar.d.ts +8 -0
  102. package/dist/esm/ResourceAvatar.js +24 -0
  103. package/dist/esm/ResourceAvatar.js.map +1 -0
  104. package/dist/esm/ResourceBadge.d.ts +0 -1
  105. package/dist/esm/ResourceBadge.js +2 -3
  106. package/dist/esm/ResourceBadge.js.map +1 -1
  107. package/dist/esm/ResourceBlame.js +3 -3
  108. package/dist/esm/ResourceBlame.js.map +1 -1
  109. package/dist/esm/ResourceForm.js +10 -10
  110. package/dist/esm/ResourceForm.js.map +1 -1
  111. package/dist/esm/ResourceHistoryTable.d.ts +0 -1
  112. package/dist/esm/ResourceHistoryTable.js +2 -1
  113. package/dist/esm/ResourceHistoryTable.js.map +1 -1
  114. package/dist/esm/ResourceInput.d.ts +2 -3
  115. package/dist/esm/ResourceInput.js +37 -29
  116. package/dist/esm/ResourceInput.js.map +1 -1
  117. package/dist/esm/ResourcePropertyInput.js +30 -18
  118. package/dist/esm/ResourcePropertyInput.js.map +1 -1
  119. package/dist/esm/ResourceTimeline.js +23 -17
  120. package/dist/esm/ResourceTimeline.js.map +1 -1
  121. package/dist/esm/Scheduler.js +7 -7
  122. package/dist/esm/Scheduler.js.map +1 -1
  123. package/dist/esm/SearchControl.js +76 -58
  124. package/dist/esm/SearchControl.js.map +1 -1
  125. package/dist/esm/SearchControlField.js.map +1 -1
  126. package/dist/esm/SearchFieldEditor.js +7 -7
  127. package/dist/esm/SearchFieldEditor.js.map +1 -1
  128. package/dist/esm/SearchFilterEditor.js +11 -15
  129. package/dist/esm/SearchFilterEditor.js.map +1 -1
  130. package/dist/esm/SearchFilterValueDialog.js +4 -3
  131. package/dist/esm/SearchFilterValueDialog.js.map +1 -1
  132. package/dist/esm/SearchFilterValueInput.js +6 -7
  133. package/dist/esm/SearchFilterValueInput.js.map +1 -1
  134. package/dist/esm/SearchPopupMenu.d.ts +0 -4
  135. package/dist/esm/SearchPopupMenu.js +59 -73
  136. package/dist/esm/SearchPopupMenu.js.map +1 -1
  137. package/dist/esm/SearchUtils.d.ts +5 -5
  138. package/dist/esm/SearchUtils.js +11 -12
  139. package/dist/esm/SearchUtils.js.map +1 -1
  140. package/dist/esm/ServiceRequestTimeline.js +2 -0
  141. package/dist/esm/ServiceRequestTimeline.js.map +1 -1
  142. package/dist/esm/StatusBadge.d.ts +0 -1
  143. package/dist/esm/StatusBadge.js +55 -1
  144. package/dist/esm/StatusBadge.js.map +1 -1
  145. package/dist/esm/Timeline.js +12 -20
  146. package/dist/esm/Timeline.js.map +1 -1
  147. package/dist/esm/TimingInput.js +14 -17
  148. package/dist/esm/TimingInput.js.map +1 -1
  149. package/dist/esm/ValueSetAutocomplete.d.ts +10 -0
  150. package/dist/esm/ValueSetAutocomplete.js +65 -0
  151. package/dist/esm/ValueSetAutocomplete.js.map +1 -0
  152. package/dist/esm/auth/AuthenticationForm.js +12 -20
  153. package/dist/esm/auth/AuthenticationForm.js.map +1 -1
  154. package/dist/esm/auth/ChooseProfileForm.js +10 -10
  155. package/dist/esm/auth/ChooseProfileForm.js.map +1 -1
  156. package/dist/esm/auth/NewProjectForm.js +12 -15
  157. package/dist/esm/auth/NewProjectForm.js.map +1 -1
  158. package/dist/esm/auth/NewUserForm.js +25 -33
  159. package/dist/esm/auth/NewUserForm.js.map +1 -1
  160. package/dist/esm/auth/RegisterForm.d.ts +0 -1
  161. package/dist/esm/auth/RegisterForm.js.map +1 -1
  162. package/dist/esm/auth/SignInForm.d.ts +0 -1
  163. package/dist/esm/auth/SignInForm.js.map +1 -1
  164. package/dist/esm/defaulttheme.css +0 -51
  165. package/dist/esm/index.d.ts +3 -21
  166. package/dist/esm/index.js +4 -22
  167. package/dist/esm/index.js.map +1 -1
  168. package/dist/esm/index.min.js +1 -1
  169. package/dist/esm/index.min.js.map +1 -1
  170. package/dist/esm/node_modules/tslib/tslib.es6.js +13 -1
  171. package/dist/esm/node_modules/tslib/tslib.es6.js.map +1 -1
  172. package/dist/esm/stories/{UploadButton.stories.d.ts → AttachmentButton.stories.d.ts} +1 -0
  173. package/dist/{cjs/stories/Select.stories.d.ts → esm/stories/CodeInput.stories.d.ts} +0 -0
  174. package/dist/esm/stories/{FormSection.stories.d.ts → CodeableConceptInput.stories.d.ts} +0 -0
  175. package/dist/esm/stories/PeriodInput.stories.d.ts +6 -0
  176. package/dist/esm/stories/{Avatar.stories.d.ts → ResourceAvatar.stories.d.ts} +0 -0
  177. package/dist/esm/stories/ResourceForm.stories.d.ts +1 -0
  178. package/dist/{cjs/stories/Dialog.stories.d.ts → esm/stories/ResourceInput.stories.d.ts} +2 -1
  179. package/dist/esm/stories/SearchControl.stories.d.ts +1 -0
  180. package/dist/esm/styles.css +35 -1206
  181. package/dist/esm/utils/outcomes.d.ts +1 -0
  182. package/dist/esm/utils/outcomes.js +5 -1
  183. package/dist/esm/utils/outcomes.js.map +1 -1
  184. package/package.json +27 -19
  185. package/dist/cjs/Autocomplete.d.ts +0 -20
  186. package/dist/cjs/Avatar.d.ts +0 -12
  187. package/dist/cjs/Button.d.ts +0 -15
  188. package/dist/cjs/Checkbox.d.ts +0 -12
  189. package/dist/cjs/Dialog.d.ts +0 -10
  190. package/dist/cjs/FooterLinks.d.ts +0 -6
  191. package/dist/cjs/Header.d.ts +0 -12
  192. package/dist/cjs/HeaderSearchInput.d.ts +0 -10
  193. package/dist/cjs/Input.d.ts +0 -22
  194. package/dist/cjs/InputRow.d.ts +0 -7
  195. package/dist/cjs/Loading.d.ts +0 -3
  196. package/dist/cjs/MenuItem.d.ts +0 -9
  197. package/dist/cjs/MenuSeparator.d.ts +0 -3
  198. package/dist/cjs/Popup.d.ts +0 -14
  199. package/dist/cjs/Scrollable.d.ts +0 -9
  200. package/dist/cjs/Select.d.ts +0 -16
  201. package/dist/cjs/SubMenu.d.ts +0 -7
  202. package/dist/cjs/Tab.d.ts +0 -12
  203. package/dist/cjs/TabList.d.ts +0 -10
  204. package/dist/cjs/TabPanel.d.ts +0 -6
  205. package/dist/cjs/TabSwitch.d.ts +0 -6
  206. package/dist/cjs/TextArea.d.ts +0 -18
  207. package/dist/cjs/TitleBar.d.ts +0 -6
  208. package/dist/cjs/UploadButton.d.ts +0 -7
  209. package/dist/cjs/stories/Autocomplete.stories.d.ts +0 -9
  210. package/dist/cjs/stories/Button.stories.d.ts +0 -9
  211. package/dist/cjs/stories/Header.stories.d.ts +0 -8
  212. package/dist/cjs/stories/Tabs.stories.d.ts +0 -6
  213. package/dist/esm/Autocomplete.d.ts +0 -20
  214. package/dist/esm/Autocomplete.js +0 -281
  215. package/dist/esm/Autocomplete.js.map +0 -1
  216. package/dist/esm/Avatar.d.ts +0 -12
  217. package/dist/esm/Avatar.js +0 -24
  218. package/dist/esm/Avatar.js.map +0 -1
  219. package/dist/esm/Button.d.ts +0 -15
  220. package/dist/esm/Button.js +0 -13
  221. package/dist/esm/Button.js.map +0 -1
  222. package/dist/esm/Checkbox.d.ts +0 -12
  223. package/dist/esm/Checkbox.js +0 -13
  224. package/dist/esm/Checkbox.js.map +0 -1
  225. package/dist/esm/Dialog.d.ts +0 -10
  226. package/dist/esm/Dialog.js +0 -43
  227. package/dist/esm/Dialog.js.map +0 -1
  228. package/dist/esm/FooterLinks.d.ts +0 -6
  229. package/dist/esm/FooterLinks.js +0 -8
  230. package/dist/esm/FooterLinks.js.map +0 -1
  231. package/dist/esm/Header.d.ts +0 -12
  232. package/dist/esm/Header.js +0 -99
  233. package/dist/esm/Header.js.map +0 -1
  234. package/dist/esm/HeaderSearchInput.d.ts +0 -10
  235. package/dist/esm/HeaderSearchInput.js +0 -181
  236. package/dist/esm/HeaderSearchInput.js.map +0 -1
  237. package/dist/esm/Input.d.ts +0 -22
  238. package/dist/esm/Input.js +0 -26
  239. package/dist/esm/Input.js.map +0 -1
  240. package/dist/esm/InputRow.d.ts +0 -7
  241. package/dist/esm/InputRow.js +0 -8
  242. package/dist/esm/InputRow.js.map +0 -1
  243. package/dist/esm/Loading.d.ts +0 -3
  244. package/dist/esm/Loading.js +0 -11
  245. package/dist/esm/Loading.js.map +0 -1
  246. package/dist/esm/MenuItem.d.ts +0 -9
  247. package/dist/esm/MenuItem.js +0 -8
  248. package/dist/esm/MenuItem.js.map +0 -1
  249. package/dist/esm/MenuSeparator.d.ts +0 -3
  250. package/dist/esm/MenuSeparator.js +0 -8
  251. package/dist/esm/MenuSeparator.js.map +0 -1
  252. package/dist/esm/Popup.d.ts +0 -14
  253. package/dist/esm/Popup.js +0 -78
  254. package/dist/esm/Popup.js.map +0 -1
  255. package/dist/esm/Scrollable.d.ts +0 -9
  256. package/dist/esm/Scrollable.js +0 -12
  257. package/dist/esm/Scrollable.js.map +0 -1
  258. package/dist/esm/Select.d.ts +0 -16
  259. package/dist/esm/Select.js +0 -16
  260. package/dist/esm/Select.js.map +0 -1
  261. package/dist/esm/SubMenu.d.ts +0 -7
  262. package/dist/esm/SubMenu.js +0 -38
  263. package/dist/esm/SubMenu.js.map +0 -1
  264. package/dist/esm/Tab.d.ts +0 -12
  265. package/dist/esm/Tab.js +0 -19
  266. package/dist/esm/Tab.js.map +0 -1
  267. package/dist/esm/TabList.d.ts +0 -10
  268. package/dist/esm/TabList.js +0 -23
  269. package/dist/esm/TabList.js.map +0 -1
  270. package/dist/esm/TabPanel.d.ts +0 -6
  271. package/dist/esm/TabPanel.js +0 -8
  272. package/dist/esm/TabPanel.js.map +0 -1
  273. package/dist/esm/TabSwitch.d.ts +0 -6
  274. package/dist/esm/TabSwitch.js +0 -16
  275. package/dist/esm/TabSwitch.js.map +0 -1
  276. package/dist/esm/TextArea.d.ts +0 -18
  277. package/dist/esm/TextArea.js +0 -16
  278. package/dist/esm/TextArea.js.map +0 -1
  279. package/dist/esm/TitleBar.d.ts +0 -6
  280. package/dist/esm/TitleBar.js +0 -8
  281. package/dist/esm/TitleBar.js.map +0 -1
  282. package/dist/esm/UploadButton.d.ts +0 -7
  283. package/dist/esm/UploadButton.js.map +0 -1
  284. package/dist/esm/stories/Autocomplete.stories.d.ts +0 -9
  285. package/dist/esm/stories/Button.stories.d.ts +0 -9
  286. package/dist/esm/stories/Dialog.stories.d.ts +0 -5
  287. package/dist/esm/stories/Header.stories.d.ts +0 -8
  288. package/dist/esm/stories/Input.stories.d.ts +0 -6
  289. package/dist/esm/stories/Loading.stories.d.ts +0 -5
  290. package/dist/esm/stories/Select.stories.d.ts +0 -6
  291. package/dist/esm/stories/Tabs.stories.d.ts +0 -6
@@ -0,0 +1,65 @@
1
+ import { __awaiter } from './node_modules/tslib/tslib.es6.js';
2
+ import { MultiSelect } from '@mantine/core';
3
+ import React, { useState, useRef, useCallback, useEffect } from 'react';
4
+ import { useMedplum } from './MedplumProvider.js';
5
+
6
+ function valueSetElementToAutocompleteItem(element) {
7
+ return {
8
+ value: element.code,
9
+ label: getDisplay(element),
10
+ element,
11
+ };
12
+ }
13
+ function ValueSetAutocomplete(props) {
14
+ const medplum = useMedplum();
15
+ const { property, defaultValue } = props;
16
+ const [textValues, setTextValues] = useState(defaultValue ? [defaultValue.code] : []);
17
+ const [data, setData] = useState(defaultValue ? [valueSetElementToAutocompleteItem(defaultValue)] : []);
18
+ const dataRef = useRef();
19
+ dataRef.current = data;
20
+ const loadValues = useCallback((input) => __awaiter(this, void 0, void 0, function* () {
21
+ var _a, _b;
22
+ const system = (_a = property.binding) === null || _a === void 0 ? void 0 : _a.valueSet;
23
+ const valueSet = yield medplum.searchValueSet(system, input);
24
+ const valueSetElements = (_b = valueSet.expansion) === null || _b === void 0 ? void 0 : _b.contains;
25
+ const newData = [...dataRef.current];
26
+ for (const valueSetElement of valueSetElements) {
27
+ if (!newData.some((item) => item.value === valueSetElement.code)) {
28
+ newData.push(valueSetElementToAutocompleteItem(valueSetElement));
29
+ }
30
+ }
31
+ setData(newData);
32
+ }), [medplum, property, dataRef]);
33
+ function handleChange(values) {
34
+ setTextValues(values);
35
+ const textValue = values[0];
36
+ let currentItem = undefined;
37
+ if (textValue) {
38
+ currentItem = dataRef.current.find((item) => item.value === values[0]);
39
+ if (!currentItem) {
40
+ const newElement = { code: textValue, display: textValue };
41
+ currentItem = valueSetElementToAutocompleteItem(newElement);
42
+ setData([...dataRef.current, currentItem]);
43
+ }
44
+ }
45
+ if (props.onChange) {
46
+ props.onChange(currentItem === null || currentItem === void 0 ? void 0 : currentItem.element);
47
+ }
48
+ }
49
+ useEffect(() => {
50
+ loadValues('').catch(console.log);
51
+ }, [loadValues]);
52
+ return (React.createElement(MultiSelect, { data: data, placeholder: props.placeholder, searchable: true, creatable: true, clearable: true, value: textValues, filter: (value, selected, item) => {
53
+ var _a, _b;
54
+ return !!(textValues.length === 0 &&
55
+ !selected &&
56
+ (((_a = item.element.display) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(value.toLowerCase().trim())) ||
57
+ ((_b = item.element.code) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(value.toLowerCase().trim()))));
58
+ }, onChange: handleChange, getCreateLabel: (query) => `+ Create ${query}`, onCreate: (query) => valueSetElementToAutocompleteItem({ code: query, display: query }) }));
59
+ }
60
+ function getDisplay(item) {
61
+ return item.display || item.code || '';
62
+ }
63
+
64
+ export { ValueSetAutocomplete };
65
+ //# sourceMappingURL=ValueSetAutocomplete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValueSetAutocomplete.js","sources":["../../src/ValueSetAutocomplete.tsx"],"sourcesContent":["import { MultiSelect } from '@mantine/core';\nimport { ElementDefinition, ValueSetExpansionContains } from '@medplum/fhirtypes';\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { useMedplum } from './MedplumProvider';\n\nexport interface ValueSetAutocompleteProps {\n property: ElementDefinition;\n name: string;\n placeholder?: string;\n defaultValue?: ValueSetExpansionContains;\n onChange?: (value: ValueSetExpansionContains | undefined) => void;\n}\n\ninterface ValueSetAutocompleteItem {\n value: string;\n label: string;\n element: ValueSetExpansionContains;\n}\n\nfunction valueSetElementToAutocompleteItem(element: ValueSetExpansionContains): ValueSetAutocompleteItem {\n return {\n value: element.code as string,\n label: getDisplay(element),\n element,\n };\n}\n\nexport function ValueSetAutocomplete(props: ValueSetAutocompleteProps): JSX.Element {\n const medplum = useMedplum();\n const { property, defaultValue } = props;\n const [textValues, setTextValues] = useState<string[]>(defaultValue ? [defaultValue.code as string] : []);\n\n const [data, setData] = useState<ValueSetAutocompleteItem[]>(\n defaultValue ? [valueSetElementToAutocompleteItem(defaultValue)] : []\n );\n\n const dataRef = useRef<ValueSetAutocompleteItem[]>();\n dataRef.current = data;\n\n const loadValues = useCallback(\n async (input: string): Promise<void> => {\n const system = property.binding?.valueSet as string;\n const valueSet = await medplum.searchValueSet(system, input);\n const valueSetElements = valueSet.expansion?.contains as ValueSetExpansionContains[];\n const newData = [...(dataRef.current as ValueSetAutocompleteItem[])];\n\n for (const valueSetElement of valueSetElements) {\n if (!newData.some((item) => item.value === valueSetElement.code)) {\n newData.push(valueSetElementToAutocompleteItem(valueSetElement));\n }\n }\n\n setData(newData);\n },\n [medplum, property, dataRef]\n );\n\n function handleChange(values: string[]): void {\n setTextValues(values);\n\n const textValue = values[0];\n let currentItem = undefined;\n if (textValue) {\n currentItem = (dataRef.current as ValueSetAutocompleteItem[]).find((item) => item.value === values[0]);\n if (!currentItem) {\n const newElement = { code: textValue, display: textValue };\n currentItem = valueSetElementToAutocompleteItem(newElement);\n setData([...(dataRef.current as ValueSetAutocompleteItem[]), currentItem]);\n }\n }\n\n if (props.onChange) {\n props.onChange(currentItem?.element);\n }\n }\n\n useEffect(() => {\n loadValues('').catch(console.log);\n }, [loadValues]);\n\n return (\n <MultiSelect\n data={data}\n placeholder={props.placeholder}\n searchable\n creatable\n clearable\n value={textValues}\n filter={(value: string, selected: boolean, item: ValueSetAutocompleteItem) =>\n !!(\n textValues.length === 0 &&\n !selected &&\n (item.element.display?.toLowerCase().includes(value.toLowerCase().trim()) ||\n item.element.code?.toLowerCase().includes(value.toLowerCase().trim()))\n )\n }\n onChange={handleChange}\n getCreateLabel={(query) => `+ Create ${query}`}\n onCreate={(query) => valueSetElementToAutocompleteItem({ code: query, display: query })}\n />\n );\n}\n\nfunction getDisplay(item: ValueSetExpansionContains): string {\n return item.display || item.code || '';\n}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AAS,UAAU,CAAC,IAA+B,EAAA;IACjD,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;AACzC;;;;"}
@@ -1,13 +1,10 @@
1
1
  import { __awaiter } from '../node_modules/tslib/tslib.es6.js';
2
+ import { Group, Divider, Stack, TextInput, PasswordInput, Anchor, Checkbox, Button } from '@mantine/core';
2
3
  import React, { useState } from 'react';
3
- import { Button } from '../Button.js';
4
4
  import { Form } from '../Form.js';
5
- import { FormSection } from '../FormSection.js';
6
5
  import { getGoogleClientId, GoogleButton } from '../GoogleButton.js';
7
- import { Input } from '../Input.js';
8
- import { MedplumLink } from '../MedplumLink.js';
9
6
  import { useMedplum } from '../MedplumProvider.js';
10
- import { getIssuesForExpression } from '../utils/outcomes.js';
7
+ import { getIssuesForExpression, getErrorsForInput } from '../utils/outcomes.js';
11
8
 
12
9
  function AuthenticationForm(props) {
13
10
  const medplum = useMedplum();
@@ -43,7 +40,7 @@ function AuthenticationForm(props) {
43
40
  return (React.createElement("div", { "data-testid": "text-field-error", key: (_a = issue.details) === null || _a === void 0 ? void 0 : _a.text }, (_b = issue.details) === null || _b === void 0 ? void 0 : _b.text));
44
41
  }))),
45
42
  googleClientId && (React.createElement(React.Fragment, null,
46
- React.createElement("div", { className: "medplum-signin-google-container" },
43
+ React.createElement(Group, { position: "center", p: "xl", style: { height: 70 } },
47
44
  React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) => {
48
45
  startPkce()
49
46
  .then(() => medplum.startGoogleLogin({
@@ -59,20 +56,15 @@ function AuthenticationForm(props) {
59
56
  .then(props.handleAuthResponse)
60
57
  .catch(setOutcome);
61
58
  } })),
62
- React.createElement("div", { className: "medplum-signin-separator" }, "or"))),
63
- React.createElement(FormSection, { title: "Email", htmlFor: "email", outcome: outcome },
64
- React.createElement(Input, { name: "email", type: "email", testid: "email", required: true, autoFocus: true, outcome: outcome })),
65
- React.createElement(FormSection, { title: "Password", htmlFor: "password", outcome: outcome },
66
- React.createElement(Input, { name: "password", type: "password", testid: "password", autoComplete: "off", required: true, outcome: outcome })),
67
- React.createElement("div", { className: "medplum-signin-buttons" },
68
- (props.onForgotPassword || props.onRegister) && (React.createElement("div", null,
69
- props.onForgotPassword && (React.createElement(MedplumLink, { testid: "forgotpassword", onClick: props.onForgotPassword }, "Forgot password")),
70
- props.onRegister && (React.createElement(MedplumLink, { testid: "register", onClick: props.onRegister }, "Register")))),
71
- React.createElement("div", null,
72
- React.createElement("input", { type: "checkbox", id: "remember", name: "remember", value: "true" }),
73
- React.createElement("label", { htmlFor: "remember" }, "Remember me")),
74
- React.createElement("div", null,
75
- React.createElement(Button, { type: "submit", testid: "submit" }, "Sign in")))));
59
+ React.createElement(Divider, { label: "or", labelPosition: "center", my: "lg" }))),
60
+ React.createElement(Stack, { spacing: "xl" },
61
+ React.createElement(TextInput, { name: "email", type: "email", label: "Email", placeholder: "name@domain.com", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'email') }),
62
+ React.createElement(PasswordInput, { name: "password", type: "password", label: "Password", autoComplete: "off", required: true, error: getErrorsForInput(outcome, 'password') })),
63
+ React.createElement(Group, { position: "apart", mt: "xl", noWrap: true },
64
+ props.onForgotPassword && (React.createElement(Anchor, { component: "button", type: "button", color: "dimmed", onClick: props.onForgotPassword, size: "xs" }, "Forgot password")),
65
+ props.onRegister && (React.createElement(Anchor, { component: "button", type: "button", color: "dimmed", onClick: props.onRegister, size: "xs" }, "Register")),
66
+ React.createElement(Checkbox, { name: "remember", label: "Remember me", size: "xs" }),
67
+ React.createElement(Button, { type: "submit" }, "Sign in"))));
76
68
  }
77
69
 
78
70
  export { AuthenticationForm };
@@ -1 +1 @@
1
- {"version":3,"file":"AuthenticationForm.js","sources":["../../../src/auth/AuthenticationForm.tsx"],"sourcesContent":["import { GoogleCredentialResponse, LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Button } from '../Button';\nimport { Form } from '../Form';\nimport { FormSection } from '../FormSection';\nimport { getGoogleClientId, GoogleButton } from '../GoogleButton';\nimport { Input } from '../Input';\nimport { MedplumLink } from '../MedplumLink';\nimport { useMedplum } from '../MedplumProvider';\nimport { getIssuesForExpression } from '../utils/outcomes';\n\nexport interface AuthenticationFormProps {\n readonly projectId?: string;\n readonly clientId?: string;\n readonly scope?: string;\n readonly nonce?: string;\n readonly googleClientId?: string;\n readonly generatePkce?: boolean;\n readonly codeChallenge?: string;\n readonly codeChallengeMethod?: string;\n readonly onForgotPassword?: () => void;\n readonly onRegister?: () => void;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n readonly children?: React.ReactNode;\n}\n\nexport function AuthenticationForm(props: AuthenticationFormProps): JSX.Element {\n const medplum = useMedplum();\n const googleClientId = getGoogleClientId(props.googleClientId);\n const [outcome, setOutcome] = useState<OperationOutcome>();\n const issues = getIssuesForExpression(outcome, undefined);\n\n async function startPkce(): Promise<void> {\n if (props.generatePkce) {\n await medplum.startPkce();\n }\n }\n\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={(formData: Record<string, string>) => {\n startPkce()\n .then(() =>\n medplum.startLogin({\n projectId: props.projectId,\n clientId: props.clientId,\n scope: props.scope,\n nonce: props.nonce,\n codeChallenge: props.codeChallenge,\n codeChallengeMethod: props.codeChallengeMethod,\n email: formData.email,\n password: formData.password,\n remember: formData.remember === 'true',\n })\n )\n .then(props.handleAuthResponse)\n .catch(setOutcome);\n }}\n >\n <div className=\"medplum-center\">{props.children}</div>\n {issues && (\n <div className=\"medplum-input-error\">\n {issues.map((issue) => (\n <div data-testid=\"text-field-error\" key={issue.details?.text}>\n {issue.details?.text}\n </div>\n ))}\n </div>\n )}\n {googleClientId && (\n <>\n <div className=\"medplum-signin-google-container\">\n <GoogleButton\n googleClientId={googleClientId}\n handleGoogleCredential={(response: GoogleCredentialResponse) => {\n startPkce()\n .then(() =>\n medplum.startGoogleLogin({\n projectId: props.projectId,\n clientId: props.clientId,\n scope: props.scope,\n nonce: props.nonce,\n codeChallenge: props.codeChallenge,\n codeChallengeMethod: props.codeChallengeMethod,\n googleClientId: response.clientId,\n googleCredential: response.credential,\n })\n )\n .then(props.handleAuthResponse)\n .catch(setOutcome);\n }}\n />\n </div>\n <div className=\"medplum-signin-separator\">or</div>\n </>\n )}\n <FormSection title=\"Email\" htmlFor=\"email\" outcome={outcome}>\n <Input name=\"email\" type=\"email\" testid=\"email\" required={true} autoFocus={true} outcome={outcome} />\n </FormSection>\n <FormSection title=\"Password\" htmlFor=\"password\" outcome={outcome}>\n <Input name=\"password\" type=\"password\" testid=\"password\" autoComplete=\"off\" required={true} outcome={outcome} />\n </FormSection>\n <div className=\"medplum-signin-buttons\">\n {(props.onForgotPassword || props.onRegister) && (\n <div>\n {props.onForgotPassword && (\n <MedplumLink testid=\"forgotpassword\" onClick={props.onForgotPassword}>\n Forgot password\n </MedplumLink>\n )}\n {props.onRegister && (\n <MedplumLink testid=\"register\" onClick={props.onRegister}>\n Register\n </MedplumLink>\n )}\n </div>\n )}\n <div>\n <input type=\"checkbox\" id=\"remember\" name=\"remember\" value=\"true\" />\n <label htmlFor=\"remember\">Remember me</label>\n </div>\n <div>\n <Button type=\"submit\" testid=\"submit\">\n Sign in\n </Button>\n </div>\n </div>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AA2BM,SAAU,kBAAkB,CAAC,KAA8B,EAAA;AAC/D,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC/D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAC3D,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAE1D,IAAA,SAAe,SAAS,GAAA;;YACtB,IAAI,KAAK,CAAC,YAAY,EAAE;AACtB,g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aAAA,CAAA,KAAA,EAAA,IAAA;AACE,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAC,QAAQ,EAE5B,EAAA,SAAA,CAAA,CACL,CACF,CACD,EACP;AACJ;;;;"}
1
+ {"version":3,"file":"AuthenticationForm.js","sources":["../../../src/auth/AuthenticationForm.tsx"],"sourcesContent":["import { Anchor, Button, Checkbox, Divider, Group, PasswordInput, Stack, TextInput } from '@mantine/core';\nimport { GoogleCredentialResponse, LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Form } from '../Form';\nimport { getGoogleClientId, GoogleButton } from '../GoogleButton';\nimport { useMedplum } from '../MedplumProvider';\nimport { getErrorsForInput, getIssuesForExpression } from '../utils/outcomes';\n\nexport interface AuthenticationFormProps {\n readonly projectId?: string;\n readonly clientId?: string;\n readonly scope?: string;\n readonly nonce?: string;\n readonly googleClientId?: string;\n readonly generatePkce?: boolean;\n readonly codeChallenge?: string;\n readonly codeChallengeMethod?: string;\n readonly onForgotPassword?: () => void;\n readonly onRegister?: () => void;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n readonly children?: React.ReactNode;\n}\n\nexport function AuthenticationForm(props: AuthenticationFormProps): JSX.Element {\n const medplum = useMedplum();\n const googleClientId = getGoogleClientId(props.googleClientId);\n const [outcome, setOutcome] = useState<OperationOutcome>();\n const issues = getIssuesForExpression(outcome, undefined);\n\n async function startPkce(): Promise<void> {\n if (props.generatePkce) {\n await medplum.startPkce();\n }\n }\n\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={(formData: Record<string, string>) => {\n startPkce()\n .then(() =>\n medplum.startLogin({\n projectId: props.projectId,\n clientId: props.clientId,\n scope: props.scope,\n nonce: props.nonce,\n codeChallenge: props.codeChallenge,\n codeChallengeMethod: props.codeChallengeMethod,\n email: formData.email,\n password: formData.password,\n remember: formData.remember === 'true',\n })\n )\n .then(props.handleAuthResponse)\n .catch(setOutcome);\n }}\n >\n <div className=\"medplum-center\">{props.children}</div>\n {issues && (\n <div className=\"medplum-input-error\">\n {issues.map((issue) => (\n <div data-testid=\"text-field-error\" key={issue.details?.text}>\n {issue.details?.text}\n </div>\n ))}\n </div>\n )}\n {googleClientId && (\n <>\n <Group position=\"center\" p=\"xl\" style={{ height: 70 }}>\n <GoogleButton\n googleClientId={googleClientId}\n handleGoogleCredential={(response: GoogleCredentialResponse) => {\n startPkce()\n .then(() =>\n medplum.startGoogleLogin({\n projectId: props.projectId,\n clientId: props.clientId,\n scope: props.scope,\n nonce: props.nonce,\n codeChallenge: props.codeChallenge,\n codeChallengeMethod: props.codeChallengeMethod,\n googleClientId: response.clientId,\n googleCredential: response.credential,\n })\n )\n .then(props.handleAuthResponse)\n .catch(setOutcome);\n }}\n />\n </Group>\n <Divider label=\"or\" labelPosition=\"center\" my=\"lg\" />\n </>\n )}\n <Stack spacing=\"xl\">\n <TextInput\n name=\"email\"\n type=\"email\"\n label=\"Email\"\n placeholder=\"name@domain.com\"\n required={true}\n autoFocus={true}\n error={getErrorsForInput(outcome, 'email')}\n />\n <PasswordInput\n name=\"password\"\n type=\"password\"\n label=\"Password\"\n autoComplete=\"off\"\n required={true}\n error={getErrorsForInput(outcome, 'password')}\n />\n </Stack>\n <Group position=\"apart\" mt=\"xl\" noWrap>\n {props.onForgotPassword && (\n <Anchor component=\"button\" type=\"button\" color=\"dimmed\" onClick={props.onForgotPassword} size=\"xs\">\n Forgot password\n </Anchor>\n )}\n {props.onRegister && (\n <Anchor component=\"button\" type=\"button\" color=\"dimmed\" onClick={props.onRegister} size=\"xs\">\n Register\n </Anchor>\n )}\n <Checkbox name=\"remember\" label=\"Remember me\" size=\"xs\" />\n <Button type=\"submit\">Sign in</Button>\n </Group>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAwBM,SAAU,kBAAkB,CAAC,KAA8B,EAAA;AAC/D,I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AAQ,EAAC,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAC,IAAI,eAEnF,CACV;AACD,YAAA,KAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,IAAI,EAAG,CAAA;YAC1D,KAAC,CAAA,aAAA,CAAA,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAiB,EAAA,SAAA,CAAA,CAChC,CACH,EACP;AACJ;;;;"}
@@ -1,17 +1,17 @@
1
+ import { Stack, Text, UnstyledButton, Group, Avatar } from '@mantine/core';
1
2
  import React from 'react';
2
- import { Avatar } from '../Avatar.js';
3
3
  import { Logo } from '../Logo.js';
4
4
  import { useMedplum } from '../MedplumProvider.js';
5
5
 
6
6
  function ChooseProfileForm(props) {
7
7
  const medplum = useMedplum();
8
- return (React.createElement("div", null,
8
+ return (React.createElement(Stack, null,
9
9
  React.createElement("div", { className: "medplum-center" },
10
10
  React.createElement(Logo, { size: 32 }),
11
- React.createElement("h1", null, "Choose profile")),
11
+ React.createElement(Text, { size: "lg", weight: 500 }, "Choose profile")),
12
12
  props.memberships.map((membership) => {
13
- var _a, _b, _c;
14
- return (React.createElement("div", { className: "medplum-nav-menu-profile", key: membership.id, onClick: () => {
13
+ var _a, _b;
14
+ return (React.createElement(UnstyledButton, { key: membership.id, onClick: () => {
15
15
  medplum
16
16
  .post('auth/profile', {
17
17
  login: props.login,
@@ -20,11 +20,11 @@ function ChooseProfileForm(props) {
20
20
  .then(props.handleAuthResponse)
21
21
  .catch(console.log);
22
22
  } },
23
- React.createElement("div", { className: "medplum-nav-menu-profile-icon" },
24
- React.createElement(Avatar, { alt: (_a = membership.profile) === null || _a === void 0 ? void 0 : _a.display })),
25
- React.createElement("div", { className: "medplum-nav-menu-profile-label" }, (_b = membership.profile) === null || _b === void 0 ? void 0 :
26
- _b.display,
27
- React.createElement("div", { className: "medplum-nav-menu-profile-help-text" }, (_c = membership.project) === null || _c === void 0 ? void 0 : _c.display))));
23
+ React.createElement(Group, null,
24
+ React.createElement(Avatar, { radius: "xl" }),
25
+ React.createElement("div", { style: { flex: 1 } },
26
+ React.createElement(Text, { size: "sm", weight: 500 }, (_a = membership.profile) === null || _a === void 0 ? void 0 : _a.display),
27
+ React.createElement(Text, { color: "dimmed", size: "xs" }, (_b = membership.project) === null || _b === void 0 ? void 0 : _b.display)))));
28
28
  })));
29
29
  }
30
30
 
@@ -1 +1 @@
1
- {"version":3,"file":"ChooseProfileForm.js","sources":["../../../src/auth/ChooseProfileForm.tsx"],"sourcesContent":["import { ProjectMembership } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { Avatar } from '../Avatar';\nimport { Logo } from '../Logo';\nimport { useMedplum } from '../MedplumProvider';\n\nexport interface ChooseProfileFormProps {\n login: string;\n memberships: ProjectMembership[];\n handleAuthResponse: (response: any) => void;\n}\n\nexport function ChooseProfileForm(props: ChooseProfileFormProps): JSX.Element {\n const medplum = useMedplum();\n return (\n <div>\n <div className=\"medplum-center\">\n <Logo size={32} />\n <h1>Choose profile</h1>\n </div>\n {props.memberships.map((membership: ProjectMembership) => (\n <div\n className=\"medplum-nav-menu-profile\"\n key={membership.id}\n onClick={() => {\n medplum\n .post('auth/profile', {\n login: props.login,\n profile: membership.id,\n })\n .then(props.handleAuthResponse)\n .catch(console.log);\n }}\n >\n <div className=\"medplum-nav-menu-profile-icon\">\n <Avatar alt={membership.profile?.display} />\n </div>\n <div className=\"medplum-nav-menu-profile-label\">\n {membership.profile?.display}\n <div className=\"medplum-nav-menu-profile-help-text\">{membership.project?.display}</div>\n </div>\n </div>\n ))}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;AAYM,SAAU,iBAAiB,CAAC,KAA6B,EAAA;AAC7D,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;QACE,KAAK,CAAA,aAAA,C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AAU,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,OAAO,CAAO,CACnF,CACF,EACP;SAAA,CAAC,CACE,EACN;AACJ;;;;"}
1
+ {"version":3,"file":"ChooseProfileForm.js","sources":["../../../src/auth/ChooseProfileForm.tsx"],"sourcesContent":["import { Avatar, Group, Stack, Text, UnstyledButton } from '@mantine/core';\nimport { ProjectMembership } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { Logo } from '../Logo';\nimport { useMedplum } from '../MedplumProvider';\n\nexport interface ChooseProfileFormProps {\n login: string;\n memberships: ProjectMembership[];\n handleAuthResponse: (response: any) => void;\n}\n\nexport function ChooseProfileForm(props: ChooseProfileFormProps): JSX.Element {\n const medplum = useMedplum();\n return (\n <Stack>\n <div className=\"medplum-center\">\n <Logo size={32} />\n <Text size=\"lg\" weight={500}>\n Choose profile\n </Text>\n </div>\n {props.memberships.map((membership: ProjectMembership) => (\n <UnstyledButton\n key={membership.id}\n onClick={() => {\n medplum\n .post('auth/profile', {\n login: props.login,\n profile: membership.id,\n })\n .then(props.handleAuthResponse)\n .catch(console.log);\n }}\n >\n <Group>\n <Avatar radius=\"xl\" />\n <div style={{ flex: 1 }}>\n <Text size=\"sm\" weight={500}>\n {membership.profile?.display}\n </Text>\n <Text color=\"dimmed\" size=\"xs\">\n {membership.project?.display}\n </Text>\n </div>\n </Group>\n </UnstyledButton>\n ))}\n </Stack>\n );\n}\n"],"names":[],"mappings":";;;;;AAYM,SAAU,iBAAiB,CAAC,KAA6B,EAAA;AAC7D,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,QACE,oBAAC,KAAK,EAAA,IAAA;QACJ,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,gBAAgB,EAAA;AAC7B,YAAA,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CA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CACH,CACA,CACO,EAClB;SAAA,CAAC,CACI,EACR;AACJ;;;;"}
@@ -1,11 +1,10 @@
1
1
  import { __awaiter } from '../node_modules/tslib/tslib.es6.js';
2
+ import { Stack, TextInput, Text, Group, Button } from '@mantine/core';
2
3
  import React, { useState } from 'react';
3
- import { Button } from '../Button.js';
4
4
  import { Form } from '../Form.js';
5
- import { FormSection } from '../FormSection.js';
6
- import { Input } from '../Input.js';
7
5
  import { Logo } from '../Logo.js';
8
6
  import { useMedplum } from '../MedplumProvider.js';
7
+ import { getErrorsForInput } from '../utils/outcomes.js';
9
8
 
10
9
  function NewProjectForm(props) {
11
10
  const medplum = useMedplum();
@@ -24,18 +23,16 @@ function NewProjectForm(props) {
24
23
  React.createElement("div", { className: "medplum-center" },
25
24
  React.createElement(Logo, { size: 32 }),
26
25
  React.createElement("h1", null, "Create project")),
27
- React.createElement(FormSection, { title: "Project Name", htmlFor: "projectName", outcome: outcome },
28
- React.createElement(Input, { name: "projectName", type: "text", testid: "projectName", placeholder: "My Project", required: true, outcome: outcome })),
29
- React.createElement("p", { style: { fontSize: '12px', color: '#888' } },
30
- "By clicking submit you agree to the Medplum ",
31
- React.createElement("a", { href: "https://www.medplum.com/privacy" }, "Privacy\u00A0Policy"),
32
- ' and ',
33
- React.createElement("a", { href: "https://www.medplum.com/terms" }, "Terms\u00A0of\u00A0Service"),
34
- "."),
35
- React.createElement("div", { className: "medplum-signin-buttons" },
36
- React.createElement("div", null),
37
- React.createElement("div", null,
38
- React.createElement(Button, { type: "submit", testid: "submit" }, "Create project")))));
26
+ React.createElement(Stack, { spacing: "xl" },
27
+ React.createElement(TextInput, { name: "projectName", label: "Project Name", placeholder: "My Project", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'firstName') }),
28
+ React.createElement(Text, { color: "dimmed", size: "xs" },
29
+ "By clicking submit you agree to the Medplum ",
30
+ React.createElement("a", { href: "https://www.medplum.com/privacy" }, "Privacy\u00A0Policy"),
31
+ ' and ',
32
+ React.createElement("a", { href: "https://www.medplum.com/terms" }, "Terms\u00A0of\u00A0Service"),
33
+ ".")),
34
+ React.createElement(Group, { position: "right", mt: "xl", noWrap: true },
35
+ React.createElement(Button, { type: "submit" }, "Create project"))));
39
36
  }
40
37
 
41
38
  export { NewProjectForm };
@@ -1 +1 @@
1
- {"version":3,"file":"NewProjectForm.js","sources":["../../../src/auth/NewProjectForm.tsx"],"sourcesContent":["import { LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Button } from '../Button';\nimport { Form } from '../Form';\nimport { FormSection } from '../FormSection';\nimport { Input } from '../Input';\nimport { Logo } from '../Logo';\nimport { useMedplum } from '../MedplumProvider';\n\nexport interface NewProjectFormProps {\n login: string;\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function NewProjectForm(props: NewProjectFormProps): JSX.Element {\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome | undefined>();\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={async (formData: Record<string, string>) => {\n try {\n props.handleAuthResponse(\n await medplum.startNewProject({\n login: props.login,\n projectName: formData.projectName,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n >\n <div className=\"medplum-center\">\n <Logo size={32} />\n <h1>Create project</h1>\n </div>\n <FormSection title=\"Project Name\" htmlFor=\"projectName\" outcome={outcome}>\n <Input\n name=\"projectName\"\n type=\"text\"\n testid=\"projectName\"\n placeholder=\"My Project\"\n required={true}\n outcome={outcome}\n />\n </FormSection>\n <p style={{ fontSize: '12px', color: '#888' }}>\n By clicking submit you agree to the Medplum <a href=\"https://www.medplum.com/privacy\">Privacy&nbsp;Policy</a>\n {' and '}\n <a href=\"https://www.medplum.com/terms\">Terms&nbsp;of&nbsp;Service</a>.\n </p>\n <div className=\"medplum-signin-buttons\">\n <div />\n <div>\n <Button type=\"submit\" testid=\"submit\">\n Create project\n </Button>\n </div>\n </div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,EACd,OAAO,EAAE,OAAO,EAAA,CAChB,CACU;QACd,KAAG,CAAA,aAAA,CAAA,GAAA,EAAA,EAAA,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAA;;YACC,KAAG,CAAA,aAAA,CAAA,GAAA,EAAA,EAAA,IAAI,EAAC,iCAAiC,EAAwB,EAAA,qBAAA,CAAA;YAC5G,OAAO;YACR,KAAG,CAAA,aAAA,CAAA,GAAA,EAAA,EAAA,IAAI,EAAC,+BAA+B,EAA+B,EAAA,4BAAA,CAAA;AACpE,YAAA,GAAA,CAAA;QACJ,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,wBAAwB,EAAA;YACrC,KAAO,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,CAAA;AACP,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;AACE,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAC,QAAQ,EAE5B,EAAA,gBAAA,CAAA,CACL,CACF,CACD,EACP;AACJ;;;;"}
1
+ {"version":3,"file":"NewProjectForm.js","sources":["../../../src/auth/NewProjectForm.tsx"],"sourcesContent":["import { Button, Group, Stack, Text, TextInput } from '@mantine/core';\nimport { LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Form } from '../Form';\nimport { Logo } from '../Logo';\nimport { useMedplum } from '../MedplumProvider';\nimport { getErrorsForInput } from '../utils/outcomes';\n\nexport interface NewProjectFormProps {\n login: string;\n handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function NewProjectForm(props: NewProjectFormProps): JSX.Element {\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome | undefined>();\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={async (formData: Record<string, string>) => {\n try {\n props.handleAuthResponse(\n await medplum.startNewProject({\n login: props.login,\n projectName: formData.projectName,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n >\n <div className=\"medplum-center\">\n <Logo size={32} />\n <h1>Create project</h1>\n </div>\n <Stack spacing=\"xl\">\n <TextInput\n name=\"projectName\"\n label=\"Project Name\"\n placeholder=\"My Project\"\n required={true}\n autoFocus={true}\n error={getErrorsForInput(outcome, 'firstName')}\n />\n <Text color=\"dimmed\" size=\"xs\">\n By clicking submit you agree to the Medplum <a href=\"https://www.medplum.com/privacy\">Privacy&nbsp;Policy</a>\n {' and '}\n <a href=\"https://www.medplum.com/terms\">Terms&nbsp;of&nbsp;Service</a>.\n </Text>\n </Stack>\n <Group position=\"right\" mt=\"xl\" noWrap>\n <Button type=\"submit\">Create project</Button>\n </Group>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAcM,SAAU,cAAc,CAAC,KAA0B,EAAA;AACvD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAgC,CAAC;AACvE,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,IAAI,EACH,EAAA,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EACxB,QAAQ,EAAE,CAAO,QAAgC,KAAI,SAAA,CAAA,IAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;YACnD,IAAI;AACF,gBAAA,KAAK,CAAC,kBAAkB,CACtB,MAAM,OAAO,CAAC,eAAe,CAAC;oBAC5B,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,WAAW,EAAE,QAAQ,CAAC,WAAW;AAClC,iBAAA,CAAC,CACH,CAAC;AACH,aAAA;AAAC,YAAA,OAAO,GAAG,EAAE;gBACZ,UAAU,CAAC,GAAuB,CAAC,CAAC;AACrC,aAAA;AACH,SAAC,CAAA,EAAA;QAED,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,gBAAgB,EAAA;AAC7B,YAAA,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,EAAE,EAAI,CAAA;AAClB,YAAA,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAA,gBAAA,CAAuB,CACnB;AACN,QAAA,KAAA,CAAA,aAAA,CAAC,KAAK,EAAA,EAAC,OAAO,EAAC,IAAI,EAAA;AACjB,YAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EACR,IAAI,EAAC,aAAa,EAClB,KAAK,EAAC,cAAc,EACpB,WAAW,EAAC,YAAY,EACxB,QAAQ,EAAE,IAAI,EACd,SAAS,EAAE,IAAI,EACf,KAAK,EAAE,iBAAiB,CAAC,OAAO,EAAE,WAAW,CAAC,EAC9C,CAAA;YACF,KAAC,CAAA,aAAA,CAAA,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAA;;gBACgB,KAAG,CAAA,aAAA,CAAA,GAAA,EAAA,EAAA,IAAI,EAAC,iCAAiC,EAAwB,EAAA,qBAAA,CAAA;gBAC5G,OAAO;gBACR,KAAG,CAAA,aAAA,CAAA,GAAA,EAAA,EAAA,IAAI,EAAC,+BAA+B,EAA+B,EAAA,4BAAA,CAAA;oBACjE,CACD;QACR,KAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAC,MAAM,EAAA,IAAA,EAAA;YACpC,KAAC,CAAA,aAAA,CAAA,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAwB,EAAA,gBAAA,CAAA,CACvC,CACH,EACP;AACJ;;;;"}
@@ -1,12 +1,10 @@
1
1
  import { __awaiter } from '../node_modules/tslib/tslib.es6.js';
2
+ import { Group, Divider, Stack, TextInput, PasswordInput, Text, Checkbox, Button } from '@mantine/core';
2
3
  import React, { useState, useEffect } from 'react';
3
- import { Button } from '../Button.js';
4
4
  import { Form } from '../Form.js';
5
- import { FormSection } from '../FormSection.js';
6
5
  import { getGoogleClientId, GoogleButton } from '../GoogleButton.js';
7
- import { Input } from '../Input.js';
8
6
  import { useMedplum } from '../MedplumProvider.js';
9
- import { getIssuesForExpression } from '../utils/outcomes.js';
7
+ import { getIssuesForExpression, getErrorsForInput } from '../utils/outcomes.js';
10
8
  import { initRecaptcha, getRecaptcha } from '../utils/recaptcha.js';
11
9
 
12
10
  function NewUserForm(props) {
@@ -40,7 +38,7 @@ function NewUserForm(props) {
40
38
  return (React.createElement("div", { "data-testid": "text-field-error", key: (_a = issue.details) === null || _a === void 0 ? void 0 : _a.text }, (_b = issue.details) === null || _b === void 0 ? void 0 : _b.text));
41
39
  }))),
42
40
  googleClientId && (React.createElement(React.Fragment, null,
43
- React.createElement("div", { className: "medplum-signin-google-container" },
41
+ React.createElement(Group, { position: "center", p: "xl", style: { height: 70 } },
44
42
  React.createElement(GoogleButton, { googleClientId: googleClientId, handleGoogleCredential: (response) => __awaiter(this, void 0, void 0, function* () {
45
43
  try {
46
44
  props.handleAuthResponse(yield medplum.startGoogleLogin({
@@ -53,34 +51,28 @@ function NewUserForm(props) {
53
51
  setOutcome(err);
54
52
  }
55
53
  }) })),
56
- React.createElement("div", { className: "medplum-signin-separator" }, "or"))),
57
- React.createElement(FormSection, { title: "First Name", htmlFor: "firstName", outcome: outcome },
58
- React.createElement(Input, { name: "firstName", type: "text", testid: "firstName", placeholder: "First name", required: true, autoFocus: true, outcome: outcome })),
59
- React.createElement(FormSection, { title: "Last Name", htmlFor: "lastName", outcome: outcome },
60
- React.createElement(Input, { name: "lastName", type: "text", testid: "lastName", placeholder: "Last name", required: true, outcome: outcome })),
61
- React.createElement(FormSection, { title: "Email", htmlFor: "email", outcome: outcome },
62
- React.createElement(Input, { name: "email", type: "email", testid: "email", placeholder: "name@domain.com", required: true, outcome: outcome })),
63
- React.createElement(FormSection, { title: "Password", htmlFor: "password", outcome: outcome },
64
- React.createElement(Input, { name: "password", type: "password", testid: "password", autoComplete: "off", required: true, outcome: outcome })),
65
- React.createElement("p", { style: { fontSize: '12px', color: '#888' } },
66
- "By clicking submit you agree to the Medplum ",
67
- React.createElement("a", { href: "https://www.medplum.com/privacy" }, "Privacy\u00A0Policy"),
68
- ' and ',
69
- React.createElement("a", { href: "https://www.medplum.com/terms" }, "Terms\u00A0of\u00A0Service"),
70
- "."),
71
- React.createElement("p", { style: { fontSize: '12px', color: '#888' } },
72
- "This site is protected by reCAPTCHA and the Google",
73
- ' ',
74
- React.createElement("a", { href: "https://policies.google.com/privacy" }, "Privacy\u00A0Policy"),
75
- ' and ',
76
- React.createElement("a", { href: "https://policies.google.com/terms" }, "Terms\u00A0of\u00A0Service"),
77
- " apply."),
78
- React.createElement("div", { className: "medplum-signin-buttons" },
79
- React.createElement("div", null,
80
- React.createElement("input", { type: "checkbox", id: "remember", name: "remember", value: "true" }),
81
- React.createElement("label", { htmlFor: "remember" }, "Remember me")),
82
- React.createElement("div", null,
83
- React.createElement(Button, { type: "submit", testid: "submit" }, "Create account")))));
54
+ React.createElement(Divider, { label: "or", labelPosition: "center", my: "lg" }))),
55
+ React.createElement(Stack, { spacing: "xl" },
56
+ React.createElement(TextInput, { name: "firstName", type: "text", label: "First name", placeholder: "First name", required: true, autoFocus: true, error: getErrorsForInput(outcome, 'firstName') }),
57
+ React.createElement(TextInput, { name: "lastName", type: "text", label: "Last name", placeholder: "Last name", required: true, error: getErrorsForInput(outcome, 'lastName') }),
58
+ React.createElement(TextInput, { name: "email", type: "email", label: "Email", placeholder: "name@domain.com", required: true, error: getErrorsForInput(outcome, 'email') }),
59
+ React.createElement(PasswordInput, { name: "password", label: "Password", autoComplete: "off", required: true, error: getErrorsForInput(outcome, 'password') }),
60
+ React.createElement(Text, { color: "dimmed", size: "xs" },
61
+ "By clicking submit you agree to the Medplum ",
62
+ React.createElement("a", { href: "https://www.medplum.com/privacy" }, "Privacy\u00A0Policy"),
63
+ ' and ',
64
+ React.createElement("a", { href: "https://www.medplum.com/terms" }, "Terms\u00A0of\u00A0Service"),
65
+ "."),
66
+ React.createElement(Text, { color: "dimmed", size: "xs" },
67
+ "This site is protected by reCAPTCHA and the Google",
68
+ ' ',
69
+ React.createElement("a", { href: "https://policies.google.com/privacy" }, "Privacy\u00A0Policy"),
70
+ ' and ',
71
+ React.createElement("a", { href: "https://policies.google.com/terms" }, "Terms\u00A0of\u00A0Service"),
72
+ " apply.")),
73
+ React.createElement(Group, { position: "apart", mt: "xl", noWrap: true },
74
+ React.createElement(Checkbox, { name: "remember", label: "Remember me", size: "xs" }),
75
+ React.createElement(Button, { type: "submit" }, "Create account"))));
84
76
  }
85
77
 
86
78
  export { NewUserForm };
@@ -1 +1 @@
1
- {"version":3,"file":"NewUserForm.js","sources":["../../../src/auth/NewUserForm.tsx"],"sourcesContent":["import { GoogleCredentialResponse, LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { Button } from '../Button';\nimport { Form } from '../Form';\nimport { FormSection } from '../FormSection';\nimport { getGoogleClientId, GoogleButton } from '../GoogleButton';\nimport { Input } from '../Input';\nimport { useMedplum } from '../MedplumProvider';\nimport { getIssuesForExpression } from '../utils/outcomes';\nimport { getRecaptcha, initRecaptcha } from '../utils/recaptcha';\n\nexport interface NewUserFormProps {\n readonly projectId: string;\n readonly googleClientId?: string;\n readonly recaptchaSiteKey: string;\n readonly children?: React.ReactNode;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function NewUserForm(props: NewUserFormProps): JSX.Element {\n const googleClientId = getGoogleClientId(props.googleClientId);\n const recaptchaSiteKey = props.recaptchaSiteKey;\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome>();\n const issues = getIssuesForExpression(outcome, undefined);\n\n useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);\n\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={async (formData: Record<string, string>) => {\n try {\n const recaptchaToken = await getRecaptcha(recaptchaSiteKey);\n props.handleAuthResponse(\n await medplum.startNewUser({\n projectId: props.projectId,\n firstName: formData.firstName,\n lastName: formData.lastName,\n email: formData.email,\n password: formData.password,\n remember: formData.remember === 'true',\n recaptchaSiteKey,\n recaptchaToken,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n >\n <div className=\"medplum-center\">{props.children}</div>\n {issues && (\n <div className=\"medplum-input-error\">\n {issues.map((issue) => (\n <div data-testid=\"text-field-error\" key={issue.details?.text}>\n {issue.details?.text}\n </div>\n ))}\n </div>\n )}\n {googleClientId && (\n <>\n <div className=\"medplum-signin-google-container\">\n <GoogleButton\n googleClientId={googleClientId}\n handleGoogleCredential={async (response: GoogleCredentialResponse) => {\n try {\n props.handleAuthResponse(\n await medplum.startGoogleLogin({\n googleClientId: response.clientId,\n googleCredential: response.credential,\n createUser: true,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n />\n </div>\n <div className=\"medplum-signin-separator\">or</div>\n </>\n )}\n <FormSection title=\"First Name\" htmlFor=\"firstName\" outcome={outcome}>\n <Input\n name=\"firstName\"\n type=\"text\"\n testid=\"firstName\"\n placeholder=\"First name\"\n required={true}\n autoFocus={true}\n outcome={outcome}\n />\n </FormSection>\n <FormSection title=\"Last Name\" htmlFor=\"lastName\" outcome={outcome}>\n <Input\n name=\"lastName\"\n type=\"text\"\n testid=\"lastName\"\n placeholder=\"Last name\"\n required={true}\n outcome={outcome}\n />\n </FormSection>\n <FormSection title=\"Email\" htmlFor=\"email\" outcome={outcome}>\n <Input\n name=\"email\"\n type=\"email\"\n testid=\"email\"\n placeholder=\"name@domain.com\"\n required={true}\n outcome={outcome}\n />\n </FormSection>\n <FormSection title=\"Password\" htmlFor=\"password\" outcome={outcome}>\n <Input name=\"password\" type=\"password\" testid=\"password\" autoComplete=\"off\" required={true} outcome={outcome} />\n </FormSection>\n <p style={{ fontSize: '12px', color: '#888' }}>\n By clicking submit you agree to the Medplum <a href=\"https://www.medplum.com/privacy\">Privacy&nbsp;Policy</a>\n {' and '}\n <a href=\"https://www.medplum.com/terms\">Terms&nbsp;of&nbsp;Service</a>.\n </p>\n <p style={{ fontSize: '12px', color: '#888' }}>\n This site is protected by reCAPTCHA and the Google{' '}\n <a href=\"https://policies.google.com/privacy\">Privacy&nbsp;Policy</a>\n {' and '}\n <a href=\"https://policies.google.com/terms\">Terms&nbsp;of&nbsp;Service</a> apply.\n </p>\n <div className=\"medplum-signin-buttons\">\n <div>\n <input type=\"checkbox\" id=\"remember\" name=\"remember\" value=\"true\" />\n <label htmlFor=\"remember\">Remember me</label>\n </div>\n <div>\n <Button type=\"submit\" testid=\"submit\">\n Create account\n </Button>\n </div>\n </div>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAoBM,SAAU,WAAW,CAAC,KAAuB,EAAA;IACjD,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;AAC/D,IAAA,MAAM,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;AAChD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAC3D,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAE1D,IAAA,SAAS,CAAC,MAAM,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAErE,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,IAAI,EACH,EAAA,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,EACxB,QAAQ,EAAE,CAAO,QAAgC,KAAI,SAAA,CAAA,IAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;YACnD,IAAI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AAA,GAAA,EAAA,EAAA,IAAI,EAAC,qCAAqC,EAAwB,EAAA,qBAAA,CAAA;YACpE,OAAO;YACR,KAAG,CAAA,aAAA,CAAA,GAAA,EAAA,EAAA,IAAI,EAAC,mCAAmC,EAA+B,EAAA,4BAAA,CAAA;AACxE,YAAA,SAAA,CAAA;QACJ,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,wBAAwB,EAAA;AACrC,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;AACE,gBAAA,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,IAAI,EAAC,UAAU,EAAC,EAAE,EAAC,UAAU,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,MAAM,EAAG,CAAA;AACpE,gBAAA,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,OAAO,EAAC,UAAU,EAAA,EAAA,aAAA,CAAoB,CACzC;AACN,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;AACE,gBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAC,QAAQ,EAE5B,EAAA,gBAAA,CAAA,CACL,CACF,CACD,EACP;AACJ;;;;"}
1
+ {"version":3,"file":"NewUserForm.js","sources":["../../../src/auth/NewUserForm.tsx"],"sourcesContent":["import { Button, Checkbox, Divider, Group, PasswordInput, Stack, Text, TextInput } from '@mantine/core';\nimport { GoogleCredentialResponse, LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { Form } from '../Form';\nimport { getGoogleClientId, GoogleButton } from '../GoogleButton';\nimport { useMedplum } from '../MedplumProvider';\nimport { getErrorsForInput, getIssuesForExpression } from '../utils/outcomes';\nimport { getRecaptcha, initRecaptcha } from '../utils/recaptcha';\n\nexport interface NewUserFormProps {\n readonly projectId: string;\n readonly googleClientId?: string;\n readonly recaptchaSiteKey: string;\n readonly children?: React.ReactNode;\n readonly handleAuthResponse: (response: LoginAuthenticationResponse) => void;\n}\n\nexport function NewUserForm(props: NewUserFormProps): JSX.Element {\n const googleClientId = getGoogleClientId(props.googleClientId);\n const recaptchaSiteKey = props.recaptchaSiteKey;\n const medplum = useMedplum();\n const [outcome, setOutcome] = useState<OperationOutcome>();\n const issues = getIssuesForExpression(outcome, undefined);\n\n useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);\n\n return (\n <Form\n style={{ maxWidth: 400 }}\n onSubmit={async (formData: Record<string, string>) => {\n try {\n const recaptchaToken = await getRecaptcha(recaptchaSiteKey);\n props.handleAuthResponse(\n await medplum.startNewUser({\n projectId: props.projectId,\n firstName: formData.firstName,\n lastName: formData.lastName,\n email: formData.email,\n password: formData.password,\n remember: formData.remember === 'true',\n recaptchaSiteKey,\n recaptchaToken,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n >\n <div className=\"medplum-center\">{props.children}</div>\n {issues && (\n <div className=\"medplum-input-error\">\n {issues.map((issue) => (\n <div data-testid=\"text-field-error\" key={issue.details?.text}>\n {issue.details?.text}\n </div>\n ))}\n </div>\n )}\n {googleClientId && (\n <>\n <Group position=\"center\" p=\"xl\" style={{ height: 70 }}>\n <GoogleButton\n googleClientId={googleClientId}\n handleGoogleCredential={async (response: GoogleCredentialResponse) => {\n try {\n props.handleAuthResponse(\n await medplum.startGoogleLogin({\n googleClientId: response.clientId,\n googleCredential: response.credential,\n createUser: true,\n })\n );\n } catch (err) {\n setOutcome(err as OperationOutcome);\n }\n }}\n />\n </Group>\n <Divider label=\"or\" labelPosition=\"center\" my=\"lg\" />\n </>\n )}\n <Stack spacing=\"xl\">\n <TextInput\n name=\"firstName\"\n type=\"text\"\n label=\"First name\"\n placeholder=\"First name\"\n required={true}\n autoFocus={true}\n error={getErrorsForInput(outcome, 'firstName')}\n />\n <TextInput\n name=\"lastName\"\n type=\"text\"\n label=\"Last name\"\n placeholder=\"Last name\"\n required={true}\n error={getErrorsForInput(outcome, 'lastName')}\n />\n <TextInput\n name=\"email\"\n type=\"email\"\n label=\"Email\"\n placeholder=\"name@domain.com\"\n required={true}\n error={getErrorsForInput(outcome, 'email')}\n />\n <PasswordInput\n name=\"password\"\n label=\"Password\"\n autoComplete=\"off\"\n required={true}\n error={getErrorsForInput(outcome, 'password')}\n />\n <Text color=\"dimmed\" size=\"xs\">\n By clicking submit you agree to the Medplum <a href=\"https://www.medplum.com/privacy\">Privacy&nbsp;Policy</a>\n {' and '}\n <a href=\"https://www.medplum.com/terms\">Terms&nbsp;of&nbsp;Service</a>.\n </Text>\n <Text color=\"dimmed\" size=\"xs\">\n This site is protected by reCAPTCHA and the Google{' '}\n <a href=\"https://policies.google.com/privacy\">Privacy&nbsp;Policy</a>\n {' and '}\n <a href=\"https://policies.google.com/terms\">Terms&nbsp;of&nbsp;Service</a> apply.\n </Text>\n </Stack>\n <Group position=\"apart\" mt=\"xl\" noWrap>\n <Checkbox name=\"remember\" label=\"Remember me\" size=\"xs\" />\n <Button type=\"submit\">Create account</Button>\n </Group>\n </Form>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAkBM,SAAU,WAAW,CAAC,KAAuB,EAAA;IACjD,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;AAC/D,IAAA,MAAM,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;AAChD,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAC3D,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAE1D,IAAA,SAAS,CAAC,MAAM,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAErE,IAAA,QACE,KAAC,CAAA,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AO;gBACR,KAAG,CAAA,aAAA,CAAA,GAAA,EAAA,EAAA,IAAI,EAAC,mCAAmC,EAA+B,EAAA,4BAAA,CAAA;0BACrE,CACD;QACR,KAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,QAAQ,EAAC,OAAO,EAAC,EAAE,EAAC,IAAI,EAAC,MAAM,EAAA,IAAA,EAAA;AACpC,YAAA,KAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,EAAC,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,aAAa,EAAC,IAAI,EAAC,IAAI,EAAG,CAAA;YAC1D,KAAC,CAAA,aAAA,CAAA,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAwB,EAAA,gBAAA,CAAA,CACvC,CACH,EACP;AACJ;;;;"}
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import './SignInForm.css';
3
2
  import '../util.css';
4
3
  export interface RegisterFormProps {
5
4
  readonly type: 'patient' | 'project';
@@ -1 +1 @@
1
- {"version":3,"file":"RegisterForm.js","sources":["../../../src/auth/RegisterForm.tsx"],"sourcesContent":["import { LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { Document } from '../Document';\nimport { useMedplum } from '../MedplumProvider';\nimport { NewProjectForm } from './NewProjectForm';\nimport { NewUserForm } from './NewUserForm';\nimport './SignInForm.css';\nimport '../util.css';\n\nexport interface RegisterFormProps {\n readonly type: 'patient' | 'project';\n readonly projectId?: string;\n readonly googleClientId?: string;\n readonly recaptchaSiteKey: string;\n readonly children?: React.ReactNode;\n readonly onSuccess: () => void;\n}\n\nexport function RegisterForm(props: RegisterFormProps): JSX.Element {\n const { type, projectId, googleClientId, recaptchaSiteKey, onSuccess } = props;\n const medplum = useMedplum();\n const [login, setLogin] = useState<string | undefined>(undefined);\n const [outcome, setOutcome] = useState<OperationOutcome>();\n\n useEffect(() => {\n if (type === 'patient' && login) {\n medplum\n .startNewPatient({ login, projectId: projectId as string })\n .then((response) => medplum.processCode(response.code as string))\n .then(() => onSuccess())\n .catch((err) => setOutcome(err as OperationOutcome));\n }\n }, [medplum, type, projectId, login, onSuccess]);\n\n function handleAuthResponse(response: LoginAuthenticationResponse): void {\n if (response.code) {\n medplum\n .processCode(response.code)\n .then(() => onSuccess())\n .catch(console.log);\n } else if (response.login) {\n setLogin(response.login);\n }\n }\n\n return (\n <Document width={450}>\n {outcome && <pre>{JSON.stringify(outcome, null, 2)}</pre>}\n {!login && (\n <NewUserForm\n projectId={projectId as string}\n googleClientId={googleClientId}\n recaptchaSiteKey={recaptchaSiteKey}\n handleAuthResponse={handleAuthResponse}\n >\n {props.children}\n </NewUserForm>\n )}\n {login && type === 'project' && <NewProjectForm login={login} handleAuthResponse={handleAuthResponse} />}\n </Document>\n );\n}\n"],"names":[],"mappings":";;;;;;AAmBM,SAAU,YAAY,CAAC,KAAwB,EAAA;AACnD,IAAA,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;AAC/E,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;IAClE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,EAAoB,CAAC;IAE3D,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,EAAE;YAC/B,OAAO;iBACJ,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,SAAmB,EAAE,CAAC;AAC1D,iBAAA,IAAI,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAc,CAAC,CAAC;AAChE,iBAAA,IAAI,CAAC,MAAM,SAAS,EAAE,CAAC;iBACvB,KAAK,CAAC,CAAC,GAAG,KAAK,UAAU,CAAC,GAAuB,CAAC,CAAC,CAAC;AACxD,SAAA;AACH,KAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAEjD,SAAS,kBAAkB,CAAC,QAAqC,EAAA;QAC/D,IAAI,QAAQ,CAAC,IAAI,EAAE;YACjB,OAAO;AACJ,iBAAA,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC1B,iBAAA,IAAI,CAAC,MAAM,SAAS,EAAE,CAAC;AACvB,iBAAA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACvB,SAAA;aAAM,IAAI,QAAQ,CAAC,KAAK,EAAE;AACzB,YAAA,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1B,SAAA;KACF;AAED,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,QAAQ,EAAC,EAAA,KAAK,EAAE,GAAG,EAAA;AACjB,QAAA,OAAO,IAAI,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAO;QACxD,CAAC,KAAK,KACL,KAAC,CAAA,aAAA,CAAA,WAAW,EACV,EAAA,SAAS,EAAE,SAAmB,EAC9B,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EAAA,EAErC,KAAK,CAAC,QAAQ,CACH,CACf;AACA,QAAA,KAAK,IAAI,IAAI,KAAK,SAAS,IAAI,KAAA,CAAA,aAAA,CAAC,cAAc,EAAC,EAAA,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAI,CAAA,CAC/F,EACX;AACJ;;;;"}
1
+ {"version":3,"file":"RegisterForm.js","sources":["../../../src/auth/RegisterForm.tsx"],"sourcesContent":["import { LoginAuthenticationResponse } from '@medplum/core';\nimport { OperationOutcome } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { Document } from '../Document';\nimport { useMedplum } from '../MedplumProvider';\nimport { NewProjectForm } from './NewProjectForm';\nimport { NewUserForm } from './NewUserForm';\n\nimport '../util.css';\n\nexport interface RegisterFormProps {\n readonly type: 'patient' | 'project';\n readonly projectId?: string;\n readonly googleClientId?: string;\n readonly recaptchaSiteKey: string;\n readonly children?: React.ReactNode;\n readonly onSuccess: () => void;\n}\n\nexport function RegisterForm(props: RegisterFormProps): JSX.Element {\n const { type, projectId, googleClientId, recaptchaSiteKey, onSuccess } = props;\n const medplum = useMedplum();\n const [login, setLogin] = useState<string | undefined>(undefined);\n const [outcome, setOutcome] = useState<OperationOutcome>();\n\n useEffect(() => {\n if (type === 'patient' && login) {\n medplum\n .startNewPatient({ login, projectId: projectId as string })\n .then((response) => medplum.processCode(response.code as string))\n .then(() => onSuccess())\n .catch((err) => setOutcome(err as OperationOutcome));\n }\n }, [medplum, type, projectId, login, onSuccess]);\n\n function handleAuthResponse(response: LoginAuthenticationResponse): void {\n if (response.code) {\n medplum\n .processCode(response.code)\n .then(() => onSuccess())\n .catch(console.log);\n } else if (response.login) {\n setLogin(response.login);\n }\n }\n\n return (\n <Document width={450}>\n {outcome && <pre>{JSON.stringify(outcome, null, 2)}</pre>}\n {!login && (\n <NewUserForm\n projectId={projectId as string}\n googleClientId={googleClientId}\n recaptchaSiteKey={recaptchaSiteKey}\n handleAuthResponse={handleAuthResponse}\n >\n {props.children}\n </NewUserForm>\n )}\n {login && type === 'project' && <NewProjectForm login={login} handleAuthResponse={handleAuthResponse} />}\n </Document>\n );\n}\n"],"names":[],"mappings":";;;;;;AAmBM,SAAU,YAAY,CAAC,KAAwB,EAAA;AACnD,IAAA,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;AAC/E,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,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AC,KAAK,KACL,KAAC,CAAA,aAAA,CAAA,WAAW,EACV,EAAA,SAAS,EAAE,SAAmB,EAC9B,cAAc,EAAE,cAAc,EAC9B,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EAAA,EAErC,KAAK,CAAC,QAAQ,CACH,CACf;AACA,QAAA,KAAK,IAAI,IAAI,KAAK,SAAS,IAAI,KAAA,CAAA,aAAA,CAAC,cAAc,EAAC,EAAA,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAI,CAAA,CAC/F,EACX;AACJ;;;;"}
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import '../util.css';
3
- import './SignInForm.css';
4
3
  export interface SignInFormProps {
5
4
  readonly remember?: boolean;
6
5
  readonly projectId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"SignInForm.js","sources":["../../../src/auth/SignInForm.tsx"],"sourcesContent":["import { LoginAuthenticationResponse } from '@medplum/core';\nimport { ProjectMembership } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Document } from '../Document';\nimport { useMedplum } from '../MedplumProvider';\nimport '../util.css';\nimport { AuthenticationForm } from './AuthenticationForm';\nimport { ChooseProfileForm } from './ChooseProfileForm';\nimport { NewProjectForm } from './NewProjectForm';\nimport './SignInForm.css';\n\nexport interface SignInFormProps {\n readonly remember?: boolean;\n readonly projectId?: string;\n readonly googleClientId?: string;\n readonly clientId?: string;\n readonly scope?: string;\n readonly nonce?: string;\n readonly codeChallenge?: string;\n readonly codeChallengeMethod?: string;\n readonly onSuccess?: () => void;\n readonly onForgotPassword?: () => void;\n readonly onRegister?: () => void;\n readonly onCode?: (code: string) => void;\n readonly children?: React.ReactNode;\n}\n\nexport function SignInForm(props: SignInFormProps): JSX.Element {\n const medplum = useMedplum();\n const [login, setLogin] = useState<string | undefined>(undefined);\n const [memberships, setMemberships] = useState<ProjectMembership[] | undefined>(undefined);\n\n function handleAuthResponse(response: LoginAuthenticationResponse): void {\n if (response.login) {\n setLogin(response.login);\n }\n\n if (response.memberships) {\n setMemberships(response.memberships);\n }\n\n if (response.code) {\n if (props.onCode) {\n props.onCode(response.code);\n } else {\n medplum\n .processCode(response.code)\n .then(() => {\n if (props.onSuccess) {\n props.onSuccess();\n }\n })\n .catch(console.log);\n }\n }\n }\n\n return (\n <Document width={450}>\n {(() => {\n if (!login) {\n return (\n <AuthenticationForm\n projectId={props.projectId}\n clientId={props.clientId}\n scope={props.scope}\n nonce={props.nonce}\n googleClientId={props.googleClientId}\n generatePkce={!props.onCode}\n codeChallenge={props.codeChallenge}\n codeChallengeMethod={props.codeChallengeMethod}\n onForgotPassword={props.onForgotPassword}\n onRegister={props.onRegister}\n handleAuthResponse={handleAuthResponse}\n >\n {props.children}\n </AuthenticationForm>\n );\n } else if (memberships) {\n return <ChooseProfileForm login={login} memberships={memberships} handleAuthResponse={handleAuthResponse} />;\n } else if (props.projectId === 'new') {\n return <NewProjectForm login={login} handleAuthResponse={handleAuthResponse} />;\n } else {\n return <div>Success</div>;\n }\n })()}\n </Document>\n );\n}\n"],"names":[],"mappings":";;;;;;;AA2BM,SAAU,UAAU,CAAC,KAAsB,EAAA;AAC/C,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;IAClE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAkC,SAAS,CAAC,CAAC;IAE3F,SAAS,kBAAkB,CAAC,QAAqC,EAAA;QAC/D,IAAI,QAAQ,CAAC,KAAK,EAAE;AAClB,YAAA,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1B,SAAA;QAED,IAAI,QAAQ,CAAC,WAAW,EAAE;AACxB,YAAA,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACtC,SAAA;QAED,IAAI,QAAQ,CAAC,IAAI,EAA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AA;AAAM,aAAA,IAAI,KAAK,CAAC,SAAS,KAAK,KAAK,EAAE;YACpC,OAAO,KAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAA,CAAI,CAAC;AACjF,SAAA;AAAM,aAAA;AACL,YAAA,OAAO,2CAAkB,CAAC;AAC3B,SAAA;AACH,KAAC,GAAG,CACK,EACX;AACJ;;;;"}
1
+ {"version":3,"file":"SignInForm.js","sources":["../../../src/auth/SignInForm.tsx"],"sourcesContent":["import { LoginAuthenticationResponse } from '@medplum/core';\nimport { ProjectMembership } from '@medplum/fhirtypes';\nimport React, { useState } from 'react';\nimport { Document } from '../Document';\nimport { useMedplum } from '../MedplumProvider';\nimport { AuthenticationForm } from './AuthenticationForm';\nimport { ChooseProfileForm } from './ChooseProfileForm';\nimport { NewProjectForm } from './NewProjectForm';\n\nimport '../util.css';\n\nexport interface SignInFormProps {\n readonly remember?: boolean;\n readonly projectId?: string;\n readonly googleClientId?: string;\n readonly clientId?: string;\n readonly scope?: string;\n readonly nonce?: string;\n readonly codeChallenge?: string;\n readonly codeChallengeMethod?: string;\n readonly onSuccess?: () => void;\n readonly onForgotPassword?: () => void;\n readonly onRegister?: () => void;\n readonly onCode?: (code: string) => void;\n readonly children?: React.ReactNode;\n}\n\nexport function SignInForm(props: SignInFormProps): JSX.Element {\n const medplum = useMedplum();\n const [login, setLogin] = useState<string | undefined>(undefined);\n const [memberships, setMemberships] = useState<ProjectMembership[] | undefined>(undefined);\n\n function handleAuthResponse(response: LoginAuthenticationResponse): void {\n if (response.login) {\n setLogin(response.login);\n }\n\n if (response.memberships) {\n setMemberships(response.memberships);\n }\n\n if (response.code) {\n if (props.onCode) {\n props.onCode(response.code);\n } else {\n medplum\n .processCode(response.code)\n .then(() => {\n if (props.onSuccess) {\n props.onSuccess();\n }\n })\n .catch(console.log);\n }\n }\n }\n\n return (\n <Document width={450}>\n {(() => {\n if (!login) {\n return (\n <AuthenticationForm\n projectId={props.projectId}\n clientId={props.clientId}\n scope={props.scope}\n nonce={props.nonce}\n googleClientId={props.googleClientId}\n generatePkce={!props.onCode}\n codeChallenge={props.codeChallenge}\n codeChallengeMethod={props.codeChallengeMethod}\n onForgotPassword={props.onForgotPassword}\n onRegister={props.onRegister}\n handleAuthResponse={handleAuthResponse}\n >\n {props.children}\n </AuthenticationForm>\n );\n } else if (memberships) {\n return <ChooseProfileForm login={login} memberships={memberships} handleAuthResponse={handleAuthResponse} />;\n } else if (props.projectId === 'new') {\n return <NewProjectForm login={login} handleAuthResponse={handleAuthResponse} />;\n } else {\n return <div>Success</div>;\n }\n })()}\n </Document>\n );\n}\n"],"names":[],"mappings":";;;;;;;AA2BM,SAAU,UAAU,CAAC,KAAsB,EAAA;AAC/C,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAqB,SAAS,CAAC,CAAC;IAClE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAkC,SAAS,CAAC,CAAC;IAE3F,SAAS,kBAAkB,CAAC,QAAqC,EAAA;QAC/D,IAAI,QAAQ,CAAC,KAAK,EAAE;AAClB,YAAA,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1B,SAAA;QAED,IAAI,QAAQ,CAAC,WAAW,EAAE;AACxB,YAAA,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACtC,SAAA;QAED,IAAI,QAAQ,CAAC,IAAI,EAAE;YACjB,IAAI,KAAK,CAAC,MAAM,EAAE;AAChB,gBAAA,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7B,aAAA;AAAM,iBAAA;gBACL,OAAO;AACJ,qBAAA,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;qBAC1B,IAAI,CAAC,MAAK;oBACT,IAAI,KAAK,C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