@zendeskgarden/react-chrome 9.0.0-next.16 → 9.0.0-next.18

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 (70) hide show
  1. package/dist/esm/elements/Chrome.js +9 -8
  2. package/dist/esm/elements/header/HeaderItemIcon.js +2 -18
  3. package/dist/esm/elements/nav/Nav.js +13 -7
  4. package/dist/esm/elements/nav/NavItem.js +5 -11
  5. package/dist/esm/elements/nav/NavItemIcon.js +2 -18
  6. package/dist/esm/elements/sheet/Sheet.js +1 -1
  7. package/dist/esm/styled/StyledChrome.js +1 -1
  8. package/dist/esm/styled/StyledSkipNav.js +43 -15
  9. package/dist/esm/styled/StyledSkipNavIcon.js +10 -4
  10. package/dist/esm/styled/body/StyledBody.js +6 -3
  11. package/dist/esm/styled/body/StyledContent.js +18 -6
  12. package/dist/esm/styled/body/StyledMain.js +6 -3
  13. package/dist/esm/styled/footer/StyledFooter.js +28 -7
  14. package/dist/esm/styled/footer/StyledFooterItem.js +1 -1
  15. package/dist/esm/styled/header/StyledBaseHeaderItem.js +24 -15
  16. package/dist/esm/styled/header/StyledHeader.js +46 -12
  17. package/dist/esm/styled/header/StyledHeaderItem.js +46 -14
  18. package/dist/esm/styled/header/StyledHeaderItemIcon.js +13 -5
  19. package/dist/esm/styled/header/StyledHeaderItemText.js +5 -5
  20. package/dist/esm/styled/header/StyledHeaderItemWrapper.js +1 -1
  21. package/dist/esm/styled/header/StyledLogoHeaderItem.js +33 -21
  22. package/dist/esm/styled/nav/StyledBaseNavItem.js +12 -11
  23. package/dist/esm/styled/nav/StyledBrandmarkNavItem.js +2 -2
  24. package/dist/esm/styled/nav/StyledLogoNavItem.js +15 -22
  25. package/dist/esm/styled/nav/StyledNav.js +33 -13
  26. package/dist/esm/styled/nav/StyledNavButton.js +64 -35
  27. package/dist/esm/styled/nav/StyledNavItemIcon.js +12 -5
  28. package/dist/esm/styled/nav/StyledNavItemText.js +19 -14
  29. package/dist/esm/styled/nav/StyledNavList.js +1 -1
  30. package/dist/esm/styled/nav/StyledNavListItem.js +1 -1
  31. package/dist/esm/styled/sheet/StyledSheet.js +32 -17
  32. package/dist/esm/styled/sheet/StyledSheetBody.js +1 -1
  33. package/dist/esm/styled/sheet/StyledSheetClose.js +13 -16
  34. package/dist/esm/styled/sheet/StyledSheetDescription.js +6 -3
  35. package/dist/esm/styled/sheet/StyledSheetFooter.js +23 -4
  36. package/dist/esm/styled/sheet/StyledSheetFooterItem.js +1 -1
  37. package/dist/esm/styled/sheet/StyledSheetHeader.js +27 -5
  38. package/dist/esm/styled/sheet/StyledSheetTitle.js +6 -3
  39. package/dist/esm/styled/sheet/StyledSheetWrapper.js +21 -18
  40. package/dist/esm/styled/utils.js +20 -0
  41. package/dist/index.cjs.js +662 -403
  42. package/dist/typings/elements/header/HeaderItemIcon.d.ts +1 -1
  43. package/dist/typings/elements/nav/NavItemIcon.d.ts +1 -1
  44. package/dist/typings/styled/StyledSkipNav.d.ts +0 -3
  45. package/dist/typings/styled/StyledSkipNavIcon.d.ts +2 -2
  46. package/dist/typings/styled/body/StyledContent.d.ts +2 -1
  47. package/dist/typings/styled/footer/StyledFooter.d.ts +1 -2
  48. package/dist/typings/styled/header/StyledBaseHeaderItem.d.ts +1 -6
  49. package/dist/typings/styled/header/StyledHeader.d.ts +1 -2
  50. package/dist/typings/styled/header/StyledHeaderItem.d.ts +0 -3
  51. package/dist/typings/styled/header/StyledHeaderItemIcon.d.ts +3 -4
  52. package/dist/typings/styled/header/StyledHeaderItemText.d.ts +0 -1
  53. package/dist/typings/styled/header/StyledLogoHeaderItem.d.ts +2 -4
  54. package/dist/typings/styled/nav/StyledBaseNavItem.d.ts +1 -2
  55. package/dist/typings/styled/nav/StyledBrandmarkNavItem.d.ts +0 -3
  56. package/dist/typings/styled/nav/StyledLogoNavItem.d.ts +3 -7
  57. package/dist/typings/styled/nav/StyledNav.d.ts +2 -6
  58. package/dist/typings/styled/nav/StyledNavButton.d.ts +2 -13
  59. package/dist/typings/styled/nav/StyledNavItemIcon.d.ts +3 -4
  60. package/dist/typings/styled/nav/StyledNavItemText.d.ts +2 -1
  61. package/dist/typings/styled/sheet/StyledSheetClose.d.ts +4 -8
  62. package/dist/typings/styled/sheet/StyledSheetDescription.d.ts +2 -3
  63. package/dist/typings/styled/sheet/StyledSheetFooter.d.ts +2 -2
  64. package/dist/typings/styled/sheet/StyledSheetFooterItem.d.ts +2 -3
  65. package/dist/typings/styled/sheet/StyledSheetHeader.d.ts +2 -6
  66. package/dist/typings/styled/sheet/StyledSheetTitle.d.ts +2 -3
  67. package/dist/typings/styled/sheet/StyledSheetWrapper.d.ts +2 -2
  68. package/dist/typings/styled/utils.d.ts +15 -0
  69. package/dist/typings/utils/useChromeContext.d.ts +0 -1
  70. package/package.json +4 -3
