@guardian/stand 0.0.27 → 0.0.28

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 (73) hide show
  1. package/dist/components/form/Form.cjs +1 -1
  2. package/dist/components/form/Form.js +1 -1
  3. package/dist/components/form/styles.cjs +1 -4
  4. package/dist/components/form/styles.js +1 -2
  5. package/dist/components/select/styles.cjs +0 -2
  6. package/dist/components/select/styles.js +0 -2
  7. package/dist/components/topbar/TopBar.cjs +120 -14
  8. package/dist/components/topbar/TopBar.js +55 -9
  9. package/dist/components/topbar/styles.cjs +49 -5
  10. package/dist/components/topbar/styles.js +43 -4
  11. package/dist/components/topbar/topBarItem/TopBarItem.cjs +5 -1
  12. package/dist/components/topbar/topBarItem/TopBarItem.js +5 -2
  13. package/dist/components/topbar/topBarItem/styles.cjs +10 -3
  14. package/dist/components/topbar/topBarItem/styles.js +10 -3
  15. package/dist/components/topbar/topBarNavigation/TopBarNavigation.cjs +54 -38
  16. package/dist/components/topbar/topBarNavigation/TopBarNavigation.js +6 -4
  17. package/dist/components/topbar/topBarNavigation/styles.cjs +45 -8
  18. package/dist/components/topbar/topBarNavigation/styles.js +45 -8
  19. package/dist/components/topbar/topBarToolName/TopBarToolName.cjs +50 -9
  20. package/dist/components/topbar/topBarToolName/TopBarToolName.js +16 -8
  21. package/dist/components/topbar/topBarToolName/styles.cjs +42 -4
  22. package/dist/components/topbar/topBarToolName/styles.js +37 -5
  23. package/dist/index.cjs +2 -0
  24. package/dist/index.js +1 -0
  25. package/dist/styleD/build/css/component/TopBar.css +19 -1
  26. package/dist/styleD/build/css/component/form.css +0 -2
  27. package/dist/styleD/build/css/component/select.css +0 -1
  28. package/dist/styleD/build/css/semantic/breakpoints.css +18 -0
  29. package/dist/styleD/build/css/semantic/colors.css +4 -0
  30. package/dist/styleD/build/typescript/component/TopBar.cjs +38 -2
  31. package/dist/styleD/build/typescript/component/TopBar.js +38 -2
  32. package/dist/styleD/build/typescript/component/form.cjs +0 -6
  33. package/dist/styleD/build/typescript/component/form.js +0 -6
  34. package/dist/styleD/build/typescript/component/select.cjs +0 -1
  35. package/dist/styleD/build/typescript/component/select.js +0 -1
  36. package/dist/styleD/build/typescript/semantic/breakpoints.cjs +30 -0
  37. package/dist/styleD/build/typescript/semantic/breakpoints.js +28 -0
  38. package/dist/styleD/build/typescript/semantic/colors.cjs +4 -0
  39. package/dist/styleD/build/typescript/semantic/colors.js +4 -0
  40. package/dist/styleD/utils/semantic/mq.cjs +38 -0
  41. package/dist/styleD/utils/semantic/mq.js +26 -0
  42. package/dist/types/components/checkbox/CheckboxGroupSandbox.d.ts +2 -2
  43. package/dist/types/components/form/styles.d.ts +1 -3
  44. package/dist/types/components/text-area/sandbox.d.ts +2 -2
  45. package/dist/types/components/text-input/sandbox.d.ts +2 -2
  46. package/dist/types/components/topbar/TopBar.d.ts +1 -1
  47. package/dist/types/components/topbar/styles.d.ts +8 -2
  48. package/dist/types/components/topbar/topBarItem/TopBarItem.d.ts +1 -1
  49. package/dist/types/components/topbar/topBarItem/styles.d.ts +1 -1
  50. package/dist/types/components/topbar/topBarItem/types.d.ts +6 -1
  51. package/dist/types/components/topbar/topBarNavigation/TopBarNavigation.d.ts +1 -1
  52. package/dist/types/components/topbar/topBarNavigation/styles.d.ts +2 -2
  53. package/dist/types/components/topbar/topBarNavigation/types.d.ts +5 -0
  54. package/dist/types/components/topbar/topBarToolName/TopBarToolName.d.ts +1 -1
  55. package/dist/types/components/topbar/topBarToolName/styles.d.ts +7 -4
  56. package/dist/types/components/topbar/topBarToolName/types.d.ts +12 -0
  57. package/dist/types/components/topbar/types.d.ts +10 -1
  58. package/dist/types/index.d.ts +2 -0
  59. package/dist/types/styleD/build/typescript/component/TopBar.d.ts +36 -0
  60. package/dist/types/styleD/build/typescript/component/form.d.ts +0 -6
  61. package/dist/types/styleD/build/typescript/component/select.d.ts +0 -1
  62. package/dist/types/styleD/build/typescript/semantic/breakpoints.d.ts +30 -0
  63. package/dist/types/styleD/build/typescript/semantic/colors.d.ts +4 -0
  64. package/dist/types/styleD/stories/semantic/Breakpoints.d.ts +15 -0
  65. package/dist/types/styleD/utils/semantic/mq.d.ts +61 -0
  66. package/dist/types/styleD/utils/semantic/mq.test.d.ts +1 -0
  67. package/dist/types/util/useResize.d.ts +1 -0
  68. package/dist/types/utils.d.ts +1 -0
  69. package/dist/util/useResize.cjs +34 -0
  70. package/dist/util/useResize.js +32 -0
  71. package/dist/utils.cjs +4 -0
  72. package/dist/utils.js +1 -0
  73. package/package.json +1 -1
