@guardian/stand 0.0.27 → 0.0.29
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/dist/components/form/Form.cjs +1 -1
- package/dist/components/form/Form.js +1 -1
- package/dist/components/form/styles.cjs +1 -4
- package/dist/components/form/styles.js +1 -2
- package/dist/components/select/styles.cjs +0 -2
- package/dist/components/select/styles.js +0 -2
- package/dist/components/topbar/TopBar.cjs +122 -14
- package/dist/components/topbar/TopBar.js +55 -9
- package/dist/components/topbar/styles.cjs +47 -5
- package/dist/components/topbar/styles.js +41 -4
- package/dist/components/topbar/topBarItem/TopBarItem.cjs +5 -1
- package/dist/components/topbar/topBarItem/TopBarItem.js +5 -2
- package/dist/components/topbar/topBarItem/styles.cjs +10 -3
- package/dist/components/topbar/topBarItem/styles.js +10 -3
- package/dist/components/topbar/topBarNavigation/TopBarNavigation.cjs +54 -38
- package/dist/components/topbar/topBarNavigation/TopBarNavigation.js +6 -4
- package/dist/components/topbar/topBarNavigation/styles.cjs +45 -8
- package/dist/components/topbar/topBarNavigation/styles.js +45 -8
- package/dist/components/topbar/topBarToolName/TopBarToolName.cjs +50 -9
- package/dist/components/topbar/topBarToolName/TopBarToolName.js +16 -8
- package/dist/components/topbar/topBarToolName/styles.cjs +42 -4
- package/dist/components/topbar/topBarToolName/styles.js +37 -5
- package/dist/index.cjs +2 -0
- package/dist/index.js +1 -0
- package/dist/styleD/build/css/component/TopBar.css +19 -1
- package/dist/styleD/build/css/component/form.css +0 -2
- package/dist/styleD/build/css/component/select.css +0 -1
- package/dist/styleD/build/css/semantic/breakpoints.css +18 -0
- package/dist/styleD/build/css/semantic/colors.css +4 -0
- package/dist/styleD/build/typescript/component/TopBar.cjs +38 -2
- package/dist/styleD/build/typescript/component/TopBar.js +38 -2
- package/dist/styleD/build/typescript/component/form.cjs +0 -6
- package/dist/styleD/build/typescript/component/form.js +0 -6
- package/dist/styleD/build/typescript/component/select.cjs +0 -1
- package/dist/styleD/build/typescript/component/select.js +0 -1
- package/dist/styleD/build/typescript/semantic/breakpoints.cjs +30 -0
- package/dist/styleD/build/typescript/semantic/breakpoints.js +28 -0
- package/dist/styleD/build/typescript/semantic/colors.cjs +4 -0
- package/dist/styleD/build/typescript/semantic/colors.js +4 -0
- package/dist/styleD/utils/semantic/mq.cjs +38 -0
- package/dist/styleD/utils/semantic/mq.js +26 -0
- package/dist/types/components/checkbox/CheckboxGroupSandbox.d.ts +2 -2
- package/dist/types/components/form/styles.d.ts +1 -3
- package/dist/types/components/text-area/sandbox.d.ts +2 -2
- package/dist/types/components/text-input/sandbox.d.ts +2 -2
- package/dist/types/components/topbar/TopBar.d.ts +1 -1
- package/dist/types/components/topbar/styles.d.ts +8 -2
- package/dist/types/components/topbar/topBarItem/TopBarItem.d.ts +1 -1
- package/dist/types/components/topbar/topBarItem/styles.d.ts +1 -1
- package/dist/types/components/topbar/topBarItem/types.d.ts +6 -1
- package/dist/types/components/topbar/topBarNavigation/TopBarNavigation.d.ts +1 -1
- package/dist/types/components/topbar/topBarNavigation/styles.d.ts +2 -2
- package/dist/types/components/topbar/topBarNavigation/types.d.ts +5 -0
- package/dist/types/components/topbar/topBarToolName/TopBarToolName.d.ts +1 -1
- package/dist/types/components/topbar/topBarToolName/styles.d.ts +7 -4
- package/dist/types/components/topbar/topBarToolName/types.d.ts +12 -0
- package/dist/types/components/topbar/types.d.ts +10 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/styleD/build/typescript/component/TopBar.d.ts +36 -0
- package/dist/types/styleD/build/typescript/component/form.d.ts +0 -6
- package/dist/types/styleD/build/typescript/component/select.d.ts +0 -1
- package/dist/types/styleD/build/typescript/semantic/breakpoints.d.ts +30 -0
- package/dist/types/styleD/build/typescript/semantic/colors.d.ts +4 -0
- package/dist/types/styleD/stories/semantic/Breakpoints.d.ts +15 -0
- package/dist/types/styleD/utils/semantic/mq.d.ts +61 -0
- package/dist/types/styleD/utils/semantic/mq.test.d.ts +1 -0
- package/dist/types/util/useResize.d.ts +1 -0
- package/dist/types/utils.d.ts +1 -0
- package/dist/util/useResize.cjs +34 -0
- package/dist/util/useResize.js +32 -0
- package/dist/utils.cjs +4 -0
- package/dist/utils.js +1 -0
- 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
|
|
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
|
|
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
|
|
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
|
|
64
|
-
let rightSide
|
|
65
|
-
let toolName
|
|
66
|
-
let avatar
|
|
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,74 @@ function TopBar({
|
|
|
97
145
|
className,
|
|
98
146
|
...props,
|
|
99
147
|
children: [
|
|
100
|
-
/* @__PURE__ */ jsxRuntime.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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: mergedTheme.collapsedNavMenu.popover.offset,
|
|
185
|
+
containerPadding: mergedTheme.collapsedNavMenu.popover.containerPadding,
|
|
186
|
+
shouldFlip: false,
|
|
187
|
+
children: leftSideMenuItems
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.topBarContainerStyles(mergedTheme), children: toolName }),
|
|
196
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
css: styles.topBarContainerStyles(mergedTheme, {
|
|
200
|
+
collapseBelow: collapseBelow.containerLeft
|
|
201
|
+
}),
|
|
202
|
+
children: leftSide
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
206
|
+
"div",
|
|
207
|
+
{
|
|
208
|
+
css: [
|
|
209
|
+
styles.topBarSpacerStyles(mergedTheme),
|
|
210
|
+
styles.topBarContainerStyles(mergedTheme)
|
|
211
|
+
],
|
|
212
|
+
children: rightSide
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.topBarContainerStyles(mergedTheme), children: avatar })
|
|
108
216
|
]
|
|
109
217
|
}
|
|
110
218
|
);
|
|
@@ -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 {
|
|
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,
|
|
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
|
|
42
|
-
let rightSide
|
|
43
|
-
let toolName
|
|
44
|
-
let avatar
|
|
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
|
-
|
|
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: mergedTheme.collapsedNavMenu.popover.offset, containerPadding: mergedTheme.collapsedNavMenu.popover.containerPadding, shouldFlip: false, 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,59 @@ const topBarStyles = (theme) => {
|
|
|
13
14
|
justify-content: ${theme["justify-content"]};
|
|
14
15
|
`;
|
|
15
16
|
};
|
|
16
|
-
const
|
|
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
|
|
37
|
+
const topBarSpacerStyles = (theme) => {
|
|
22
38
|
return react.css`
|
|
23
|
-
|
|
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
|
+
background-color: ${theme.collapsedNavMenu.popover["background-color"]};
|
|
62
|
+
border-left: ${theme.collapsedNavMenu.popover.border};
|
|
63
|
+
border-right: ${theme.collapsedNavMenu.popover.border};
|
|
24
64
|
`;
|
|
25
65
|
};
|
|
26
66
|
|
|
27
67
|
exports.defaultTopBarTheme = defaultTopBarTheme;
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
68
|
+
exports.topBarCollapsedNavMenuButtonStyles = topBarCollapsedNavMenuButtonStyles;
|
|
69
|
+
exports.topBarCollapsedNavMenuPopoverStyles = topBarCollapsedNavMenuPopoverStyles;
|
|
70
|
+
exports.topBarContainerStyles = topBarContainerStyles;
|
|
71
|
+
exports.topBarSpacerStyles = topBarSpacerStyles;
|
|
30
72
|
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,51 @@ const topBarStyles = (theme) => {
|
|
|
11
12
|
justify-content: ${theme["justify-content"]};
|
|
12
13
|
`;
|
|
13
14
|
};
|
|
14
|
-
const
|
|
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
|
|
32
|
+
const topBarSpacerStyles = (theme) => {
|
|
20
33
|
return css`
|
|
21
|
-
|
|
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
|
+
background-color: ${theme.collapsedNavMenu.popover["background-color"]};
|
|
57
|
+
border-left: ${theme.collapsedNavMenu.popover.border};
|
|
58
|
+
border-right: ${theme.collapsedNavMenu.popover.border};
|
|
22
59
|
`;
|
|
23
60
|
};
|
|
24
61
|
|
|
25
|
-
export { defaultTopBarTheme,
|
|
62
|
+
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: [
|
|
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: [
|
|
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
|
-
|
|
15
|
-
${
|
|
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
|
-
|
|
13
|
-
${
|
|
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
|
|