@@ -6,30 +6,62 @@
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
8
  import { math } from 'polished';
9
- import { focusStyles, getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles } from '@zendeskgarden/react-theming';
10
10
  import { StyledHeaderItemIcon } from './StyledHeaderItemIcon.js';
11
- import { StyledBaseHeaderItem, getHeaderItemSize } from './StyledBaseHeaderItem.js';
11
+ import { StyledBaseHeaderItem } from './StyledBaseHeaderItem.js';
12
12
  import { StyledHeaderItemText } from './StyledHeaderItemText.js';
13
+ import { getHeaderItemSize } from '../utils.js';
13
14
 
14
15
  const COMPONENT_ID = 'chrome.header_item';
15
- const imgStyles = props => {
16
- const size = math(`${getHeaderItemSize(props)} - ${props.theme.space.base * 2}`);
17
- return css(["img{margin:0;border-radius:", ";width:", ";height:", ";}"], math(`${props.theme.borderRadii.md} - 1`), size, size);
16
+ const colorStyles = _ref => {
17
+ let {
18
+ theme,
19
+ maxY
20
+ } = _ref;
21
+ const options = {
22
+ theme,
23
+ variable: 'foreground.subtle'
24
+ };
25
+ const hoverColor = getColor({
26
+ ...options,
27
+ dark: {
28
+ offset: -100
29
+ },
30
+ light: {
31
+ offset: 100
32
+ }
33
+ });
34
+ const activeColor = getColor({
35
+ ...options,
36
+ dark: {
37
+ offset: -200
38
+ },
39
+ light: {
40
+ offset: 200
41
+ }
42
+ });
43
+ return css(["&:hover,&:focus{color:inherit;}", ";&:hover ", ",&:hover ", "{color:", ";}&:active ", ",&:active ", "{color:", ";}"], focusStyles({
44
+ theme,
45
+ inset: maxY
46
+ }), StyledHeaderItemIcon, StyledHeaderItemText, hoverColor, StyledHeaderItemIcon, StyledHeaderItemText, activeColor);
47
+ };
48
+ const sizeStyles = _ref2 => {
49
+ let {
50
+ theme,
51
+ isRound
52
+ } = _ref2;
53
+ const iconBorderRadius = isRound ? '100px' : undefined;
54
+ const imageBorderRadius = math(`${theme.borderRadii.md} - 1`);
55
+ const imageSize = math(`${getHeaderItemSize(theme)} - ${theme.space.base * 2}`);
56
+ return css(["img{margin:0;border-radius:", ";width:", ";height:", ";}", "{border-radius:", ";}"], imageBorderRadius, imageSize, imageSize, StyledHeaderItemIcon, iconBorderRadius);
18
57
  };
19
58
  const StyledHeaderItem = styled(StyledBaseHeaderItem).attrs({
20
59
  'data-garden-id': COMPONENT_ID,
21
- 'data-garden-version': '9.0.0-next.16'
60
+ 'data-garden-version': '9.0.0-next.18'
22
61
  }).withConfig({
23
62
  displayName: "StyledHeaderItem",
24
63
  componentId: "sc-14sft6n-0"
25
- })(["&:hover,&:focus{text-decoration:none;color:inherit;}", " &:focus-visible:active{box-shadow:none;}&:hover ", ",&:hover ", ",&:active ", ",&:active ", "{color:", ";}", " ", " ", ";"], props => focusStyles({
26
- theme: props.theme,
27
- inset: props.maxY
28
- }), StyledHeaderItemIcon, StyledHeaderItemText, StyledHeaderItemIcon, StyledHeaderItemText, props => getColorV8('chromeHue', 700, props.theme), imgStyles, props => props.isRound && `
29
- ${StyledHeaderItemIcon} {
30
- border-radius: 100px;
31
- }
32
- `, props => retrieveComponentStyles(COMPONENT_ID, props));
64
+ })(["cursor:pointer;&:hover,&:focus{text-decoration:none;}", ";", ";& ", ",& ", "{transition:box-shadow 0.1s ease-in-out,color 0.1s ease-in-out;}", ";"], sizeStyles, colorStyles, StyledHeaderItemIcon, StyledHeaderItemText, props => retrieveComponentStyles(COMPONENT_ID, props));
33
65
  StyledHeaderItem.defaultProps = {
34
66
  theme: DEFAULT_THEME
35
67
  };
