@openmrs/esm-framework 6.3.1-pre.3199 → 6.3.1-pre.3207

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 (35) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/openmrs-esm-framework.js +2 -2
  3. package/dist/openmrs-esm-framework.js.map +1 -1
  4. package/docs/classes/OpenmrsFetchError.md +4 -4
  5. package/docs/functions/convertToLocaleCalendar.md +1 -1
  6. package/docs/functions/formatDate.md +1 -1
  7. package/docs/functions/formatDatetime.md +1 -1
  8. package/docs/functions/formatDuration.md +3 -3
  9. package/docs/functions/formatPartialDate.md +1 -1
  10. package/docs/functions/formatTime.md +1 -1
  11. package/docs/functions/getDefaultCalendar.md +1 -1
  12. package/docs/functions/isOmrsDateStrict.md +1 -1
  13. package/docs/functions/isOmrsDateToday.md +1 -1
  14. package/docs/functions/makeUrl.md +1 -1
  15. package/docs/functions/openmrsFetch.md +1 -1
  16. package/docs/functions/openmrsObservableFetch.md +1 -1
  17. package/docs/functions/parseDate.md +1 -1
  18. package/docs/functions/registerDefaultCalendar.md +1 -1
  19. package/docs/functions/toDateObjectStrict.md +1 -1
  20. package/docs/functions/toOmrsIsoString.md +1 -1
  21. package/docs/interfaces/FetchConfig.md +3 -3
  22. package/docs/interfaces/FetchError.md +3 -3
  23. package/docs/interfaces/FetchHeaders.md +1 -1
  24. package/docs/interfaces/FetchResponseJson.md +1 -1
  25. package/docs/interfaces/OpenmrsDateRangePickerProps.md +783 -0
  26. package/docs/type-aliases/DateInput.md +1 -1
  27. package/docs/type-aliases/FormatDateMode.md +1 -1
  28. package/docs/type-aliases/FormatDateOptions.md +10 -10
  29. package/docs/variables/OpenmrsDateRangePicker.md +9 -0
  30. package/docs/variables/fhirBaseUrl.md +1 -1
  31. package/docs/variables/restBaseUrl.md +1 -1
  32. package/docs/variables/sessionEndpoint.md +1 -1
  33. package/mock-jest.tsx +31 -1
  34. package/mock.tsx +31 -1
  35. package/package.json +20 -20
@@ -4,4 +4,4 @@
4
4
 
5
5
  > **DateInput** = `string` \| `number` \| `Date`
6
6
 
7
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:8
7
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:7
@@ -4,4 +4,4 @@
4
4
 
5
5
  > **FormatDateMode** = `"standard"` \| `"wide"`
6
6
 
7
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:51
7
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:50
@@ -4,7 +4,7 @@
4
4
 
5
5
  > **FormatDateOptions** = `object`
6
6
 
7
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:52
7
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:51
8
8
 
9
9
  ## Properties
10
10
 
@@ -12,7 +12,7 @@ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:52
12
12
 
13
13
  > `optional` **calendar**: `string`
14
14
 
15
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:56
15
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:55
16
16
 
17
17
  The calendar to use when formatting this date.
18
18
 
@@ -22,7 +22,7 @@ The calendar to use when formatting this date.
22
22
 
23
23
  > **day**: `boolean`
24
24
 
25
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:72
25
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:71
26
26
 
27
27
  Whether to include the day number
28
28
 
@@ -32,7 +32,7 @@ Whether to include the day number
32
32
 
33
33
  > `optional` **locale**: `string`
34
34
 
35
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:60
35
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:59
36
36
 
37
37
  The locale to use when formatting this date
38
38
 
@@ -42,7 +42,7 @@ The locale to use when formatting this date
42
42
 
43
43
  > **mode**: [`FormatDateMode`](FormatDateMode.md)
44
44
 
45
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:65
45
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:64
46
46
 
47
47
  - `standard`: "03 Feb 2022"
48
48
  - `wide`: "03 — Feb — 2022"
@@ -53,7 +53,7 @@ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:65
53
53
 
54
54
  > **month**: `boolean`
55
55
 
56
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:74
56
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:73
57
57
 
58
58
  Whether to include the month number
59
59
 
@@ -63,7 +63,7 @@ Whether to include the month number
63
63
 
64
64
  > **noToday**: `boolean`
65
65
 
66
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:85
66
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:84
67
67
 
68
68
  Disables the special handling of dates that are today. If false
69
69
  (the default), then dates that are today will be formatted as "Today"
@@ -76,7 +76,7 @@ formatted the same as all other dates.
76
76
 
77
77
  > `optional` **numberingSystem**: `string`
78
78
 
79
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:78
79
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:77
80
80
 
81
81
  The unicode numbering system to use
82
82
 
@@ -86,7 +86,7 @@ The unicode numbering system to use
86
86
 
87
87
  > **time**: `true` \| `false` \| `"for today"`
88
88
 
89
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:70
89
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:69
90
90
 
91
91
  Whether the time should be included in the output always (`true`),
