@openmrs/esm-styleguide 8.0.1-pre.3705 → 8.0.1-pre.3723

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.
@@ -12,6 +12,6 @@ export interface ActionMenuProps {
12
12
  * for a workspace group. The action menu is only rendered when at least one
13
13
  * window in the workspace group has an icon defined.
14
14
  */
15
- export declare function ActionMenu({ workspaceGroup, groupProps }: ActionMenuProps): React.JSX.Element | null;
15
+ export declare function ActionMenu({ workspaceGroup, groupProps }: ActionMenuProps): React.JSX.Element;
16
16
  export default ActionMenu;
17
17
  //# sourceMappingURL=action-menu2.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-menu2.component.d.ts","sourceRoot":"","sources":["../../../src/workspaces2/action-menu2/action-menu2.component.tsx"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAOtE,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,yBAAyB,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CACxC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,eAAe,4BAgDzE;AAED,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"action-menu2.component.d.ts","sourceRoot":"","sources":["../../../src/workspaces2/action-menu2/action-menu2.component.tsx"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAOtE,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,yBAAyB,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CACxC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,eAAe,qBA8BzE;AAED,eAAe,UAAU,CAAC"}
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { type OpenedWindow } from '@openmrs/esm-extensions';
3
3
  interface WorkspaceWindowProps {
4
4
  openedWindow: OpenedWindow;
5
+ showActionMenu: boolean;
5
6
  }
6
7
  /**
7
8
  * Renders an opened workspace window.
@@ -1 +1 @@
1
- {"version":3,"file":"active-workspace-window.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/active-workspace-window.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,YAAY,EAAyC,MAAM,yBAAyB,CAAC;AAOnG,UAAU,oBAAoB;IAC5B,YAAY,EAAE,YAAY,CAAC;CAC5B;AACD;;GAEG;AACH,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA4BzD,CAAC;AAyGF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"active-workspace-window.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/active-workspace-window.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,YAAY,EAAyC,MAAM,yBAAyB,CAAC;AAOnG,UAAU,oBAAoB;IAC5B,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;CACzB;AACD;;GAEG;AACH,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA6BzD,CAAC;AA6GF,eAAe,qBAAqB,CAAC"}
@@ -32,6 +32,7 @@ export interface Workspace2DefinitionProps<WorkspaceProps extends object = objec
32
32
  workspaceName: string;
33
33
  windowName: string;
34
34
  isRootWorkspace: boolean;
35
+ showActionMenu: boolean;
35
36
  }
36
37
  /**
37
38
  * @experimental
@@ -1 +1 @@
1
- {"version":3,"file":"workspace2.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/workspace2.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWzD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB,CACxC,cAAc,SAAS,MAAM,GAAG,MAAM,EACtC,WAAW,SAAS,MAAM,GAAG,MAAM,EACnC,UAAU,SAAS,MAAM,GAAG,MAAM;IAElC;;;;;;OAMG;IACH,oBAAoB,CAAC,KAAK,SAAS,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAEhG;;;;;OAKG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvG,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAC9B,cAAc,SAAS,MAAM,EAC7B,WAAW,SAAS,MAAM,EAC1B,UAAU,SAAS,MAAM,IACvB,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgJhD,CAAC"}
1
+ {"version":3,"file":"workspace2.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/workspace2.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWzD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB,CACxC,cAAc,SAAS,MAAM,GAAG,MAAM,EACtC,WAAW,SAAS,MAAM,GAAG,MAAM,EACnC,UAAU,SAAS,MAAM,GAAG,MAAM;IAElC;;;;;;OAMG;IACH,oBAAoB,CAAC,KAAK,SAAS,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAEhG;;;;;OAKG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvG,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAC9B,cAAc,SAAS,MAAM,EAC7B,WAAW,SAAS,MAAM,EAC1B,UAAU,SAAS,MAAM,IACvB,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2JhD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-styleguide",
3
- "version": "8.0.1-pre.3705",
3
+ "version": "8.0.1-pre.3723",
4
4
  "license": "MPL-2.0",
5
5
  "description": "The styleguide for OpenMRS SPA",
6
6
  "main": "dist/openmrs-esm-styleguide.js",
@@ -98,17 +98,17 @@
98
98
  "swr": "2.x"
99
99
  },
100
100
  "devDependencies": {
101
- "@openmrs/esm-api": "8.0.1-pre.3705",
102
- "@openmrs/esm-config": "8.0.1-pre.3705",
103
- "@openmrs/esm-emr-api": "8.0.1-pre.3705",
104
- "@openmrs/esm-error-handling": "8.0.1-pre.3705",
105
- "@openmrs/esm-extensions": "8.0.1-pre.3705",
106
- "@openmrs/esm-globals": "8.0.1-pre.3705",
107
- "@openmrs/esm-navigation": "8.0.1-pre.3705",
108
- "@openmrs/esm-react-utils": "8.0.1-pre.3705",
109
- "@openmrs/esm-state": "8.0.1-pre.3705",
110
- "@openmrs/esm-translations": "8.0.1-pre.3705",
111
- "@openmrs/esm-utils": "8.0.1-pre.3705",
101
+ "@openmrs/esm-api": "8.0.1-pre.3723",
102
+ "@openmrs/esm-config": "8.0.1-pre.3723",
103
+ "@openmrs/esm-emr-api": "8.0.1-pre.3723",
104
+ "@openmrs/esm-error-handling": "8.0.1-pre.3723",
105
+ "@openmrs/esm-extensions": "8.0.1-pre.3723",
106
+ "@openmrs/esm-globals": "8.0.1-pre.3723",
107
+ "@openmrs/esm-navigation": "8.0.1-pre.3723",
108
+ "@openmrs/esm-react-utils": "8.0.1-pre.3723",
109
+ "@openmrs/esm-state": "8.0.1-pre.3723",
110
+ "@openmrs/esm-translations": "8.0.1-pre.3723",
111
+ "@openmrs/esm-utils": "8.0.1-pre.3723",
112
112
  "@rspack/cli": "^1.3.11",
113
113
  "@rspack/core": "^1.3.11",
114
114
  "@types/geopattern": "^1.2.9",
@@ -5,11 +5,6 @@ html {
5
5
  scroll-behavior: smooth;
6
6
  }
7
7
 
8
- body {
9
- display: flex;
10
- flex-direction: column;
11
- }
12
-
13
8
  .omrs-app-error {
14
9
  padding: layout.$spacing-11;
15
10
  width: 100%;
@@ -61,4 +56,5 @@ body {
61
56
  'topNav topNav topNav'
62
57
  'leftNav appRoots workspace';
63
58
  grid-template-columns: min-content 1fr min-content;
59
+ container-type: inline-size;
64
60
  }
@@ -23,17 +23,9 @@ export interface ActionMenuProps {
23
23
  * window in the workspace group has an icon defined.
24
24
  */
25
25
  export function ActionMenu({ workspaceGroup, groupProps }: ActionMenuProps) {
26
- const { registeredWindowsByName } = useWorkspace2Store();
27
26
  const layout = useLayoutType();
28
- const { name: groupName, persistence } = workspaceGroup;
27
+ const { name: persistence } = workspaceGroup;
29
28
 
30
- const windowsWithIcons = Object.values(registeredWindowsByName)
31
- .filter((window): window is Required<typeof window> => window.group === groupName && window.icon !== undefined)
32
- .sort((a, b) => (a.order ?? Number.MAX_VALUE) - (b.order ?? Number.MAX_VALUE));
33
-
34
- if (windowsWithIcons.length === 0) {
35
- return null; // No icons to display
36
- }
37
29
  const isClosable = persistence == 'closable';
38
30
 
39
31
  return (
@@ -58,16 +50,6 @@ export function ActionMenu({ workspaceGroup, groupProps }: ActionMenuProps) {
58
50
  <ExtensionSlot className={styles.container} name={workspaceGroup.name} state={{ groupProps }} />
59
51
  </ComponentContext.Provider>
60
52
  </div>
61
- {isClosable && !isDesktop(layout) && (
62
- <IconButton
63
- align="left"
64
- onClick={() => closeWorkspaceGroup2()}
65
- label={getCoreTranslation('close')}
66
- kind="ghost"
67
- >
68
- <CloseIcon />
69
- </IconButton>
70
- )}
71
53
  </aside>
72
54
  );
73
55
  }
@@ -12,11 +12,12 @@ import styles from './workspace2.module.scss';
12
12
 
13
13
  interface WorkspaceWindowProps {
14
14
  openedWindow: OpenedWindow;
15
+ showActionMenu: boolean;
15
16
  }
16
17
  /**
17
18
  * Renders an opened workspace window.
18
19
  */
19
- const ActiveWorkspaceWindow: React.FC<WorkspaceWindowProps> = ({ openedWindow }) => {
20
+ const ActiveWorkspaceWindow: React.FC<WorkspaceWindowProps> = ({ openedWindow, showActionMenu }) => {
20
21
  const { openedWorkspaces } = openedWindow;
21
22
  const [lifeCycles, setLifeCycles] = useState<ParcelConfig[]>();
22
23
  const { registeredWorkspacesByName } = workspace2Store.getState();
@@ -40,6 +41,7 @@ const ActiveWorkspaceWindow: React.FC<WorkspaceWindowProps> = ({ openedWindow })
40
41
  lifeCycle={lifeCycles && lifeCycles[i] ? lifeCycles[i] : undefined}
41
42
  isRootWorkspace={i === 0}
42
43
  isLeafWorkspace={i === openedWorkspaces.length - 1}
44
+ showActionMenu={showActionMenu}
43
45
  />
44
46
  ))}
45
47
  </>
@@ -52,6 +54,7 @@ interface ActiveWorkspaceProps {
52
54
  openedWindow: OpenedWindow;
53
55
  isRootWorkspace: boolean;
54
56
  isLeafWorkspace: boolean;
57
+ showActionMenu: boolean;
55
58
  }
56
59
 
57
60
  const ActiveWorkspace: React.FC<ActiveWorkspaceProps> = ({
@@ -60,6 +63,7 @@ const ActiveWorkspace: React.FC<ActiveWorkspaceProps> = ({
60
63
  openedWindow,
61
64
  isRootWorkspace,
62
65
  isLeafWorkspace,
66
+ showActionMenu,
63
67
  }) => {
64
68
  const { openedGroup, closeWorkspace, openChildWorkspace } = useWorkspace2Store();
65
69
 
@@ -108,6 +112,7 @@ const ActiveWorkspace: React.FC<ActiveWorkspaceProps> = ({
108
112
  isRootWorkspace,
109
113
  isLeafWorkspace,
110
114
  windowName: openedWindow.windowName,
115
+ showActionMenu,
111
116
  },
112
117
  [openedWorkspace, closeWorkspace, openedGroup, openedWindow],
113
118
  );
@@ -132,6 +137,7 @@ const ActiveWorkspace: React.FC<ActiveWorkspaceProps> = ({
132
137
  <div
133
138
  className={classNames(styles.workspaceMiddleContainer, {
134
139
  [styles.isRootWorkspace]: isRootWorkspace,
140
+ [styles.showActionMenu]: showActionMenu,
135
141
  })}
136
142
  >
137
143
  <div
@@ -19,7 +19,7 @@ export function renderWorkspaceWindowsAndMenu(target: HTMLElement | null) {
19
19
  * and all the active workspace windows within that group.
20
20
  */
21
21
  function WorkspaceWindowsAndMenu() {
22
- const { openedGroup, openedWindows, registeredGroupsByName } = useWorkspace2Store();
22
+ const { openedGroup, openedWindows, registeredGroupsByName, registeredWindowsByName } = useWorkspace2Store();
23
23
 
24
24
  useEffect(() => {
25
25
  const unsubscribe = subscribeOpenmrsEvent('before-page-changed', (pageChangedEvent) => {
@@ -41,6 +41,12 @@ function WorkspaceWindowsAndMenu() {
41
41
  const group = registeredGroupsByName[openedGroup.groupName];
42
42
  const hasMaximizedWindow = openedWindows.some((window) => window.maximized);
43
43
 
44
+ const { name: groupName } = group;
45
+ const windowsWithIcons = Object.values(registeredWindowsByName)
46
+ .filter((window): window is Required<typeof window> => window.group === groupName && window.icon !== undefined)
47
+ .sort((a, b) => (a.order ?? Number.MAX_VALUE) - (b.order ?? Number.MAX_VALUE));
48
+ const showActionMenu = windowsWithIcons.length > 0;
49
+
44
50
  return (
45
51
  <div
46
52
  className={classNames(styles.workspaceWindowsAndMenuContainer, {
@@ -50,10 +56,16 @@ function WorkspaceWindowsAndMenu() {
50
56
  >
51
57
  <div className={styles.workspaceWindowsContainer}>
52
58
  {openedWindows.map((openedWindow) => {
53
- return <ActiveWorkspaceWindow key={openedWindow.windowName} openedWindow={openedWindow} />;
59
+ return (
60
+ <ActiveWorkspaceWindow
61
+ key={openedWindow.windowName}
62
+ openedWindow={openedWindow}
63
+ showActionMenu={showActionMenu}
64
+ />
65
+ );
54
66
  })}
55
67
  </div>
56
- <ActionMenu workspaceGroup={group} groupProps={openedGroup.props} />
68
+ {showActionMenu && <ActionMenu workspaceGroup={group} groupProps={openedGroup.props} />}
57
69
  </div>
58
70
  );
59
71
  }
@@ -6,7 +6,7 @@ import { isDesktop, useLayoutType } from '@openmrs/esm-react-utils';
6
6
  import { getCoreTranslation } from '@openmrs/esm-translations';
7
7
  import { getOpenedWindowIndexByWorkspace } from '@openmrs/esm-extensions';
8
8
  import { ArrowRightIcon, CloseIcon } from '../icons';
9
- import { useWorkspace2Store, useWorkspace2Context } from './workspace2';
9
+ import { useWorkspace2Store, useWorkspace2Context, closeWorkspaceGroup2 } from './workspace2';
10
10
  import styles from './workspace2.module.scss';
11
11
 
12
12
  interface Workspace2Props {
@@ -46,6 +46,7 @@ export interface Workspace2DefinitionProps<
46
46
  workspaceName: string;
47
47
  windowName: string;
48
48
  isRootWorkspace: boolean;
49
+ showActionMenu: boolean;
49
50
  }
50
51
 
51
52
  /**
@@ -79,7 +80,7 @@ export const Workspace2: React.FC<Workspace2Props> = ({ title, children, hasUnsa
79
80
  setWorkspaceTitle,
80
81
  isMostRecentlyOpenedWindowHidden,
81
82
  } = useWorkspace2Store();
82
- const { workspaceName, isRootWorkspace, closeWorkspace } = useWorkspace2Context();
83
+ const { workspaceName, isRootWorkspace, closeWorkspace, showActionMenu } = useWorkspace2Context();
83
84
 
84
85
  const openedWindowIndex = getOpenedWindowIndexByWorkspace(workspaceName);
85
86
 
@@ -145,6 +146,7 @@ export const Workspace2: React.FC<Workspace2Props> = ({ title, children, hasUnsa
145
146
  [styles.maximized]: maximized,
146
147
  [styles.hidden]: isWindowHidden,
147
148
  [styles.isRootWorkspace]: isRootWorkspace,
149
+ [styles.showActionMenu]: showActionMenu,
148
150
  })}
149
151
  >
150
152
  <div
@@ -154,56 +156,66 @@ export const Workspace2: React.FC<Workspace2Props> = ({ title, children, hasUnsa
154
156
  [styles.isRootWorkspace]: isRootWorkspace,
155
157
  })}
156
158
  >
157
- <>
158
- <Header aria-label={getCoreTranslation('workspaceHeader')} className={styles.header}>
159
- <HeaderName prefix="">{title}</HeaderName>
160
- <div className={styles.overlayHeaderSpacer} />
161
- <HeaderGlobalBar className={styles.headerButtons}>
162
- {isDesktop(layout) ? (
163
- <>
164
- {(canMaximize || maximized) && (
159
+ <Header aria-label={getCoreTranslation('workspaceHeader')} className={styles.header}>
160
+ <HeaderName prefix="">{title}</HeaderName>
161
+ <div className={styles.overlayHeaderSpacer} />
162
+ <HeaderGlobalBar className={styles.headerButtons}>
163
+ {isDesktop(layout) ? (
164
+ <>
165
+ {(canMaximize || maximized) && (
166
+ <HeaderGlobalAction
167
+ aria-label={maximized ? getCoreTranslation('minimize') : getCoreTranslation('maximize')}
168
+ onClick={() => setWindowMaximized(windowName, !maximized)}
169
+ >
170
+ {maximized ? <Minimize /> : <Maximize />}
171
+ </HeaderGlobalAction>
172
+ )}
173
+ {canHide ? (
174
+ <HeaderGlobalAction aria-label={getCoreTranslation('hide')} onClick={() => hideWindow()}>
175
+ <ArrowRightIcon />
176
+ </HeaderGlobalAction>
177
+ ) : (
178
+ // in desktop mode, if the group is closeable, the close button
179
+ // is rendered in the side nav, not in the workspace
180
+ !canCloseGroup && (
165
181
  <HeaderGlobalAction
166
- aria-label={maximized ? getCoreTranslation('minimize') : getCoreTranslation('maximize')}
167
- onClick={() => setWindowMaximized(windowName, !maximized)}
182
+ aria-label={getCoreTranslation('close')}
183
+ onClick={() => closeWorkspace({ closeWindow: true })}
168
184
  >
169
- {maximized ? <Minimize /> : <Maximize />}
185
+ <CloseIcon />
170
186
  </HeaderGlobalAction>
171
- )}
172
- {canHide ? (
173
- <HeaderGlobalAction aria-label={getCoreTranslation('hide')} onClick={() => hideWindow()}>
174
- <ArrowRightIcon />
175
- </HeaderGlobalAction>
176
- ) : (
177
- !canCloseGroup && (
178
- <HeaderGlobalAction
179
- aria-label={getCoreTranslation('close')}
180
- onClick={() => closeWorkspace({ closeWindow: true })}
181
- >
182
- <CloseIcon />
183
- </HeaderGlobalAction>
184
- )
185
- )}
186
- </>
187
- ) : (
188
- <>
189
- {canHide && (
190
- <HeaderGlobalAction aria-label={getCoreTranslation('hide')} onClick={() => hideWindow()}>
191
- <DownToBottom />
192
- </HeaderGlobalAction>
193
- )}
194
-
187
+ )
188
+ )}
189
+ </>
190
+ ) : (
191
+ <>
192
+ {canHide ? (
193
+ <HeaderGlobalAction aria-label={getCoreTranslation('hide')} onClick={() => hideWindow()}>
194
+ <DownToBottom />
195
+ </HeaderGlobalAction>
196
+ ) : (
197
+ // in tablet mode, the close button is rendered regardless of
198
+ // whether the group is closeable. The close button closes
199
+ // the workspace group (and the side nav) if group is closeable;
200
+ // otherwise it only closes the workspace window.
195
201
  <HeaderGlobalAction
196
202
  aria-label={getCoreTranslation('close')}
197
- onClick={() => closeWorkspace({ closeWindow: true })}
203
+ onClick={() => {
204
+ if (canCloseGroup) {
205
+ closeWorkspaceGroup2();
206
+ } else {
207
+ closeWorkspace({ closeWindow: true });
208
+ }
209
+ }}
198
210
  >
199
211
  <CloseIcon />
200
212
  </HeaderGlobalAction>
201
- </>
202
- )}
203
- </HeaderGlobalBar>
204
- </Header>
205
- <div className={classNames(styles.workspaceContent)}>{children}</div>
206
- </>
213
+ )}
214
+ </>
215
+ )}
216
+ </HeaderGlobalBar>
217
+ </Header>
218
+ <div className={classNames(styles.workspaceContent)}>{children}</div>
207
219
  </div>
208
220
  </div>
209
221
  </div>
@@ -166,8 +166,18 @@ $extraWideWorkspaceWidth: 48.25rem;
166
166
  }
167
167
  }
168
168
 
169
+ // fallback for browsers that don't support the container CSS feature,
170
+ // the width is slightly off if <body> has a vertical scrollbar
169
171
  .workspaceOuterContainer {
170
- width: 100vw !important;
172
+ width: 100vw;
173
+ }
174
+
175
+ // using the container CSS feature, for browser that support it
176
+ // get the container query width (i.e. width of <body>, without the scrollbars)
177
+ @supports (width: 100cqw) {
178
+ .workspaceOuterContainer {
179
+ width: 100cqw;
180
+ }
171
181
  }
172
182
 
173
183
  .workspaceMiddleContainer {
@@ -175,15 +185,25 @@ $extraWideWorkspaceWidth: 48.25rem;
175
185
  &.hidden {
176
186
  display: none;
177
187
  }
188
+
189
+ // in tablet mode, reduce the height to of the workspace window to accommodate the workspace menu (bottom nav)
190
+ &.showActionMenu {
191
+ height: calc(100% - layout.$spacing-10);
192
+ }
178
193
  }
179
194
 
180
195
  .workspaceInnerContainer {
181
- width: 100vw !important;
196
+ width: 100% !important;
182
197
  }
183
198
 
184
199
  .marginWorkspaceContent {
185
200
  margin-bottom: var(--bottom-nav-height);
186
201
  }
202
+
203
+ .workspaceContent {
204
+ overflow-y: auto;
205
+ height: 100%;
206
+ }
187
207
  }
188
208
 
189
209
  // Overriding styles for RTL support