@@ -4,17 +4,25 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import styled from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
7
+ import styled, { css } from 'styled-components';
8
+ import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'chrome.header_item_icon';
11
- const StyledHeaderItemIcon = styled.div.attrs({
11
+ const sizeStyles = _ref => {
12
+ let {
13
+ theme
14
+ } = _ref;
15
+ const margin = `0 ${theme.space.base * 0.75}px`;
16
+ const size = theme.iconSizes.md;
17
+ return css(["margin:", ";width:", ";min-width:", ";height:", ";"], margin, size, size, size);
18
+ };
19
+ const StyledHeaderItemIcon = styled(StyledBaseIcon).attrs({
12
20
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.0.0-next.16'
21
+ 'data-garden-version': '9.0.0-next.18'
14
22
  }).withConfig({
15
23
  displayName: "StyledHeaderItemIcon",
16
24
  componentId: "sc-1jhhp6z-0"
17
- })(["transition:transform 0.25s ease-in-out;margin:0 3px;width:", ";min-width:", ";height:", ";", ";"], props => props.theme.iconSizes.md, props => props.theme.iconSizes.md, props => props.theme.iconSizes.md, props => retrieveComponentStyles(COMPONENT_ID, props));
25
+ })(["transition:transform 0.25s ease-in-out;", ";", ";"], sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
18
26
  StyledHeaderItemIcon.defaultProps = {
19
27
  theme: DEFAULT_THEME
20
28
  };
@@ -4,20 +4,20 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import styled, { css } from 'styled-components';
7
+ import styled from 'styled-components';
8
+ import { hideVisually } from 'polished';
8
9
  import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
10
 
10
11
  const COMPONENT_ID = 'chrome.header_item_text';
11
- const clippedStyling = css(["position:absolute;margin:0;clip:rect(1px,1px,1px,1px);width:1px;height:1px;overflow:hidden;white-space:nowrap;"]);
12
12
  const StyledHeaderItemText = styled.span.attrs({
13
13
  'data-garden-id': COMPONENT_ID,
14
- 'data-garden-version': '9.0.0-next.16'
14
+ 'data-garden-version': '9.0.0-next.18'
15
15
  }).withConfig({
16
16
  displayName: "StyledHeaderItemText",
17
17
  componentId: "sc-goz7la-0"
18
- })(["margin:0 3px;", " ", ";"], props => props.isClipped && clippedStyling, props => retrieveComponentStyles(COMPONENT_ID, props));
18
+ })(["margin:", ";", " ", ";"], props => `0 ${props.theme.space.base * 0.75}px`, props => props.isClipped && hideVisually(), props => retrieveComponentStyles(COMPONENT_ID, props));
19
19
  StyledHeaderItemText.defaultProps = {
20
20
  theme: DEFAULT_THEME
21
21
  };
22
22
 
23
- export { StyledHeaderItemText, clippedStyling };
23
+ export { StyledHeaderItemText };
@@ -11,7 +11,7 @@ import { StyledBaseHeaderItem } from './StyledBaseHeaderItem.js';
11
11
  const COMPONENT_ID = 'chrome.header_item_wrapper';
