@openmrs/esm-styleguide 3.2.1-pre.1149 → 3.2.1-pre.1160
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 +45 -15
- package/dist/openmrs-esm-styleguide.css +1 -1
- package/dist/openmrs-esm-styleguide.css.map +1 -1
- package/dist/openmrs-esm-styleguide.js +2 -1
- package/dist/openmrs-esm-styleguide.js.LICENSE.txt +14 -0
- package/dist/openmrs-esm-styleguide.js.map +1 -1
- package/package.json +3 -3
- package/src/declarations.d.ts +2 -0
- package/src/index.ts +1 -0
- package/src/left-nav/index.tsx +49 -0
- package/src/left-nav/left-nav.module.scss +34 -0
- package/src/public.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-styleguide",
|
|
3
|
-
"version": "3.2.1-pre.
|
|
3
|
+
"version": "3.2.1-pre.1160",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "The styleguide for OpenMRS SPA",
|
|
6
6
|
"browser": "dist/openmrs-esm-styleguide.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"rxjs": "6.x"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@openmrs/esm-extensions": "^3.2.1-pre.
|
|
54
|
+
"@openmrs/esm-extensions": "^3.2.1-pre.1160",
|
|
55
55
|
"@pickra/copy-code-block": "^1.1.7",
|
|
56
56
|
"@storybook/addon-a11y": "^5.2.1",
|
|
57
57
|
"@storybook/addon-knobs": "^5.2.1",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"react-dom": "^16.13.1",
|
|
67
67
|
"rxjs": "^6.5.3"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "a34508fb8c153ebfbf13c97b9f386907f44d3b1e"
|
|
70
70
|
}
|
package/src/declarations.d.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** @module @category UI */
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ExtensionSlot, useStore } from "@openmrs/esm-react-utils";
|
|
4
|
+
import { createGlobalStore } from "@openmrs/esm-state";
|
|
5
|
+
import { SideNav, SideNavProps } from "carbon-components-react";
|
|
6
|
+
import styles from "./left-nav.module.scss";
|
|
7
|
+
|
|
8
|
+
interface LeftNavStore {
|
|
9
|
+
slotName: string | null;
|
|
10
|
+
basePath: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const leftNavStore = createGlobalStore<LeftNavStore>("left-nav", {
|
|
14
|
+
slotName: null,
|
|
15
|
+
basePath: window.spaBase,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export function setLeftNav({ name, basePath }) {
|
|
19
|
+
leftNavStore.setState({ slotName: name, basePath });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function unsetLeftNav(name) {
|
|
23
|
+
if (leftNavStore.getState().slotName == name) {
|
|
24
|
+
leftNavStore.setState({ slotName: null });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type LeftNavMenuProps = SideNavProps;
|
|
29
|
+
|
|
30
|
+
export const LeftNavMenu = React.forwardRef<HTMLElement, LeftNavMenuProps>(
|
|
31
|
+
(props, ref) => {
|
|
32
|
+
const { slotName, basePath } = useStore(leftNavStore);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<SideNav
|
|
36
|
+
ref={ref}
|
|
37
|
+
expanded
|
|
38
|
+
aria-label="Left navigation"
|
|
39
|
+
className={styles.link}
|
|
40
|
+
{...props}
|
|
41
|
+
>
|
|
42
|
+
<ExtensionSlot extensionSlotName="global-nav-menu-slot" />
|
|
43
|
+
{slotName ? (
|
|
44
|
+
<ExtensionSlot extensionSlotName={slotName} state={{ basePath }} />
|
|
45
|
+
) : null}
|
|
46
|
+
</SideNav>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@import "../vars";
|
|
2
|
+
@import "carbon-components/scss/globals/scss/typography.scss";
|
|
3
|
+
@import "~carbon-components/scss/globals/scss/_spacing.scss";
|
|
4
|
+
|
|
5
|
+
.link > div a:nth-child(1) {
|
|
6
|
+
height: 3rem;
|
|
7
|
+
padding: 1.5rem 0 1.5rem 1.2rem;
|
|
8
|
+
color: $ui-04;
|
|
9
|
+
border-left: 0.25rem solid transparent;
|
|
10
|
+
@include carbon--type-style("productive-heading-01");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:global(.omrs-breakpoint-gt-tablet) .link > div {
|
|
14
|
+
padding-top: 1rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:global(.omrs-breakpoint-gt-tablet) .link > div a:nth-child(1) {
|
|
18
|
+
height: 2rem;
|
|
19
|
+
color: $ui-04;
|
|
20
|
+
padding: 0 0 0 1rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.link > div a:nth-child(1):hover {
|
|
24
|
+
background-color: $ui-03;
|
|
25
|
+
color: $ui-05;
|
|
26
|
+
border-left: var(--brand-01);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.link > div a:nth-child(1):focus {
|
|
30
|
+
background-color: $ui-03;
|
|
31
|
+
outline: none;
|
|
32
|
+
color: $ui-05;
|
|
33
|
+
border-left: var(--brand-01);
|
|
34
|
+
}
|
package/src/public.ts
CHANGED