@automattic/vip-design-system 2.4.0 → 2.4.2

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.
@@ -55,7 +55,7 @@ var MobileMenu = exports.MobileMenu = /*#__PURE__*/(0, _react.forwardRef)(functi
55
55
  width: '100%',
56
56
  flexDirection: 'column'
57
57
  },
58
- children: [toolbarItems && (0, _jsxRuntime.jsx)(_index.Nav.Primary, {
58
+ children: [toolbarItems && (0, _jsxRuntime.jsx)(_index.Nav.PrimaryInverse, {
59
59
  label: "Main Links",
60
60
  orientation: "vertical",
61
61
  children: toolbarItems
@@ -40,126 +40,134 @@ var MobileMenuExample = exports.MobileMenuExample = function MobileMenuExample()
40
40
  children: "My Organizations"
41
41
  })]
42
42
  }),
43
- children: (0, _jsxRuntime.jsxs)(_.Nav.Menu, {
43
+ children: (0, _jsxRuntime.jsx)(_.Flex, {
44
44
  sx: {
45
- mb: 4
45
+ gap: 3,
46
+ px: 5,
47
+ py: 0,
48
+ flexDirection: 'column'
46
49
  },
47
- label: "Nav Menu",
48
- children: [(0, _jsxRuntime.jsx)(_.NavItem.Menu, {
49
- href: "https://wordpress.com",
50
- renderIcon: function renderIcon(size) {
51
- return (0, _jsxRuntime.jsx)(_bi.BiGridAlt, {
52
- size: size
53
- });
54
- },
55
- as: _CustomLink.CustomLink,
56
- children: "Overview"
57
- }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
58
- as: _CustomLink.CustomLink,
59
- href: "https://random-website.com/",
60
- renderIcon: function renderIcon(size) {
61
- return (0, _jsxRuntime.jsx)(_bi.BiWindows, {
62
- size: size
63
- });
64
- },
65
- children: "Network Sites"
66
- }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
67
- as: _CustomLink.CustomLink,
68
- href: "https://random-website.com/",
69
- renderIcon: function renderIcon(size) {
70
- return (0, _jsxRuntime.jsx)(_ai.AiOutlineLock, {
71
- size: size
72
- });
73
- },
74
- children: "Domains & TLS"
75
- }), (0, _jsxRuntime.jsxs)(_.NavItem.MenuGroup, {
76
- active: true,
77
- label: "Logs",
78
- renderIcon: function renderIcon(size) {
79
- return (0, _jsxRuntime.jsx)(_bi.BiHistory, {
80
- size: size
81
- });
50
+ children: (0, _jsxRuntime.jsxs)(_.Nav.Menu, {
51
+ sx: {
52
+ mb: 4
82
53
  },
54
+ label: "Nav Menu",
83
55
  children: [(0, _jsxRuntime.jsx)(_.NavItem.Menu, {
56
+ href: "https://wordpress.com",
57
+ renderIcon: function renderIcon(size) {
58
+ return (0, _jsxRuntime.jsx)(_bi.BiGridAlt, {
59
+ size: size
60
+ });
61
+ },
84
62
  as: _CustomLink.CustomLink,
85
- href: "https://google.com/",
86
- children: "Audit"
63
+ children: "Overview"
87
64
  }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
65
+ as: _CustomLink.CustomLink,
66
+ href: "https://random-website.com/",
67
+ renderIcon: function renderIcon(size) {
68
+ return (0, _jsxRuntime.jsx)(_bi.BiWindows, {
69
+ size: size
70
+ });
71
+ },
72
+ children: "Network Sites"
73
+ }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
74
+ as: _CustomLink.CustomLink,
75
+ href: "https://random-website.com/",
76
+ renderIcon: function renderIcon(size) {
77
+ return (0, _jsxRuntime.jsx)(_ai.AiOutlineLock, {
78
+ size: size
79
+ });
80
+ },
81
+ children: "Domains & TLS"
82
+ }), (0, _jsxRuntime.jsxs)(_.NavItem.MenuGroup, {
88
83
  active: true,
84
+ label: "Logs",
85
+ renderIcon: function renderIcon(size) {
86
+ return (0, _jsxRuntime.jsx)(_bi.BiHistory, {
87
+ size: size
88
+ });
89
+ },
90
+ children: [(0, _jsxRuntime.jsx)(_.NavItem.Menu, {
91
+ as: _CustomLink.CustomLink,
92
+ href: "https://google.com/",
93
+ children: "Audit"
94
+ }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
95
+ active: true,
96
+ as: _CustomLink.CustomLink,
97
+ href: "https://wpvip.com/",
98
+ children: "Runtime"
99
+ }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
100
+ as: _CustomLink.CustomLink,
101
+ href: "https://dashboard.wpvip.com/",
102
+ children: "Slow Query"
103
+ })]
104
+ }), (0, _jsxRuntime.jsxs)(_.NavItem.MenuGroup, {
105
+ label: "Performance",
106
+ renderIcon: function renderIcon(size) {
107
+ return (0, _jsxRuntime.jsx)(_bi.BiTachometer, {
108
+ size: size
109
+ });
110
+ },
111
+ children: [(0, _jsxRuntime.jsx)(_.NavItem.Menu, {
112
+ as: _CustomLink.CustomLink,
113
+ href: "https://random-website.com/",
114
+ children: "Metrics"
115
+ }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
116
+ as: _CustomLink.CustomLink,
117
+ href: "https://random-website.com/",
118
+ children: "Monitor"
119
+ }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
120
+ as: _CustomLink.CustomLink,
121
+ href: "https://random-website.com/",
122
+ children: "Cache"
123
+ })]
124
+ }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
89
125
  as: _CustomLink.CustomLink,
90
- href: "https://wpvip.com/",
91
- children: "Runtime"
126
+ href: "https://random-website.com/",
127
+ renderIcon: function renderIcon(size) {
128
+ return (0, _jsxRuntime.jsx)(_bi.BiCodeAlt, {
129
+ size: size
130
+ });
131
+ },
132
+ children: "Code [v]"
92
133
  }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
93
134
  as: _CustomLink.CustomLink,
94
- href: "https://dashboard.wpvip.com/",
95
- children: "Slow Query"
96
- })]
97
- }), (0, _jsxRuntime.jsxs)(_.NavItem.MenuGroup, {
98
- label: "Performance",
99
- renderIcon: function renderIcon(size) {
100
- return (0, _jsxRuntime.jsx)(_bi.BiTachometer, {
101
- size: size
102
- });
103
- },
104
- children: [(0, _jsxRuntime.jsx)(_.NavItem.Menu, {
135
+ href: "https://random-website.com/",
136
+ renderIcon: function renderIcon(size) {
137
+ return (0, _jsxRuntime.jsx)(_bi.BiData, {
138
+ size: size
139
+ });
140
+ },
141
+ children: "Database [v]"
142
+ }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
105
143
  as: _CustomLink.CustomLink,
106
144
  href: "https://random-website.com/",
107
- children: "Metrics"
145
+ renderIcon: function renderIcon(size) {
146
+ return (0, _jsxRuntime.jsx)(_md.MdOutlinePhotoLibrary, {
147
+ size: size
148
+ });
149
+ },
150
+ children: "Media [v]"
108
151
  }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
109
152
  as: _CustomLink.CustomLink,
110
153
  href: "https://random-website.com/",
111
- children: "Monitor"
154
+ renderIcon: function renderIcon(size) {
155
+ return (0, _jsxRuntime.jsx)(_bi.BiBell, {
156
+ size: size
157
+ });
158
+ },
159
+ children: "Notifications"
112
160
  }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
113
161
  as: _CustomLink.CustomLink,
114
162
  href: "https://random-website.com/",
115
- children: "Cache"
163
+ renderIcon: function renderIcon(size) {
164
+ return (0, _jsxRuntime.jsx)(_bi.BiBulb, {
165
+ size: size
166
+ });
167
+ },
168
+ children: "Features"
116
169
  })]