12
12
  const StyledHeaderItemWrapper = styled(StyledBaseHeaderItem).attrs({
13
13
  'data-garden-id': COMPONENT_ID,
14
- 'data-garden-version': '9.0.0-next.16',
14
+ 'data-garden-version': '9.0.0-next.18',
15
15
  as: 'div'
16
16
  }).withConfig({
17
17
  displayName: "StyledHeaderItemWrapper",
@@ -4,38 +4,50 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import styled from 'styled-components';
8
- import { getColorV8, retrieveComponentStyles, DEFAULT_THEME, PALETTE } from '@zendeskgarden/react-theming';
7
+ import styled, { css } from 'styled-components';
8
+ import { hideVisually } from 'polished';
9
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
9
10
  import { StyledHeaderItemIcon } from './StyledHeaderItemIcon.js';
10
11
  import { StyledBaseHeaderItem } from './StyledBaseHeaderItem.js';
11
- import { StyledHeaderItemText, clippedStyling } from './StyledHeaderItemText.js';
12
- import { getNavWidth } from '../nav/StyledNav.js';
12
+ import { StyledHeaderItemText } from './StyledHeaderItemText.js';
13
+ import { getProductColor, getNavWidth } from '../utils.js';
13
14
 
14
15
  const COMPONENT_ID = 'chrome.header_item';
15
- const retrieveProductColor = props => {
16
- switch (props.product) {
17
- case 'chat':
18
- return PALETTE.product.chat;
19
- case 'explore':
20
- return PALETTE.product.explore;
21
- case 'guide':
22
- return PALETTE.product.guide;
23
- case 'support':
24
- return PALETTE.product.support;
25
- case 'talk':
26
- return PALETTE.product.talk;
27
- default:
28
- return 'inherit';
29
- }
16
+ const colorStyles = _ref => {
17
+ let {
18
+ theme,
19
+ product
20
+ } = _ref;
21
+ const borderColor = getColor({
22
+ theme,
23
+ variable: 'border.default'
24
+ });
25
+ const fill = getColor({
26
+ theme,
27
+ variable: 'foreground.default'
28
+ });
29
+ const color = getProductColor(product, fill );
30
+ return css(["border-", "-color:", ";color:", ";fill:", ";"], theme.rtl ? 'left' : 'right', borderColor, color, fill);
31
+ };
32
+ const sizeStyles = _ref2 => {
33
+ let {
34
+ theme
35
+ } = _ref2;
36
+ const border = theme.borders.sm;
37
+ const iconSize = theme.iconSizes.lg;
38
+ const marginRight = theme.rtl ? `-${theme.space.base}px` : 'auto';
39
+ const marginLeft = theme.rtl ? 'auto' : `-${theme.space.base}px`;
40
+ const width = getNavWidth(theme);
41
+ return css(["margin-right:", ";margin-left:", ";border-", ":", ";width:", ";height:100%;", "{margin:0;width:", ";height:", ";}"], marginRight, marginLeft, theme.rtl ? 'left' : 'right', border, width, StyledHeaderItemIcon, iconSize, iconSize);
30
42
  };
31
43
  const StyledLogoHeaderItem = styled(StyledBaseHeaderItem).attrs({
32
44
  'data-garden-id': COMPONENT_ID,
33
- 'data-garden-version': '9.0.0-next.16',
45
+ 'data-garden-version': '9.0.0-next.18',
34
46
  as: 'div'
35
47
  }).withConfig({
36
48
  displayName: "StyledLogoHeaderItem",
37
49
  componentId: "sc-1n1d1yv-0"
38
- })(["display:none;order:0;margin-right:", ";margin-left:", ";border-", ":", ";border-radius:0;padding:0;width:", ";height:100%;overflow:hidden;fill:", ";text-decoration:none;color:", ";", "{", "}", "{margin:0;width:", ";height:", ";}", ";"], props => props.theme.rtl ? `-${props.theme.space.base}px` : 'auto', props => props.theme.rtl ? 'auto' : `-${props.theme.space.base}px`, props => props.theme.rtl ? 'left' : 'right', props => `${props.theme.borders.sm} ${getColorV8('neutralHue', 300, props.theme)}`, props => getNavWidth(props), props => getColorV8('chromeHue', 700, props.theme), props => retrieveProductColor(props), StyledHeaderItemText, clippedStyling, StyledHeaderItemIcon, props => props.theme.iconSizes.lg, props => props.theme.iconSizes.lg, props => retrieveComponentStyles(COMPONENT_ID, props));
50
+ })(["display:none;order:0;border-radius:0;padding:0;overflow:hidden;text-decoration:none;", ";", ";", "{", "}", ";"], sizeStyles, colorStyles, StyledHeaderItemText, hideVisually(), props => retrieveComponentStyles(COMPONENT_ID, props));
39
51
  StyledLogoHeaderItem.defaultProps = {
40
52
  theme: DEFAULT_THEME
41
53
  };
@@ -7,26 +7,27 @@
7
7
  import styled, { css } from 'styled-components';
8
8
  import { math } from 'polished';
9
9
  import { DEFAULT_THEME } from '@zendeskgarden/react-theming';
10
- import { getNavWidth } from './StyledNav.js';
10
+ import { getNavItemHeight, getNavWidth } from '../utils.js';
11
11
 
12
12
  const COMPONENT_ID = 'chrome.base_nav_item';
13
- const getNavItemHeight = props => {
14
- return `${props.theme.space.base * 13}px`;
15
- };
16
- const sizeStyles = props => {
17
- const verticalPadding = math(`(${getNavItemHeight(props)} - ${props.theme.iconSizes.lg}) / 2`);
18
- const horizontalPadding = math(`(${getNavWidth(props)} - ${props.theme.iconSizes.lg}) / 4`);
19
- return css(["padding:", " ", ";min-height:", ";"], verticalPadding, horizontalPadding, getNavItemHeight);
13
+ const sizeStyles = _ref => {
14
+ let {
15
+ theme
16
+ } = _ref;
17
+ const minHeight = getNavItemHeight(theme);
18
+ const verticalPadding = math(`(${minHeight} - ${theme.iconSizes.lg}) / 2`);
19
+ const horizontalPadding = math(`(${getNavWidth(theme)} - ${theme.iconSizes.lg}) / 4`);
20
+ return css(["padding:", " ", ";min-height:", ";"], verticalPadding, horizontalPadding, minHeight);
20
21
  };
21
22
  const StyledBaseNavItem = styled.div.attrs({
22
23
  'data-garden-id': COMPONENT_ID,
23
- 'data-garden-version': '9.0.0-next.16'
24
+ 'data-garden-version': '9.0.0-next.18'
24
25
  }).withConfig({
25
26
  displayName: "StyledBaseNavItem",
26
27
  componentId: "sc-zvo43f-0"
27
- })(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:outline-color 0.1s ease-in-out,box-shadow 0.1s ease-in-out,background-color 0.1s ease-in-out,opacity 0.1s ease-in-out;", ""], props => sizeStyles(props));
28
+ })(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:outline-color 0.1s ease-in-out,box-shadow 0.1s ease-in-out,background-color 0.1s ease-in-out,opacity 0.1s ease-in-out;", ";"], sizeStyles);
28
29
  StyledBaseNavItem.defaultProps = {
29
30
  theme: DEFAULT_THEME
30
31
  };
31
32
 
32
- export { StyledBaseNavItem, getNavItemHeight };
33
+ export { StyledBaseNavItem };
@@ -11,11 +11,11 @@ import { StyledBaseNavItem } from './StyledBaseNavItem.js';
11
11
  const COMPONENT_ID = 'chrome.brandmark_nav_list_item';
12
12
  const StyledBrandmarkNavItem = styled(StyledBaseNavItem).attrs({
13
13
  'data-garden-id': COMPONENT_ID,
14
- 'data-garden-version': '9.0.0-next.16'
14
+ 'data-garden-version': '9.0.0-next.18'
15
15
  }).withConfig({
16
16
  displayName: "StyledBrandmarkNavItem",
17
17
  componentId: "sc-8kynd4-0"
18
- })(["order:1;opacity:0.3;margin-top:auto;min-height:0;"]);
18
+ })(["order:1;opacity:", ";margin-top:auto;min-height:0;"], props => props.theme.opacity[400]);
19
19
  StyledBrandmarkNavItem.defaultProps = {
20
20
  theme: DEFAULT_THEME
21
21
  };
