@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
@@ -21,50 +21,66 @@ function TopBarNavigation({
21
21
  theme = {},
22
22
  cssOverrides,
23
23
  className,
24
+ _menuOpen,
24
25
  ...props
25
26
  }) {
26
27
  const mergedTheme = mergeDeep.mergeDeep(styles.defaultTopBarNavigationTheme, theme);
27
28
  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,
29
+ return /* @__PURE__ */ jsxRuntime.jsx(
30
+ "div",
51
31
  {
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
- ]
32
+ css: styles.topBarNavigationDividerStyles(mergedTheme, { alignment }, _menuOpen),
33
+ children: menuChildren ? /* @__PURE__ */ jsxRuntime.jsxs(
34
+ Menu.Menu,
35
+ {
36
+ popoverProps: {
37
+ placement: _menuOpen ? "end" : void 0
38
+ },
39
+ size: _menuOpen ? "sm" : void 0,
40
+ children: [
41
+ /* @__PURE__ */ jsxRuntime.jsx(Menu.MenuToggle, { children: /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Pressable, { isDisabled, children: /* @__PURE__ */ jsxRuntime.jsxs(
42
+ "span",
43
+ {
44
+ role: "button",
45
+ "data-disabled": isDisabled ? true : void 0,
46
+ css: [
47
+ styles.topBarNavigationStyles(mergedTheme, isSelected, _menuOpen),
48
+ styles.topBarNavigationTypographyStyles(mergedTheme, size),
49
+ cssOverrides
50
+ ],
51
+ className,
52
+ ...props,
53
+ children: [
54
+ /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: iconSize, children: icon }),
55
+ /* @__PURE__ */ jsxRuntime.jsx("span", { css: styles.topBarNavigationTextStyles(mergedTheme), children: text }),
56
+ /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.topBarMenuIndicatorStyles(mergedTheme), children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: iconSize, children: menuIndicator }) })
57
+ ]
58
+ }
59
+ ) }) }),
60
+ menuChildren
61
+ ]
62
+ }
63
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
64
+ reactAriaComponents.Link,
65
+ {
66
+ css: [
67
+ styles.topBarNavigationStyles(mergedTheme, isSelected, _menuOpen),
68
+ styles.topBarNavigationTypographyStyles(mergedTheme, size),
69
+ cssOverrides
70
+ ],
71
+ href,
72
+ onPress,
73
+ className,
74
+ isDisabled,
75
+ ...props,
76
+ children: [
77
+ /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: iconSize, children: icon }),
78
+ /* @__PURE__ */ jsxRuntime.jsx("span", { css: styles.topBarNavigationTextStyles(mergedTheme), children: text })
79
+ ]
80
+ }
81
+ )
66
82
  }
67
- ) });
83
+ );
68
84
  }
69
85
 
70
86
  exports.TopBarNavigation = TopBarNavigation;
@@ -6,15 +6,17 @@ import { Menu, MenuToggle } from '../../menu/Menu.js';
6
6
  import { topBarNavigationTextStyles, topBarMenuIndicatorStyles, topBarNavigationStyles, topBarNavigationTypographyStyles, topBarNavigationDividerStyles, defaultTopBarNavigationTheme } from './styles.js';
7
7
 
