@openmrs/esm-styleguide 10.0.1-pre.5539 → 10.0.1-pre.5545
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.
- package/.turbo/turbo-build.log +1 -1
- package/dist/components/_main-content.scss +0 -12
- package/dist/emitter.d.ts +18 -0
- package/dist/emitter.d.ts.map +1 -0
- package/dist/emitter.js +43 -0
- package/dist/notifications/active-actionable-notifications.component.d.ts +2 -2
- package/dist/notifications/active-actionable-notifications.component.d.ts.map +1 -1
- package/dist/notifications/active-notifications.component.d.ts +2 -2
- package/dist/notifications/active-notifications.component.d.ts.map +1 -1
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +5 -5
- package/dist/snackbars/active-snackbar.component.d.ts +2 -2
- package/dist/snackbars/active-snackbar.component.d.ts.map +1 -1
- package/dist/snackbars/index.d.ts.map +1 -1
- package/dist/snackbars/index.js +2 -2
- package/dist/toasts/active-toasts.component.d.ts +2 -2
- package/dist/toasts/active-toasts.component.d.ts.map +1 -1
- package/dist/toasts/index.js +3 -3
- package/package.json +25 -27
- package/src/components/_main-content.scss +0 -12
- package/src/emitter.ts +33 -0
- package/src/notifications/active-actionable-notifications.component.tsx +2 -2
- package/src/notifications/active-notifications.component.tsx +2 -2
- package/src/notifications/index.tsx +5 -5
- package/src/snackbars/active-snackbar.component.tsx +2 -2
- package/src/snackbars/index.tsx +2 -2
- package/src/toasts/active-toasts.component.tsx +2 -2
- package/src/toasts/index.tsx +3 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
[0] Successfully compiled:
|
|
1
|
+
[0] Successfully compiled: 124 files, copied 168 files with swc (263.4ms)
|
|
2
2
|
[0] swc --strip-leading-paths --copy-files src -d dist && svgo -rf dist --quiet exited with code 0
|
|
3
3
|
[1] tsc --project tsconfig.build.json exited with code 0
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
4
|
--omrs-sidenav-width: 16rem;
|
|
5
|
-
--omrs-offline-banner-height: 0;
|
|
6
5
|
--omrs-navbar-height: #{layout.$spacing-09};
|
|
7
6
|
--omrs-topnav-height: var(--omrs-navbar-height);
|
|
8
7
|
}
|
|
@@ -11,14 +10,3 @@
|
|
|
11
10
|
margin-left: 0;
|
|
12
11
|
transition: margin-left 0.5s ease;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
.omrs-offline {
|
|
16
|
-
--omrs-offline-banner-height: #{layout.$spacing-06};
|
|
17
|
-
--omrs-topnav-height: 4.5rem;
|
|
18
|
-
|
|
19
|
-
.cds--side-nav,
|
|
20
|
-
.cds--header-panel--expanded,
|
|
21
|
-
.cds--side-nav__overlay {
|
|
22
|
-
top: var(--omrs-topnav-height);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal multicast event emitter used internally by the styleguide's
|
|
3
|
+
* notification, snackbar, and toast rendering hosts.
|
|
4
|
+
*
|
|
5
|
+
* It replaces the rxjs `Subject` these hosts previously relied on. Those usages
|
|
6
|
+
* only ever needed `next()` to push a value and `subscribe()` to receive values
|
|
7
|
+
* (returning something with `unsubscribe()`), so a tiny emitter lets the
|
|
8
|
+
* framework drop its rxjs dependency entirely.
|
|
9
|
+
*/
|
|
10
|
+
export interface EmitterSubscription {
|
|
11
|
+
unsubscribe(): void;
|
|
12
|
+
}
|
|
13
|
+
export declare class Emitter<T> {
|
|
14
|
+
private listeners;
|
|
15
|
+
subscribe(listener: (value: T) => void): EmitterSubscription;
|
|
16
|
+
next(value: T): void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=emitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,IAAI,IAAI,CAAC;CACrB;AAED,qBAAa,OAAO,CAAC,CAAC;IACpB,OAAO,CAAC,SAAS,CAAiC;IAElD,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,mBAAmB;IAS5D,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;CAOrB"}
|
package/dist/emitter.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal multicast event emitter used internally by the styleguide's
|
|
3
|
+
* notification, snackbar, and toast rendering hosts.
|
|
4
|
+
*
|
|
5
|
+
* It replaces the rxjs `Subject` these hosts previously relied on. Those usages
|
|
6
|
+
* only ever needed `next()` to push a value and `subscribe()` to receive values
|
|
7
|
+
* (returning something with `unsubscribe()`), so a tiny emitter lets the
|
|
8
|
+
* framework drop its rxjs dependency entirely.
|
|
9
|
+
*/ function _define_property(obj, key, value) {
|
|
10
|
+
if (key in obj) {
|
|
11
|
+
Object.defineProperty(obj, key, {
|
|
12
|
+
value: value,
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
obj[key] = value;
|
|
19
|
+
}
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
|
22
|
+
export class Emitter {
|
|
23
|
+
subscribe(listener) {
|
|
24
|
+
this.listeners.add(listener);
|
|
25
|
+
return {
|
|
26
|
+
unsubscribe: ()=>{
|
|
27
|
+
this.listeners.delete(listener);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
next(value) {
|
|
32
|
+
// Iterate over a snapshot so a listener that unsubscribes while handling an
|
|
33
|
+
// emission doesn't disturb the iteration.
|
|
34
|
+
for (const listener of [
|
|
35
|
+
...this.listeners
|
|
36
|
+
]){
|
|
37
|
+
listener(value);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
constructor(){
|
|
41
|
+
_define_property(this, "listeners", new Set());
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Subject } from 'rxjs';
|
|
3
2
|
import type { ActionableNotificationMeta } from './actionable-notification.component';
|
|
3
|
+
import type { Emitter } from '../emitter';
|
|
4
4
|
interface ActionableActiveNotificationProps {
|
|
5
|
-
subject:
|
|
5
|
+
subject: Emitter<ActionableNotificationMeta>;
|
|
6
6
|
}
|
|
7
7
|
declare const ActionableActiveNotifications: React.FC<ActionableActiveNotificationProps>;
|
|
8
8
|
export default ActionableActiveNotifications;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-actionable-notifications.component.d.ts","sourceRoot":"","sources":["../../src/notifications/active-actionable-notifications.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"active-actionable-notifications.component.d.ts","sourceRoot":"","sources":["../../src/notifications/active-actionable-notifications.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEtF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,UAAU,iCAAiC;IACzC,OAAO,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;CAC9C;AAED,QAAA,MAAM,6BAA6B,EAAE,KAAK,CAAC,EAAE,CAAC,iCAAiC,CA4B9E,CAAC;AAEF,eAAe,6BAA6B,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Subject } from 'rxjs';
|
|
3
2
|
import type { InlineNotificationMeta } from './notification.component';
|
|
3
|
+
import type { Emitter } from '../emitter';
|
|
4
4
|
interface ActiveNotificationProps {
|
|
5
|
-
subject:
|
|
5
|
+
subject: Emitter<InlineNotificationMeta>;
|
|
6
6
|
}
|
|
7
7
|
declare const ActiveNotifications: React.FC<ActiveNotificationProps>;
|
|
8
8
|
export default ActiveNotifications;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-notifications.component.d.ts","sourceRoot":"","sources":["../../src/notifications/active-notifications.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"active-notifications.component.d.ts","sourceRoot":"","sources":["../../src/notifications/active-notifications.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,UAAU,uBAAuB;IAC/B,OAAO,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAC1C;AAED,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA2B1D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAA0B,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,KAAK,EAA8B,gCAAgC,EAAE,MAAM,qCAAqC,CAAC;AAWxH;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,QAKnE;AAYD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,sBAAsB,QAkBpE;AAID,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,QAKvE;AAUD;;;GAGG;AAEH,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,gCAAgC,QAYxF"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/** @module @category UI */ import React from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { isEmpty } from "lodash-es";
|
|
4
|
+
import { createRoot } from "react-dom/client";
|
|
4
5
|
import ActiveNotifications from "./active-notifications.component.js";
|
|
5
6
|
import ActionableActiveNotifications from "./active-actionable-notifications.component.js";
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
const inlineNotificationsSubject = new Subject();
|
|
7
|
+
import { Emitter } from "../emitter.js";
|
|
8
|
+
const inlineNotificationsSubject = new Emitter();
|
|
9
9
|
let notificationId = 0;
|
|
10
|
-
const actionableNotificationsSubject = new
|
|
10
|
+
const actionableNotificationsSubject = new Emitter();
|
|
11
11
|
let actionableNotificationId = 0;
|
|
12
12
|
/**
|
|
13
13
|
* Starts a rendering host for inline notifications. Should only be used by the app shell.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @module @category UI */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { Subject } from 'rxjs';
|
|
4
3
|
import type { SnackbarMeta } from './snackbar.component';
|
|
4
|
+
import type { Emitter } from '../emitter';
|
|
5
5
|
interface ActiveSnackbarProps {
|
|
6
|
-
subject:
|
|
6
|
+
subject: Emitter<SnackbarMeta>;
|
|
7
7
|
}
|
|
8
8
|
declare const ActiveSnackbars: React.FC<ActiveSnackbarProps>;
|
|
9
9
|
export default ActiveSnackbars;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-snackbar.component.d.ts","sourceRoot":"","sources":["../../src/snackbars/active-snackbar.component.tsx"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"active-snackbar.component.d.ts","sourceRoot":"","sources":["../../src/snackbars/active-snackbar.component.tsx"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,UAAU,mBAAmB;IAC3B,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAChC;AAED,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgClD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/snackbars/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/snackbars/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,sBAAsB,CAAC;AAI7E,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKrG;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,QAKzD;AAMD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,kBAAkB,QAWxD"}
|
package/dist/snackbars/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/** @module @category UI */ import React from "react";
|
|
3
3
|
import { createRoot } from "react-dom/client";
|
|
4
|
-
import { Subject } from "rxjs";
|
|
5
4
|
import ActiveSnackbars from "./active-snackbar.component.js";
|
|
6
|
-
|
|
5
|
+
import { Emitter } from "../emitter.js";
|
|
6
|
+
const snackbarsSubject = new Emitter();
|
|
7
7
|
let snackbarId = 0;
|
|
8
8
|
/**
|
|
9
9
|
* Starts a rendering host for snack bar notifications. Should only be used by the app shell.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/** @module @category UI */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { Subject } from 'rxjs';
|
|
4
3
|
import type { ToastNotificationMeta } from './toast.component';
|
|
4
|
+
import type { Emitter } from '../emitter';
|
|
5
5
|
interface ActiveToastsProps {
|
|
6
|
-
subject:
|
|
6
|
+
subject: Emitter<ToastNotificationMeta>;
|
|
7
7
|
}
|
|
8
8
|
declare const ActiveToasts: React.FC<ActiveToastsProps>;
|
|
9
9
|
export default ActiveToasts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-toasts.component.d.ts","sourceRoot":"","sources":["../../src/toasts/active-toasts.component.tsx"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"active-toasts.component.d.ts","sourceRoot":"","sources":["../../src/toasts/active-toasts.component.tsx"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACzC;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAgC7C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/dist/toasts/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/** @module @category UI */ import React from "react";
|
|
3
|
+
import { isEmpty } from "lodash-es";
|
|
3
4
|
import { createRoot } from "react-dom/client";
|
|
4
|
-
import { Subject } from "rxjs";
|
|
5
5
|
import ActiveToasts from "./active-toasts.component.js";
|
|
6
|
-
import
|
|
7
|
-
const toastsSubject = new
|
|
6
|
+
import { Emitter } from "../emitter.js";
|
|
7
|
+
const toastsSubject = new Emitter();
|
|
8
8
|
let toastId = 0;
|
|
9
9
|
/**
|
|
10
10
|
* Starts a rendering host for toast notifications. Should only be used by the app shell.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-styleguide",
|
|
3
|
-
"version": "10.0.1-pre.
|
|
3
|
+
"version": "10.0.1-pre.5545",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "The styleguide for OpenMRS SPA",
|
|
6
6
|
"module": "dist/internal.js",
|
|
@@ -78,39 +78,38 @@
|
|
|
78
78
|
"react-aria-components": "^1.7.1"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"@openmrs/esm-api": "^10.0.1-pre.
|
|
82
|
-
"@openmrs/esm-config": "^10.0.1-pre.
|
|
83
|
-
"@openmrs/esm-emr-api": "^10.0.1-pre.
|
|
84
|
-
"@openmrs/esm-error-handling": "^10.0.1-pre.
|
|
85
|
-
"@openmrs/esm-extensions": "^10.0.1-pre.
|
|
86
|
-
"@openmrs/esm-globals": "^10.0.1-pre.
|
|
87
|
-
"@openmrs/esm-navigation": "^10.0.1-pre.
|
|
88
|
-
"@openmrs/esm-react-utils": "^10.0.1-pre.
|
|
89
|
-
"@openmrs/esm-routes": "^10.0.1-pre.
|
|
90
|
-
"@openmrs/esm-state": "^10.0.1-pre.
|
|
91
|
-
"@openmrs/esm-translations": "^10.0.1-pre.
|
|
92
|
-
"@openmrs/esm-utils": "^10.0.1-pre.
|
|
81
|
+
"@openmrs/esm-api": "^10.0.1-pre.5545",
|
|
82
|
+
"@openmrs/esm-config": "^10.0.1-pre.5545",
|
|
83
|
+
"@openmrs/esm-emr-api": "^10.0.1-pre.5545",
|
|
84
|
+
"@openmrs/esm-error-handling": "^10.0.1-pre.5545",
|
|
85
|
+
"@openmrs/esm-extensions": "^10.0.1-pre.5545",
|
|
86
|
+
"@openmrs/esm-globals": "^10.0.1-pre.5545",
|
|
87
|
+
"@openmrs/esm-navigation": "^10.0.1-pre.5545",
|
|
88
|
+
"@openmrs/esm-react-utils": "^10.0.1-pre.5545",
|
|
89
|
+
"@openmrs/esm-routes": "^10.0.1-pre.5545",
|
|
90
|
+
"@openmrs/esm-state": "^10.0.1-pre.5545",
|
|
91
|
+
"@openmrs/esm-translations": "^10.0.1-pre.5545",
|
|
92
|
+
"@openmrs/esm-utils": "^10.0.1-pre.5545",
|
|
93
93
|
"dayjs": "1.x",
|
|
94
94
|
"i18next": "25.x",
|
|
95
95
|
"react": "18.x",
|
|
96
96
|
"react-dom": "18.x",
|
|
97
97
|
"react-i18next": "16.x",
|
|
98
|
-
"rxjs": "6.x",
|
|
99
98
|
"swr": "2.x"
|
|
100
99
|
},
|
|
101
100
|
"devDependencies": {
|
|
102
|
-
"@openmrs/esm-api": "10.0.1-pre.
|
|
103
|
-
"@openmrs/esm-config": "10.0.1-pre.
|
|
104
|
-
"@openmrs/esm-emr-api": "10.0.1-pre.
|
|
105
|
-
"@openmrs/esm-error-handling": "10.0.1-pre.
|
|
106
|
-
"@openmrs/esm-extensions": "10.0.1-pre.
|
|
107
|
-
"@openmrs/esm-globals": "10.0.1-pre.
|
|
108
|
-
"@openmrs/esm-navigation": "10.0.1-pre.
|
|
109
|
-
"@openmrs/esm-react-utils": "10.0.1-pre.
|
|
110
|
-
"@openmrs/esm-routes": "10.0.1-pre.
|
|
111
|
-
"@openmrs/esm-state": "10.0.1-pre.
|
|
112
|
-
"@openmrs/esm-translations": "10.0.1-pre.
|
|
113
|
-
"@openmrs/esm-utils": "10.0.1-pre.
|
|
101
|
+
"@openmrs/esm-api": "10.0.1-pre.5545",
|
|
102
|
+
"@openmrs/esm-config": "10.0.1-pre.5545",
|
|
103
|
+
"@openmrs/esm-emr-api": "10.0.1-pre.5545",
|
|
104
|
+
"@openmrs/esm-error-handling": "10.0.1-pre.5545",
|
|
105
|
+
"@openmrs/esm-extensions": "10.0.1-pre.5545",
|
|
106
|
+
"@openmrs/esm-globals": "10.0.1-pre.5545",
|
|
107
|
+
"@openmrs/esm-navigation": "10.0.1-pre.5545",
|
|
108
|
+
"@openmrs/esm-react-utils": "10.0.1-pre.5545",
|
|
109
|
+
"@openmrs/esm-routes": "10.0.1-pre.5545",
|
|
110
|
+
"@openmrs/esm-state": "10.0.1-pre.5545",
|
|
111
|
+
"@openmrs/esm-translations": "10.0.1-pre.5545",
|
|
112
|
+
"@openmrs/esm-utils": "10.0.1-pre.5545",
|
|
114
113
|
"@swc/cli": "0.8.1",
|
|
115
114
|
"@swc/core": "1.15.21",
|
|
116
115
|
"@types/geopattern": "^1.2.9",
|
|
@@ -122,7 +121,6 @@
|
|
|
122
121
|
"react": "^18.3.1",
|
|
123
122
|
"react-dom": "^18.3.1",
|
|
124
123
|
"rimraf": "^6.1.3",
|
|
125
|
-
"rxjs": "^6.5.3",
|
|
126
124
|
"svgo": "^3.3.2",
|
|
127
125
|
"swr": "2.5.1",
|
|
128
126
|
"typescript": "^5.8.3",
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
:root {
|
|
4
4
|
--omrs-sidenav-width: 16rem;
|
|
5
|
-
--omrs-offline-banner-height: 0;
|
|
6
5
|
--omrs-navbar-height: #{layout.$spacing-09};
|
|
7
6
|
--omrs-topnav-height: var(--omrs-navbar-height);
|
|
8
7
|
}
|
|
@@ -11,14 +10,3 @@
|
|
|
11
10
|
margin-left: 0;
|
|
12
11
|
transition: margin-left 0.5s ease;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
.omrs-offline {
|
|
16
|
-
--omrs-offline-banner-height: #{layout.$spacing-06};
|
|
17
|
-
--omrs-topnav-height: 4.5rem;
|
|
18
|
-
|
|
19
|
-
.cds--side-nav,
|
|
20
|
-
.cds--header-panel--expanded,
|
|
21
|
-
.cds--side-nav__overlay {
|
|
22
|
-
top: var(--omrs-topnav-height);
|
|
23
|
-
}
|
|
24
|
-
}
|
package/src/emitter.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal multicast event emitter used internally by the styleguide's
|
|
3
|
+
* notification, snackbar, and toast rendering hosts.
|
|
4
|
+
*
|
|
5
|
+
* It replaces the rxjs `Subject` these hosts previously relied on. Those usages
|
|
6
|
+
* only ever needed `next()` to push a value and `subscribe()` to receive values
|
|
7
|
+
* (returning something with `unsubscribe()`), so a tiny emitter lets the
|
|
8
|
+
* framework drop its rxjs dependency entirely.
|
|
9
|
+
*/
|
|
10
|
+
export interface EmitterSubscription {
|
|
11
|
+
unsubscribe(): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class Emitter<T> {
|
|
15
|
+
private listeners = new Set<(value: T) => void>();
|
|
16
|
+
|
|
17
|
+
subscribe(listener: (value: T) => void): EmitterSubscription {
|
|
18
|
+
this.listeners.add(listener);
|
|
19
|
+
return {
|
|
20
|
+
unsubscribe: () => {
|
|
21
|
+
this.listeners.delete(listener);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
next(value: T): void {
|
|
27
|
+
// Iterate over a snapshot so a listener that unsubscribes while handling an
|
|
28
|
+
// emission doesn't disturb the iteration.
|
|
29
|
+
for (const listener of [...this.listeners]) {
|
|
30
|
+
listener(value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import type { Subject } from 'rxjs';
|
|
3
2
|
import type { ActionableNotificationMeta } from './actionable-notification.component';
|
|
4
3
|
import { ActionableNotificationComponent } from './actionable-notification.component';
|
|
4
|
+
import type { Emitter } from '../emitter';
|
|
5
5
|
|
|
6
6
|
interface ActionableActiveNotificationProps {
|
|
7
|
-
subject:
|
|
7
|
+
subject: Emitter<ActionableNotificationMeta>;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const ActionableActiveNotifications: React.FC<ActionableActiveNotificationProps> = ({ subject }) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import type { Subject } from 'rxjs';
|
|
3
2
|
import type { InlineNotificationMeta } from './notification.component';
|
|
4
3
|
import { Notification } from './notification.component';
|
|
4
|
+
import type { Emitter } from '../emitter';
|
|
5
5
|
|
|
6
6
|
interface ActiveNotificationProps {
|
|
7
|
-
subject:
|
|
7
|
+
subject: Emitter<InlineNotificationMeta>;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const ActiveNotifications: React.FC<ActiveNotificationProps> = ({ subject }) => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/** @module @category UI */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { isEmpty } from 'lodash-es';
|
|
4
|
+
import { createRoot } from 'react-dom/client';
|
|
4
5
|
import type { InlineNotificationMeta, NotificationDescriptor } from './notification.component';
|
|
5
6
|
import type { ActionableNotificationMeta, ActionableNotificationDescriptor } from './actionable-notification.component';
|
|
6
7
|
import ActiveNotifications from './active-notifications.component';
|
|
7
8
|
import ActionableActiveNotifications from './active-actionable-notifications.component';
|
|
8
|
-
import
|
|
9
|
-
import { createRoot } from 'react-dom/client';
|
|
9
|
+
import { Emitter } from '../emitter';
|
|
10
10
|
|
|
11
|
-
const inlineNotificationsSubject = new
|
|
11
|
+
const inlineNotificationsSubject = new Emitter<InlineNotificationMeta>();
|
|
12
12
|
let notificationId = 0;
|
|
13
13
|
|
|
14
|
-
const actionableNotificationsSubject = new
|
|
14
|
+
const actionableNotificationsSubject = new Emitter<ActionableNotificationMeta>();
|
|
15
15
|
let actionableNotificationId = 0;
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** @module @category UI */
|
|
2
2
|
import React, { useEffect, useState, useCallback } from 'react';
|
|
3
|
-
import type { Subject } from 'rxjs';
|
|
4
3
|
import type { SnackbarMeta } from './snackbar.component';
|
|
5
4
|
import { Snackbar } from './snackbar.component';
|
|
5
|
+
import type { Emitter } from '../emitter';
|
|
6
6
|
|
|
7
7
|
interface ActiveSnackbarProps {
|
|
8
|
-
subject:
|
|
8
|
+
subject: Emitter<SnackbarMeta>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const ActiveSnackbars: React.FC<ActiveSnackbarProps> = ({ subject }) => {
|
package/src/snackbars/index.tsx
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/** @module @category UI */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
|
-
import { Subject } from 'rxjs';
|
|
5
4
|
|
|
6
5
|
import type { SnackbarDescriptor, SnackbarMeta } from './snackbar.component';
|
|
7
6
|
import ActiveSnackbars from './active-snackbar.component';
|
|
7
|
+
import { Emitter } from '../emitter';
|
|
8
8
|
|
|
9
9
|
export { type SnackbarDescriptor, type SnackbarType, type SnackbarMeta } from './snackbar.component';
|
|
10
10
|
|
|
11
|
-
const snackbarsSubject = new
|
|
11
|
+
const snackbarsSubject = new Emitter<SnackbarMeta>();
|
|
12
12
|
let snackbarId = 0;
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** @module @category UI */
|
|
2
2
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import type { Subject } from 'rxjs';
|
|
4
3
|
import type { ToastNotificationMeta } from './toast.component';
|
|
5
4
|
import { Toast } from './toast.component';
|
|
5
|
+
import type { Emitter } from '../emitter';
|
|
6
6
|
|
|
7
7
|
interface ActiveToastsProps {
|
|
8
|
-
subject:
|
|
8
|
+
subject: Emitter<ToastNotificationMeta>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const ActiveToasts: React.FC<ActiveToastsProps> = ({ subject }) => {
|
package/src/toasts/index.tsx
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/** @module @category UI */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { isEmpty } from 'lodash-es';
|
|
3
4
|
import { createRoot } from 'react-dom/client';
|
|
4
|
-
import { Subject } from 'rxjs';
|
|
5
5
|
import type { ToastDescriptor, ToastNotificationMeta } from './toast.component';
|
|
6
6
|
import ActiveToasts from './active-toasts.component';
|
|
7
|
-
import
|
|
7
|
+
import { Emitter } from '../emitter';
|
|
8
8
|
|
|
9
9
|
export { type ToastDescriptor, type ToastType, type ToastNotificationMeta } from './toast.component';
|
|
10
10
|
|
|
11
|
-
const toastsSubject = new
|
|
11
|
+
const toastsSubject = new Emitter<ToastNotificationMeta>();
|
|
12
12
|
let toastId = 0;
|
|
13
13
|
|
|
14
14
|
/**
|