@@ -5,38 +5,31 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { DEFAULT_THEME, PALETTE } from '@zendeskgarden/react-theming';
8
+ import { DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
9
9
  import { StyledBaseNavItem } from './StyledBaseNavItem.js';
10
+ import { getProductColor } from '../utils.js';
10
11
 
11
12
  const COMPONENT_ID = 'chrome.logo_nav_list_item';
12
- const retrieveProductColor = product => {
13
- switch (product) {
14
- case 'chat':
15
- return PALETTE.product.chat;
16
- case 'explore':
17
- return PALETTE.product.explore;
18
- case 'guide':
19
- return PALETTE.product.guide;
20
- case 'support':
21
- return PALETTE.product.support;
22
- case 'talk':
23
- return PALETTE.product.talk;
24
- default:
25
- return 'inherit';
26
- }
27
- };
28
- const colorStyles = props => {
29
- const fillColor = props.isLight ? props.theme.palette.grey[800] : props.theme.palette.white;
30
- const color = props.isLight || props.isDark ? fillColor : retrieveProductColor(props.product);
13
+ const colorStyles = _ref => {
14
+ let {
15
+ theme,
16
+ hue,
17
+ product
18
+ } = _ref;
19
+ const fillColor = getColor({
20
+ theme,
21
+ variable: 'foreground.default'
22
+ });
23
+ const color = hue === 'chromeHue' ? getProductColor(product) : fillColor;
31
24
  return css(["color:", ";fill:", ";"], color, fillColor);
32
25
  };
33
26
  const StyledLogoNavItem = styled(StyledBaseNavItem).attrs({
34
27
  'data-garden-id': COMPONENT_ID,
35
- 'data-garden-version': '9.0.0-next.16'
28
+ 'data-garden-version': '9.0.0-next.18'
36
29
  }).withConfig({
37
30
  displayName: "StyledLogoNavItem",
38
31
  componentId: "sc-saaydx-0"
39
- })(["order:-1;opacity:1;cursor:default;min-height:0;", ";"], props => colorStyles(props));
32
+ })(["order:-1;opacity:1;cursor:default;min-height:0;", ";"], colorStyles);
40
33
  StyledLogoNavItem.defaultProps = {
41
34
  theme: DEFAULT_THEME
42
35
  };