@@ -31,7 +31,7 @@ function FormInputContainer({
31
31
  return /* @__PURE__ */ jsxRuntime.jsxs(
32
32
  Tag,
33
33
  {
34
- css: [styles.formInputContainerStyles(mergedTheme, { size }), cssOverrides],
34
+ css: [styles.formInputContainerStyles(mergedTheme), cssOverrides],
35
35
  isDisabled,
36
36
  ...props,
37
37
  children: [
@@ -11,7 +11,7 @@ function FormInputContainer({ as: Component, size = "md", label, description, er
11
11
  }
12
12
  const mergedTheme = mergeDeep(mergeDeep(defaultFormInputContainerTheme, theme), formInputContainerTheme ?? {});
13
13
  const Tag = Component;
14
- return jsxs(Tag, { css: [formInputContainerStyles(mergedTheme, { size }), cssOverrides], isDisabled, ...props, children: [label && jsx(Label, { css: formInputLabelStyles(mergedTheme, { size, isDisabled }), children: label }), description && jsx("div", { css: formInputDescriptionStyles(mergedTheme, { isDisabled }), children: description }), children, error && jsx(FieldError, { children: jsx(InlineMessage, { level: "error", children: error }) })] });
14
+ return jsxs(Tag, { css: [formInputContainerStyles(mergedTheme), cssOverrides], isDisabled, ...props, children: [label && jsx(Label, { css: formInputLabelStyles(mergedTheme, { size, isDisabled }), children: label }), description && jsx("div", { css: formInputDescriptionStyles(mergedTheme, { isDisabled }), children: description }), children, error && jsx(FieldError, { children: jsx(InlineMessage, { level: "error", children: error }) })] });
15
15
  }
16
16
 
17
17
  export { FormInputContainer };
@@ -5,15 +5,12 @@ var form = require('../../styleD/build/typescript/component/form.cjs');
5
5
  var typography = require('../../styleD/utils/semantic/typography.cjs');
6
6
 
7
7
  const defaultFormInputContainerTheme = form.componentForm.input;
8
- const formInputContainerStyles = (theme, {
9
- size
10
- }) => {
8
+ const formInputContainerStyles = (theme) => {
11
9
  return react.css`
12
10
  display: ${theme.shared.container.display};
13
11
  flex-direction: ${theme.shared.container["flex-direction"]};
14
12
  gap: ${theme.shared.container.gap};
15
13
  width: ${theme.shared.container.width};
16
- max-width: ${theme[size].container["max-width"]};
17
14
  `;
18
15
  };
19
16
  const formInputLabelStyles = (theme, {
@@ -3,13 +3,12 @@ import { componentForm } from '../../styleD/build/typescript/component/form.js';
3
3
  import { convertTypographyToEmotionStringStyle } from '../../styleD/utils/semantic/typography.js';
4
4
 
5
5
  const defaultFormInputContainerTheme = componentForm.input;
6
- const formInputContainerStyles = (theme, { size }) => {
6
+ const formInputContainerStyles = (theme) => {
7
7
  return css`
8
8
  display: ${theme.shared.container.display};
9
9
  flex-direction: ${theme.shared.container["flex-direction"]};
10
10
  gap: ${theme.shared.container.gap};
11
11
  width: ${theme.shared.container.width};
12
- max-width: ${theme[size].container["max-width"]};
13
12
  `;
14
13
  };
15
14
  const formInputLabelStyles = (theme, { isDisabled, size }) => {
@@ -7,7 +7,6 @@ var typography = require('../../styleD/utils/semantic/typography.cjs');
7
7
  const defaultSelectTheme = select.componentSelect;
8
8
  const popoverStyles = (theme) => {
9
9
  return react.css`
10
- max-width: ${theme.shared.maxWidth};
11
10
  width: ${theme.shared.width};
12
11
  `;
13
12
  };
@@ -50,7 +49,6 @@ const listBoxStyles = (theme) => {
50
49
  background-color: ${theme.shared.listBox.backgroundColor};
51
50
  border: ${theme.shared.listBox.border};
52
51
  box-shadow: ${theme.shared.listBox.shadow};
53
- max-width: ${theme.shared.maxWidth};
54
52
  width: ${theme.shared.width};
55
53
  outline: none;
56
54
  `;
@@ -5,7 +5,6 @@ import { convertTypographyToEmotionStringStyle } from '../../styleD/utils/semant
5
5
  const defaultSelectTheme = componentSelect;
6
6
  const popoverStyles = (theme) => {
7
7
  return css`
8
- max-width: ${theme.shared.maxWidth};
9
8
  width: ${theme.shared.width};
10
9
  `;
11
10
  };
@@ -48,7 +47,6 @@ const listBoxStyles = (theme) => {
48
47
  background-color: ${theme.shared.listBox.backgroundColor};
49
48
  border: ${theme.shared.listBox.border};
50
49
  box-shadow: ${theme.shared.listBox.shadow};
51
- max-width: ${theme.shared.maxWidth};
52
50
  width: ${theme.shared.width};
53
51
  outline: none;
54
52
  `;
@@ -2,12 +2,17 @@
2
2
 
3
3
  var jsxRuntime = require('@emotion/react/jsx-runtime');
4
4
  var React = require('react');
5
+ var reactAriaComponents = require('react-aria-components');
5
6
  var mergeDeep = require('../../util/mergeDeep.cjs');
7
+ var useResize = require('../../util/useResize.cjs');
6
8
  var Avatar = require('../avatar/Avatar.cjs');
9
+ var Icon = require('../icon/Icon.cjs');
7
10
  var styles = require('./styles.cjs');
8
11
  var TopBarItem = require('./topBarItem/TopBarItem.cjs');
9
12
  var TopBarNavigation = require('./topBarNavigation/TopBarNavigation.cjs');
10
13
  var TopBarToolName = require('./topBarToolName/TopBarToolName.cjs');
14
+ var AvatarLink = require('../avatar-link/AvatarLink.cjs');
15
+ var AvatarButton = require('../avatar-button/AvatarButton.cjs');
11
16
 
12
17
  function TopBarSide({
13
18
  children,
@@ -54,16 +59,22 @@ function TopBarContainerLeft({
54
59
  }
55
60
  function TopBar({
56
61
  children,
62
+ collapseBelow = {
63
+ toolName: "lg",
64
+ containerLeft: "lg"
65
+ },
57
66
  theme = {},
58
67
  cssOverrides,
59
68
  className,
60
69
  ...props
61
70
  }) {
71
+ const [menuOpen, setMenuOpen] = React.useState(false);
72
+ const buttonRef = React.useRef(null);
62
73
  const mergedTheme = mergeDeep.mergeDeep(styles.defaultTopBarTheme, theme);
63
- let leftSide = null;
64
- let rightSide = null;
65
- let toolName = null;
66
- let avatar = null;
74
+ let leftSide;
75
+ let rightSide;
76
+ let toolName;
77
+ let avatar;
67
78
  React.Children.forEach(children, (child) => {
68
79
  if (!React.isValidElement(child)) {
69
80
  return;
@@ -71,10 +82,10 @@ function TopBar({
71
82
  if (child.type === TopBarToolName.TopBarToolName) {
72
83
  toolName ?? (toolName = React.cloneElement(
73
84
  child,
74
- { theme: mergedTheme.ToolName }
85
+ { theme: mergedTheme.ToolName, collapseBelow: collapseBelow.toolName }
75
86
  ));
76
87
  }
77
- if (child.type === Avatar.Avatar) {
88
+ if (child.type === Avatar.Avatar || child.type === AvatarLink.AvatarLink || child.type === AvatarButton.AvatarButton) {
78
89
  avatar ?? (avatar = /* @__PURE__ */ jsxRuntime.jsx(TopBarItem.TopBarItem, { theme: mergedTheme.Item, alignment: "right", children: child }));
79
90
  }
80
91
  if (child.type === TopBarContainerLeft) {
@@ -90,6 +101,43 @@ function TopBar({
90
101
  ));
91
102
  }
92
103
  });
104
+ const leftSideMenuItems = [];
105
+ if (leftSide) {
106
+ React.Children.forEach(
107
+ leftSide.props.children,
108
+ (child) => {
109
+ if (!React.isValidElement(child)) {
110
+ return;
111
+ }
112
+ if (child.type === TopBarNavigation.TopBarNavigation) {
113
+ leftSideMenuItems.push(
114
+ React.cloneElement(
115
+ child,
116
+ {
117
+ theme: mergedTheme.Navigation,
118
+ alignment: "left",
119
+ _menuOpen: menuOpen
120
+ }
121
+ )
122
+ );
123
+ }
124
+ if (child.type === TopBarItem.TopBarItem) {
125
+ leftSideMenuItems.push(
126
+ React.cloneElement(child, {
127
+ theme: mergedTheme.Item,
128
+ alignment: "left",
129
+ _menuOpen: menuOpen
130
+ })
131
+ );
132
+ }
133
+ }
134
+ );
135
+ }
136
+ useResize.useResize(() => {
137
+ if (menuOpen) {
138
+ setMenuOpen(false);
139
+ }
140
+ });
93
141
  return /* @__PURE__ */ jsxRuntime.jsxs(
94
142
  "div",
95
143
  {
@@ -97,14 +145,72 @@ function TopBar({
97
145
  className,
98
146
  ...props,
99
147
  children: [
100
- /* @__PURE__ */ jsxRuntime.jsxs("div", { css: styles.topBarContainerLeftStyles(mergedTheme), children: [
101
- toolName,
102
- leftSide
103
- ] }),
104
- /* @__PURE__ */ jsxRuntime.jsxs("div", { css: styles.topBarContainerRightStyles(mergedTheme), children: [
105
- rightSide,
106
- avatar
107
- ] })
148
+ leftSideMenuItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
149
+ "div",
150
+ {
151
+ css: styles.topBarContainerStyles(mergedTheme, {
152
+ showUntil: collapseBelow.containerLeft
153
+ }),
154
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
155
+ reactAriaComponents.DialogTrigger,
156
+ {
157
+ isOpen: menuOpen,
158
+ onOpenChange: (isOpen) => {
159
+ setMenuOpen(isOpen);
160
+ },
161
+ children: [
162
+ /* @__PURE__ */ jsxRuntime.jsx(
163
+ reactAriaComponents.Button,
164
+ {
165
+ "aria-label": "Navigation Menu",
166
+ ref: buttonRef,
167
+ css: styles.topBarCollapsedNavMenuButtonStyles(mergedTheme, menuOpen),
168
+ children: /* @__PURE__ */ jsxRuntime.jsx(
169
+ TopBarItem.TopBarItem,
170
+ {
171
+ alignment: "left",
172
+ size: "sm",
173
+ theme: mergedTheme.Item,
174
+ "aria-label": "Navigation Menu",
175
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: "lg", children: menuOpen ? "close" : "menu" })
176
+ }
177
+ )
178
+ }
179
+ ),
180
+ /* @__PURE__ */ jsxRuntime.jsx(
181
+ reactAriaComponents.Popover,
182
+ {
183
+ css: styles.topBarCollapsedNavMenuPopoverStyles(mergedTheme),
184
+ offset: 12,
185
+ children: leftSideMenuItems
186
+ }
187
+ )
188
+ ]
189
+ }
190
+ )
191
+ }
192
+ ),
193
+ /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.topBarContainerStyles(mergedTheme), children: toolName }),
194
+ /* @__PURE__ */ jsxRuntime.jsx(
195
+ "div",
196
+ {
197
+ css: styles.topBarContainerStyles(mergedTheme, {
198
+ collapseBelow: collapseBelow.containerLeft
199
+ }),
200
+ children: leftSide
201
+ }
202
+ ),
203
+ /* @__PURE__ */ jsxRuntime.jsx(
204
+ "div",
205
+ {
206
+ css: [
207
+ styles.topBarSpacerStyles(mergedTheme),
208
+ styles.topBarContainerStyles(mergedTheme)
209
+ ],
210
+ children: rightSide
211
+ }
212
+ ),
213
+ /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.topBarContainerStyles(mergedTheme), children: avatar })
108
214
  ]
109
215
  }
110
216
  );
@@ -1,11 +1,16 @@
1
1
  import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
2
2
  import React from 'react';
3
+ import { DialogTrigger, Button, Popover } from 'react-aria-components';
3
4
  import { mergeDeep } from '../../util/mergeDeep.js';
5
+ import { useResize } from '../../util/useResize.js';
4
6
  import { Avatar } from '../avatar/Avatar.js';
5
- import { topBarContainerLeftStyles, topBarContainerRightStyles, topBarStyles, defaultTopBarTheme } from './styles.js';
7
+ import { Icon } from '../icon/Icon.js';
8
+ import { topBarCollapsedNavMenuButtonStyles, topBarCollapsedNavMenuPopoverStyles, topBarContainerStyles, topBarSpacerStyles, topBarStyles, defaultTopBarTheme } from './styles.js';
6
9
  import { TopBarItem } from './topBarItem/TopBarItem.js';
7
10
  import { TopBarNavigation } from './topBarNavigation/TopBarNavigation.js';
8
11
  import { TopBarToolName } from './topBarToolName/TopBarToolName.js';
12
+ import { AvatarLink } from '../avatar-link/AvatarLink.js';
13
+ import { AvatarButton } from '../avatar-button/AvatarButton.js';
9
14
 
10
15
  function TopBarSide({ children, alignment, theme }) {
11
16
  const items = [];
@@ -36,20 +41,25 @@ function TopBarContainerRight({ children, theme }) {
36
41
  function TopBarContainerLeft({ children, theme }) {
37
42
  return jsx(TopBarSide, { alignment: "left", theme, children });
38
43
  }
39
- function TopBar({ children, theme = {}, cssOverrides, className, ...props }) {
44
+ function TopBar({ children, collapseBelow = {
45
+ toolName: "lg",
46
+ containerLeft: "lg"
47
+ }, theme = {}, cssOverrides, className, ...props }) {
48
+ const [menuOpen, setMenuOpen] = React.useState(false);
49
+ const buttonRef = React.useRef(null);
40
50
  const mergedTheme = mergeDeep(defaultTopBarTheme, theme);
41
- let leftSide = null;
42
- let rightSide = null;
43
- let toolName = null;
44
- let avatar = null;
51
+ let leftSide;
52
+ let rightSide;
53
+ let toolName;
54
+ let avatar;
45
55
  React.Children.forEach(children, (child) => {
46
56
  if (!React.isValidElement(child)) {
47
57
  return;
48
58
  }
49
59
  if (child.type === TopBarToolName) {
50
- toolName ?? (toolName = React.cloneElement(child, { theme: mergedTheme.ToolName }));
60
+ toolName ?? (toolName = React.cloneElement(child, { theme: mergedTheme.ToolName, collapseBelow: collapseBelow.toolName }));
51
61
  }
52
- if (child.type === Avatar) {
62
+ if (child.type === Avatar || child.type === AvatarLink || child.type === AvatarButton) {
53
63
  avatar ?? (avatar = jsx(TopBarItem, { theme: mergedTheme.Item, alignment: "right", children: child }));
54
64
  }
55
65
  if (child.type === TopBarContainerLeft) {
@@ -59,7 +69,43 @@ function TopBar({ children, theme = {}, cssOverrides, className, ...props }) {
59
69
  rightSide ?? (rightSide = React.cloneElement(child, { theme: mergedTheme }));
60
70
  }
61
71
  });
62
- return jsxs("div", { css: [topBarStyles(mergedTheme), cssOverrides], className, ...props, children: [jsxs("div", { css: topBarContainerLeftStyles(mergedTheme), children: [toolName, leftSide] }), jsxs("div", { css: topBarContainerRightStyles(mergedTheme), children: [rightSide, avatar] })] });
72
+ const leftSideMenuItems = [];
73
+ if (leftSide) {
74
+ React.Children.forEach(leftSide.props.children, (child) => {
75
+ if (!React.isValidElement(child)) {
76
+ return;
77
+ }
78
+ if (child.type === TopBarNavigation) {
79
+ leftSideMenuItems.push(React.cloneElement(child, {
80
+ theme: mergedTheme.Navigation,
81
+ alignment: "left",
82
+ _menuOpen: menuOpen
83
+ }));
84
+ }
85
+ if (child.type === TopBarItem) {
86
+ leftSideMenuItems.push(React.cloneElement(child, {
87
+ theme: mergedTheme.Item,
88
+ alignment: "left",
89
+ _menuOpen: menuOpen
90
+ }));
91
+ }
92
+ });
93
+ }
94
+ useResize(() => {
95
+ if (menuOpen) {
96
+ setMenuOpen(false);
97
+ }
98
+ });
99
+ return jsxs("div", { css: [topBarStyles(mergedTheme), cssOverrides], className, ...props, children: [leftSideMenuItems.length > 0 && jsx("div", { css: topBarContainerStyles(mergedTheme, {
100
+ showUntil: collapseBelow.containerLeft
101
+ }), children: jsxs(DialogTrigger, { isOpen: menuOpen, onOpenChange: (isOpen) => {
102
+ setMenuOpen(isOpen);
103
+ }, children: [jsx(Button, { "aria-label": "Navigation Menu", ref: buttonRef, css: topBarCollapsedNavMenuButtonStyles(mergedTheme, menuOpen), children: jsx(TopBarItem, { alignment: "left", size: "sm", theme: mergedTheme.Item, "aria-label": "Navigation Menu", children: jsx(Icon, { size: "lg", children: menuOpen ? "close" : "menu" }) }) }), jsx(Popover, { css: topBarCollapsedNavMenuPopoverStyles(mergedTheme), offset: 12, children: leftSideMenuItems })] }) }), jsx("div", { css: topBarContainerStyles(mergedTheme), children: toolName }), jsx("div", { css: topBarContainerStyles(mergedTheme, {
104
+ collapseBelow: collapseBelow.containerLeft
105
+ }), children: leftSide }), jsx("div", { css: [
106
+ topBarSpacerStyles(mergedTheme),
107
+ topBarContainerStyles(mergedTheme)
108
+ ], children: rightSide }), jsx("div", { css: topBarContainerStyles(mergedTheme), children: avatar })] });
63
109
  }
64
110
 
65
111
  export { TopBar, TopBarContainerLeft, TopBarContainerRight };
@@ -2,6 +2,7 @@
2
2
 
3
3
  var react = require('@emotion/react');
4
4
  var TopBar = require('../../styleD/build/typescript/component/TopBar.cjs');
5
+ var mq = require('../../styleD/utils/semantic/mq.cjs');
5
6
 
6
7
  const defaultTopBarTheme = TopBar.componentTopBar;
7
8
  const topBarStyles = (theme) => {
@@ -13,18 +14,61 @@ const topBarStyles = (theme) => {
13
14
  justify-content: ${theme["justify-content"]};
14
15
  `;
15
16
  };
16
- const topBarContainerLeftStyles = (theme) => {
17
+ const topBarContainerStyles = (theme, {
18
+ collapseBelow,
19
+ showUntil
20
+ } = {}) => {
17
21
  return react.css`
18
22
  display: ${theme.display};
23
+
24
+ ${collapseBelow && react.css`
25
+ ${mq.until[collapseBelow]} {
26
+ display: none;
27
+ }
28
+ `}
29
+
30
+ ${showUntil && react.css`
31
+ ${mq.from[showUntil]} {
32
+ display: none;
33
+ }
34
+ `}
19
35
  `;
20
36
  };
21
- const topBarContainerRightStyles = (theme) => {
37
+ const topBarSpacerStyles = (theme) => {
22
38
  return react.css`
23
- display: ${theme.display};
39
+ margin-left: ${theme.spacer["margin-left"]};
40
+ `;
41
+ };
42
+ const topBarCollapsedNavMenuButtonStyles = (theme, menuOpen) => {
43
+ return react.css`
44
+ margin: ${theme.collapsedNavMenu.button.margin};
45
+ padding: ${theme.collapsedNavMenu.button.padding};
46
+ background: ${theme.collapsedNavMenu.button.background};
47
+ border: ${theme.collapsedNavMenu.button.border};
48
+ cursor: ${theme.collapsedNavMenu.button.cursor};
49
+
50
+ &[data-hovered] {
51
+ background-color: ${theme.collapsedNavMenu.button.hovered["background-color"]};
52
+ }
53
+
54
+ ${menuOpen && react.css`
55
+ background-color: ${theme.collapsedNavMenu.button.active["background-color"]};
56
+ `}
57
+ `;
58
+ };
59
+ const topBarCollapsedNavMenuPopoverStyles = (theme) => {
60
+ return react.css`
61
+ left: ${theme.collapsedNavMenu.popover.left};
62
+ top: ${theme.collapsedNavMenu.popover.top};
63
+ background-color: ${theme.collapsedNavMenu.popover["background-color"]};
64
+ border-left: ${theme.collapsedNavMenu.popover.border};
65
+ border-right: ${theme.collapsedNavMenu.popover.border};
24
66
  `;
25
67
  };
26
68
 
27
69
  exports.defaultTopBarTheme = defaultTopBarTheme;
28
- exports.topBarContainerLeftStyles = topBarContainerLeftStyles;
29
- exports.topBarContainerRightStyles = topBarContainerRightStyles;
70
+ exports.topBarCollapsedNavMenuButtonStyles = topBarCollapsedNavMenuButtonStyles;
71
+ exports.topBarCollapsedNavMenuPopoverStyles = topBarCollapsedNavMenuPopoverStyles;
72
+ exports.topBarContainerStyles = topBarContainerStyles;
73
+ exports.topBarSpacerStyles = topBarSpacerStyles;
30
74
  exports.topBarStyles = topBarStyles;
@@ -1,5 +1,6 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { componentTopBar } from '../../styleD/build/typescript/component/TopBar.js';
3
+ import { until, from } from '../../styleD/utils/semantic/mq.js';
3
4
 
4
5
  const defaultTopBarTheme = componentTopBar;
5
6
  const topBarStyles = (theme) => {
@@ -11,15 +12,53 @@ const topBarStyles = (theme) => {
11
12
  justify-content: ${theme["justify-content"]};
12
13
  `;
13
14
  };
14
- const topBarContainerLeftStyles = (theme) => {
15
+ const topBarContainerStyles = (theme, { collapseBelow, showUntil } = {}) => {
15
16
  return css`
16
17
  display: ${theme.display};
18
+
19
+ ${collapseBelow && css`
20
+ ${until[collapseBelow]} {
21
+ display: none;
22
+ }
23
+ `}
24
+
25
+ ${showUntil && css`
26
+ ${from[showUntil]} {
27
+ display: none;
28
+ }
29
+ `}
17
30
  `;
18
31
  };
19
- const topBarContainerRightStyles = (theme) => {
32
+ const topBarSpacerStyles = (theme) => {
20
33
  return css`
21
- display: ${theme.display};
34
+ margin-left: ${theme.spacer["margin-left"]};
35
+ `;
36
+ };
37
+ const topBarCollapsedNavMenuButtonStyles = (theme, menuOpen) => {
38
+ return css`
39
+ margin: ${theme.collapsedNavMenu.button.margin};
40
+ padding: ${theme.collapsedNavMenu.button.padding};
41
+ background: ${theme.collapsedNavMenu.button.background};
42
+ border: ${theme.collapsedNavMenu.button.border};
43
+ cursor: ${theme.collapsedNavMenu.button.cursor};
44
+
45
+ &[data-hovered] {
46
+ background-color: ${theme.collapsedNavMenu.button.hovered["background-color"]};
47
+ }
48
+
49
+ ${menuOpen && css`
50
+ background-color: ${theme.collapsedNavMenu.button.active["background-color"]};
51
+ `}
52
+ `;
53
+ };
54
+ const topBarCollapsedNavMenuPopoverStyles = (theme) => {
55
+ return css`
56
+ left: ${theme.collapsedNavMenu.popover.left};
57
+ top: ${theme.collapsedNavMenu.popover.top};
58
+ background-color: ${theme.collapsedNavMenu.popover["background-color"]};
59
+ border-left: ${theme.collapsedNavMenu.popover.border};
60
+ border-right: ${theme.collapsedNavMenu.popover.border};
22
61
  `;
23
62
  };
24
63
 
25
- export { defaultTopBarTheme, topBarContainerLeftStyles, topBarContainerRightStyles, topBarStyles };
64
+ export { defaultTopBarTheme, topBarCollapsedNavMenuButtonStyles, topBarCollapsedNavMenuPopoverStyles, topBarContainerStyles, topBarSpacerStyles, topBarStyles };
@@ -11,13 +11,17 @@ function TopBarItem({
11
11
  cssOverrides,
12
12
  className,
13
13
  size = "md",
14
+ _menuOpen,
14
15
  ...props
15
16
  }) {
16
17
  const mergedTheme = mergeDeep.mergeDeep(styles.defaultTopBarItemTheme, theme);
17
18
  return /* @__PURE__ */ jsxRuntime.jsx(
18
19
  "div",
19
20
  {
20
- css: [styles.topBarItemStyles(mergedTheme, alignment, { size }), cssOverrides],
21
+ css: [
22
+ styles.topBarItemStyles(mergedTheme, alignment, { size }, _menuOpen),
23
+ cssOverrides
24
+ ],
21
25
  className,
22
26
  ...props,
23
27
  children
@@ -2,9 +2,12 @@ import { jsx } from '@emotion/react/jsx-runtime';
2
2
  import { mergeDeep } from '../../../util/mergeDeep.js';
3
3
  import { topBarItemStyles, defaultTopBarItemTheme } from './styles.js';
4
4
 
5
- function TopBarItem({ children, alignment = "left", theme = {}, cssOverrides, className, size = "md", ...props }) {
5
+ function TopBarItem({ children, alignment = "left", theme = {}, cssOverrides, className, size = "md", _menuOpen, ...props }) {
6
6
  const mergedTheme = mergeDeep(defaultTopBarItemTheme, theme);
7
- return jsx("div", { css: [topBarItemStyles(mergedTheme, alignment, { size }), cssOverrides], className, ...props, children });
7
+ return jsx("div", { css: [
8
+ topBarItemStyles(mergedTheme, alignment, { size }, _menuOpen),
9
+ cssOverrides
10
+ ], className, ...props, children });
8
11
  }
9
12
 
10
13
  export { TopBarItem };
@@ -4,15 +4,22 @@ var react = require('@emotion/react');
4
4
  var TopBar = require('../../../styleD/build/typescript/component/TopBar.cjs');
5
5
 
6
6
  const defaultTopBarItemTheme = TopBar.componentTopBar.Item;
7
- const topBarItemStyles = (theme, alignment, { size }) => {
7
+ const topBarItemStyles = (theme, alignment, { size }, _menuOpen) => {
8
8
  return react.css`
9
9
  display: ${theme.display};
10
10
  align-items: ${theme["align-items"]};
11
11
  height: ${theme.height};
12
12
  padding: ${theme[size].padding.top} ${theme[size].padding.right}
13
13
  ${theme[size].padding.bottom} ${theme[size].padding.left};
14
- ${alignment === "left" ? "border-right" : "border-left"}: ${theme.border};
15
- ${alignment === "right" && "margin-left: auto"};
14
+
15
+ ${_menuOpen ? react.css`
16
+ height: 64px;
17
+ justify-content: center;
18
+ border-bottom: ${theme.border};
19
+ ` : react.css`
20
+ ${alignment === "left" ? "border-right" : "border-left"}: ${theme.border};
21
+ ${alignment === "right" && "margin-left: auto"};
22
+ `}
16
23
  `;
17
24
  };
18
25
 
@@ -2,15 +2,22 @@ import { css } from '@emotion/react';
2
2
  import { componentTopBar } from '../../../styleD/build/typescript/component/TopBar.js';
3
3
 
4
4
  const defaultTopBarItemTheme = componentTopBar.Item;
5
- const topBarItemStyles = (theme, alignment, { size }) => {
5
+ const topBarItemStyles = (theme, alignment, { size }, _menuOpen) => {
6
6
  return css`
7
7
  display: ${theme.display};
8
8
  align-items: ${theme["align-items"]};
9
9
  height: ${theme.height};
10
10
  padding: ${theme[size].padding.top} ${theme[size].padding.right}
11
11
  ${theme[size].padding.bottom} ${theme[size].padding.left};
12
- ${alignment === "left" ? "border-right" : "border-left"}: ${theme.border};
13
- ${alignment === "right" && "margin-left: auto"};
12
+
13
+ ${_menuOpen ? css`
14
+ height: 64px;
15
+ justify-content: center;
16
+ border-bottom: ${theme.border};
17
+ ` : css`
18
+ ${alignment === "left" ? "border-right" : "border-left"}: ${theme.border};
19
+ ${alignment === "right" && "margin-left: auto"};
20
+ `}
14
21
  `;
15
22
  };
16
23