92
92
  never (`false`), or only when the input date is today (`for today`).
@@ -97,6 +97,6 @@ never (`false`), or only when the input date is today (`for today`).
97
97
 
98
98
  > **year**: `boolean`
99
99
 
100
- Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:76
100
+ Defined in: packages/framework/esm-utils/dist/dates/date-util.d.ts:75
101
101
 
102
102
  Whether to include the year
@@ -0,0 +1,9 @@
1
+ [O3 Framework](../API.md) / OpenmrsDateRangePicker
2
+
3
+ # Variable: OpenmrsDateRangePicker
4
+
5
+ > `const` **OpenmrsDateRangePicker**: `ForwardRefExoticComponent`\<[`OpenmrsDateRangePickerProps`](../interfaces/OpenmrsDateRangePickerProps.md) & `RefAttributes`\<`HTMLDivElement`\>\>
6
+
7
+ Defined in: [packages/framework/esm-styleguide/src/datepicker/date-range/date-range-picker.component.tsx:70](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/datepicker/date-range/date-range-picker.component.tsx#L70)
8
+
9
+ A date range picker to enter or select a date and time range. Based on React Aria, but styled to look like Carbon.
@@ -4,4 +4,4 @@
4
4
 
5
5
  > `const` **fhirBaseUrl**: `"/ws/fhir2/R4"` = `'/ws/fhir2/R4'`
6
6
 
7
- Defined in: [packages/framework/esm-api/src/openmrs-fetch.ts:9](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/openmrs-fetch.ts#L9)
7
+ Defined in: [packages/framework/esm-api/src/openmrs-fetch.ts:10](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/openmrs-fetch.ts#L10)
@@ -4,4 +4,4 @@
4
4
 
5
5
  > `const` **restBaseUrl**: `"/ws/rest/v1"` = `'/ws/rest/v1'`
6
6
 
7
- Defined in: [packages/framework/esm-api/src/openmrs-fetch.ts:8](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/openmrs-fetch.ts#L8)
7
+ Defined in: [packages/framework/esm-api/src/openmrs-fetch.ts:9](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/openmrs-fetch.ts#L9)
@@ -4,4 +4,4 @@
4
4
 
5
5
  > `const` **sessionEndpoint**: `"/ws/rest/v1/session"`
6
6
 
7
- Defined in: [packages/framework/esm-api/src/openmrs-fetch.ts:10](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/openmrs-fetch.ts#L10)
7
+ Defined in: [packages/framework/esm-api/src/openmrs-fetch.ts:11](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-api/src/openmrs-fetch.ts#L11)
package/mock-jest.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { NEVER } from 'rxjs';
3
3
  import type {} from '@openmrs/esm-globals';
4
4
  import * as utils from '@openmrs/esm-utils';
@@ -110,6 +110,36 @@ export const OpenmrsDatePicker = jest.fn(({ id, labelText, value, onChange, isIn
110
110
  </>
111
111
  ));
112
112
 
113
+ export const OpenmrsDateRangePicker = jest.fn(({ id, labelText, value = [], onChange, isInvalid, invalidText }) => {
114
+ const [inputValue, setInputValue] = useState(() => {
115
+ const [start, end] = value;
116
+ const formattedStart = start ? dayjs(start).format('DD/MM/YYYY') : 'dd/mm/yyyy';
117
+ const formattedEnd = end ? dayjs(end).format('DD/MM/YYYY') : 'dd/mm/yyyy';
118
+ return `${formattedStart}–${formattedEnd}`;
119
+ });
120
+
121
+ const handleChange = (e) => {
122
+ const raw = e.target.value;
123
+ setInputValue(raw);
124
+
125
+ const [startStr, endStr] = raw.split('–');
126
+ const start = dayjs(startStr, 'DD/MM/YYYY', true);
127
+ const end = dayjs(endStr, 'DD/MM/YYYY', true);
128
+
129
+ if (start.isValid() && end.isValid()) {
130
+ onChange?.([start.toDate(), end.toDate()]);
131
+ }
132
+ };
133
+
134
+ return (
135
+ <div>
136
+ <label htmlFor={id}>{labelText}</label>
137
+ <input id={id} type="text" value={inputValue} onChange={handleChange} />
138
+ {isInvalid && <span>{invalidText}</span>}
139
+ </div>
140
+ );
141
+ });
142
+
113
143
  /* esm-utils */
114
144
  export {
115
145
  getDefaultsFromConfigSchema,
package/mock.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { vi } from 'vitest';
3
3
  import { NEVER } from 'rxjs';
4
4
  import type {} from '@openmrs/esm-globals';
@@ -111,6 +111,36 @@ export const OpenmrsDatePicker = vi.fn(({ id, labelText, value, onChange, isInva
111
111
  </>
112
112
  ));
113
113
 
114
+ export const OpenmrsDateRangePicker = vi.fn(({ id, labelText, value = [], onChange, isInvalid, invalidText }) => {
115
+ const [inputValue, setInputValue] = useState(() => {
116
+ const [start, end] = value;
117
+ const formattedStart = start ? dayjs(start).format('DD/MM/YYYY') : 'dd/mm/yyyy';
118
+ const formattedEnd = end ? dayjs(end).format('DD/MM/YYYY') : 'dd/mm/yyyy';
119
+ return `${formattedStart}–${formattedEnd}`;
120
+ });
121
+
122
+ const handleChange = (e) => {
123
+ const raw = e.target.value;
124
+ setInputValue(raw);
125
+
126
+ const [startStr, endStr] = raw.split('–');
127
+ const start = dayjs(startStr, 'DD/MM/YYYY', true);
128
+ const end = dayjs(endStr, 'DD/MM/YYYY', true);
129
+
130
+ if (start.isValid() && end.isValid()) {
131
+ onChange?.([start.toDate(), end.toDate()]);
132
+ }
133
+ };
134
+
135
+ return (
136
+ <div>
137
+ <label htmlFor={id}>{labelText}</label>
138
+ <input id={id} type="text" value={inputValue} onChange={handleChange} />
139
+ {isInvalid && <span>{invalidText}</span>}
140
+ </div>
141
+ );
142
+ });
143
+
114
144
  /* esm-utils */
115
145
  export {
116
146
  getDefaultsFromConfigSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-framework",
3
- "version": "6.3.1-pre.3199",
3
+ "version": "6.3.1-pre.3207",
4
4
  "license": "MPL-2.0",
5
5
  "type": "module",
6
6
  "module": "dist/openmrs-esm-framework.js",
@@ -59,24 +59,24 @@
59
59
  "access": "public"
60
60
  },
61
61
  "dependencies": {
62
- "@openmrs/esm-api": "6.3.1-pre.3199",
63
- "@openmrs/esm-config": "6.3.1-pre.3199",
64
- "@openmrs/esm-context": "6.3.1-pre.3199",
65
- "@openmrs/esm-dynamic-loading": "6.3.1-pre.3199",
66
- "@openmrs/esm-emr-api": "6.3.1-pre.3199",
67
- "@openmrs/esm-error-handling": "6.3.1-pre.3199",
68
- "@openmrs/esm-expression-evaluator": "6.3.1-pre.3199",
69
- "@openmrs/esm-extensions": "6.3.1-pre.3199",
70
- "@openmrs/esm-feature-flags": "6.3.1-pre.3199",
71
- "@openmrs/esm-globals": "6.3.1-pre.3199",
72
- "@openmrs/esm-navigation": "6.3.1-pre.3199",
73
- "@openmrs/esm-offline": "6.3.1-pre.3199",
74
- "@openmrs/esm-react-utils": "6.3.1-pre.3199",
75
- "@openmrs/esm-routes": "6.3.1-pre.3199",
76
- "@openmrs/esm-state": "6.3.1-pre.3199",
77
- "@openmrs/esm-styleguide": "6.3.1-pre.3199",
78
- "@openmrs/esm-translations": "6.3.1-pre.3199",
79
- "@openmrs/esm-utils": "6.3.1-pre.3199"
62
+ "@openmrs/esm-api": "6.3.1-pre.3207",
63
+ "@openmrs/esm-config": "6.3.1-pre.3207",
64
+ "@openmrs/esm-context": "6.3.1-pre.3207",
65
+ "@openmrs/esm-dynamic-loading": "6.3.1-pre.3207",
66
+ "@openmrs/esm-emr-api": "6.3.1-pre.3207",
67
+ "@openmrs/esm-error-handling": "6.3.1-pre.3207",
68
+ "@openmrs/esm-expression-evaluator": "6.3.1-pre.3207",
69
+ "@openmrs/esm-extensions": "6.3.1-pre.3207",
70
+ "@openmrs/esm-feature-flags": "6.3.1-pre.3207",
71
+ "@openmrs/esm-globals": "6.3.1-pre.3207",
72
+ "@openmrs/esm-navigation": "6.3.1-pre.3207",
73
+ "@openmrs/esm-offline": "6.3.1-pre.3207",
74
+ "@openmrs/esm-react-utils": "6.3.1-pre.3207",
75
+ "@openmrs/esm-routes": "6.3.1-pre.3207",
76
+ "@openmrs/esm-state": "6.3.1-pre.3207",
77
+ "@openmrs/esm-styleguide": "6.3.1-pre.3207",
78
+ "@openmrs/esm-translations": "6.3.1-pre.3207",
79
+ "@openmrs/esm-utils": "6.3.1-pre.3207"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "dayjs": "1.x",
@@ -98,7 +98,7 @@
98
98
  "sass-embedded": "^1.89.0",
99
99
  "svgo-loader": "^4.0.0",
100
100
  "typedoc": "^0.28.5",
101
- "typedoc-plugin-file-categories": "6.3.1-pre.3199",
101
+ "typedoc-plugin-file-categories": "6.3.1-pre.3207",
102
102
  "typedoc-plugin-markdown": "^4.6.3",
103
103
  "typedoc-plugin-no-inherit": "^1.6.1",
104
104
  "typescript": "^5.8.3",