@@ -5,30 +5,50 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
9
+ import { getNavWidthExpanded, getNavWidth } from '../utils.js';
9
10
 
10
11
  const COMPONENT_ID = 'chrome.nav';
11
- const colorStyles = props => {
12
- const shade = props.isDark || props.isLight ? 600 : 700;
13
- const backgroundColor = getColorV8(props.hue, shade, props.theme);
14
- const foregroundColor = props.isLight ? props.theme.palette.black : props.theme.palette.white;
12
+ const colorStyles = _ref => {
13
+ let {
14
+ theme,
15
+ hue
16
+ } = _ref;
17
+ const shade = hue === 'chromeHue' ? 900 : undefined;
18
+ const backgroundColor = getColor({
19
+ theme,
20
+ hue,
21
+ shade
22
+ });
23
+ const foregroundColor = getColor({
24
+ theme,
25
+ dark: {
26
+ hue: 'white'
27
+ },
28
+ light: {
29
+ hue: 'black'
30
+ }
31
+ });
15
32
  return css(["background-color:", ";color:", ";"], backgroundColor, foregroundColor);
16
33
  };
17
- const getNavWidth = props => {
18
- return `${props.theme.space.base * 15}px`;
19
- };
20
- const getExpandedNavWidth = () => {
21
- return `200px`;
34
+ const sizeStyles = _ref2 => {
35
+ let {
36
+ theme,
37
+ isExpanded
38
+ } = _ref2;
39
+ const fontSize = theme.fontSizes.md;
40
+ const width = isExpanded ? getNavWidthExpanded() : getNavWidth(theme);
41
+ return css(["width:", ";font-size:", ";"], width, fontSize);
22
42
  };
23
43
  const StyledNav = styled.nav.attrs({
24
44
  'data-garden-id': COMPONENT_ID,
25
- 'data-garden-version': '9.0.0-next.16'
45
+ 'data-garden-version': '9.0.0-next.18'
26
46
  }).withConfig({
27
47
  displayName: "StyledNav",
28
48
  componentId: "sc-6j462r-0"
29
- })(["display:flex;position:relative;flex-direction:column;flex-shrink:0;order:-1;width:", ";font-size:", ";", ";", ";"], props => props.isExpanded ? getExpandedNavWidth : getNavWidth, props => props.theme.fontSizes.md, props => colorStyles(props), props => retrieveComponentStyles(COMPONENT_ID, props));
49
+ })(["display:flex;position:relative;flex-direction:column;flex-shrink:0;order:-1;", ";", ";", ";"], colorStyles, sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
30
50
  StyledNav.defaultProps = {
31
51
  theme: DEFAULT_THEME
32
52
  };
33
53
 
34
- export { StyledNav, getExpandedNavWidth, getNavWidth };
54
+ export { StyledNav };
@@ -5,59 +5,88 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { math, rgba } from 'polished';
9
- import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, DEFAULT_THEME, getColorV8, focusStyles } from '@zendeskgarden/react-theming';
8
+ import { math } from 'polished';
9
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles } from '@zendeskgarden/react-theming';
10
10
  import { StyledBaseNavItem } from './StyledBaseNavItem.js';
11
11
  import { StyledNavItemIcon } from './StyledNavItemIcon.js';
12
- import { getNavWidth } from './StyledNav.js';
12
+ import { getNavWidth } from '../utils.js';
13
13
 
14
14
  const COMPONENT_ID = 'chrome.nav_button';
