@medplum/react 0.9.7

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 (158) hide show
  1. package/README.md +91 -0
  2. package/dist/cjs/defaulttheme.css +245 -0
  3. package/dist/cjs/index.js +5256 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/cjs/index.min.js +2 -0
  6. package/dist/cjs/index.min.js.map +1 -0
  7. package/dist/cjs/package.json +1 -0
  8. package/dist/cjs/styles.css +1510 -0
  9. package/dist/esm/defaulttheme.css +245 -0
  10. package/dist/esm/index.js +5129 -0
  11. package/dist/esm/index.js.map +1 -0
  12. package/dist/esm/index.min.js +2 -0
  13. package/dist/esm/index.min.js.map +1 -0
  14. package/dist/esm/package.json +1 -0
  15. package/dist/esm/styles.css +1510 -0
  16. package/dist/types/AddressDisplay.d.ts +6 -0
  17. package/dist/types/AddressInput.d.ts +8 -0
  18. package/dist/types/AnnotationInput.d.ts +8 -0
  19. package/dist/types/AttachmentArrayDisplay.d.ts +7 -0
  20. package/dist/types/AttachmentArrayInput.d.ts +9 -0
  21. package/dist/types/AttachmentDisplay.d.ts +7 -0
  22. package/dist/types/AttachmentInput.d.ts +9 -0
  23. package/dist/types/Autocomplete.d.ts +19 -0
  24. package/dist/types/Avatar.d.ts +12 -0
  25. package/dist/types/BackboneElementDisplay.d.ts +11 -0
  26. package/dist/types/BackboneElementInput.d.ts +12 -0
  27. package/dist/types/Button.d.ts +15 -0
  28. package/dist/types/CalendarInput.d.ts +15 -0
  29. package/dist/types/CodeInput.d.ts +9 -0
  30. package/dist/types/CodeableConceptDisplay.d.ts +6 -0
  31. package/dist/types/CodeableConceptInput.d.ts +9 -0
  32. package/dist/types/CodingDisplay.d.ts +6 -0
  33. package/dist/types/CodingInput.d.ts +9 -0
  34. package/dist/types/ContactPointDisplay.d.ts +6 -0
  35. package/dist/types/ContactPointInput.d.ts +8 -0
  36. package/dist/types/DateTimeDisplay.d.ts +5 -0
  37. package/dist/types/DateTimeInput.d.ts +23 -0
  38. package/dist/types/DefaultResourceTimeline.d.ts +6 -0
  39. package/dist/types/DescriptionList.d.ts +12 -0
  40. package/dist/types/DiagnosticReportDisplay.d.ts +12 -0
  41. package/dist/types/Dialog.d.ts +10 -0
  42. package/dist/types/Document.d.ts +7 -0
  43. package/dist/types/EncounterTimeline.d.ts +6 -0
  44. package/dist/types/ErrorBoundary.d.ts +18 -0
  45. package/dist/types/ExtensionInput.d.ts +8 -0
  46. package/dist/types/FhirPathDisplay.d.ts +9 -0
  47. package/dist/types/FhirPathTable.d.ts +29 -0
  48. package/dist/types/FooterLinks.d.ts +6 -0
  49. package/dist/types/Form.d.ts +8 -0
  50. package/dist/types/FormSection.d.ts +11 -0
  51. package/dist/types/FormUtils.d.ts +5 -0
  52. package/dist/types/GoogleButton.d.ts +8 -0
  53. package/dist/types/Header.d.ts +10 -0
  54. package/dist/types/HeaderSearchInput.d.ts +10 -0
  55. package/dist/types/HumanNameDisplay.d.ts +8 -0
  56. package/dist/types/HumanNameInput.d.ts +8 -0
  57. package/dist/types/IdentifierDisplay.d.ts +6 -0
  58. package/dist/types/IdentifierInput.d.ts +8 -0
  59. package/dist/types/Input.d.ts +21 -0
  60. package/dist/types/InputRow.d.ts +7 -0
  61. package/dist/types/Loading.d.ts +3 -0
  62. package/dist/types/Logo.d.ts +6 -0
  63. package/dist/types/MedplumLink.d.ts +12 -0
  64. package/dist/types/MedplumProvider.d.ts +34 -0
  65. package/dist/types/MenuItem.d.ts +9 -0
  66. package/dist/types/MenuSeparator.d.ts +3 -0
  67. package/dist/types/PatientTimeline.d.ts +6 -0
  68. package/dist/types/PeriodDisplay.d.ts +6 -0
  69. package/dist/types/PeriodInput.d.ts +8 -0
  70. package/dist/types/Popup.d.ts +14 -0
  71. package/dist/types/QuantityDisplay.d.ts +7 -0
  72. package/dist/types/QuantityInput.d.ts +8 -0
  73. package/dist/types/QuestionnaireBuilder.d.ts +8 -0
  74. package/dist/types/QuestionnaireForm.d.ts +16 -0
  75. package/dist/types/QuestionnaireUtils.d.ts +30 -0
  76. package/dist/types/RangeDisplay.d.ts +6 -0
  77. package/dist/types/RangeInput.d.ts +14 -0
  78. package/dist/types/RatioDisplay.d.ts +6 -0
  79. package/dist/types/RatioInput.d.ts +14 -0
  80. package/dist/types/ReferenceDisplay.d.ts +7 -0
  81. package/dist/types/ReferenceInput.d.ts +9 -0
  82. package/dist/types/ResourceArrayDisplay.d.ts +13 -0
  83. package/dist/types/ResourceArrayInput.d.ts +13 -0
  84. package/dist/types/ResourceBadge.d.ts +9 -0
  85. package/dist/types/ResourceBlame.d.ts +10 -0
  86. package/dist/types/ResourceDiff.d.ts +9 -0
  87. package/dist/types/ResourceDiffTable.d.ts +9 -0
  88. package/dist/types/ResourceForm.d.ts +10 -0
  89. package/dist/types/ResourceHistoryTable.d.ts +9 -0
  90. package/dist/types/ResourceInput.d.ts +11 -0
  91. package/dist/types/ResourceName.d.ts +7 -0
  92. package/dist/types/ResourcePropertyDisplay.d.ts +25 -0
  93. package/dist/types/ResourcePropertyInput.d.ts +22 -0
  94. package/dist/types/ResourceTable.d.ts +7 -0
  95. package/dist/types/ResourceTimeline.d.ts +11 -0
  96. package/dist/types/Scheduler.d.ts +7 -0
  97. package/dist/types/Scrollable.d.ts +9 -0
  98. package/dist/types/SearchControl.d.ts +38 -0
  99. package/dist/types/SearchControlField.d.ts +41 -0
  100. package/dist/types/SearchFieldEditor.d.ts +11 -0
  101. package/dist/types/SearchFilterEditor.d.ts +10 -0
  102. package/dist/types/SearchFilterValueDialog.d.ts +15 -0
  103. package/dist/types/SearchFilterValueDisplay.d.ts +7 -0
  104. package/dist/types/SearchFilterValueInput.d.ts +12 -0
  105. package/dist/types/SearchPopupMenu.d.ts +15 -0
  106. package/dist/types/SearchUtils.d.ts +177 -0
  107. package/dist/types/Select.d.ts +16 -0
  108. package/dist/types/ServiceRequestTimeline.d.ts +6 -0
  109. package/dist/types/SignInForm.d.ts +14 -0
  110. package/dist/types/SubMenu.d.ts +7 -0
  111. package/dist/types/Tab.d.ts +12 -0
  112. package/dist/types/TabList.d.ts +10 -0
  113. package/dist/types/TabPanel.d.ts +6 -0
  114. package/dist/types/TabSwitch.d.ts +6 -0
  115. package/dist/types/TextArea.d.ts +17 -0
  116. package/dist/types/Timeline.d.ts +17 -0
  117. package/dist/types/TitleBar.d.ts +6 -0
  118. package/dist/types/UploadButton.d.ts +6 -0
  119. package/dist/types/constants.d.ts +1 -0
  120. package/dist/types/index.d.ts +72 -0
  121. package/dist/types/stories/AddressInput.stories.d.ts +6 -0
  122. package/dist/types/stories/AttachmentArrayInput.stories.d.ts +6 -0
  123. package/dist/types/stories/AttachmentInput.stories.d.ts +6 -0
  124. package/dist/types/stories/Autocomplete.stories.d.ts +8 -0
  125. package/dist/types/stories/Avatar.stories.d.ts +10 -0
  126. package/dist/types/stories/Button.stories.d.ts +9 -0
  127. package/dist/types/stories/DiagnosticReportDisplay.stories.d.ts +5 -0
  128. package/dist/types/stories/Dialog.stories.d.ts +5 -0
  129. package/dist/types/stories/EncounterTimeline.stories.d.ts +5 -0
  130. package/dist/types/stories/FhirPathDisplay.stories.d.ts +7 -0
  131. package/dist/types/stories/FormSection.stories.d.ts +6 -0
  132. package/dist/types/stories/Header.stories.d.ts +6 -0
  133. package/dist/types/stories/Input.stories.d.ts +6 -0
  134. package/dist/types/stories/Loading.stories.d.ts +5 -0
  135. package/dist/types/stories/Logo.stories.d.ts +5 -0
  136. package/dist/types/stories/PatientTimeline.stories.d.ts +5 -0
  137. package/dist/types/stories/QuestionnaireBuilder.stories.d.ts +7 -0
  138. package/dist/types/stories/QuestionnaireForm.stories.d.ts +9 -0
  139. package/dist/types/stories/ReferenceInput.stories.d.ts +6 -0
  140. package/dist/types/stories/ResourceBlame.stories.d.ts +5 -0
  141. package/dist/types/stories/ResourceForm.stories.d.ts +12 -0
  142. package/dist/types/stories/ResourceHistoryTable.stories.d.ts +5 -0
  143. package/dist/types/stories/ResourceTable.stories.d.ts +7 -0
  144. package/dist/types/stories/Scheduler.stories.d.ts +5 -0
  145. package/dist/types/stories/SearchControl.stories.d.ts +9 -0
  146. package/dist/types/stories/Select.stories.d.ts +6 -0
  147. package/dist/types/stories/SignInForm.stories.d.ts +8 -0
  148. package/dist/types/stories/Tabs.stories.d.ts +6 -0
  149. package/dist/types/stories/Timeline.stories.d.ts +5 -0
  150. package/dist/types/test.setup.d.ts +1 -0
  151. package/dist/types/useResource.d.ts +8 -0
  152. package/dist/types/utils/blame.d.ts +8 -0
  153. package/dist/types/utils/date.d.ts +6 -0
  154. package/dist/types/utils/diff.d.ts +16 -0
  155. package/dist/types/utils/dom.d.ts +15 -0
  156. package/dist/types/utils/outcomes.d.ts +2 -0
  157. package/dist/types/utils.d.ts +5 -0
  158. package/package.json +95 -0