8
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 }) {
9
+ function TopBarNavigation({ text, size = "md", isSelected = false, icon, menuChildren, href, onPress, isDisabled, alignment = "left", theme = {}, cssOverrides, className, _menuOpen, ...props }) {
10
10
  const mergedTheme = mergeDeep(defaultTopBarNavigationTheme, theme);
11
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),
12
+ return jsx("div", { css: topBarNavigationDividerStyles(mergedTheme, { alignment }, _menuOpen), children: menuChildren ? jsxs(Menu, { popoverProps: {
13
+ placement: _menuOpen ? "end" : void 0
14
+ }, size: _menuOpen ? "sm" : void 0, children: [jsx(MenuToggle, { children: jsx(Pressable, { isDisabled, children: jsxs("span", { role: "button", "data-disabled": isDisabled ? true : void 0, css: [
15
+ topBarNavigationStyles(mergedTheme, isSelected, _menuOpen),
14
16
  topBarNavigationTypographyStyles(mergedTheme, size),
15
17
  cssOverrides
16
18
  ], 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),
19
+ topBarNavigationStyles(mergedTheme, isSelected, _menuOpen),
18
20
  topBarNavigationTypographyStyles(mergedTheme, size),
19
21
  cssOverrides
20
22
  ], href, onPress, className, isDisabled, ...props, children: [jsx(Icon, { size: iconSize, children: icon }), jsx("span", { css: topBarNavigationTextStyles(mergedTheme), children: text })] }) });
@@ -5,7 +5,7 @@ var TopBar = require('../../../styleD/build/typescript/component/TopBar.cjs');
5
5
  var typography = require('../../../styleD/utils/semantic/typography.cjs');
6
6
 
7
7
  const defaultTopBarNavigationTheme = TopBar.componentTopBar.Navigation;
8
- const topBarNavigationStyles = (theme, selected) => {
8
+ const topBarNavigationStyles = (theme, selected, _menuOpen) => {
9
9
  return react.css`
10
10
  display: ${theme.shared.display};
11
11
  position: ${theme.shared.position};
@@ -14,19 +14,15 @@ const topBarNavigationStyles = (theme, selected) => {
14
14
  padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
15
15
  ${theme.shared.padding.bottom} ${theme.shared.padding.left};
16
16
  color: ${selected ? `${theme.selected.color}` : `${theme.unselected.color}`};
17
- border-top: ${theme.shared["border-top"]};
18
- border-bottom: ${theme.unselected["border-bottom"]};
19
17
 
20
18
  &[data-hovered],
21
19
  &:hover {
22
- border-bottom: ${theme.selected["border-bottom"]};
23
20
  cursor: ${theme.shared.cursor};
24
21
  }
25
22
 
26
23
  &[data-focus-visible],
27
24
  &:focus-visible {
28
25
  outline: ${theme.shared[":focus-visible"].outline};
29
- border-bottom: ${theme.selected["border-bottom"]};
30
26
  outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
31
27
  }
32
28
 
@@ -35,13 +31,54 @@ const topBarNavigationStyles = (theme, selected) => {
35
31
  color: ${theme.shared[":disabled"].color};
36
32
  }
37
33
 
38
- ${selected && `border-bottom: ${theme.selected["border-bottom"]};`}
34
+ ${_menuOpen ? react.css`
35
+ border-right: ${theme.shared["border-top"]};
36
+ border-left: ${theme.unselected["border-bottom"]};
37
+ width: 100%;
38
+
39
+ &[data-hovered],
40
+ &:hover {
41
+ border-left: ${theme.selected["border-bottom"]};
42
+ }
43
+
44
+ &[data-focus-visible],
45
+ &:focus-visible {
46
+ border-left: ${theme.selected["border-bottom"]};
47
+ }
48
+
49
+ ${selected && `
50
+ border-left: ${theme.selected["border-bottom"]};
51
+ background-color: ${theme.shared._menuOpen.selected["background-color"]};
52
+ `}
53
+ ` : react.css`
54
+ border-top: ${theme.shared["border-top"]};
55
+ border-bottom: ${theme.unselected["border-bottom"]};
56
+
57
+ &[data-hovered],
58
+ &:hover {
59
+ border-bottom: ${theme.selected["border-bottom"]};
60
+ }
61
+
62
+ &[data-focus-visible],
63
+ &:focus-visible {
64
+ border-bottom: ${theme.selected["border-bottom"]};
65
+ }
66
+
67
+ ${selected && `
68
+ border-bottom: ${theme.selected["border-bottom"]};
69
+ `}
70
+ `}
39
71
 
40
72
  text-decoration: ${theme.shared["text-decoration"]};
41
73
  `;
42
74
  };
43
- const topBarNavigationDividerStyles = (theme, { alignment }) => react.css`
44
- ${alignment === "left" ? "border-right" : "border-left"}: ${theme.shared.divider};
75
+ const topBarNavigationDividerStyles = (theme, { alignment }, _menuOpen) => react.css`
76
+ ${_menuOpen ? react.css`
77
+ height: ${theme.shared._menuOpen.height};
78
+ border-bottom: ${theme.shared.divider};
79
+ ` : react.css`
80
+ ${alignment === "left" ? "border-right" : "border-left"}: ${theme.shared.divider};
81
+ `}
45
82
  `;
46
83
  const topBarNavigationTextStyles = (theme) => react.css`
47
84
  margin-left: ${theme.text.margin.left};
@@ -3,7 +3,7 @@ import { componentTopBar } from '../../../styleD/build/typescript/component/TopB
3
3
  import { convertTypographyToEmotionStringStyle } from '../../../styleD/utils/semantic/typography.js';
4
4
 
5
5
  const defaultTopBarNavigationTheme = componentTopBar.Navigation;
6
- const topBarNavigationStyles = (theme, selected) => {
6
+ const topBarNavigationStyles = (theme, selected, _menuOpen) => {
7
7
  return css`
8
8
  display: ${theme.shared.display};
9
9
  position: ${theme.shared.position};
@@ -12,19 +12,15 @@ const topBarNavigationStyles = (theme, selected) => {
12
12
  padding: ${theme.shared.padding.top} ${theme.shared.padding.right}
13
13
  ${theme.shared.padding.bottom} ${theme.shared.padding.left};
14
14
  color: ${selected ? `${theme.selected.color}` : `${theme.unselected.color}`};
15
- border-top: ${theme.shared["border-top"]};
16
- border-bottom: ${theme.unselected["border-bottom"]};
17
15
 
18
16
  &[data-hovered],
19
17
  &:hover {
20
- border-bottom: ${theme.selected["border-bottom"]};
21
18
  cursor: ${theme.shared.cursor};
22
19
  }
23
20
 
24
21
  &[data-focus-visible],
25
22
  &:focus-visible {
26
23
  outline: ${theme.shared[":focus-visible"].outline};
27
- border-bottom: ${theme.selected["border-bottom"]};
28
24
  outline-offset: ${theme.shared[":focus-visible"]["outline-offset"]};
29
25
  }
30
26
 
@@ -33,13 +29,54 @@ const topBarNavigationStyles = (theme, selected) => {
33
29
  color: ${theme.shared[":disabled"].color};
34
30
  }
35
31
 
36
- ${selected && `border-bottom: ${theme.selected["border-bottom"]};`}
32
+ ${_menuOpen ? css`
33
+ border-right: ${theme.shared["border-top"]};
34
+ border-left: ${theme.unselected["border-bottom"]};
35
+ width: 100%;
36
+
37
+ &[data-hovered],
38
+ &:hover {
39
+ border-left: ${theme.selected["border-bottom"]};
40
+ }
41
+
42
+ &[data-focus-visible],
43
+ &:focus-visible {
44
+ border-left: ${theme.selected["border-bottom"]};
45
+ }
46
+
47
+ ${selected && `
48
+ border-left: ${theme.selected["border-bottom"]};
49
+ background-color: ${theme.shared._menuOpen.selected["background-color"]};
50
+ `}
51
+ ` : css`
52
+ border-top: ${theme.shared["border-top"]};
53
+ border-bottom: ${theme.unselected["border-bottom"]};
54
+
55
+ &[data-hovered],
56
+ &:hover {
57
+ border-bottom: ${theme.selected["border-bottom"]};
58
+ }
59
+
60
+ &[data-focus-visible],
61
+ &:focus-visible {
62
+ border-bottom: ${theme.selected["border-bottom"]};
63
+ }
64
+
65
+ ${selected && `
66
+ border-bottom: ${theme.selected["border-bottom"]};
67
+ `}
68
+ `}
37
69
 
38
70
  text-decoration: ${theme.shared["text-decoration"]};
39
71
  `;
40
72
  };
41
- const topBarNavigationDividerStyles = (theme, { alignment }) => css`
42
- ${alignment === "left" ? "border-right" : "border-left"}: ${theme.shared.divider};
73
+ const topBarNavigationDividerStyles = (theme, { alignment }, _menuOpen) => css`
74
+ ${_menuOpen ? css`
75
+ height: ${theme.shared._menuOpen.height};
76
+ border-bottom: ${theme.shared.divider};
77
+ ` : css`
78
+ ${alignment === "left" ? "border-right" : "border-left"}: ${theme.shared.divider};
79
+ `}
43
80
  `;
44
81
  const topBarNavigationTextStyles = (theme) => css`
45
82
  margin-left: ${theme.text.margin.left};
@@ -13,25 +13,30 @@ function ToolName({
13
13
  favicon,
14
14
  subsection,
15
15
  subsectionIcon,
16
+ collapseBelow = "lg",
16
17
  theme = {},
17
18
  cssOverrides
18
19
  }) {
19
20
  const mergedTheme = mergeDeep.mergeDeep(styles.defaultToolNameTheme, theme);
20
21
  return /* @__PURE__ */ jsxRuntime.jsx(TopBarItem.TopBarItem, { alignment: "left", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { css: [styles.toolNameStyles(mergedTheme), cssOverrides], children: [
21
22
  /* @__PURE__ */ jsxRuntime.jsx(Favicon.Favicon, { ...favicon }),
22
- /* @__PURE__ */ jsxRuntime.jsx("div", { css: [styles.toolNameTypography(mergedTheme)], children: name }),
23
+ /* @__PURE__ */ jsxRuntime.jsx("div", { css: [styles.toolNameTypography(mergedTheme, { collapseBelow })], children: name }),
23
24
  subsection && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
24
- /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.dividerStyles(mergedTheme), children: "\xA0" }),
25
- /* @__PURE__ */ jsxRuntime.jsxs("div", { css: styles.subsectionStyles(mergedTheme), children: [
25
+ /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.dividerStyles(mergedTheme, { collapseBelow }), children: "\xA0" }),
26
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { css: styles.subsectionStyles(mergedTheme, { collapseBelow }), children: [
26
27
  subsectionIcon && /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { size: "sm", children: subsectionIcon }),
27
28
  /* @__PURE__ */ jsxRuntime.jsx("div", { css: styles.subsectionTypography(mergedTheme), children: subsection })
28
29
  ] })
29
30
  ] })
30
31
  ] }) });
31
32
  }
32
- const TopBarToolName = (props) => {
33
- const mergedTheme = mergeDeep.mergeDeep(styles.defaultToolNameTheme, props.theme ?? {});
34
- if (("href" in props || "onPress" in props) && "hoverText" in props) {
33
+ const TopBarToolName = ({
34
+ collapseBelow = "lg",
35
+ theme = {},
36
+ ...props
37
+ }) => {
38
+ const mergedTheme = mergeDeep.mergeDeep(styles.defaultToolNameTheme, theme);
39
+ if (("href" in props || "onPress" in props) && ("hoverText" in props || "collapsedHoverText" in props)) {
35
40
  return /* @__PURE__ */ jsxRuntime.jsxs(
36
41
  reactAriaComponents.Link,
37
42
  {
@@ -39,13 +44,49 @@ const TopBarToolName = (props) => {
39
44
  href: props.href,
40
45
  onPress: props.onPress,
41
46
  children: [
42
- /* @__PURE__ */ jsxRuntime.jsx("div", { css: [styles.toolNameHoverLinkStyles(mergedTheme)], children: props.hoverText }),
43
- /* @__PURE__ */ jsxRuntime.jsx(ToolName, { ...props })
47
+ /* @__PURE__ */ jsxRuntime.jsxs(
48
+ "div",
49
+ {
50
+ css: [
51
+ styles.toolNameHoverLinkStyles(mergedTheme, {
52
+ collapseBelow
53
+ })
54
+ ],
55
+ children: [
56
+ /* @__PURE__ */ jsxRuntime.jsx(
57
+ "span",
58
+ {
59
+ css: styles.toolNameHoverLinkTextExpandedStyles({
60
+ collapseBelow
61
+ }),
62
+ children: props.hoverText ?? props.collapsedHoverText
63
+ }
64
+ ),
65
+ /* @__PURE__ */ jsxRuntime.jsx(
66
+ "span",
67
+ {
68
+ css: styles.toolNameHoverLinkTextCollapsedStyles({
69
+ collapseBelow
70
+ }),
71
+ children: props.collapsedHoverText ?? props.hoverText
72
+ }
73
+ )
74
+ ]
75
+ }
76
+ ),
77
+ /* @__PURE__ */ jsxRuntime.jsx(
78
+ ToolName,
79
+ {
80
+ theme: mergedTheme,
81
+ collapseBelow,
82
+ ...props
83
+ }
84
+ )
44
85
  ]
45
86
  }
46
87
  );
47
88
  }
48
- return /* @__PURE__ */ jsxRuntime.jsx(ToolName, { ...props });
89
+ return /* @__PURE__ */ jsxRuntime.jsx(ToolName, { theme: mergedTheme, collapseBelow, ...props });
49
90
  };
50
91
 
51
92
  exports.TopBarToolName = TopBarToolName;
@@ -4,18 +4,26 @@ import { mergeDeep } from '../../../util/mergeDeep.js';
4
4
  import { Favicon } from '../../favicon/Favicon.js';
5
5
  import { Icon } from '../../icon/Icon.js';
6
6
  import { TopBarItem } from '../topBarItem/TopBarItem.js';
7
- import { defaultToolNameTheme, toolNameHoverLinkStyles, toolNameLinkStyles, toolNameTypography, dividerStyles, subsectionTypography, subsectionStyles, toolNameStyles } from './styles.js';
7
+ import { toolNameHoverLinkTextExpandedStyles, toolNameHoverLinkTextCollapsedStyles, toolNameHoverLinkStyles, toolNameLinkStyles, defaultToolNameTheme, toolNameTypography, dividerStyles, subsectionTypography, subsectionStyles, toolNameStyles } from './styles.js';
8
8
 
9
- function ToolName({ name, favicon, subsection, subsectionIcon, theme = {}, cssOverrides }) {
9
+ function ToolName({ name, favicon, subsection, subsectionIcon, collapseBelow = "lg", theme = {}, cssOverrides }) {
10
10
  const mergedTheme = mergeDeep(defaultToolNameTheme, theme);
11
- return jsx(TopBarItem, { alignment: "left", size: "sm", children: jsxs("div", { css: [toolNameStyles(mergedTheme), cssOverrides], children: [jsx(Favicon, { ...favicon }), jsx("div", { css: [toolNameTypography(mergedTheme)], children: name }), subsection && jsxs(Fragment, { children: [jsx("div", { css: dividerStyles(mergedTheme), children: "\xA0" }), jsxs("div", { css: subsectionStyles(mergedTheme), children: [subsectionIcon && jsx(Icon, { size: "sm", children: subsectionIcon }), jsx("div", { css: subsectionTypography(mergedTheme), children: subsection })] })] })] }) });
11
+ return jsx(TopBarItem, { alignment: "left", size: "sm", children: jsxs("div", { css: [toolNameStyles(mergedTheme), cssOverrides], children: [jsx(Favicon, { ...favicon }), jsx("div", { css: [toolNameTypography(mergedTheme, { collapseBelow })], children: name }), subsection && jsxs(Fragment, { children: [jsx("div", { css: dividerStyles(mergedTheme, { collapseBelow }), children: "\xA0" }), jsxs("div", { css: subsectionStyles(mergedTheme, { collapseBelow }), children: [subsectionIcon && jsx(Icon, { size: "sm", children: subsectionIcon }), jsx("div", { css: subsectionTypography(mergedTheme), children: subsection })] })] })] }) });
12
12
  }
13
- const TopBarToolName = (props) => {
14
- const mergedTheme = mergeDeep(defaultToolNameTheme, props.theme ?? {});
15
- if (("href" in props || "onPress" in props) && "hoverText" in props) {
16
- return jsxs(Link, { css: toolNameLinkStyles(mergedTheme), href: props.href, onPress: props.onPress, children: [jsx("div", { css: [toolNameHoverLinkStyles(mergedTheme)], children: props.hoverText }), jsx(ToolName, { ...props })] });
13
+ const TopBarToolName = ({ collapseBelow = "lg", theme = {}, ...props }) => {
14
+ const mergedTheme = mergeDeep(defaultToolNameTheme, theme);
15
+ if (("href" in props || "onPress" in props) && ("hoverText" in props || "collapsedHoverText" in props)) {
16
+ return jsxs(Link, { css: toolNameLinkStyles(mergedTheme), href: props.href, onPress: props.onPress, children: [jsxs("div", { css: [
17
+ toolNameHoverLinkStyles(mergedTheme, {
18
+ collapseBelow
19
+ })
20
+ ], children: [jsx("span", { css: toolNameHoverLinkTextExpandedStyles({
21
+ collapseBelow
22
+ }), children: props.hoverText ?? props.collapsedHoverText }), jsx("span", { css: toolNameHoverLinkTextCollapsedStyles({
23
+ collapseBelow
24
+ }), children: props.collapsedHoverText ?? props.hoverText })] }), jsx(ToolName, { theme: mergedTheme, collapseBelow, ...props })] });
17
25
  }
18
- return jsx(ToolName, { ...props });
26
+ return jsx(ToolName, { theme: mergedTheme, collapseBelow, ...props });
19
27
  };
20
28
 
21
29
  export { TopBarToolName };
@@ -2,10 +2,11 @@
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
  var typography = require('../../../styleD/utils/semantic/typography.cjs');
6
7
 
7
8
  const defaultToolNameTheme = TopBar.componentTopBar.ToolName;
8
- const toolNameHoverLinkStyles = (theme) => {
9
+ const toolNameHoverLinkStyles = (theme, { collapseBelow }) => {
9
10
  return react.css`
10
11
  ${typography.convertTypographyToEmotionStringStyle(theme.hoverLink.typography)}
11
12
  background-color: ${theme.hoverLink.backgroundColor};
@@ -19,6 +20,32 @@ const toolNameHoverLinkStyles = (theme) => {
19
20
  position: ${theme.hoverLink.position};
20
21
  width: ${theme.hoverLink.width};
21
22
  height: ${theme.hoverLink.height};
23
+
24
+ ${mq.until[collapseBelow]} {
25
+ padding-left: ${theme.hoverLink.collapsed.paddingLeft};
26
+ padding-right: ${theme.hoverLink.collapsed.paddingRight};
27
+ justify-content: ${theme.hoverLink.collapsed["justify-content"]};
28
+ }
29
+ `;
30
+ };
31
+ const toolNameHoverLinkTextExpandedStyles = ({
32
+ collapseBelow
33
+ }) => {
34
+ return react.css`
35
+ ${mq.until[collapseBelow]} {
36
+ display: none;
37
+ }
38
+ `;
39
+ };
40
+ const toolNameHoverLinkTextCollapsedStyles = ({
41
+ collapseBelow
42
+ }) => {
43
+ return react.css`
44
+ display: none;
45
+
46
+ ${mq.until[collapseBelow]} {
47
+ display: block;
48
+ }
22
49
  `;
23
50
  };
24
51
  const toolNameLinkStyles = (theme) => {
@@ -50,22 +77,31 @@ const toolNameStyles = (theme) => {
50
77
  color: ${theme.color};
51
78
  `;
52
79
  };
53
- const toolNameTypography = (theme) => {
80
+ const toolNameTypography = (theme, { collapseBelow }) => {
54
81
  return react.css`
55
82
  ${typography.convertTypographyToEmotionStringStyle(theme.typography)}
83
+ ${mq.until[collapseBelow]} {
84
+ display: none;
85
+ }
56
86
  `;
57
87
  };
58
- const dividerStyles = (theme) => {
88
+ const dividerStyles = (theme, { collapseBelow }) => {
59
89
  return react.css`
60
90
  border-right: ${theme.divider.border};
61
91
  height: ${theme.divider.height};
92
+ ${mq.until[collapseBelow]} {
93
+ display: none;
94
+ }
62
95
  `;
63
96
  };
64
- const subsectionStyles = (theme) => {
97
+ const subsectionStyles = (theme, { collapseBelow }) => {
65
98
  return react.css`
66
99
  display: ${theme.display};
67
100
  align-items: ${theme["align-items"]};
68
101
  gap: ${theme.subsection.gap};
102
+ ${mq.until[collapseBelow]} {
103
+ display: none;
104
+ }
69
105
  `;
70
106
  };
71
107
  const subsectionTypography = (theme) => {
@@ -79,6 +115,8 @@ exports.dividerStyles = dividerStyles;
79
115
  exports.subsectionStyles = subsectionStyles;
80
116
  exports.subsectionTypography = subsectionTypography;
81
117
  exports.toolNameHoverLinkStyles = toolNameHoverLinkStyles;
118
+ exports.toolNameHoverLinkTextCollapsedStyles = toolNameHoverLinkTextCollapsedStyles;
119
+ exports.toolNameHoverLinkTextExpandedStyles = toolNameHoverLinkTextExpandedStyles;
82
120
  exports.toolNameLinkStyles = toolNameLinkStyles;
83
121
  exports.toolNameStyles = toolNameStyles;
84
122
  exports.toolNameTypography = toolNameTypography;
@@ -1,9 +1,10 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { componentTopBar } from '../../../styleD/build/typescript/component/TopBar.js';
3
+ import { until } from '../../../styleD/utils/semantic/mq.js';
3
4
  import { convertTypographyToEmotionStringStyle } from '../../../styleD/utils/semantic/typography.js';
4
5
 
5
6
  const defaultToolNameTheme = componentTopBar.ToolName;
6
- const toolNameHoverLinkStyles = (theme) => {
7
+ const toolNameHoverLinkStyles = (theme, { collapseBelow }) => {
7
8
  return css`
8
9
  ${convertTypographyToEmotionStringStyle(theme.hoverLink.typography)}
9
10
  background-color: ${theme.hoverLink.backgroundColor};
@@ -17,6 +18,28 @@ const toolNameHoverLinkStyles = (theme) => {
17
18
  position: ${theme.hoverLink.position};
18
19
  width: ${theme.hoverLink.width};
19
20
  height: ${theme.hoverLink.height};
21
+
22
+ ${until[collapseBelow]} {
23
+ padding-left: ${theme.hoverLink.collapsed.paddingLeft};
24
+ padding-right: ${theme.hoverLink.collapsed.paddingRight};
25
+ justify-content: ${theme.hoverLink.collapsed["justify-content"]};
26
+ }
27
+ `;
28
+ };
29
+ const toolNameHoverLinkTextExpandedStyles = ({ collapseBelow }) => {
30
+ return css`
31
+ ${until[collapseBelow]} {
32
+ display: none;
33
+ }
34
+ `;
35
+ };
36
+ const toolNameHoverLinkTextCollapsedStyles = ({ collapseBelow }) => {
37
+ return css`
38
+ display: none;
39
+
40
+ ${until[collapseBelow]} {
41
+ display: block;
42
+ }
20
43
  `;
21
44
  };
22
45
  const toolNameLinkStyles = (theme) => {
@@ -48,22 +71,31 @@ const toolNameStyles = (theme) => {
48
71
  color: ${theme.color};
49
72
  `;
50
73
  };
51
- const toolNameTypography = (theme) => {
74
+ const toolNameTypography = (theme, { collapseBelow }) => {
52
75
  return css`
53
76
  ${convertTypographyToEmotionStringStyle(theme.typography)}
77
+ ${until[collapseBelow]} {
78
+ display: none;
79
+ }
54
80
  `;
55
81
  };
56
- const dividerStyles = (theme) => {
82
+ const dividerStyles = (theme, { collapseBelow }) => {
57
83
  return css`
58
84
  border-right: ${theme.divider.border};
59
85
  height: ${theme.divider.height};
86
+ ${until[collapseBelow]} {
87
+ display: none;
88
+ }
60
89
  `;
61
90
  };
62
- const subsectionStyles = (theme) => {
91
+ const subsectionStyles = (theme, { collapseBelow }) => {
63
92
  return css`
64
93
  display: ${theme.display};
65
94
  align-items: ${theme["align-items"]};
66
95
  gap: ${theme.subsection.gap};
96
+ ${until[collapseBelow]} {
97
+ display: none;
98
+ }
67
99
  `;
68
100
  };
69
101
  const subsectionTypography = (theme) => {
@@ -72,4 +104,4 @@ const subsectionTypography = (theme) => {
72
104
  `;
73
105
  };
74
106
 
75
- export { defaultToolNameTheme, dividerStyles, subsectionStyles, subsectionTypography, toolNameHoverLinkStyles, toolNameLinkStyles, toolNameStyles, toolNameTypography };
107
+ export { defaultToolNameTheme, dividerStyles, subsectionStyles, subsectionTypography, toolNameHoverLinkStyles, toolNameHoverLinkTextCollapsedStyles, toolNameHoverLinkTextExpandedStyles, toolNameLinkStyles, toolNameStyles, toolNameTypography };
package/dist/index.cjs CHANGED
@@ -28,6 +28,7 @@ var colors$1 = require('./styleD/build/typescript/semantic/colors.cjs');
28
28
  var typography$2 = require('./styleD/build/typescript/semantic/typography.cjs');
29
29
  var sizing$1 = require('./styleD/build/typescript/semantic/sizing.cjs');
30
30
  var shadow = require('./styleD/build/typescript/semantic/shadow.cjs');
31
+ var breakpoints = require('./styleD/build/typescript/semantic/breakpoints.cjs');
31
32
 
32
33
 
33
34
 
@@ -59,3 +60,4 @@ exports.semanticColors = colors$1.semanticColors;
59
60
  exports.semanticTypography = typography$2.semanticTypography;
60
61
  exports.semanticSizing = sizing$1.semanticSizing;
61
62
  exports.semanticShadow = shadow.semanticShadow;
63
+ exports.semanticBreakpoints = breakpoints.semanticBreakpoints;
package/dist/index.js CHANGED
@@ -26,3 +26,4 @@ export { semanticColors } from './styleD/build/typescript/semantic/colors.js';
26
26
  export { semanticTypography } from './styleD/build/typescript/semantic/typography.js';
27
27
  export { semanticSizing } from './styleD/build/typescript/semantic/sizing.js';
28
28
  export { semanticShadow } from './styleD/build/typescript/semantic/shadow.js';
29
+ export { semanticBreakpoints } from './styleD/build/typescript/semantic/breakpoints.js';
@@ -6,8 +6,20 @@
6
6
  --component-top-bar-background-color: #f6f6f6;
7
7
  --component-top-bar-display: flex;
8
8
  --component-top-bar-height: 4rem;
9
- --component-top-bar-justify-content: space-between;
9
+ --component-top-bar-justify-content: flex-start;
10
10
  --component-top-bar-border: 0.0625rem solid #cccccc;
11
+ --component-top-bar-spacer-margin-left: auto;
12
+ --component-top-bar-collapsed-nav-menu-button-margin: 0;
13
+ --component-top-bar-collapsed-nav-menu-button-padding: 0;
14
+ --component-top-bar-collapsed-nav-menu-button-background: none;
15
+ --component-top-bar-collapsed-nav-menu-button-border: none;
16
+ --component-top-bar-collapsed-nav-menu-button-cursor: pointer;
17
+ --component-top-bar-collapsed-nav-menu-button-hovered-background-color: #ededed;
18
+ --component-top-bar-collapsed-nav-menu-button-active-background-color: #ededed;
19
+ --component-top-bar-collapsed-nav-menu-popover-left: auto !important;
20
+ --component-top-bar-collapsed-nav-menu-popover-top: auto !important;
21
+ --component-top-bar-collapsed-nav-menu-popover-background-color: #f6f6f6;
22
+ --component-top-bar-collapsed-nav-menu-popover-border: 0.0625rem solid #cccccc;
11
23
  --component-top-bar-item-display: flex;
12
24
  --component-top-bar-item-align-items: center;
13
25
  --component-top-bar-item-height: 100%;
@@ -41,6 +53,9 @@
41
53
  --component-top-bar-navigation-shared-focus-visible-outline-offset: -0.0625rem;
42
54
  --component-top-bar-navigation-shared-border-top: 0.5rem solid transparent;
43
55
  --component-top-bar-navigation-shared-divider: 0.0625rem solid #cccccc;
56
+ --component-top-bar-navigation-shared-menu-open-width: 100%;
57
+ --component-top-bar-navigation-shared-menu-open-height: 64px;
58
+ --component-top-bar-navigation-shared-menu-open-selected-background-color: #ededed;
44
59
  --component-top-bar-navigation-text-margin-left: 0.375rem;
45
60
  --component-top-bar-navigation-menu-indicator-margin-top: 0.375rem;
46
61
  --component-top-bar-navigation-menu-indicator-margin-left: 0.125rem;
@@ -94,4 +109,7 @@
94
109
  --component-top-bar-tool-name-hover-link-focused-outline: 0.125rem solid
95
110
  #0072a9;
96
111
  --component-top-bar-tool-name-hover-link-focused-outline-offset: -0.125rem;
112
+ --component-top-bar-tool-name-hover-link-collapsed-padding-left: 0.25rem;
113
+ --component-top-bar-tool-name-hover-link-collapsed-padding-right: 0.25rem;
114
+ --component-top-bar-tool-name-hover-link-collapsed-justify-content: center;
97
115
  }