15
- const colorStyles = props => {
16
- const {
15
+ const colorStyles = _ref => {
16
+ let {
17
+ theme,
18
+ hue
19
+ } = _ref;
20
+ const activeBackgroundColor = getColor({
21
+ theme,
22
+ dark: {
23
+ hue: 'white'
24
+ },
25
+ light: {
26
+ hue: 'black'
27
+ },
28
+ transparency: theme.opacity[100]
29
+ });
30
+ const currentBackgroundColor = hue === 'chromeHue' ? getColor({
17
31
  theme,
18
32
  hue,
19
- isLight,
20
- isDark,
21
- isCurrent
22
- } = props;
23
- const DARK = theme.palette.black;
24
- const LIGHT = theme.palette.white;
25
- let currentColor;
26
- let hoverColor;
27
- if (isCurrent) {
28
- if (isLight) {
29
- currentColor = rgba(DARK, 0.4);
30
- } else if (isDark) {
31
- currentColor = rgba(LIGHT, 0.4);
32
- } else {
33
- currentColor = getColorV8(hue, 500, theme);
33
+ shade: 700
34
+ }) : getColor({
35
+ theme,
36
+ dark: {
37
+ hue: 'white'
38
+ },
39
+ light: {
40
+ hue: 'black'
41
+ },
42
+ transparency: theme.opacity[500]
43
+ });
44
+ const focusOutlineColor = getColor({
45
+ theme,
46
+ dark: {
47
+ hue: 'white'
48
+ },
49
+ light: {
50
+ hue: 'black'
34
51
  }
35
- } else {
36
- hoverColor = rgba(isLight ? LIGHT : DARK, 0.1);
37
- }
38
- const activeColor = rgba(isLight ? DARK : LIGHT, 0.1);
39
- const focusColor = isLight ? DARK : LIGHT;
40
- return css(["opacity:", ";outline-color:transparent;background-color:", ";&:hover{opacity:1;background-color:", ";}", " &:active{background-color:", ";}"], isCurrent ? 1 : 0.6, currentColor, hoverColor, focusStyles({
52
+ });
53
+ const focusOutlineOffset = `-${theme.borderWidths.md}`;
54
+ const hoverBackgroundColor = getColor({
41
55
  theme,
42
- condition: false ,
56
+ dark: {
57
+ hue: 'black'
58
+ },
59
+ light: {
60
+ hue: 'white'
61
+ },
62
+ transparency: theme.opacity[100]
63
+ });
64
+ return css(["opacity:", ";outline-color:transparent;background-color:transparent;color:inherit;&:hover{opacity:1;background-color:", ";}&:hover,&:focus{color:inherit;}", " &:active{background-color:", ";}&[aria-current='true']{opacity:1;background-color:", ";}"], theme.opacity[700], hoverBackgroundColor, focusStyles({
65
+ theme,
66
+ condition: false,
43
67
  styles: {
44
68
  opacity: 1,
45
- outlineColor: focusColor
69
+ outlineColor: focusOutlineColor,
70
+ outlineOffset: focusOutlineOffset
46
71
  }
47
- }), activeColor);
72
+ }), activeBackgroundColor, currentBackgroundColor);
73
+ };
74
+ const sizeStyles = _ref2 => {
75
+ let {
76
+ theme,
77
+ isExpanded
78
+ } = _ref2;
79
+ const iconMargin = isExpanded ? `0 ${math(`(${getNavWidth(theme)} - ${theme.iconSizes.lg}) / 4`)}` : undefined;
80
+ return css(["margin:0;border:none;box-sizing:border-box;min-width:0;font-size:inherit;", "{margin:", ";}"], StyledNavItemIcon, iconMargin);
48
81
  };
49
82
  const StyledNavButton = styled(StyledBaseNavItem).attrs({
50
83
  'data-garden-id': COMPONENT_ID,
51
- 'data-garden-version': '9.0.0-next.16',
84
+ 'data-garden-version': '9.0.0-next.18',
52
85
  as: 'button'
53
86
  }).withConfig({
54
87
  displayName: "StyledNavButton",
55
88
  componentId: "sc-f5ux3-0"
56
- })(["flex:1;justify-content:", ";margin:0;border:none;box-sizing:border-box;background:transparent;cursor:", ";min-width:0;text-align:", ";text-decoration:none;color:inherit;font-size:inherit;&:hover,&:focus{text-decoration:none;color:inherit;}", ";&:focus-visible:hover,&:focus-visible:active,", "{outline:", " solid;outline-offset:-", ";}", " ", ";"], props => props.isExpanded && 'start', props => props.isCurrent ? 'default' : 'pointer', props => props.isExpanded && 'inherit', colorStyles, SELECTOR_FOCUS_VISIBLE, props => math(`${props.theme.borderWidths.md} - 1`), props => props.theme.borderWidths.md, props => props.isExpanded && `
57
- ${StyledNavItemIcon} {
58
- margin: 0 ${math(`(${getNavWidth(props)} - ${props.theme.iconSizes.lg}) / 4`)};
59
- }
60
- `, props => retrieveComponentStyles(COMPONENT_ID, props));
89
+ })(["flex:1;justify-content:", ";cursor:pointer;text-align:", ";text-decoration:none;", ";&:hover,&:focus{text-decoration:none;}&[aria-current='true']{cursor:default;}", ";", ";"], props => props.isExpanded && 'start', props => props.isExpanded && 'inherit', sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
61
90
  StyledNavButton.defaultProps = {
62
91
  theme: DEFAULT_THEME
63
92
  };
@@ -4,17 +4,24 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import styled from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
7
+ import styled, { css } from 'styled-components';
8
+ import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'chrome.nav_item_icon';
11
- const StyledNavItemIcon = styled.div.attrs({
11
+ const sizeStyles = _ref => {
12
+ let {
13
+ theme
14
+ } = _ref;
15
+ const size = theme.iconSizes.lg;
16
+ return css(["width:", ";height:", ";"], size, size);
17
+ };
18
+ const StyledNavItemIcon = styled(StyledBaseIcon).attrs({
12
19
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.0.0-next.16'
20
+ 'data-garden-version': '9.0.0-next.18'
14
21
  }).withConfig({
15
22
  displayName: "StyledNavItemIcon",
16
23
  componentId: "sc-7w9rpt-0"
17
- })(["align-self:flex-start;order:0;border-radius:", ";width:", ";height:", ";", ";"], props => props.theme.borderRadii.md, props => props.theme.iconSizes.lg, props => props.theme.iconSizes.lg, props => retrieveComponentStyles(COMPONENT_ID, props));
24
+ })(["align-self:flex-start;order:0;border-radius:", ";", ";", ";"], props => props.theme.borderRadii.md, sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
18
25
  StyledNavItemIcon.defaultProps = {
19
26
  theme: DEFAULT_THEME
20
27
  };
@@ -4,29 +4,34 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import styled from 'styled-components';
7
+ import styled, { css } from 'styled-components';
8
8
  import { math } from 'polished';
9
- import { getLineHeight, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+ import { retrieveComponentStyles, DEFAULT_THEME, getLineHeight } from '@zendeskgarden/react-theming';
10
10
  import { StyledNavButton } from './StyledNavButton.js';
11
- import { getNavWidth } from './StyledNav.js';
11
+ import { getNavWidth } from '../utils.js';
12
12
 
13
13
  const COMPONENT_ID = 'chrome.nav_item_text';
14
+ const sizeStyles = _ref => {
15
+ let {
16
+ theme,
17
+ isExpanded,
18
+ isWrapped
19
+ } = _ref;
20
+ const clip = isExpanded ? 'auto' : undefined;
21
+ const lineHeight = getLineHeight(theme.space.base * 5, theme.fontSizes.md);
22
+ const margin = isExpanded ? `0 ${math(`(${getNavWidth(theme)} - ${theme.iconSizes.lg}) / 4`)}` : undefined;
23
+ const width = isExpanded ? 'auto' : undefined;
24
+ const height = isExpanded ? 'auto' : undefined;
25
+ const whiteSpace = isWrapped ? undefined : 'nowrap';
26
+ return css(["clip:rect(1px,1px,1px,1px);margin:", ";width:1px;height:1px;line-height:", ";white-space:", ";", " > &&{clip:", ";width:", ";height:", ";}"], margin, lineHeight, whiteSpace, StyledNavButton, clip, width, height);
27
+ };
14
28
  const StyledNavItemText = styled.span.attrs({
15
29
  'data-garden-id': COMPONENT_ID,
16
- 'data-garden-version': '9.0.0-next.16'
30
+ 'data-garden-version': '9.0.0-next.18'
17
31
  }).withConfig({
18
32
  displayName: "StyledNavItemText",
19
33
  componentId: "sc-13m84xl-0"
20
- })(["position:absolute;order:1;clip:rect(1px,1px,1px,1px);margin:", ";width:1px;height:1px;overflow:hidden;line-height:", ";white-space:", ";", " ", ";"], props => props.isExpanded && `0 ${math(`(${getNavWidth(props)} - ${props.theme.iconSizes.lg}) / 4`)}`, props => getLineHeight(props.theme.space.base * 5, props.theme.fontSizes.md), props => props.isWrapped ? 'normal' : 'nowrap', props => props.isExpanded && `
21
- ${StyledNavButton} > && {
22
- position: static;
23
- flex: 1;
24
- clip: auto;
25
- width: auto;
26
- height: auto;
27
- text-overflow: ellipsis;
28
- }
29
- `, props => retrieveComponentStyles(COMPONENT_ID, props));
34
+ })(["position:absolute;order:1;overflow:hidden;", " > &&{position:", ";flex:", ";text-overflow:", ";}", ";", ";"], StyledNavButton, props => props.isExpanded ? 'static' : undefined, props => props.isExpanded ? 1 : undefined, props => props.isExpanded ? 'ellipsis' : undefined, sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
30
35
  StyledNavItemText.defaultProps = {
31
36
  theme: DEFAULT_THEME
32
37
  };
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
10
10
  const COMPONENT_ID = 'chrome.nav_list';
11
11
  const StyledNavList = styled.ul.attrs({
12
12
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.0.0-next.16'
13
+ 'data-garden-version': '9.0.0-next.18'
14
14
  }).withConfig({
15
15
  displayName: "StyledNavList",
16
16
  componentId: "sc-1s0nkfb-0"
@@ -10,7 +10,7 @@ import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-the
10
10
  const COMPONENT_ID = 'chrome.nav_list_item';
11
11
  const StyledNavListItem = styled.li.attrs({
12
12
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.0.0-next.16'
13
+ 'data-garden-version': '9.0.0-next.18'
14
14
  }).withConfig({
15
15
  displayName: "StyledNavListItem",
16
16
  componentId: "sc-18cj2v7-0"