117
- }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
118
- as: _CustomLink.CustomLink,
119
- href: "https://random-website.com/",
120
- renderIcon: function renderIcon(size) {
121
- return (0, _jsxRuntime.jsx)(_bi.BiCodeAlt, {
122
- size: size
123
- });
124
- },
125
- children: "Code [v]"
126
- }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
127
- as: _CustomLink.CustomLink,
128
- href: "https://random-website.com/",
129
- renderIcon: function renderIcon(size) {
130
- return (0, _jsxRuntime.jsx)(_bi.BiData, {
131
- size: size
132
- });
133
- },
134
- children: "Database [v]"
135
- }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
136
- as: _CustomLink.CustomLink,
137
- href: "https://random-website.com/",
138
- renderIcon: function renderIcon(size) {
139
- return (0, _jsxRuntime.jsx)(_md.MdOutlinePhotoLibrary, {
140
- size: size
141
- });
142
- },
143
- children: "Media [v]"
144
- }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
145
- as: _CustomLink.CustomLink,
146
- href: "https://random-website.com/",
147
- renderIcon: function renderIcon(size) {
148
- return (0, _jsxRuntime.jsx)(_bi.BiBell, {
149
- size: size
150
- });
151
- },
152
- children: "Notifications"
153
- }), (0, _jsxRuntime.jsx)(_.NavItem.Menu, {
154
- as: _CustomLink.CustomLink,
155
- href: "https://random-website.com/",
156
- renderIcon: function renderIcon(size) {
157
- return (0, _jsxRuntime.jsx)(_bi.BiBulb, {
158
- size: size
159
- });
160
- },
161
- children: "Features"
162
- })]
170
+ })
163
171
  })
164
172
  })]
165
173
  });
@@ -2,7 +2,7 @@
2
2
  /** @jsxImportSource theme-ui */
3
3
  import * as NavigationMenu from '@radix-ui/react-navigation-menu';
4
4
  export declare const VIP_NAV = "vip-nav-component";
5
- export type NavVariant = 'primary' | 'tabs' | 'toolbar' | 'menu' | 'menu-inverse' | 'breadcrumbs';
5
+ export type NavVariant = 'primary' | 'tabs' | 'toolbar' | 'menu' | 'menu-inverse' | 'breadcrumbs' | 'primary-inverse';
6
6
  export interface NavProps extends NavigationMenu.NavigationMenuProps {
7
7
  className?: string;
8
8
  variant?: NavVariant;
@@ -12,6 +12,7 @@ export interface NavProps extends NavigationMenu.NavigationMenuProps {
12
12
  export type NavItemRenderIconProp = (size: number) => JSX.Element | null;
13
13
  export declare const Nav: {
14
14
  Primary: import("react").ForwardRefExoticComponent<NavProps & import("react").RefAttributes<HTMLElement>>;
15
+ PrimaryInverse: import("react").ForwardRefExoticComponent<NavProps & import("react").RefAttributes<HTMLElement>>;
15
16
  Tab: import("react").ForwardRefExoticComponent<NavProps & import("react").RefAttributes<HTMLElement>>;
16
17
  Toolbar: import("react").ForwardRefExoticComponent<NavProps & import("react").RefAttributes<HTMLElement>>;
17
18
  Menu: import("react").ForwardRefExoticComponent<NavProps & import("react").RefAttributes<HTMLElement>>;
@@ -24,7 +24,7 @@ var NavBase = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
24
24
  "aria-label": label,
25
25
  ref: ref,
26
26
  className: (0, _classnames["default"])(VIP_NAV, className),
27
- sx: (0, _styles.navStyles)(variant),
27
+ sx: (0, _styles.navStyles)(variant, orientation),
28
28
  orientation: orientation,
29
29
  children: (0, _jsxRuntime.jsx)(NavigationMenu.List, {
30
30
  className: (0, _classnames["default"])(VIP_NAV + "-list"),
@@ -39,6 +39,12 @@ var NavPrimary = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
39
39
  ref: ref
40
40
  }));
41
41
  });
