@openmrs/esm-framework 9.0.3-pre.4556 → 9.0.3-pre.4622

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.
@@ -1,3 +1,3 @@
1
- [0] Successfully compiled: 3 files with swc (116.91ms)
1
+ [0] Successfully compiled: 3 files with swc (116.52ms)
2
2
  [0] swc --strip-leading-paths src -d dist exited with code 0
3
3
  [1] tsc --project tsconfig.build.json exited with code 0
@@ -2,6 +2,8 @@
2
2
 
3
3
  # Function: useAppContext()
4
4
 
5
+ ## Call Signature
6
+
5
7
  > **useAppContext**\<`T`\>(`namespace`): `undefined` \| `Readonly`\<`T`\>
6
8
 
7
9
  Defined in: [packages/framework/esm-react-utils/src/useAppContext.ts:26](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useAppContext.ts#L26)
@@ -10,27 +12,81 @@ This hook is used to access a namespace within the overall AppContext, so that a
10
12
  use any shared contextual values. A selector may be provided to further restrict the properties
11
13
  returned from the namespace.
12
14
 
13
- ## Type Parameters
15
+ ### Type Parameters
14
16
 
15
- ### T
17
+ #### T
16
18
 
17
19
  `T` *extends* `object` = `object`
18
20
 
19
21
  The type of the value stored in the namespace
20
22
 
21
- ## Parameters
23
+ ### Parameters
22
24
 
23
- ### namespace
25
+ #### namespace
24
26
 
25
27
  `string`
26
28
 
27
29
  The namespace to load properties from
28
30
 
29
- ## Returns
31
+ ### Returns
30
32
 
31
33
  `undefined` \| `Readonly`\<`T`\>
32
34
 
33
- ## Examples
35
+ ### Examples
36
+
37
+ ```ts
38
+ // load a full namespace
39
+ const patientContext = useAppContext<PatientContext>('patient');
40
+ ```
41
+
42
+ ```ts
43
+ // loads part of a namespace
44
+ const patientName = useAppContext<PatientContext, string | undefined>('patient', (state) => state.display);
45
+ ```
46
+
47
+ ## Call Signature
48
+
49
+ > **useAppContext**\<`T`, `U`\>(`namespace`, `selector`): `undefined` \| `Readonly`\<`U`\>
50
+
51
+ Defined in: [packages/framework/esm-react-utils/src/useAppContext.ts:52](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useAppContext.ts#L52)
52
+
53
+ This hook is used to access a namespace within the overall AppContext, so that a component can
54
+ use any shared contextual values. A selector may be provided to further restrict the properties
55
+ returned from the namespace.
56
+
57
+ ### Type Parameters
58
+
59
+ #### T
60
+
61
+ `T` *extends* `object` = `object`
62
+
63
+ The type of the value stored in the namespace
64
+
65
+ #### U
66
+
67
+ `U` = `T`
68
+
69
+ The return type of this hook which is mostly relevant when using a selector
70
+
71
+ ### Parameters
72
+
73
+ #### namespace
74
+
75
+ `string`
76
+
77
+ The namespace to load properties from
78
+
79
+ #### selector
80
+
81
+ (`state`) => `Readonly`\<`U`\>
82
+
83
+ An optional function which extracts the relevant part of the state
84
+
85
+ ### Returns
86
+
87
+ `undefined` \| `Readonly`\<`U`\>
88
+
89
+ ### Examples
34
90
 
35
91
  ```ts
36
92
  // load a full namespace
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-framework",
3
- "version": "9.0.3-pre.4556",
3
+ "version": "9.0.3-pre.4622",
4
4
  "license": "MPL-2.0",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
@@ -59,24 +59,24 @@
59
59
  "access": "public"
60
60
  },
61
61
  "dependencies": {
62
- "@openmrs/esm-api": "9.0.3-pre.4556",
63
- "@openmrs/esm-config": "9.0.3-pre.4556",
64
- "@openmrs/esm-context": "9.0.3-pre.4556",
65
- "@openmrs/esm-dynamic-loading": "9.0.3-pre.4556",
66
- "@openmrs/esm-emr-api": "9.0.3-pre.4556",
67
- "@openmrs/esm-error-handling": "9.0.3-pre.4556",
68
- "@openmrs/esm-expression-evaluator": "9.0.3-pre.4556",
69
- "@openmrs/esm-extensions": "9.0.3-pre.4556",
70
- "@openmrs/esm-feature-flags": "9.0.3-pre.4556",
71
- "@openmrs/esm-globals": "9.0.3-pre.4556",
72
- "@openmrs/esm-navigation": "9.0.3-pre.4556",
73
- "@openmrs/esm-offline": "9.0.3-pre.4556",
74
- "@openmrs/esm-react-utils": "9.0.3-pre.4556",
75
- "@openmrs/esm-routes": "9.0.3-pre.4556",
76
- "@openmrs/esm-state": "9.0.3-pre.4556",
77
- "@openmrs/esm-styleguide": "9.0.3-pre.4556",
78
- "@openmrs/esm-translations": "9.0.3-pre.4556",
79
- "@openmrs/esm-utils": "9.0.3-pre.4556"
62
+ "@openmrs/esm-api": "9.0.3-pre.4622",
63
+ "@openmrs/esm-config": "9.0.3-pre.4622",
64
+ "@openmrs/esm-context": "9.0.3-pre.4622",
65
+ "@openmrs/esm-dynamic-loading": "9.0.3-pre.4622",
66
+ "@openmrs/esm-emr-api": "9.0.3-pre.4622",
67
+ "@openmrs/esm-error-handling": "9.0.3-pre.4622",
68
+ "@openmrs/esm-expression-evaluator": "9.0.3-pre.4622",
69
+ "@openmrs/esm-extensions": "9.0.3-pre.4622",
70
+ "@openmrs/esm-feature-flags": "9.0.3-pre.4622",
71
+ "@openmrs/esm-globals": "9.0.3-pre.4622",
72
+ "@openmrs/esm-navigation": "9.0.3-pre.4622",
73
+ "@openmrs/esm-offline": "9.0.3-pre.4622",
74
+ "@openmrs/esm-react-utils": "9.0.3-pre.4622",
75
+ "@openmrs/esm-routes": "9.0.3-pre.4622",
76
+ "@openmrs/esm-state": "9.0.3-pre.4622",
77
+ "@openmrs/esm-styleguide": "9.0.3-pre.4622",
78
+ "@openmrs/esm-translations": "9.0.3-pre.4622",
79
+ "@openmrs/esm-utils": "9.0.3-pre.4622"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "dayjs": "1.x",
@@ -89,7 +89,7 @@
89
89
  "swr": "2.x"
90
90
  },
91
91
  "devDependencies": {
92
- "@openmrs/typedoc-plugin-file-categories": "9.0.3-pre.4556",
92
+ "@openmrs/typedoc-plugin-file-categories": "9.0.3-pre.4622",
93
93
  "@swc/cli": "0.8.1",
94
94
  "@swc/core": "1.15.21",
95
95
  "@vitest/coverage-v8": "^4.1.2",