@guardian/stand 0.0.16 → 0.0.17
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/README.md +1 -0
- package/dist/TopBar.cjs +9 -3
- package/dist/TopBar.js +4 -1
- package/dist/components/button/Button.cjs +1 -1
- package/dist/components/button/Button.js +1 -1
- package/dist/components/icon-button/IconButton.cjs +1 -1
- package/dist/components/icon-button/IconButton.js +1 -1
- package/dist/components/icon-link-button/IconLinkButton.cjs +1 -1
- package/dist/components/icon-link-button/IconLinkButton.js +1 -1
- package/dist/components/link-button/LinkButton.cjs +1 -1
- package/dist/components/link-button/LinkButton.js +1 -1
- package/dist/components/menu/styles.cjs +1 -0
- package/dist/components/menu/styles.js +1 -0
- package/dist/components/topbar/TopBar.cjs +101 -0
- package/dist/components/topbar/TopBar.js +63 -0
- package/dist/components/topbar/styles.cjs +30 -0
- package/dist/components/topbar/styles.js +25 -0
- package/dist/components/topbar/topBarItem/TopBarItem.cjs +28 -0
- package/dist/components/topbar/topBarItem/TopBarItem.js +10 -0
- package/dist/components/topbar/topBarItem/styles.cjs +20 -0
- package/dist/components/topbar/topBarItem/styles.js +17 -0
- package/dist/components/topbar/topBarNavigation/TopBarNavigation.cjs +70 -0
- package/dist/components/topbar/topBarNavigation/TopBarNavigation.js +23 -0
- package/dist/components/topbar/topBarNavigation/styles.cjs +68 -0
- package/dist/components/topbar/topBarNavigation/styles.js +61 -0
- package/dist/components/topbar/{toolName → topBarToolName}/TopBarToolName.cjs +3 -2
- package/dist/components/topbar/topBarToolName/TopBarToolName.js +13 -0
- package/dist/styleD/build/css/base/typography.css +3 -3
- package/dist/styleD/build/css/component/TopBar.css +55 -1
- package/dist/styleD/build/css/component/avatar.css +1 -1
- package/dist/styleD/build/css/component/button.css +177 -255
- package/dist/styleD/build/css/component/favicon.css +1 -1
- package/dist/styleD/build/css/component/menu.css +5 -4
- package/dist/styleD/build/css/component/tagAutocomplete.css +1 -1
- package/dist/styleD/build/css/component/tagTable.css +1 -1
- package/dist/styleD/build/css/component/topBarItem.css +7 -0
- package/dist/styleD/build/css/component/userMenu.css +6 -6
- package/dist/styleD/build/css/semantic/colors.css +45 -46
- package/dist/styleD/build/css/semantic/sizing.css +1 -0
- package/dist/styleD/build/css/semantic/typography.css +30 -30
- package/dist/styleD/build/typescript/base/typography.cjs +3 -3
- package/dist/styleD/build/typescript/base/typography.js +3 -3
- package/dist/styleD/build/typescript/component/TopBar.cjs +94 -0
- package/dist/styleD/build/typescript/component/TopBar.js +94 -0
- package/dist/styleD/build/typescript/component/button.cjs +5 -130
- package/dist/styleD/build/typescript/component/button.js +5 -130
- package/dist/styleD/build/typescript/component/menu.cjs +2 -1
- package/dist/styleD/build/typescript/component/menu.js +2 -1
- package/dist/styleD/build/typescript/semantic/colors.cjs +47 -52
- package/dist/styleD/build/typescript/semantic/colors.js +47 -52
- package/dist/styleD/build/typescript/semantic/sizing.cjs +1 -0
- package/dist/styleD/build/typescript/semantic/sizing.js +1 -0
- package/dist/types/TopBar.d.ts +12 -3
- package/dist/types/components/button/sandbox.d.ts +4 -4
- package/dist/types/components/button/types.d.ts +1 -1
- package/dist/types/components/icon-button/sandbox.d.ts +4 -4
- package/dist/types/components/icon-button/styles.d.ts +3 -128
- package/dist/types/components/icon-button/types.d.ts +1 -1
- package/dist/types/components/icon-link-button/sandbox.d.ts +4 -4
- package/dist/types/components/icon-link-button/styles.d.ts +3 -128
- package/dist/types/components/icon-link-button/types.d.ts +1 -1
- package/dist/types/components/link-button/sandbox.d.ts +4 -4
- package/dist/types/components/link-button/styles.d.ts +3 -128
- package/dist/types/components/link-button/types.d.ts +1 -1
- package/dist/types/components/topbar/TopBar.d.ts +8 -0
- package/dist/types/components/topbar/sandbox.d.ts +5 -0
- package/dist/types/components/topbar/styles.d.ts +9 -0
- package/dist/types/components/topbar/topBarItem/TopBarItem.d.ts +2 -0
- package/dist/types/components/topbar/topBarItem/sandbox.d.ts +5 -0
- package/dist/types/components/topbar/topBarItem/styles.d.ts +8 -0
- package/dist/types/components/topbar/topBarItem/types.d.ts +14 -0
- package/dist/types/components/topbar/topBarNavigation/TopBarNavigation.d.ts +2 -0
- package/dist/types/components/topbar/topBarNavigation/sandbox.d.ts +5 -0
- package/dist/types/components/topbar/topBarNavigation/styles.d.ts +12 -0
- package/dist/types/components/topbar/topBarNavigation/types.d.ts +44 -0
- package/dist/types/components/topbar/types.d.ts +3 -0
- package/dist/types/styleD/build/typescript/base/typography.d.ts +3 -3
- package/dist/types/styleD/build/typescript/component/TopBar.d.ts +94 -0
- package/dist/types/styleD/build/typescript/component/button.d.ts +3 -128
- package/dist/types/styleD/build/typescript/component/menu.d.ts +1 -0
- package/dist/types/styleD/build/typescript/semantic/colors.d.ts +44 -49
- package/dist/types/styleD/build/typescript/semantic/sizing.d.ts +1 -0
- package/dist/util/css/reset.css +10 -0
- package/dist/util/reset.css.cjs +1 -1
- package/dist/util/reset.css.js +1 -1
- package/package.json +14 -16
- package/dist/components/topbar/toolName/TopBarToolName.js +0 -12
- /package/dist/components/topbar/{toolName → topBarToolName}/styles.cjs +0 -0
- /package/dist/components/topbar/{toolName → topBarToolName}/styles.js +0 -0
- /package/dist/types/components/topbar/{toolName → topBarToolName}/TopBarToolName.d.ts +0 -0
- /package/dist/types/components/topbar/{toolName → topBarToolName}/sandbox.d.ts +0 -0
- /package/dist/types/components/topbar/{toolName → topBarToolName}/styles.d.ts +0 -0
- /package/dist/types/components/topbar/{toolName → topBarToolName}/types.d.ts +0 -0
package/README.md
CHANGED
|
@@ -181,3 +181,4 @@ Matrix generation in CI uses the same JSON file in the workflow `../.github/work
|
|
|
181
181
|
- [Style Dictionary](https://guardian.github.io/stand/?path=/docs/style-dictionary--docs)
|
|
182
182
|
- [Architecture Decision Records](https://guardian.github.io/stand/?path=/docs/architecture-decision-records--docs)
|
|
183
183
|
- [Changelog](https://guardian.github.io/stand/?path=/docs/changelog--docs)
|
|
184
|
+
- [Vision](https://guardian.github.io/stand/?path=/docs/vision--docs)
|
package/dist/TopBar.cjs
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var TopBar$1 = require('./styleD/build/typescript/component/TopBar.cjs');
|
|
4
|
+
var TopBarToolName = require('./components/topbar/topBarToolName/TopBarToolName.cjs');
|
|
5
|
+
var TopBarNavigation = require('./components/topbar/topBarNavigation/TopBarNavigation.cjs');
|
|
6
|
+
var TopBarItem = require('./components/topbar/topBarItem/TopBarItem.cjs');
|
|
7
|
+
var TopBar = require('./components/topbar/TopBar.cjs');
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
|
|
11
|
+
exports.componentTopBar = TopBar$1.componentTopBar;
|
|
8
12
|
exports.TopBarToolName = TopBarToolName.TopBarToolName;
|
|
9
|
-
exports.
|
|
13
|
+
exports.TopBarNavigation = TopBarNavigation.TopBarNavigation;
|
|
14
|
+
exports.TopBarItem = TopBarItem.TopBarItem;
|
|
15
|
+
exports.TopBar = TopBar.TopBar;
|
package/dist/TopBar.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { TopBarToolName } from './components/topbar/toolName/TopBarToolName.js';
|
|
2
1
|
export { componentTopBar } from './styleD/build/typescript/component/TopBar.js';
|
|
2
|
+
export { TopBarToolName } from './components/topbar/topBarToolName/TopBarToolName.js';
|
|
3
|
+
export { TopBarNavigation } from './components/topbar/topBarNavigation/TopBarNavigation.js';
|
|
4
|
+
export { TopBarItem } from './components/topbar/topBarItem/TopBarItem.js';
|
|
5
|
+
export { TopBar } from './components/topbar/TopBar.js';
|
|
@@ -4,7 +4,7 @@ import { mergeDeep } from '../../util/mergeDeep.js';
|
|
|
4
4
|
import { Icon } from '../icon/Icon.js';
|
|
5
5
|
import { buttonStyles, defaultButtonTheme } from './styles.js';
|
|
6
6
|
|
|
7
|
-
function Button({ variant = "
|
|
7
|
+
function Button({ variant = "primary", size = "md", theme = {}, cssOverrides, icon, ...props }) {
|
|
8
8
|
const mergedTheme = mergeDeep(defaultButtonTheme, theme);
|
|
9
9
|
const iconSize = size === "xs" ? "sm" : size;
|
|
10
10
|
return jsx(Button$1, { ...props, css: [buttonStyles(mergedTheme, { variant, size }, !!icon), cssOverrides], children: composeRenderProps(props.children, (children) => (
|
|
@@ -5,7 +5,7 @@ import { mergeDeep } from '../../util/mergeDeep.js';
|
|
|
5
5
|
import { Icon } from '../icon/Icon.js';
|
|
6
6
|
import { iconButtonStyles, defaultIconButtonTheme } from './styles.js';
|
|
7
7
|
|
|
8
|
-
function IconButton({ variant = "
|
|
8
|
+
function IconButton({ variant = "primary", size = "md", symbol, ariaLabel, theme = {}, cssOverrides, ...props }) {
|
|
9
9
|
const mergedTheme = mergeDeep(defaultIconButtonTheme, theme);
|
|
10
10
|
const buttonRef = useRef(null);
|
|
11
11
|
useEffect(() => {
|
|
@@ -5,7 +5,7 @@ import { mergeDeep } from '../../util/mergeDeep.js';
|
|
|
5
5
|
import { Icon } from '../icon/Icon.js';
|
|
6
6
|
import { iconLinkButtonStyles, defaultIconLinkButtonTheme } from './styles.js';
|
|
7
7
|
|
|
8
|
-
function IconLinkButton({ variant = "
|
|
8
|
+
function IconLinkButton({ variant = "primary", size = "md", symbol, ariaLabel, theme = {}, cssOverrides, ...props }) {
|
|
9
9
|
const mergedTheme = mergeDeep(defaultIconLinkButtonTheme, theme);
|
|
10
10
|
const linkRef = useRef(null);
|
|
11
11
|
useEffect(() => {
|
|
@@ -4,7 +4,7 @@ import { mergeDeep } from '../../util/mergeDeep.js';
|
|
|
4
4
|
import { Icon } from '../icon/Icon.js';
|
|
5
5
|
import { linkButtonStyles, defaultLinkButtonTheme } from './styles.js';
|
|
6
6
|
|
|
7
|
-
function LinkButton({ variant = "
|
|
7
|
+
function LinkButton({ variant = "primary", size = "md", theme = {}, cssOverrides, icon, ...props }) {
|
|
8
8
|
const mergedTheme = mergeDeep(defaultLinkButtonTheme, theme);
|
|
9
9
|
const iconSize = size === "xs" ? "sm" : size;
|
|
10
10
|
return jsx(Link, { ...props, css: [
|
|
@@ -33,6 +33,7 @@ const menuItemStyles = (theme, { description }, isFocusVisible = false) => react
|
|
|
33
33
|
padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
|
|
34
34
|
${theme.shared.padding.bottom} ${theme.shared.padding.left};
|
|
35
35
|
border-bottom: ${theme.shared["border-bottom"]};
|
|
36
|
+
background: ${theme.shared["background-color"]};
|
|
36
37
|
&:last-child {
|
|
37
38
|
border-bottom: ${theme.shared[":last-child"]["border-bottom"]};
|
|
38
39
|
}
|
|
@@ -31,6 +31,7 @@ const menuItemStyles = (theme, { description }, isFocusVisible = false) => css`
|
|
|
31
31
|
padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
|
|
32
32
|
${theme.shared.padding.bottom} ${theme.shared.padding.left};
|
|
33
33
|
border-bottom: ${theme.shared["border-bottom"]};
|
|
34
|
+
background: ${theme.shared["background-color"]};
|
|
34
35
|
&:last-child {
|
|
35
36
|
border-bottom: ${theme.shared[":last-child"]["border-bottom"]};
|
|
36
37
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var mergeDeep = require('../../util/mergeDeep.cjs');
|
|
6
|
+
var Avatar = require('../avatar/Avatar.cjs');
|
|
7
|
+
var styles = require('./styles.cjs');
|
|
8
|
+
var TopBarItem = require('./topBarItem/TopBarItem.cjs');
|
|
9
|
+
var TopBarNavigation = require('./topBarNavigation/TopBarNavigation.cjs');
|
|
10
|
+
var TopBarToolName = require('./topBarToolName/TopBarToolName.cjs');
|
|
11
|
+
|
|
12
|
+
function TopBarSide({
|
|
13
|
+
children,
|
|
14
|
+
alignment
|
|
15
|
+
}) {
|
|
16
|
+
const items = [];
|
|
17
|
+
React.Children.forEach(children, (child, i) => {
|
|
18
|
+
if (!React.isValidElement(child)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (child.type === TopBarItem.TopBarItem) {
|
|
22
|
+
items.push(
|
|
23
|
+
React.cloneElement(child, {
|
|
24
|
+
key: `${child.key}-${i}`,
|
|
25
|
+
alignment
|
|
26
|
+
})
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
if (child.type === TopBarNavigation.TopBarNavigation) {
|
|
30
|
+
items.push(
|
|
31
|
+
React.cloneElement(child, {
|
|
32
|
+
key: `${child.key}-${i}`,
|
|
33
|
+
alignment
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: items });
|
|
39
|
+
}
|
|
40
|
+
function TopBarContainerRight({
|
|
41
|
+
children
|
|
42
|
+
}) {
|
|
43
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TopBarSide, { alignment: "right", children });
|
|
44
|
+
}
|
|
45
|
+
function TopBarContainerLeft({
|
|
46
|
+
children
|
|
47
|
+
}) {
|
|
48
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TopBarSide, { alignment: "left", children });
|
|
49
|
+
}
|
|
50
|
+
function TopBar({
|
|
51
|
+
children,
|
|
52
|
+
theme = {},
|
|
53
|
+
cssOverrides,
|
|
54
|
+
className,
|
|
55
|
+
...props
|
|
56
|
+
}) {
|
|
57
|
+
const mergedTheme = mergeDeep.mergeDeep(styles.defaultTopBarTheme, theme);
|
|
58
|
+
let leftSide = null;
|
|
59
|
+
let rightSide = null;
|
|
60
|
+
let toolName = null;
|
|
61
|
+
let avatar = null;
|
|
62
|
+
React.Children.forEach(children, (child) => {
|
|
63
|
+
if (!React.isValidElement(child)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (child.type === TopBarToolName.TopBarToolName) {
|
|
67
|
+
toolName ?? (toolName = child);
|
|
68
|
+
}
|
|
69
|
+
if (child.type === Avatar.Avatar) {
|
|
70
|
+
avatar ?? (avatar = /* @__PURE__ */ jsxRuntime.jsx(TopBarItem.TopBarItem, { alignment: "right", children: child }));
|
|
71
|
+
}
|
|
72
|
+
if (child.type === TopBarContainerLeft) {
|
|
73
|
+
leftSide ?? (leftSide = child);
|
|
74
|
+
}
|
|
75
|
+
if (child.type === TopBarContainerRight) {
|
|
76
|
+
rightSide ?? (rightSide = child);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
css: [styles.topBarStyles(mergedTheme), cssOverrides],
|
|
83
|
+
className,
|
|
84
|
+
...props,
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { css: styles.topBarContainerLeftStyles(mergedTheme), children: [
|
|
87
|
+
toolName,
|
|
88
|
+
leftSide
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { css: styles.topBarContainerRightStyles(mergedTheme), children: [
|
|
91
|
+
rightSide,
|
|
92
|
+
avatar
|
|
93
|
+
] })
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
exports.TopBar = TopBar;
|
|
100
|
+
exports.TopBarContainerLeft = TopBarContainerLeft;
|
|
101
|
+
exports.TopBarContainerRight = TopBarContainerRight;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { mergeDeep } from '../../util/mergeDeep.js';
|
|
4
|
+
import { Avatar } from '../avatar/Avatar.js';
|
|
5
|
+
import { topBarContainerLeftStyles, topBarContainerRightStyles, topBarStyles, defaultTopBarTheme } from './styles.js';
|
|
6
|
+
import { TopBarItem } from './topBarItem/TopBarItem.js';
|
|
7
|
+
import { TopBarNavigation } from './topBarNavigation/TopBarNavigation.js';
|
|
8
|
+
import { TopBarToolName } from './topBarToolName/TopBarToolName.js';
|
|
9
|
+
|
|
10
|
+
function TopBarSide({ children, alignment }) {
|
|
11
|
+
const items = [];
|
|
12
|
+
React.Children.forEach(children, (child, i) => {
|
|
13
|
+
if (!React.isValidElement(child)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (child.type === TopBarItem) {
|
|
17
|
+
items.push(React.cloneElement(child, {
|
|
18
|
+
key: `${child.key}-${i}`,
|
|
19
|
+
alignment
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
if (child.type === TopBarNavigation) {
|
|
23
|
+
items.push(React.cloneElement(child, {
|
|
24
|
+
key: `${child.key}-${i}`,
|
|
25
|
+
alignment
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return jsx(Fragment, { children: items });
|
|
30
|
+
}
|
|
31
|
+
function TopBarContainerRight({ children }) {
|
|
32
|
+
return jsx(TopBarSide, { alignment: "right", children });
|
|
33
|
+
}
|
|
34
|
+
function TopBarContainerLeft({ children }) {
|
|
35
|
+
return jsx(TopBarSide, { alignment: "left", children });
|
|
36
|
+
}
|
|
37
|
+
function TopBar({ children, theme = {}, cssOverrides, className, ...props }) {
|
|
38
|
+
const mergedTheme = mergeDeep(defaultTopBarTheme, theme);
|
|
39
|
+
let leftSide = null;
|
|
40
|
+
let rightSide = null;
|
|
41
|
+
let toolName = null;
|
|
42
|
+
let avatar = null;
|
|
43
|
+
React.Children.forEach(children, (child) => {
|
|
44
|
+
if (!React.isValidElement(child)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (child.type === TopBarToolName) {
|
|
48
|
+
toolName ?? (toolName = child);
|
|
49
|
+
}
|
|
50
|
+
if (child.type === Avatar) {
|
|
51
|
+
avatar ?? (avatar = jsx(TopBarItem, { alignment: "right", children: child }));
|
|
52
|
+
}
|
|
53
|
+
if (child.type === TopBarContainerLeft) {
|
|
54
|
+
leftSide ?? (leftSide = child);
|
|
55
|
+
}
|
|
56
|
+
if (child.type === TopBarContainerRight) {
|
|
57
|
+
rightSide ?? (rightSide = child);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
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] })] });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { TopBar, TopBarContainerLeft, TopBarContainerRight };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('@emotion/react');
|
|
4
|
+
var TopBar = require('../../styleD/build/typescript/component/TopBar.cjs');
|
|
5
|
+
|
|
6
|
+
const defaultTopBarTheme = TopBar.componentTopBar;
|
|
7
|
+
const topBarStyles = (theme) => {
|
|
8
|
+
return react.css`
|
|
9
|
+
background-color: ${theme["background-color"]};
|
|
10
|
+
height: ${theme.height};
|
|
11
|
+
border: ${theme.border};
|
|
12
|
+
display: ${theme.display};
|
|
13
|
+
justify-content: ${theme["justify-content"]};
|
|
14
|
+
`;
|
|
15
|
+
};
|
|
16
|
+
const topBarContainerLeftStyles = (theme) => {
|
|
17
|
+
return react.css`
|
|
18
|
+
display: ${theme.display};
|
|
19
|
+
`;
|
|
20
|
+
};
|
|
21
|
+
const topBarContainerRightStyles = (theme) => {
|
|
22
|
+
return react.css`
|
|
23
|
+
display: ${theme.display};
|
|
24
|
+
`;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.defaultTopBarTheme = defaultTopBarTheme;
|
|
28
|
+
exports.topBarContainerLeftStyles = topBarContainerLeftStyles;
|
|
29
|
+
exports.topBarContainerRightStyles = topBarContainerRightStyles;
|
|
30
|
+
exports.topBarStyles = topBarStyles;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { componentTopBar } from '../../styleD/build/typescript/component/TopBar.js';
|
|
3
|
+
|
|
4
|
+
const defaultTopBarTheme = componentTopBar;
|
|
5
|
+
const topBarStyles = (theme) => {
|
|
6
|
+
return css`
|
|
7
|
+
background-color: ${theme["background-color"]};
|
|
8
|
+
height: ${theme.height};
|
|
9
|
+
border: ${theme.border};
|
|
10
|
+
display: ${theme.display};
|
|
11
|
+
justify-content: ${theme["justify-content"]};
|
|
12
|
+
`;
|
|
13
|
+
};
|
|
14
|
+
const topBarContainerLeftStyles = (theme) => {
|
|
15
|
+
return css`
|
|
16
|
+
display: ${theme.display};
|
|
17
|
+
`;
|
|
18
|
+
};
|
|
19
|
+
const topBarContainerRightStyles = (theme) => {
|
|
20
|
+
return css`
|
|
21
|
+
display: ${theme.display};
|
|
22
|
+
`;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { defaultTopBarTheme, topBarContainerLeftStyles, topBarContainerRightStyles, topBarStyles };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
4
|
+
var mergeDeep = require('../../../util/mergeDeep.cjs');
|
|
5
|
+
var styles = require('./styles.cjs');
|
|
6
|
+
|
|
7
|
+
function TopBarItem({
|
|
8
|
+
children,
|
|
9
|
+
alignment = "left",
|
|
10
|
+
theme = {},
|
|
11
|
+
cssOverrides,
|
|
12
|
+
className,
|
|
13
|
+
size = "md",
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
const mergedTheme = mergeDeep.mergeDeep(styles.defaultTopBarItemTheme, theme);
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
css: [styles.topBarItemStyles(mergedTheme, alignment, { size }), cssOverrides],
|
|
21
|
+
className,
|
|
22
|
+
...props,
|
|
23
|
+
children
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.TopBarItem = TopBarItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { mergeDeep } from '../../../util/mergeDeep.js';
|
|
3
|
+
import { topBarItemStyles, defaultTopBarItemTheme } from './styles.js';
|
|
4
|
+
|
|
5
|
+
function TopBarItem({ children, alignment = "left", theme = {}, cssOverrides, className, size = "md", ...props }) {
|
|
6
|
+
const mergedTheme = mergeDeep(defaultTopBarItemTheme, theme);
|
|
7
|
+
return jsx("div", { css: [topBarItemStyles(mergedTheme, alignment, { size }), cssOverrides], className, ...props, children });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { TopBarItem };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('@emotion/react');
|
|
4
|
+
var TopBar = require('../../../styleD/build/typescript/component/TopBar.cjs');
|
|
5
|
+
|
|
6
|
+
const defaultTopBarItemTheme = TopBar.componentTopBar.Item;
|
|
7
|
+
const topBarItemStyles = (theme, alignment, { size }) => {
|
|
8
|
+
return react.css`
|
|
9
|
+
display: ${theme.display};
|
|
10
|
+
align-items: ${theme["align-items"]};
|
|
11
|
+
height: ${theme.height};
|
|
12
|
+
padding: ${theme[size].padding.top} ${theme[size].padding.right}
|
|
13
|
+
${theme[size].padding.bottom} ${theme[size].padding.left};
|
|
14
|
+
${alignment === "left" ? "border-right" : "border-left"}: ${theme.border};
|
|
15
|
+
${alignment === "right" && "margin-left: auto"};
|
|
16
|
+
`;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.defaultTopBarItemTheme = defaultTopBarItemTheme;
|
|
20
|
+
exports.topBarItemStyles = topBarItemStyles;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { componentTopBar } from '../../../styleD/build/typescript/component/TopBar.js';
|
|
3
|
+
|
|
4
|
+
const defaultTopBarItemTheme = componentTopBar.Item;
|
|
5
|
+
const topBarItemStyles = (theme, alignment, { size }) => {
|
|
6
|
+
return css`
|
|
7
|
+
display: ${theme.display};
|
|
8
|
+
align-items: ${theme["align-items"]};
|
|
9
|
+
height: ${theme.height};
|
|
10
|
+
padding: ${theme[size].padding.top} ${theme[size].padding.right}
|
|
11
|
+
${theme[size].padding.bottom} ${theme[size].padding.left};
|
|
12
|
+
${alignment === "left" ? "border-right" : "border-left"}: ${theme.border};
|
|
13
|
+
${alignment === "right" && "margin-left: auto"};
|
|
14
|
+
`;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { defaultTopBarItemTheme, topBarItemStyles };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
4
|
+
var reactAriaComponents = require('react-aria-components');
|
|
5
|
+
var mergeDeep = require('../../../util/mergeDeep.cjs');
|
|
6
|
+
var Icon = require('../../icon/Icon.cjs');
|
|
7
|
+
var Menu = require('../../menu/Menu.cjs');
|
|
8
|
+
var styles = require('./styles.cjs');
|
|
9
|
+
|
|
10
|
+
const menuIndicator = "keyboard_arrow_down";
|
|
11
|
+
function TopBarNavigation({
|
|
12
|
+
text,
|
|
13
|
+
size = "md",
|
|
14
|
+
isSelected = false,
|
|
15
|
+
icon,
|
|
16
|
+
menuChildren,
|
|
17
|
+
href,
|
|
18
|
+
onPress,
|
|
19
|
+
isDisabled,
|
|
20
|
+
alignment = "left",
|
|
21
|
+
theme = {},
|
|
22
|
+
cssOverrides,
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
const mergedTheme = mergeDeep.mergeDeep(styles.defaultTopBarNavigationTheme, theme);
|
|
27
|
+
const iconSize = size === "md" ? "lg" : "sm";
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.topBarNavigationDividerStyles(mergedTheme, { alignment }), children: menuChildren ? /* @__PURE__ */ jsxRuntime.jsxs(Menu.Menu, { children: [
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsx(Menu.MenuToggle, { children: /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Pressable, { isDisabled, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
30
|
+
"span",
|
|
31
|
+
{
|
|
32
|
+
role: "button",
|
|
33
|
+
"data-disabled": isDisabled ? true : void 0,
|
|
34
|
+
css: [
|
|
35
|
+
styles.topBarNavigationStyles(mergedTheme, isSelected),
|
|
36
|
+
styles.topBarNavigationTypographyStyles(mergedTheme, size),
|
|
37
|
+
cssOverrides
|
|
38
|
+
],
|
|
39
|
+
className,
|
|
40
|
+
...props,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: iconSize, children: icon }),
|
|
43
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { css: styles.topBarNavigationTextStyles(mergedTheme), children: text }),
|
|
44
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.topBarMenuIndicatorStyles(mergedTheme), children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: iconSize, children: menuIndicator }) })
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
) }) }),
|
|
48
|
+
menuChildren
|
|
49
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
50
|
+
reactAriaComponents.Link,
|
|
51
|
+
{
|
|
52
|
+
css: [
|
|
53
|
+
styles.topBarNavigationStyles(mergedTheme, isSelected),
|
|
54
|
+
styles.topBarNavigationTypographyStyles(mergedTheme, size),
|
|
55
|
+
cssOverrides
|
|
56
|
+
],
|
|
57
|
+
href,
|
|
58
|
+
onPress,
|
|
59
|
+
className,
|
|
60
|
+
isDisabled,
|
|
61
|
+
...props,
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: iconSize, children: icon }),
|
|
64
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { css: styles.topBarNavigationTextStyles(mergedTheme), children: text })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
) });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
exports.TopBarNavigation = TopBarNavigation;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { Pressable, Link } from 'react-aria-components';
|
|
3
|
+
import { mergeDeep } from '../../../util/mergeDeep.js';
|
|
4
|
+
import { Icon } from '../../icon/Icon.js';
|
|
5
|
+
import { Menu, MenuToggle } from '../../menu/Menu.js';
|
|
6
|
+
import { topBarNavigationTextStyles, topBarMenuIndicatorStyles, topBarNavigationStyles, topBarNavigationTypographyStyles, topBarNavigationDividerStyles, defaultTopBarNavigationTheme } from './styles.js';
|
|
7
|
+
|
|
8
|
+
const menuIndicator = "keyboard_arrow_down";
|
|
9
|
+
function TopBarNavigation({ text, size = "md", isSelected = false, icon, menuChildren, href, onPress, isDisabled, alignment = "left", theme = {}, cssOverrides, className, ...props }) {
|
|
10
|
+
const mergedTheme = mergeDeep(defaultTopBarNavigationTheme, theme);
|
|
11
|
+
const iconSize = size === "md" ? "lg" : "sm";
|
|
12
|
+
return jsx("div", { css: topBarNavigationDividerStyles(mergedTheme, { alignment }), children: menuChildren ? jsxs(Menu, { children: [jsx(MenuToggle, { children: jsx(Pressable, { isDisabled, children: jsxs("span", { role: "button", "data-disabled": isDisabled ? true : void 0, css: [
|
|
13
|
+
topBarNavigationStyles(mergedTheme, isSelected),
|
|
14
|
+
topBarNavigationTypographyStyles(mergedTheme, size),
|
|
15
|
+
cssOverrides
|
|
16
|
+
], className, ...props, children: [jsx(Icon, { size: iconSize, children: icon }), jsx("span", { css: topBarNavigationTextStyles(mergedTheme), children: text }), jsx("div", { css: topBarMenuIndicatorStyles(mergedTheme), children: jsx(Icon, { size: iconSize, children: menuIndicator }) })] }) }) }), menuChildren] }) : jsxs(Link, { css: [
|
|
17
|
+
topBarNavigationStyles(mergedTheme, isSelected),
|
|
18
|
+
topBarNavigationTypographyStyles(mergedTheme, size),
|
|
19
|
+
cssOverrides
|
|
20
|
+
], href, onPress, className, isDisabled, ...props, children: [jsx(Icon, { size: iconSize, children: icon }), jsx("span", { css: topBarNavigationTextStyles(mergedTheme), children: text })] }) });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { TopBarNavigation };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('@emotion/react');
|
|
4
|
+
var TopBar = require('../../../styleD/build/typescript/component/TopBar.cjs');
|
|
5
|
+
var typography = require('../../../styleD/utils/semantic/typography.cjs');
|
|
6
|
+
|
|
7
|
+
const defaultTopBarNavigationTheme = TopBar.componentTopBar.Navigation;
|
|
8
|
+
const topBarNavigationStyles = (theme, selected) => {
|
|
9
|
+
return react.css`
|
|
10
|
+
display: ${theme.shared.display};
|
|
11
|
+
position: ${theme.shared.position};
|
|
12
|
+
align-items: ${theme.shared["align-items"]};
|
|
13
|
+
height: ${theme.shared.height};
|
|
14
|
+
padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
|
|
15
|
+
${theme.shared.padding.bottom} ${theme.shared.padding.left};
|
|
16
|
+
color: ${selected ? `${theme.selected.color}` : `${theme.unselected.color}`};
|
|
17
|
+
border-top: ${theme.shared["border-top"]};
|
|
18
|
+
border-bottom: ${theme.unselected["border-bottom"]};
|
|
19
|
+
|
|
20
|
+
&[data-hovered],
|
|
21
|
+
&:hover {
|
|
22
|
+
border-bottom: ${theme.selected["border-bottom"]};
|
|
23
|
+
cursor: ${theme.shared.cursor};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&[data-focus-visible],
|
|
27
|
+
&:focus-visible {
|
|
28
|
+
outline: ${theme.shared[":focus-visible"].outline};
|
|
29
|
+
border-bottom: ${theme.selected["border-bottom"]};
|
|
30
|
+
outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&[data-disabled] {
|
|
34
|
+
cursor: ${theme.shared[":disabled"].cursor};
|
|
35
|
+
color: ${theme.shared[":disabled"].color};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
${selected && `border-bottom: ${theme.selected["border-bottom"]};`}
|
|
39
|
+
|
|
40
|
+
text-decoration: ${theme.shared["text-decoration"]};
|
|
41
|
+
`;
|
|
42
|
+
};
|
|
43
|
+
const topBarNavigationDividerStyles = (theme, { alignment }) => react.css`
|
|
44
|
+
${alignment === "left" ? "border-right" : "border-left"}: ${theme.shared.divider};
|
|
45
|
+
`;
|
|
46
|
+
const topBarNavigationTextStyles = (theme) => react.css`
|
|
47
|
+
margin-left: ${theme.text.margin.left};
|
|
48
|
+
`;
|
|
49
|
+
const topBarNavigationTypographyStyles = (theme, size) => {
|
|
50
|
+
return size == "md" ? react.css`
|
|
51
|
+
${typography.convertTypographyToEmotionStringStyle(theme.md.typography)}
|
|
52
|
+
` : react.css`
|
|
53
|
+
${typography.convertTypographyToEmotionStringStyle(theme.sm.typography)}
|
|
54
|
+
`;
|
|
55
|
+
};
|
|
56
|
+
const topBarMenuIndicatorStyles = (theme) => {
|
|
57
|
+
return react.css`
|
|
58
|
+
margin-top: ${theme.menuIndicator.margin.top};
|
|
59
|
+
margin-left: ${theme.menuIndicator.margin.left};
|
|
60
|
+
`;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.defaultTopBarNavigationTheme = defaultTopBarNavigationTheme;
|
|
64
|
+
exports.topBarMenuIndicatorStyles = topBarMenuIndicatorStyles;
|
|
65
|
+
exports.topBarNavigationDividerStyles = topBarNavigationDividerStyles;
|
|
66
|
+
exports.topBarNavigationStyles = topBarNavigationStyles;
|
|
67
|
+
exports.topBarNavigationTextStyles = topBarNavigationTextStyles;
|
|
68
|
+
exports.topBarNavigationTypographyStyles = topBarNavigationTypographyStyles;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
|
+
import { componentTopBar } from '../../../styleD/build/typescript/component/TopBar.js';
|
|
3
|
+
import { convertTypographyToEmotionStringStyle } from '../../../styleD/utils/semantic/typography.js';
|
|
4
|
+
|
|
5
|
+
const defaultTopBarNavigationTheme = componentTopBar.Navigation;
|
|
6
|
+
const topBarNavigationStyles = (theme, selected) => {
|
|
7
|
+
return css`
|
|
8
|
+
display: ${theme.shared.display};
|
|
9
|
+
position: ${theme.shared.position};
|
|
10
|
+
align-items: ${theme.shared["align-items"]};
|
|
11
|
+
height: ${theme.shared.height};
|
|
12
|
+
padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
|
|
13
|
+
${theme.shared.padding.bottom} ${theme.shared.padding.left};
|
|
14
|
+
color: ${selected ? `${theme.selected.color}` : `${theme.unselected.color}`};
|
|
15
|
+
border-top: ${theme.shared["border-top"]};
|
|
16
|
+
border-bottom: ${theme.unselected["border-bottom"]};
|
|
17
|
+
|
|
18
|
+
&[data-hovered],
|
|
19
|
+
&:hover {
|
|
20
|
+
border-bottom: ${theme.selected["border-bottom"]};
|
|
21
|
+
cursor: ${theme.shared.cursor};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&[data-focus-visible],
|
|
25
|
+
&:focus-visible {
|
|
26
|
+
outline: ${theme.shared[":focus-visible"].outline};
|
|
27
|
+
border-bottom: ${theme.selected["border-bottom"]};
|
|
28
|
+
outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&[data-disabled] {
|
|
32
|
+
cursor: ${theme.shared[":disabled"].cursor};
|
|
33
|
+
color: ${theme.shared[":disabled"].color};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
${selected && `border-bottom: ${theme.selected["border-bottom"]};`}
|
|
37
|
+
|
|
38
|
+
text-decoration: ${theme.shared["text-decoration"]};
|
|
39
|
+
`;
|
|
40
|
+
};
|
|
41
|
+
const topBarNavigationDividerStyles = (theme, { alignment }) => css`
|
|
42
|
+
${alignment === "left" ? "border-right" : "border-left"}: ${theme.shared.divider};
|
|
43
|
+
`;
|
|
44
|
+
const topBarNavigationTextStyles = (theme) => css`
|
|
45
|
+
margin-left: ${theme.text.margin.left};
|
|
46
|
+
`;
|
|
47
|
+
const topBarNavigationTypographyStyles = (theme, size) => {
|
|
48
|
+
return size == "md" ? css`
|
|
49
|
+
${convertTypographyToEmotionStringStyle(theme.md.typography)}
|
|
50
|
+
` : css`
|
|
51
|
+
${convertTypographyToEmotionStringStyle(theme.sm.typography)}
|
|
52
|
+
`;
|
|
53
|
+
};
|
|
54
|
+
const topBarMenuIndicatorStyles = (theme) => {
|
|
55
|
+
return css`
|
|
56
|
+
margin-top: ${theme.menuIndicator.margin.top};
|
|
57
|
+
margin-left: ${theme.menuIndicator.margin.left};
|
|
58
|
+
`;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { defaultTopBarNavigationTheme, topBarMenuIndicatorStyles, topBarNavigationDividerStyles, topBarNavigationStyles, topBarNavigationTextStyles, topBarNavigationTypographyStyles };
|