42
+ var NavPrimaryInverse = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
43
+ return (0, _jsxRuntime.jsx)(NavBase, _extends({}, props, {
44
+ variant: "primary-inverse",
45
+ ref: ref
46
+ }));
47
+ });
42
48
  var NavTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
43
49
  return (0, _jsxRuntime.jsx)(NavBase, _extends({}, props, {
44
50
  variant: "tabs",
@@ -60,6 +66,7 @@ var NavMenu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
60
66
  });
61
67
  var Nav = exports.Nav = {
62
68
  Primary: NavPrimary,
69
+ PrimaryInverse: NavPrimaryInverse,
63
70
  Tab: NavTab,
64
71
  Toolbar: NavToolbar,
65
72
  Menu: NavMenu
@@ -5,6 +5,7 @@ declare const _default: {
5
5
  title: string;
6
6
  component: {
7
7
  Primary: import("react").ForwardRefExoticComponent<import("./Nav").NavProps & import("react").RefAttributes<HTMLElement>>;
8
+ PrimaryInverse: import("react").ForwardRefExoticComponent<import("./Nav").NavProps & import("react").RefAttributes<HTMLElement>>;
8
9
  Tab: import("react").ForwardRefExoticComponent<import("./Nav").NavProps & import("react").RefAttributes<HTMLElement>>;
9
10
  Toolbar: import("react").ForwardRefExoticComponent<import("./Nav").NavProps & import("react").RefAttributes<HTMLElement>>;
10
11
  Menu: import("react").ForwardRefExoticComponent<import("./Nav").NavProps & import("react").RefAttributes<HTMLElement>>;
@@ -68,22 +68,34 @@ var Tab = exports.Tab = {
68
68
  },
69
69
  label: "Nav Tab",
70
70
  children: [(0, _jsxRuntime.jsx)(_NavItem.NavItem.Tab, {
71
- active: true,
72
71
  as: _CustomLink.CustomLink,
73
- href: "https://random-website.com/",
72
+ href: "#!",
74
73
  children: "PHP"
75
74
  }), (0, _jsxRuntime.jsx)(_NavItem.NavItem.Tab, {
76
75
  as: _CustomLink.CustomLink,
77
- href: "https://wordpress.com",
76
+ href: "#2!",
78
77
  children: "WordPress"
79
78
  }), (0, _jsxRuntime.jsx)(_NavItem.NavItem.Tab, {
79
+ active: true,
80
80
  as: _CustomLink.CustomLink,
81
- href: "https://newrelic.com/",
81
+ href: "#3!",
82
82
  children: "New Relic"
83
+ }), (0, _jsxRuntime.jsx)(_NavItem.NavItem.Tab, {
84
+ as: _CustomLink.CustomLink,
85
+ href: "#4!",
86
+ children: "Datadog"
87
+ }), (0, _jsxRuntime.jsx)(_NavItem.NavItem.Tab, {
88
+ as: _CustomLink.CustomLink,
89
+ href: "#4!",
90
+ children: "OnePlus"
91
+ }), (0, _jsxRuntime.jsx)(_NavItem.NavItem.Tab, {
92
+ as: _CustomLink.CustomLink,
93
+ href: "#5!",
94
+ children: "Rollbar"
83
95
  }), (0, _jsxRuntime.jsx)(_NavItem.NavItem.Tab, {
84
96
  disabled: true,
85
97
  as: _CustomLink.CustomLink,
86
- href: "https://google.com/",
98
+ href: "#6!",
87
99
  children: "Not accessible"
88
100
  })]
89
101
  })]
@@ -4,6 +4,7 @@ type MixedStyleProp = {
4
4
  [key: string]: string | number | MixedStyleProp | ThemeUIStyleObject;
5
5
  };
6
6
  export declare const menuItemStyles: (orientation: NavProps['orientation']) => ThemeUIStyleObject;
7
+ export declare const tabItemStyles: (orientation: NavProps['orientation']) => ThemeUIStyleObject;
7
8
  export declare const menuInverseItemStyles: (orientation: NavProps['orientation']) => ThemeUIStyleObject;
8
9
  export declare const menuItemLinkStyles: MixedStyleProp;
9
10
  export declare const menuInverseItemLinkStyles: {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.menuItemStyles = exports.menuItemLinkStyles = exports.menuInverseItemStyles = exports.menuInverseItemLinkStyles = void 0;
4
+ exports.tabItemStyles = exports.menuItemStyles = exports.menuItemLinkStyles = exports.menuInverseItemStyles = exports.menuInverseItemLinkStyles = void 0;
5
5
  var _primary = require("./primary");
6
6
  var _menuItemLinkStyles, _extends2;
7
7
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -16,12 +16,19 @@ var menuItemStyles = exports.menuItemStyles = function menuItemStyles(orientatio
16
16
  });
17
17
  };
18
18
 
19
+ // Tab Item Style <li>
20
+ var tabItemStyles = exports.tabItemStyles = function tabItemStyles(orientation) {
21
+ return _extends({}, (0, _primary.defaultNavItemStyles)(orientation), {
22
+ mr: 0
23
+ });
24
+ };
25
+
19
26
  // Menu Inverse Item Style <li>