@@ -0,0 +1,8 @@
1
+ import { Reference, Resource } from '@medplum/fhirtypes';
2
+ /**
3
+ * React Hook to use a FHIR reference.
4
+ * Handles the complexity of resolving references and caching resources.
5
+ * @param value The resource or reference to resource.
6
+ * @returns The resolved resource.
7
+ */
8
+ export declare function useResource<T extends Resource>(value: Reference<T> | T | undefined): T | undefined;
@@ -0,0 +1,8 @@
1
+ import { Bundle, Meta } from '@medplum/fhirtypes';
2
+ export interface BlameRow {
3
+ id: string;
4
+ meta: Meta;
5
+ value: string;
6
+ span: number;
7
+ }
8
+ export declare function blame(history: Bundle): BlameRow[];
@@ -0,0 +1,6 @@
1
+ import { Resource } from '@medplum/fhirtypes';
2
+ /**
3
+ * Sorts an array of resources in place by meta.lastUpdated ascending.
4
+ * @param resources Array of resources.
5
+ */
6
+ export declare function sortByDateAndPriority(resources: Resource[]): void;
@@ -0,0 +1,16 @@
1
+ export declare function diff(original: string[], revised: string[]): Delta[];
2
+ export interface PathNode {
3
+ readonly i: number;
4
+ readonly j: number;
5
+ readonly prev: PathNode | undefined;
6
+ readonly snake: boolean;
7
+ }
8
+ export interface Delta {
9
+ readonly original: Chunk;
10
+ readonly revised: Chunk;
11
+ readonly type: 'change' | 'delete' | 'insert';
12
+ }
13
+ export interface Chunk {
14
+ readonly position: number;
15
+ readonly lines: string[];
16
+ }
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Kills a browser event.
4
+ * Prevents default behavior.
5
+ * Stops event propagation.
6
+ * @param e The event.
7
+ */
8
+ export declare function killEvent(e: Event | React.SyntheticEvent): void;
9
+ /**
10
+ * Returns true if the element is a checkbox or a table cell containing a checkbox.
11
+ * Table cells containing checkboxes are commonly accidentally clicked.
12
+ * @param el The HTML DOM element.
13
+ * @returns True if the element is a checkbox or a table cell containing a checkbox.
14
+ */
15
+ export declare function isCheckboxCell(el: Element): boolean;
@@ -0,0 +1,2 @@
1
+ import { OperationOutcome, OperationOutcomeIssue } from '@medplum/fhirtypes';
2
+ export declare function getIssuesForExpression(outcome: OperationOutcome | undefined, expression: string | undefined): OperationOutcomeIssue[] | undefined;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Dynamically creates a script tag for the specified JavaScript file.
3
+ * @param src The JavaScript file URL.
4
+ */
5
+ export declare function createScriptTag(src: string, onload?: () => void): void;
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@medplum/react",
3
+ "version": "0.9.7",
4
+ "description": "Medplum React Component Library",
5
+ "author": "Medplum <hello@medplum.com>",
6
+ "license": "Apache-2.0",
7
+ "homepage": "https://www.medplum.com/",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/medplum/medplum.git",
11
+ "directory": "packages/ui"
12
+ },
13
+ "scripts": {
14
+ "clean": "rimraf dist storybook-static",
15
+ "dev": "start-storybook -p 6006",
16
+ "build": "npm run clean && tsc && npm run rollup",
17
+ "rollup": "rollup --config rollup.config.js",
18
+ "test": "jest",
19
+ "storybook": "build-storybook"
20
+ },
21
+ "devDependencies": {
22
+ "@medplum/core": "0.9.7",
23
+ "@medplum/fhirtypes": "0.9.7",
24
+ "@medplum/mock": "0.9.7",
25
+ "@storybook/addon-actions": "6.5.5",
26
+ "@storybook/addon-essentials": "6.5.5",
27
+ "@storybook/addon-links": "6.5.5",
28
+ "@storybook/builder-webpack5": "6.5.5",
29
+ "@storybook/manager-webpack5": "6.5.5",
30
+ "@storybook/react": "6.5.5",
31
+ "@testing-library/dom": "8.13.0",
32
+ "@testing-library/jest-dom": "5.16.4",
33
+ "@testing-library/react": "13.2.0",
34
+ "@types/jest": "27.5.1",
35
+ "@types/node": "17.0.35",
36
+ "@types/react": "18.0.9",
37
+ "@types/react-dom": "18.0.5",
38
+ "@types/react-router-dom": "5.3.3",
39
+ "dotenv-webpack": "7.1.0",
40
+ "identity-obj-proxy": "3.0.0",
41
+ "jest": "28.1.0",
42
+ "jest-each": "28.1.0",
43
+ "html-webpack-plugin": "5.5.0",
44
+ "react": "18.1.0",
45
+ "react-dom": "18.1.0",
46
+ "react-router-dom": "6.3.0",
47
+ "rimraf": "3.0.2",
48
+ "typescript": "4.7.2"
49
+ },
50
+ "peerDependencies": {
51
+ "@medplum/core": "0.9.7",
52
+ "react": "^17.0.2 || ^18.0.0",
53
+ "react-dom": "^17.0.2 || ^18.0.0",
54
+ "react-router-dom": "^6.2.2"
55
+ },
56
+ "main": "dist/cjs/index.js",
57
+ "module": "dist/esm/index.js",
58
+ "exports": {
59
+ ".": {
60
+ "require": "./dist/cjs/index.js",
61
+ "import": "./dist/esm/index.js"
62
+ },
63
+ "./defaulttheme.css": {
64
+ "require": "./dist/cjs/defaulttheme.css",
65
+ "import": "./dist/esm/defaulttheme.css"
66
+ },
67
+ "./styles.css": {
68
+ "require": "./dist/cjs/styles.css",
69
+ "import": "./dist/esm/styles.css"
70
+ }
71
+ },
72
+ "types": "dist/types/index.d.ts",
73
+ "sideEffects": [
74
+ "*.css"
75
+ ],
76
+ "keywords": [
77
+ "medplum",
78
+ "fhir",
79
+ "healthcare",
80
+ "interoperability",
81
+ "json",
82
+ "serialization",
83
+ "hl7",
84
+ "standards",
85
+ "clinical",
86
+ "dstu2",
87
+ "stu3",
88
+ "r4",
89
+ "normative",
90
+ "ui",
91
+ "input",
92
+ "react",
93
+ "react-component"
94
+ ]
95
+ }