20
27
  var menuInverseItemStyles = exports.menuInverseItemStyles = function menuInverseItemStyles(orientation) {
21
28
  return _extends({}, menuItemStyles(orientation), {
22
29
  width: '100%',
23
30
  mr: 0,
24
- height: 45,
31
+ height: 38,
25
32
  color: 'toolbar.text.default'
26
33
  });
27
34
  };
@@ -1,3 +1,4 @@
1
1
  import { ThemeUIStyleObject } from 'theme-ui';
2
- export declare const tabRootStyles: ThemeUIStyleObject;
2
+ import { NavProps } from '../../Nav';
3
+ export declare const tabRootStyles: (orientation: NavProps['orientation']) => ThemeUIStyleObject;
3
4
  export declare const tabItemLinkStyles: ThemeUIStyleObject;
@@ -5,27 +5,61 @@ exports.tabRootStyles = exports.tabItemLinkStyles = void 0;
5
5
  var _primary = require("./primary");
6
6
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
7
7
  // Tab Root Styles <nav>
8
-
9
- var tabRootStyles = exports.tabRootStyles = {
10
- width: '100%',
11
- borderColor: 'borders.2'
8
+ var getTabPropsByOrientation = function getTabPropsByOrientation(orientation) {
9
+ if (orientation === 'vertical') {
10
+ return {
11
+ '> div:first-of-type': {
12
+ height: '100%',
13
+ overflowY: 'auto'
14
+ },
15
+ ul: {
16
+ minHeight: 'max-content'
17
+ }
18
+ };
19
+ }
20
+ return {
21
+ '> div:first-of-type': {
22
+ width: '100%',
23
+ overflowX: 'auto'
24
+ },
25
+ ul: {
26
+ minWidth: 'max-content'
27
+ }
28
+ };
29
+ };
30
+ var tabRootStyles = exports.tabRootStyles = function tabRootStyles(orientation) {
31
+ return _extends({
32
+ width: '100%',
33
+ borderColor: 'borders.2',
34
+ gap: 2
35
+ }, getTabPropsByOrientation(orientation));
12
36
  };
13
37
 
14
38
  // Tab Link <a>
15
39
  var tabItemLinkStyles = exports.tabItemLinkStyles = _extends({}, _primary.defaultItemLinkStyles, {
16
- px: 0,
17
- mr: 2,
40
+ px: 2,
41
+ height: '100%',
42
+ backgroundColor: 'red',
18
43
  color: 'heading',
19
44
  '&[data-active]': {
20
45
  color: 'link',
21
46
  fontWeight: 'normal',
22
- boxShadow: 'inset 0 -1px 0 0, 0 1px 0 0'
47
+ position: 'relative',
48
+ '&::after': {
49
+ position: 'absolute',
50
+ bottom: 0,
51
+ display: 'block',
52
+ width: '100%',
53
+ content: '""',
54
+ height: '0.125rem',
55
+ backgroundColor: 'link'
56
+ }
23
57
  },
24
58
  '&[aria-disabled="true"]': {
25
59
  color: 'muted'
26
60
  },
27
61
  ':hover': {
28
62
  fontWeight: 'regular',
29
- color: 'heading'
63
+ color: 'link'
30
64
  }
31
65
  });
@@ -3,6 +3,5 @@ import { NavProps, NavVariant } from './Nav';
3
3
  export declare const navItemLinkVariantStyles: (variant: NavVariant) => ThemeUIStyleObject;
4
4
  export declare const navItemLinkStyles: (variant: NavVariant) => ThemeUIStyleObject;
5
5
  export declare const navItemStyles: (orientation: NavProps['orientation'], variant?: NavVariant) => ThemeUIStyleObject;
6
- export declare const navRootStyles: (variant: NavVariant) => ThemeUIStyleObject;
7
- export declare const navStyles: (variant: NavVariant) => ThemeUIStyleObject;
6
+ export declare const navStyles: (variant: NavVariant, orientation: NavProps['orientation']) => ThemeUIStyleObject;
8
7
  export declare const navMenuListStyles: (orientation: NavProps['orientation']) => ThemeUIStyleObject;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.navStyles = exports.navRootStyles = exports.navMenuListStyles = exports.navItemStyles = exports.navItemLinkVariantStyles = exports.navItemLinkStyles = void 0;
4
+ exports.navStyles = exports.navMenuListStyles = exports.navItemStyles = exports.navItemLinkVariantStyles = exports.navItemLinkStyles = void 0;
5
5
  var _breadcrumbs = require("./styles/variants/breadcrumbs");
6
6
  var _menu = require("./styles/variants/menu");
7
7
  var _primary = require("./styles/variants/primary");
@@ -57,6 +57,10 @@ var navItemStyles = exports.navItemStyles = function navItemStyles(orientation,
57
57
  {
58
58
  return (0, _menu.menuItemStyles)(orientation);
59
59
  }
60
+ case 'tabs':
61
+ {
62
+ return (0, _menu.tabItemStyles)(orientation);
63
+ }
60
64
  case 'menu-inverse':
61
65
  {
62
66
  return (0, _menu.menuInverseItemStyles)(orientation);
@@ -71,28 +75,12 @@ var navItemStyles = exports.navItemStyles = function navItemStyles(orientation,
71
75
  }
72
76
  }
73
77
  };
74
- var navRootStyles = exports.navRootStyles = function navRootStyles(variant) {
75
- switch (variant) {
76
- case 'tabs':
77
- {
78
- return _tabs.tabRootStyles;
79
- }
80
- case 'toolbar':
81
- {
82
- return _toolbar.toolbarRootStyles;
83
- }
84
- default:
85
- {
86
- return _primary.defaultNavRootStyles;
87
- }
88
- }
89
- };
90
- var navStyles = exports.navStyles = function navStyles(variant) {
78
+ var navStyles = exports.navStyles = function navStyles(variant, orientation) {
91
79
  var navStyle = {};
92
80
  switch (variant) {
93
81
  case 'tabs':
94
82
  {
95
- navStyle = _tabs.tabRootStyles;
83
+ navStyle = (0, _tabs.tabRootStyles)(orientation);
96
84
  }
97
85
  break;
98
86
  case 'toolbar':
@@ -100,6 +88,15 @@ var navStyles = exports.navStyles = function navStyles(variant) {
100
88
  navStyle = _toolbar.toolbarRootStyles;
101
89
  }
102
90
  break;
91
+ case 'primary-inverse':
92
+ {
93
+ navStyle = _extends({}, _primary.defaultNavRootStyles, {
94
+ px: 5,
95
+ pt: 2,
96
+ pb: 4
97
+ });
98
+ }
99
+ break;
103
100
  default:
104
101
  {
105
102
  navStyle = _primary.defaultNavRootStyles;
@@ -38,6 +38,7 @@ export const Default = () => (
38
38
  </TabsContent>
39
39
  </Tabs>
40
40
  );
41
+
41
42
  export const SetActiveTab = () => {
42
43
  const [ activeTab, setActiveTab ] = React.useState( 'all' );
43
44
 
@@ -24,7 +24,16 @@ const styles = {
24
24
  '&[data-state="active"]': {
25
25
  color: 'link',
26
26
  fontWeight: 'regular',
27
- boxShadow: 'inset 0 -1px 0 0, 0 1px 0 0',
27
+ position: 'relative',
28
+ '&::after': {
29
+ position: 'absolute',
30
+ bottom: 0,
31
+ display: 'block',
32
+ width: '100%',
33
+ content: '""',
34
+ height: '0.125rem',
35
+ backgroundColor: 'link',
36
+ },
28
37
  },
29
38
  '&:disabled': {
30
39
  color: 'muted',
@@ -326,6 +326,7 @@ declare namespace _default {
326
326
  '&:hover': {
327
327
  textDecorationLine: string;
328
328
  textDecorationThickness: string;
329
+ textUnderlineOffset: string;
329
330
  };
330
331
  };
331
332
  export namespace svg {
@@ -536,7 +536,8 @@ export default {
536
536
  a: {
537
537
  '&:hover': {
538
538
  textDecorationLine: 'underline',
539
- textDecorationThickness: '2px',
539
+ textDecorationThickness: '0.125rem',
540
+ textUnderlineOffset: '0.250rem',
540
541
  },
541
542
  },
542
543
  svg: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip-design-system",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "main": "build/system/index.js",
5
5
  "scripts": {
6
6
  "build-storybook": "storybook build",
@@ -15,7 +15,7 @@
15
15
  "format:check": "npm run cmd:format -- --check",
16
16
  "jest": "NODE_ENV=test jest --env=jsdom",
17
17
  "jest:coverage": "npm run jest && open-cli ./coverage/index.html",
18
- "jest:watch": "npm run jest --watch",
18
+ "jest:watch": "npm run jest -- --watch",
19
19
  "theme-builder-copy": "npm run theme-builder-copy-light && npm run theme-builder-copy-dark",
20
20
  "theme-builder-copy-light": "mkdir -p build/system/theme/generated/ && cp src/system/theme/generated/valet-theme-light.json build/system/theme/generated/valet-theme-light.json",
21
21
  "theme-builder-copy-dark": "mkdir -p build/system/theme/generated/ && cp src/system/theme/generated/valet-theme-dark.json build/system/theme/generated/valet-theme-dark.json",
@@ -14,7 +14,7 @@ import {
14
14
  import { MdOutlinePhotoLibrary } from 'react-icons/md';
15
15
 
16
16
  import { MobileMenu, MobileMenuTrigger, MobileMenuWrapper } from './MobileMenu';
17
- import { Nav, NavItem } from '..';
17
+ import { Flex, Nav, NavItem } from '..';
18
18
  import { CustomLink } from '../utils/stories/CustomLink';
19
19
 
20
20
  import type { StoryObj } from '@storybook/react';
@@ -73,91 +73,100 @@ export const MobileMenuExample = () => (
73
73
  </>
74
74
  }
75
75
  >
76
- <Nav.Menu sx={ { mb: 4 } } label="Nav Menu">
77
- <NavItem.Menu
78
- href="https://wordpress.com"
79
- renderIcon={ size => <BiGridAlt size={ size } /> }
80
- as={ CustomLink }
81
- >
82
- Overview
83
- </NavItem.Menu>
84
- <NavItem.Menu
85
- as={ CustomLink }
86
- href="https://random-website.com/"
87
- renderIcon={ size => <BiWindows size={ size } /> }
88
- >
89
- Network Sites
90
- </NavItem.Menu>
91
- <NavItem.Menu
92
- as={ CustomLink }
93
- href="https://random-website.com/"
94
- renderIcon={ size => <AiOutlineLock size={ size } /> }
95
- >
96
- Domains & TLS
97
- </NavItem.Menu>
98
-
99
- <NavItem.MenuGroup active label="Logs" renderIcon={ size => <BiHistory size={ size } /> }>
100
- <NavItem.Menu as={ CustomLink } href="https://google.com/">
101
- Audit
76
+ <Flex
77
+ sx={ {
78
+ gap: 3,
79
+ px: 5,
80
+ py: 0,
81
+ flexDirection: 'column',
82
+ } }
83
+ >
84
+ <Nav.Menu sx={ { mb: 4 } } label="Nav Menu">
85
+ <NavItem.Menu
86
+ href="https://wordpress.com"
87
+ renderIcon={ size => <BiGridAlt size={ size } /> }
88
+ as={ CustomLink }
89
+ >
90
+ Overview
102
91
  </NavItem.Menu>
103
- <NavItem.Menu active as={ CustomLink } href="https://wpvip.com/">
104
- Runtime
92
+ <NavItem.Menu
93
+ as={ CustomLink }
94
+ href="https://random-website.com/"
95
+ renderIcon={ size => <BiWindows size={ size } /> }
96
+ >
97
+ Network Sites
105
98
  </NavItem.Menu>
106
- <NavItem.Menu as={ CustomLink } href="https://dashboard.wpvip.com/">
107
- Slow Query
99
+ <NavItem.Menu
100
+ as={ CustomLink }
101
+ href="https://random-website.com/"
102
+ renderIcon={ size => <AiOutlineLock size={ size } /> }
103
+ >
104
+ Domains & TLS
108
105
  </NavItem.Menu>
109
- </NavItem.MenuGroup>
110
-
111
- <NavItem.MenuGroup
112
- label="Performance"
113
- renderIcon={ size => <BiTachometer size={ size } /> }
114
- >
115
- <NavItem.Menu as={ CustomLink } href="https://random-website.com/">
116
- Metrics
106
+
107
+ <NavItem.MenuGroup active label="Logs" renderIcon={ size => <BiHistory size={ size } /> }>
108
+ <NavItem.Menu as={ CustomLink } href="https://google.com/">
109
+ Audit
110
+ </NavItem.Menu>
111
+ <NavItem.Menu active as={ CustomLink } href="https://wpvip.com/">
112
+ Runtime
113
+ </NavItem.Menu>
114
+ <NavItem.Menu as={ CustomLink } href="https://dashboard.wpvip.com/">
115
+ Slow Query
116
+ </NavItem.Menu>
117
+ </NavItem.MenuGroup>
118
+
119
+ <NavItem.MenuGroup
120
+ label="Performance"
121
+ renderIcon={ size => <BiTachometer size={ size } /> }
122
+ >
123
+ <NavItem.Menu as={ CustomLink } href="https://random-website.com/">
124
+ Metrics
125
+ </NavItem.Menu>
126
+ <NavItem.Menu as={ CustomLink } href="https://random-website.com/">
127
+ Monitor
128
+ </NavItem.Menu>
129
+ <NavItem.Menu as={ CustomLink } href="https://random-website.com/">
130
+ Cache
131
+ </NavItem.Menu>
132
+ </NavItem.MenuGroup>
133
+ <NavItem.Menu
134
+ as={ CustomLink }
135
+ href="https://random-website.com/"
136
+ renderIcon={ size => <BiCodeAlt size={ size } /> }
137
+ >
138
+ Code [v]
139
+ </NavItem.Menu>
140
+ <NavItem.Menu
141
+ as={ CustomLink }
142
+ href="https://random-website.com/"
143
+ renderIcon={ size => <BiData size={ size } /> }
144
+ >
145
+ Database [v]
146
+ </NavItem.Menu>
147
+ <NavItem.Menu
148
+ as={ CustomLink }
149
+ href="https://random-website.com/"
150
+ renderIcon={ size => <MdOutlinePhotoLibrary size={ size } /> }
151
+ >
152
+ Media [v]
117
153
  </NavItem.Menu>
118
- <NavItem.Menu as={ CustomLink } href="https://random-website.com/">
119
- Monitor
154
+ <NavItem.Menu
155
+ as={ CustomLink }
156
+ href="https://random-website.com/"
157
+ renderIcon={ size => <BiBell size={ size } /> }
158
+ >
159
+ Notifications
120
160
  </NavItem.Menu>
121
- <NavItem.Menu as={ CustomLink } href="https://random-website.com/">
122
- Cache
161
+ <NavItem.Menu
162
+ as={ CustomLink }
163
+ href="https://random-website.com/"
164
+ renderIcon={ size => <BiBulb size={ size } /> }
165
+ >
166
+ Features
123
167
  </NavItem.Menu>
124
- </NavItem.MenuGroup>
125
- <NavItem.Menu
126
- as={ CustomLink }
127
- href="https://random-website.com/"
128
- renderIcon={ size => <BiCodeAlt size={ size } /> }
129
- >
130
- Code [v]
131
- </NavItem.Menu>
132
- <NavItem.Menu
133
- as={ CustomLink }
134
- href="https://random-website.com/"
135
- renderIcon={ size => <BiData size={ size } /> }
136
- >
137
- Database [v]
138
- </NavItem.Menu>
139
- <NavItem.Menu
140
- as={ CustomLink }
141
- href="https://random-website.com/"
142
- renderIcon={ size => <MdOutlinePhotoLibrary size={ size } /> }
143
- >
144
- Media [v]
145
- </NavItem.Menu>
146
- <NavItem.Menu
147
- as={ CustomLink }
148
- href="https://random-website.com/"
149
- renderIcon={ size => <BiBell size={ size } /> }
150
- >
151
- Notifications
152
- </NavItem.Menu>
153
- <NavItem.Menu
154
- as={ CustomLink }
155
- href="https://random-website.com/"
156
- renderIcon={ size => <BiBulb size={ size } /> }
157
- >
158
- Features
159
- </NavItem.Menu>
160
- </Nav.Menu>
168
+ </Nav.Menu>
169
+ </Flex>
161
170
  </MobileMenu>
162
171
  </MobileMenuWrapper>
163
172
  );
@@ -53,9 +53,9 @@ export const MobileMenu = forwardRef< HTMLDivElement, MobileMenuProps >(
53
53
  >
54
54
  <Flex sx={ { width: '100%', flexDirection: 'column' } }>
55
55
  { toolbarItems && (
56
- <Nav.Primary label="Main Links" orientation="vertical">
56
+ <Nav.PrimaryInverse label="Main Links" orientation="vertical">
57
57
  { toolbarItems }
58
- </Nav.Primary>
58
+ </Nav.PrimaryInverse>
59
59
  ) }
60
60
 
61
61
  <Box
@@ -115,16 +115,25 @@ export const Tab: Story = {
115
115
  <strong>Variant: Tab</strong>
116
116
  </p>
117
117
  <Nav.Tab sx={ { mb: 4 } } label="Nav Tab">
118
- <NavItem.Tab active as={ CustomLink } href="https://random-website.com/">
118
+ <NavItem.Tab as={ CustomLink } href="#!">
119
119
  PHP
120
120
  </NavItem.Tab>
121
- <NavItem.Tab as={ CustomLink } href="https://wordpress.com">
121
+ <NavItem.Tab as={ CustomLink } href="#2!">
122
122
  WordPress
123
123
  </NavItem.Tab>
124
- <NavItem.Tab as={ CustomLink } href="https://newrelic.com/">
124
+ <NavItem.Tab active as={ CustomLink } href="#3!">
125
125
  New Relic
126
126
  </NavItem.Tab>
127
- <NavItem.Tab disabled as={ CustomLink } href="https://google.com/">
127
+ <NavItem.Tab as={ CustomLink } href="#4!">
128
+ Datadog
129
+ </NavItem.Tab>
130
+ <NavItem.Tab as={ CustomLink } href="#4!">
131
+ OnePlus
132
+ </NavItem.Tab>
133
+ <NavItem.Tab as={ CustomLink } href="#5!">
134
+ Rollbar
135
+ </NavItem.Tab>
136
+ <NavItem.Tab disabled as={ CustomLink } href="#6!">
128
137
  Not accessible
129
138
  </NavItem.Tab>
130
139
  </Nav.Tab>
@@ -6,7 +6,14 @@ import { Ref, forwardRef } from 'react';
6
6
  import { navMenuListStyles, navStyles } from './styles';
7
7
 
8
8
  export const VIP_NAV = 'vip-nav-component';
9
- export type NavVariant = 'primary' | 'tabs' | 'toolbar' | 'menu' | 'menu-inverse' | 'breadcrumbs';
9
+ export type NavVariant =
10
+ | 'primary'
11
+ | 'tabs'
12
+ | 'toolbar'
13
+ | 'menu'
14
+ | 'menu-inverse'
15
+ | 'breadcrumbs'
16
+ | 'primary-inverse';
10
17
 
11
18
  export interface NavProps extends NavigationMenu.NavigationMenuProps {
12
19
  className?: string;
@@ -24,7 +31,7 @@ const NavBase = forwardRef< HTMLElement, NavProps >(
24
31
  aria-label={ label }
25
32
  ref={ ref }
26
33
  className={ classNames( VIP_NAV, className ) }
27
- sx={ navStyles( variant ) }
34
+ sx={ navStyles( variant, orientation ) }
28
35
  orientation={ orientation }
29
36
  >
30
37
  <NavigationMenu.List
@@ -43,6 +50,12 @@ const NavPrimary = forwardRef< HTMLElement, NavProps >(
43
50
  )
44
51
  );
45
52
 
53
+ const NavPrimaryInverse = forwardRef< HTMLElement, NavProps >(
54
+ ( props: NavProps, ref: Ref< HTMLElement > ) => (
55
+ <NavBase { ...props } variant="primary-inverse" ref={ ref } />
56
+ )
57
+ );
58
+
46
59
  const NavTab = forwardRef< HTMLElement, NavProps >(
47
60
  ( props: NavProps, ref: Ref< HTMLElement > ) => (
48
61
  <NavBase { ...props } variant="tabs" ref={ ref } />
@@ -65,6 +78,7 @@ export type NavItemRenderIconProp = ( size: number ) => JSX.Element | null;
65
78
 
66
79
  export const Nav = {
67
80
  Primary: NavPrimary,
81
+ PrimaryInverse: NavPrimaryInverse,
68
82
  Tab: NavTab,
69
83
  Toolbar: NavToolbar,
70
84
  Menu: NavMenu,
@@ -17,6 +17,12 @@ export const menuItemStyles = ( orientation: NavProps[ 'orientation' ] ): ThemeU
17
17
  justifyContent: 'space-between',
18
18
  } );
19
19
 
20
+ // Tab Item Style <li>
21
+ export const tabItemStyles = ( orientation: NavProps[ 'orientation' ] ): ThemeUIStyleObject => ( {
22
+ ...defaultNavItemStyles( orientation ),
23
+ mr: 0,
24
+ } );
25
+
20
26
  // Menu Inverse Item Style <li>
21
27
  export const menuInverseItemStyles = (
22
28
  orientation: NavProps[ 'orientation' ]
@@ -24,7 +30,7 @@ export const menuInverseItemStyles = (
24
30
  ...menuItemStyles( orientation ),
25
31
  width: '100%',
26
32
  mr: 0,
27
- height: 45,
33
+ height: 38,
28
34
  color: 'toolbar.text.default',
29
35
  } );
30
36
 
@@ -1,27 +1,64 @@
1
1
  import { ThemeUIStyleObject } from 'theme-ui';
2
2
 
3
3
  import { defaultItemLinkStyles } from './primary';
4
+ import { NavProps } from '../../Nav';
4
5
 
5
6
  // Tab Root Styles <nav>
7
+ const getTabPropsByOrientation = ( orientation: NavProps[ 'orientation' ] ): ThemeUIStyleObject => {
8
+ if ( orientation === 'vertical' ) {
9
+ return {
10
+ '> div:first-of-type': {
11
+ height: '100%',
12
+ overflowY: 'auto',
13
+ },
14
+ ul: {
15
+ minHeight: 'max-content',
16
+ },
17
+ };
18
+ }
19
+ return {
20
+ '> div:first-of-type': {
21
+ width: '100%',
22
+ overflowX: 'auto',
23
+ },
24
+ ul: {
25
+ minWidth: 'max-content',
26
+ },
27
+ };
28
+ };
6
29
 
7
- export const tabRootStyles: ThemeUIStyleObject = {
30
+ export const tabRootStyles = ( orientation: NavProps[ 'orientation' ] ): ThemeUIStyleObject => ( {
8
31
  width: '100%',
9
32
  borderColor: 'borders.2',
10
- };
33
+ gap: 2,
34
+
35
+ // Responsive in case the content is bigger than the viewport
36
+ ...getTabPropsByOrientation( orientation ),
37
+ } );
11
38
 
12
39
  // Tab Link <a>
13
40
  export const tabItemLinkStyles: ThemeUIStyleObject = {
14
41
  ...defaultItemLinkStyles,
15
- px: 0,
16
- mr: 2,
42
+ px: 2,
43
+ height: '100%',
44
+ backgroundColor: 'red',
17
45
  color: 'heading',
18
46
  '&[data-active]': {
19
47
  color: 'link',
20
48
  fontWeight: 'normal',
21
- boxShadow: 'inset 0 -1px 0 0, 0 1px 0 0',
49
+ position: 'relative',
50
+ '&::after': {
51
+ position: 'absolute',
52
+ bottom: 0,
53
+ display: 'block',
54
+ width: '100%',
55
+ content: '""',
56
+ height: '0.125rem',
57
+ backgroundColor: 'link',
58
+ },
22
59
  },
23
60
  '&[aria-disabled="true"]': {
24
61
  color: 'muted',
25
62
  },
26
- ':hover': { fontWeight: 'regular', color: 'heading' },
63
+ ':hover': { fontWeight: 'regular', color: 'link' },
27
64
  };
@@ -8,6 +8,7 @@ import {
8
8
  menuInverseItemStyles,
9
9
  menuItemLinkStyles,
10
10
  menuItemStyles,
11
+ tabItemStyles,
11
12
  } from './styles/variants/menu';
12
13
  import {
13
14
  defaultNavItemStyles,
@@ -68,6 +69,9 @@ export const navItemStyles = (
68
69
  case 'menu': {
69
70
  return menuItemStyles( orientation );
70
71
  }
72
+ case 'tabs': {
73
+ return tabItemStyles( orientation );
74
+ }
71
75
  case 'menu-inverse': {
72
76
  return menuInverseItemStyles( orientation );
73
77
  }
@@ -82,29 +86,16 @@ export const navItemStyles = (
82
86
  }
83
87
  };
84
88
 
85
- export const navRootStyles = ( variant: NavVariant ): ThemeUIStyleObject => {
86
- switch ( variant ) {
87
- case 'tabs': {
88
- return tabRootStyles;
89
- }
90
-
91
- case 'toolbar': {
92
- return toolbarRootStyles;
93
- }
94
-
95
- default: {
96
- return defaultNavRootStyles;
97
- }
98
- }
99
- };
100
-
101
- export const navStyles = ( variant: NavVariant ): ThemeUIStyleObject => {
89
+ export const navStyles = (
90
+ variant: NavVariant,
91
+ orientation: NavProps[ 'orientation' ]
92
+ ): ThemeUIStyleObject => {
102
93
  let navStyle: ThemeUIStyleObject = {};
103
94
 
104
95
  switch ( variant ) {
105
96
  case 'tabs':
106
97
  {
107
- navStyle = tabRootStyles;
98
+ navStyle = tabRootStyles( orientation );
108
99
  }
109
100
 
110
101
  break;
@@ -113,6 +104,17 @@ export const navStyles = ( variant: NavVariant ): ThemeUIStyleObject => {
113
104
  navStyle = toolbarRootStyles;
114
105
  }
115
106
 
107
+ break;
108
+ case 'primary-inverse':
109
+ {
110
+ navStyle = {
111
+ ...defaultNavRootStyles,
112
+ px: 5,
113
+ pt: 2,
114
+ pb: 4,
115
+ };
116
+ }
117
+
116
118
  break;
117
119
  default: {
118
120
  navStyle = defaultNavRootStyles;
@@ -38,6 +38,7 @@ export const Default = () => (
38
38
  </TabsContent>
39
39
  </Tabs>
40
40
  );
41
+
41
42
  export const SetActiveTab = () => {
42
43
  const [ activeTab, setActiveTab ] = React.useState( 'all' );
43
44
 
@@ -24,7 +24,16 @@ const styles = {
24
24
  '&[data-state="active"]': {
25
25
  color: 'link',
26
26
  fontWeight: 'regular',
27
- boxShadow: 'inset 0 -1px 0 0, 0 1px 0 0',
27
+ position: 'relative',
28
+ '&::after': {
29
+ position: 'absolute',
30
+ bottom: 0,
31
+ display: 'block',
32
+ width: '100%',
33
+ content: '""',
34
+ height: '0.125rem',
35
+ backgroundColor: 'link',
36
+ },
28
37
  },
29
38
  '&:disabled': {
30
39
  color: 'muted',
@@ -536,7 +536,8 @@ export default {
536
536
  a: {
537
537
  '&:hover': {
538
538
  textDecorationLine: 'underline',
539
- textDecorationThickness: '2px',
539
+ textDecorationThickness: '0.125rem',
540
+ textUnderlineOffset: '0.250rem',
540
541
  },
541
542
  },
542
543
  svg: {