@zendeskgarden/react-tabs 8.76.1 → 8.76.3

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.
@@ -24,7 +24,8 @@ const Tab = React.forwardRef((_ref, ref) => {
24
24
  return React.createElement(StyledTab, Object.assign({
25
25
  role: "tab",
26
26
  "aria-disabled": disabled,
27
- ref: ref
27
+ ref: ref,
28
+ isVertical: tabsPropGetters?.isVertical
28
29
  }, otherProps));
29
30
  }
30
31
  const {
@@ -34,7 +35,8 @@ const Tab = React.forwardRef((_ref, ref) => {
34
35
  value: item
35
36
  });
36
37
  return React.createElement(StyledTab, Object.assign({
37
- isSelected: item === tabsPropGetters.selectedValue
38
+ isSelected: item === tabsPropGetters.selectedValue,
39
+ isVertical: tabsPropGetters.isVertical
38
40
  }, tabProps, otherProps, {
39
41
  ref: mergeRefs([tabRef, ref])
40
42
  }));
@@ -19,7 +19,9 @@ const TabList = React.forwardRef((props, ref) => {
19
19
  }, props));
20
20
  }
21
21
  const tabListProps = tabsPropGetters.getTabListProps();
22
- return React.createElement(StyledTabList, Object.assign({}, tabListProps, props, {
22
+ return React.createElement(StyledTabList, Object.assign({
23
+ isVertical: tabsPropGetters.isVertical
24
+ }, tabListProps, props, {
23
25
  ref: ref
24
26
  }));
25
27
  });
@@ -27,7 +27,8 @@ const TabPanel = React.forwardRef((_ref, ref) => {
27
27
  value: item
28
28
  });
29
29
  return React.createElement(StyledTabPanel, Object.assign({
30
- "aria-hidden": tabsPropGetters.selectedValue !== item
30
+ "aria-hidden": tabsPropGetters.selectedValue !== item,
31
+ isVertical: tabsPropGetters.isVertical
31
32
  }, tabPanelProps, otherProps, {
32
33
  ref: ref
33
34
  }));
@@ -40,8 +40,12 @@ const Tabs = forwardRef((_ref, ref) => {
40
40
  }
41
41
  }
42
42
  });
43
+ const contextValue = useMemo(() => ({
44
+ isVertical,
45
+ ...tabsContextValue
46
+ }), [isVertical, tabsContextValue]);
43
47
  return React.createElement(TabsContext.Provider, {
44
- value: tabsContextValue
48
+ value: contextValue
45
49
  }, React.createElement(StyledTabs, Object.assign({
46
50
  isVertical: isVertical
47
51
  }, otherProps, {
@@ -12,10 +12,12 @@ const COMPONENT_ID = 'tabs.tab';
12
12
  const colorStyles = _ref => {
13
13
  let {
14
14
  theme,
15
- isSelected
15
+ isSelected,
16
+ isVertical
16
17
  } = _ref;
18
+ const borderColor = isSelected ? 'currentcolor' : 'transparent';
17
19
  const selectedColor = getColorV8('primaryHue', 600, theme);
18
- return css(["border-color:", ";color:", ";&:hover{color:", ";}", " &:active{border-color:currentcolor;color:", ";}&[aria-disabled='true']{border-color:transparent;color:", ";}"], isSelected && 'currentcolor !important', isSelected ? selectedColor : 'inherit', selectedColor, focusStyles({
20
+ return css(["border-bottom-color:", ";border-", "-color:", ";color:", ";&:hover{color:", ";}", " &:active{border-color:currentcolor;color:", ";}&[aria-disabled='true']{border-color:transparent;color:", ";}"], isVertical ? undefined : borderColor, theme.rtl ? 'right' : 'left', isVertical ? borderColor : undefined, isSelected ? selectedColor : 'inherit', selectedColor, focusStyles({
19
21
  theme,
20
22
  inset: true,
21
23
  spacerWidth: null,
@@ -28,20 +30,36 @@ const colorStyles = _ref => {
28
30
  };
29
31
  const sizeStyles = _ref2 => {
30
32
  let {
31
- theme
33
+ theme,
34
+ isVertical
32
35
  } = _ref2;
33
- const paddingTop = theme.space.base * 2.5;
34
- const paddingHorizontal = theme.space.base * 7;
35
- const paddingBottom = paddingTop - stripUnit(theme.borderWidths.md) - stripUnit(theme.borderWidths.sm);
36
- return css(["padding:", "px ", "px ", "px;"], paddingTop, paddingHorizontal, paddingBottom);
36
+ const borderWidth = theme.borderWidths.md;
37
+ const focusHeight = `${theme.space.base * 5}px`;
38
+ let marginBottom;
39
+ let padding;
40
+ if (isVertical) {
41
+ marginBottom = `${theme.space.base * 5}px`;
42
+ padding = `${theme.space.base}px ${theme.space.base * 2}px`;
43
+ } else {
44
+ const paddingTop = theme.space.base * 2.5;
45
+ const paddingHorizontal = theme.space.base * 7;
46
+ const paddingBottom = paddingTop - stripUnit(theme.borderWidths.md) - stripUnit(theme.borderWidths.sm);
47
+ padding = `${paddingTop}px ${paddingHorizontal}px ${paddingBottom}px`;
48
+ }
49
+ return css(["margin-bottom:", ";border-width:", ";padding:", ";&:focus-visible::before,&[data-garden-focus-visible]::before{height:", ";}&:last-of-type{margin-bottom:0;}"], marginBottom, borderWidth, padding, focusHeight);
37
50
  };
38
51
  const StyledTab = styled.div.attrs({
39
52
  'data-garden-id': COMPONENT_ID,
40
- 'data-garden-version': '8.76.1'
53
+ 'data-garden-version': '8.76.3'
41
54
  }).withConfig({
42
55
  displayName: "StyledTab",
43
56
  componentId: "sc-x2pbow-0"
44
- })(["display:inline-block;position:relative;transition:color 0.25s ease-in-out;border-bottom:", " transparent;border-width:", ";cursor:pointer;overflow:hidden;vertical-align:top;user-select:none;text-align:center;text-decoration:none;text-overflow:ellipsis;", " ", " &:focus{text-decoration:none;}&::before{transition:box-shadow 0.1s ease-in-out;content:'';}&:focus-visible::before,&[data-garden-focus-visible]::before{position:absolute;top:", "px;right:", "px;left:", "px;border-radius:", ";height:", "px;pointer-events:none;}&:active::before{box-shadow:none;}&[aria-disabled='true']{cursor:default;}", ";"], props => props.theme.borderStyles.solid, props => props.theme.borderWidths.md, sizeStyles, colorStyles, props => props.theme.space.base * 2.5, props => props.theme.space.base * 6, props => props.theme.space.base * 6, props => props.theme.borderRadii.md, props => props.theme.space.base * 5, props => retrieveComponentStyles(COMPONENT_ID, props));
57
+ })(["display:", ";position:relative;transition:color 0.25s ease-in-out;border-bottom:", ";border-", ":", ";cursor:pointer;overflow:hidden;vertical-align:top;user-select:none;text-align:", ";text-decoration:none;text-overflow:ellipsis;", ";", ";&:focus{text-decoration:none;}&::before{transition:box-shadow 0.1s ease-in-out;content:'';}&:focus-visible::before,&[data-garden-focus-visible]::before{position:absolute;top:", "px;right:", "px;left:", "px;border-radius:", ";pointer-events:none;}&:active::before{box-shadow:none;}&[aria-disabled='true']{cursor:default;}", ";"], props => props.isVertical ? 'block' : 'inline-block', props => props.isVertical ? undefined : props.theme.borderStyles.solid, props => props.theme.rtl ? 'right' : 'left', props => props.isVertical ? props.theme.borderStyles.solid : undefined, props => {
58
+ if (props.isVertical) {
59
+ return props.theme.rtl ? 'right' : 'left';
60
+ }
61
+ return 'center';
62
+ }, sizeStyles, colorStyles, props => props.theme.space.base * (props.isVertical ? 1 : 2.5), props => props.theme.space.base * (props.isVertical ? 1 : 6), props => props.theme.space.base * (props.isVertical ? 1 : 6), props => props.theme.borderRadii.md, props => retrieveComponentStyles(COMPONENT_ID, props));
45
63
  StyledTab.defaultProps = {
46
64
  theme: DEFAULT_THEME
47
65
  };
@@ -4,17 +4,36 @@
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 } from '@zendeskgarden/react-theming';
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColorV8, getLineHeight } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'tabs.tablist';
11
+ const colorStyles = _ref => {
12
+ let {
13
+ theme
14
+ } = _ref;
15
+ const borderColor = getColorV8('neutralHue', 300, theme);
16
+ const foregroundColor = getColorV8('neutralHue', 600, theme);
17
+ return css(["border-bottom-color:", ";color:", ";"], borderColor, foregroundColor);
18
+ };
19
+ const sizeStyles = _ref2 => {
20
+ let {
21
+ theme,
22
+ isVertical
23
+ } = _ref2;
24
+ const marginBottom = isVertical ? 0 : `${theme.space.base * 5}px`;
25
+ const borderBottom = isVertical ? undefined : theme.borderWidths.sm;
26
+ const fontSize = theme.fontSizes.md;
27
+ const lineHeight = getLineHeight(theme.space.base * 5, fontSize);
28
+ return css(["margin-top:0;margin-bottom:", ";border-bottom-width:", ";padding:0;line-height:", ";font-size:", ";"], marginBottom, borderBottom, lineHeight, fontSize);
29
+ };
11
30
  const StyledTabList = styled.div.attrs({
12
31
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '8.76.1'
32
+ 'data-garden-version': '8.76.3'
14
33
  }).withConfig({
15
34
  displayName: "StyledTabList",
16
35
  componentId: "sc-wa5aaj-0"
17
- })(["display:block;margin-top:0;margin-bottom:", "px;border-bottom:", " ", " ", ";padding:0;line-height:", "px;white-space:nowrap;color:", ";font-size:", ";", ";"], props => props.theme.space.base * 5, props => props.theme.borderWidths.sm, props => props.theme.borderStyles.solid, props => getColorV8('neutralHue', 300, props.theme), props => props.theme.space.base * 5, props => getColorV8('neutralHue', 600, props.theme), props => props.theme.fontSizes.md, props => retrieveComponentStyles(COMPONENT_ID, props));
36
+ })(["display:", ";border-bottom:", ";vertical-align:", ";white-space:nowrap;", ";", ";", ";"], props => props.isVertical ? 'table-cell' : 'block', props => props.isVertical ? 'none' : props.theme.borderStyles.solid, props => props.isVertical ? 'top' : undefined, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
18
37
  StyledTabList.defaultProps = {
19
38
  theme: DEFAULT_THEME
20
39
  };
@@ -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';
7
+ import styled, { css } from 'styled-components';
8
8
  import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'tabs.tabpanel';
11
+ const sizeStyles = _ref => {
12
+ let {
13
+ theme,
14
+ isVertical
15
+ } = _ref;
16
+ const margin = isVertical ? `${theme.space.base * 8}px` : undefined;
17
+ return css(["margin-", ":", ";"], theme.rtl ? 'right' : 'left', margin);
18
+ };
11
19
  const StyledTabPanel = styled.div.attrs({
12
20
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '8.76.1'
21
+ 'data-garden-version': '8.76.3'
14
22
  }).withConfig({
15
23
  displayName: "StyledTabPanel",
16
24
  componentId: "sc-7lhrmp-0"
17
- })(["display:block;&[aria-hidden='true']{display:none;}", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
25
+ })(["display:block;vertical-align:", ";", ";&[aria-hidden='true']{display:none;}", ";"], props => props.isVertical && 'top', sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
18
26
  StyledTabPanel.defaultProps = {
19
27
  theme: DEFAULT_THEME
20
28
  };
@@ -4,26 +4,17 @@
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
8
  import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
- import { StyledTab } from './StyledTab.js';
10
- import { StyledTabPanel } from './StyledTabPanel.js';
11
- import { StyledTabList } from './StyledTabList.js';
12
9
 
13
10
  const COMPONENT_ID = 'tabs.tabs';
14
- const verticalStyling = _ref => {
15
- let {
16
- theme
17
- } = _ref;
18
- return css(["display:table;", "{display:table-cell;margin-bottom:0;border-bottom:none;vertical-align:top;}", "{display:block;margin-bottom:", "px;margin-left:", ";border-left:", ";border-bottom-style:none;border-", "-style:", ";border-", "-color:transparent;padding:", "px ", "px;text-align:", ";&:last-of-type{margin-bottom:0;}&:focus-visible::before,&[data-garden-focus-visible]::before{top:", "px;right:", "px;left:", "px;}}", "{margin-", ":", "px;vertical-align:top;}"], StyledTabList, StyledTab, theme.space.base * 5, theme.rtl && '0', theme.rtl && '0', theme.rtl ? 'right' : 'left', theme.borderStyles.solid, theme.rtl ? 'right' : 'left', theme.space.base, theme.space.base * 2, theme.rtl ? 'right' : 'left', theme.space.base, theme.space.base, theme.space.base, StyledTabPanel, theme.rtl ? 'right' : 'left', theme.space.base * 8);
19
- };
20
11
  const StyledTabs = styled.div.attrs({
21
12
  'data-garden-id': COMPONENT_ID,
22
- 'data-garden-version': '8.76.1'
13
+ 'data-garden-version': '8.76.3'
23
14
  }).withConfig({
24
15
  displayName: "StyledTabs",
25
16
  componentId: "sc-1qaor65-0"
26
- })(["display:block;overflow:hidden;direction:", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => props.isVertical && verticalStyling(props), props => retrieveComponentStyles(COMPONENT_ID, props));
17
+ })(["display:", ";overflow:hidden;direction:", ";", ";"], props => props.isVertical ? 'table' : 'block', props => props.theme.rtl && 'rtl', props => retrieveComponentStyles(COMPONENT_ID, props));
27
18
  StyledTabs.defaultProps = {
28
19
  theme: DEFAULT_THEME
29
20
  };
package/dist/index.cjs.js CHANGED
@@ -23,13 +23,15 @@ var mergeRefs__default = /*#__PURE__*/_interopDefault(mergeRefs);
23
23
  var styled__default = /*#__PURE__*/_interopDefault(styled);
24
24
 
25
25
  const COMPONENT_ID$3 = 'tabs.tab';
26
- const colorStyles = _ref => {
26
+ const colorStyles$1 = _ref => {
27
27
  let {
28
28
  theme,
29
- isSelected
29
+ isSelected,
30
+ isVertical
30
31
  } = _ref;
32
+ const borderColor = isSelected ? 'currentcolor' : 'transparent';
31
33
  const selectedColor = reactTheming.getColorV8('primaryHue', 600, theme);
32
- return styled.css(["border-color:", ";color:", ";&:hover{color:", ";}", " &:active{border-color:currentcolor;color:", ";}&[aria-disabled='true']{border-color:transparent;color:", ";}"], isSelected && 'currentcolor !important', isSelected ? selectedColor : 'inherit', selectedColor, reactTheming.focusStyles({
34
+ return styled.css(["border-bottom-color:", ";border-", "-color:", ";color:", ";&:hover{color:", ";}", " &:active{border-color:currentcolor;color:", ";}&[aria-disabled='true']{border-color:transparent;color:", ";}"], isVertical ? undefined : borderColor, theme.rtl ? 'right' : 'left', isVertical ? borderColor : undefined, isSelected ? selectedColor : 'inherit', selectedColor, reactTheming.focusStyles({
33
35
  theme,
34
36
  inset: true,
35
37
  spacerWidth: null,
@@ -40,64 +42,101 @@ const colorStyles = _ref => {
40
42
  }
41
43
  }), selectedColor, props => reactTheming.getColorV8('neutralHue', 400, props.theme));
42
44
  };
43
- const sizeStyles = _ref2 => {
45
+ const sizeStyles$2 = _ref2 => {
44
46
  let {
45
- theme
47
+ theme,
48
+ isVertical
46
49
  } = _ref2;
47
- const paddingTop = theme.space.base * 2.5;
48
- const paddingHorizontal = theme.space.base * 7;
49
- const paddingBottom = paddingTop - polished.stripUnit(theme.borderWidths.md) - polished.stripUnit(theme.borderWidths.sm);
50
- return styled.css(["padding:", "px ", "px ", "px;"], paddingTop, paddingHorizontal, paddingBottom);
50
+ const borderWidth = theme.borderWidths.md;
51
+ const focusHeight = `${theme.space.base * 5}px`;
52
+ let marginBottom;
53
+ let padding;
54
+ if (isVertical) {
55
+ marginBottom = `${theme.space.base * 5}px`;
56
+ padding = `${theme.space.base}px ${theme.space.base * 2}px`;
57
+ } else {
58
+ const paddingTop = theme.space.base * 2.5;
59
+ const paddingHorizontal = theme.space.base * 7;
60
+ const paddingBottom = paddingTop - polished.stripUnit(theme.borderWidths.md) - polished.stripUnit(theme.borderWidths.sm);
61
+ padding = `${paddingTop}px ${paddingHorizontal}px ${paddingBottom}px`;
62
+ }
63
+ return styled.css(["margin-bottom:", ";border-width:", ";padding:", ";&:focus-visible::before,&[data-garden-focus-visible]::before{height:", ";}&:last-of-type{margin-bottom:0;}"], marginBottom, borderWidth, padding, focusHeight);
51
64
  };
52
65
  const StyledTab = styled__default.default.div.attrs({
53
66
  'data-garden-id': COMPONENT_ID$3,
54
- 'data-garden-version': '8.76.1'
67
+ 'data-garden-version': '8.76.3'
55
68
  }).withConfig({
56
69
  displayName: "StyledTab",
57
70
  componentId: "sc-x2pbow-0"
58
- })(["display:inline-block;position:relative;transition:color 0.25s ease-in-out;border-bottom:", " transparent;border-width:", ";cursor:pointer;overflow:hidden;vertical-align:top;user-select:none;text-align:center;text-decoration:none;text-overflow:ellipsis;", " ", " &:focus{text-decoration:none;}&::before{transition:box-shadow 0.1s ease-in-out;content:'';}&:focus-visible::before,&[data-garden-focus-visible]::before{position:absolute;top:", "px;right:", "px;left:", "px;border-radius:", ";height:", "px;pointer-events:none;}&:active::before{box-shadow:none;}&[aria-disabled='true']{cursor:default;}", ";"], props => props.theme.borderStyles.solid, props => props.theme.borderWidths.md, sizeStyles, colorStyles, props => props.theme.space.base * 2.5, props => props.theme.space.base * 6, props => props.theme.space.base * 6, props => props.theme.borderRadii.md, props => props.theme.space.base * 5, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
71
+ })(["display:", ";position:relative;transition:color 0.25s ease-in-out;border-bottom:", ";border-", ":", ";cursor:pointer;overflow:hidden;vertical-align:top;user-select:none;text-align:", ";text-decoration:none;text-overflow:ellipsis;", ";", ";&:focus{text-decoration:none;}&::before{transition:box-shadow 0.1s ease-in-out;content:'';}&:focus-visible::before,&[data-garden-focus-visible]::before{position:absolute;top:", "px;right:", "px;left:", "px;border-radius:", ";pointer-events:none;}&:active::before{box-shadow:none;}&[aria-disabled='true']{cursor:default;}", ";"], props => props.isVertical ? 'block' : 'inline-block', props => props.isVertical ? undefined : props.theme.borderStyles.solid, props => props.theme.rtl ? 'right' : 'left', props => props.isVertical ? props.theme.borderStyles.solid : undefined, props => {
72
+ if (props.isVertical) {
73
+ return props.theme.rtl ? 'right' : 'left';
74
+ }
75
+ return 'center';
76
+ }, sizeStyles$2, colorStyles$1, props => props.theme.space.base * (props.isVertical ? 1 : 2.5), props => props.theme.space.base * (props.isVertical ? 1 : 6), props => props.theme.space.base * (props.isVertical ? 1 : 6), props => props.theme.borderRadii.md, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
59
77
  StyledTab.defaultProps = {
60
78
  theme: reactTheming.DEFAULT_THEME
61
79
  };
62
80
 
63
81
  const COMPONENT_ID$2 = 'tabs.tablist';
82
+ const colorStyles = _ref => {
83
+ let {
84
+ theme
85
+ } = _ref;
86
+ const borderColor = reactTheming.getColorV8('neutralHue', 300, theme);
87
+ const foregroundColor = reactTheming.getColorV8('neutralHue', 600, theme);
88
+ return styled.css(["border-bottom-color:", ";color:", ";"], borderColor, foregroundColor);
89
+ };
90
+ const sizeStyles$1 = _ref2 => {
91
+ let {
92
+ theme,
93
+ isVertical
94
+ } = _ref2;
95
+ const marginBottom = isVertical ? 0 : `${theme.space.base * 5}px`;
96
+ const borderBottom = isVertical ? undefined : theme.borderWidths.sm;
97
+ const fontSize = theme.fontSizes.md;
98
+ const lineHeight = reactTheming.getLineHeight(theme.space.base * 5, fontSize);
99
+ return styled.css(["margin-top:0;margin-bottom:", ";border-bottom-width:", ";padding:0;line-height:", ";font-size:", ";"], marginBottom, borderBottom, lineHeight, fontSize);
100
+ };
64
101
  const StyledTabList = styled__default.default.div.attrs({
65
102
  'data-garden-id': COMPONENT_ID$2,
66
- 'data-garden-version': '8.76.1'
103
+ 'data-garden-version': '8.76.3'
67
104
  }).withConfig({
68
105
  displayName: "StyledTabList",
69
106
  componentId: "sc-wa5aaj-0"
70
- })(["display:block;margin-top:0;margin-bottom:", "px;border-bottom:", " ", " ", ";padding:0;line-height:", "px;white-space:nowrap;color:", ";font-size:", ";", ";"], props => props.theme.space.base * 5, props => props.theme.borderWidths.sm, props => props.theme.borderStyles.solid, props => reactTheming.getColorV8('neutralHue', 300, props.theme), props => props.theme.space.base * 5, props => reactTheming.getColorV8('neutralHue', 600, props.theme), props => props.theme.fontSizes.md, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
107
+ })(["display:", ";border-bottom:", ";vertical-align:", ";white-space:nowrap;", ";", ";", ";"], props => props.isVertical ? 'table-cell' : 'block', props => props.isVertical ? 'none' : props.theme.borderStyles.solid, props => props.isVertical ? 'top' : undefined, sizeStyles$1, colorStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
71
108
  StyledTabList.defaultProps = {
72
109
  theme: reactTheming.DEFAULT_THEME
73
110
  };
74
111
 
75
112
  const COMPONENT_ID$1 = 'tabs.tabpanel';
113
+ const sizeStyles = _ref => {
114
+ let {
115
+ theme,
116
+ isVertical
117
+ } = _ref;
118
+ const margin = isVertical ? `${theme.space.base * 8}px` : undefined;
119
+ return styled.css(["margin-", ":", ";"], theme.rtl ? 'right' : 'left', margin);
120
+ };
76
121
  const StyledTabPanel = styled__default.default.div.attrs({
77
122
  'data-garden-id': COMPONENT_ID$1,
78
- 'data-garden-version': '8.76.1'
123
+ 'data-garden-version': '8.76.3'
79
124
  }).withConfig({
80
125
  displayName: "StyledTabPanel",
81
126
  componentId: "sc-7lhrmp-0"
82
- })(["display:block;&[aria-hidden='true']{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
127
+ })(["display:block;vertical-align:", ";", ";&[aria-hidden='true']{display:none;}", ";"], props => props.isVertical && 'top', sizeStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
83
128
  StyledTabPanel.defaultProps = {
84
129
  theme: reactTheming.DEFAULT_THEME
85
130
  };
86
131
 
87
132
  const COMPONENT_ID = 'tabs.tabs';
88
- const verticalStyling = _ref => {
89
- let {
90
- theme
91
- } = _ref;
92
- return styled.css(["display:table;", "{display:table-cell;margin-bottom:0;border-bottom:none;vertical-align:top;}", "{display:block;margin-bottom:", "px;margin-left:", ";border-left:", ";border-bottom-style:none;border-", "-style:", ";border-", "-color:transparent;padding:", "px ", "px;text-align:", ";&:last-of-type{margin-bottom:0;}&:focus-visible::before,&[data-garden-focus-visible]::before{top:", "px;right:", "px;left:", "px;}}", "{margin-", ":", "px;vertical-align:top;}"], StyledTabList, StyledTab, theme.space.base * 5, theme.rtl && '0', theme.rtl && '0', theme.rtl ? 'right' : 'left', theme.borderStyles.solid, theme.rtl ? 'right' : 'left', theme.space.base, theme.space.base * 2, theme.rtl ? 'right' : 'left', theme.space.base, theme.space.base, theme.space.base, StyledTabPanel, theme.rtl ? 'right' : 'left', theme.space.base * 8);
93
- };
94
133
  const StyledTabs = styled__default.default.div.attrs({
95
134
  'data-garden-id': COMPONENT_ID,
96
- 'data-garden-version': '8.76.1'
135
+ 'data-garden-version': '8.76.3'
97
136
  }).withConfig({
98
137
  displayName: "StyledTabs",
99
138
  componentId: "sc-1qaor65-0"
100
- })(["display:block;overflow:hidden;direction:", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => props.isVertical && verticalStyling(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
139
+ })(["display:", ";overflow:hidden;direction:", ";", ";"], props => props.isVertical ? 'table' : 'block', props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
101
140
  StyledTabs.defaultProps = {
102
141
  theme: reactTheming.DEFAULT_THEME
103
142
  };
@@ -118,7 +157,8 @@ const Tab = React__default.default.forwardRef((_ref, ref) => {
118
157
  return React__default.default.createElement(StyledTab, Object.assign({
119
158
  role: "tab",
120
159
  "aria-disabled": disabled,
121
- ref: ref
160
+ ref: ref,
161
+ isVertical: tabsPropGetters?.isVertical
122
162
  }, otherProps));
123
163
  }
124
164
  const {
@@ -128,7 +168,8 @@ const Tab = React__default.default.forwardRef((_ref, ref) => {
128
168
  value: item
129
169
  });
130
170
  return React__default.default.createElement(StyledTab, Object.assign({
131
- isSelected: item === tabsPropGetters.selectedValue
171
+ isSelected: item === tabsPropGetters.selectedValue,
172
+ isVertical: tabsPropGetters.isVertical
132
173
  }, tabProps, otherProps, {
133
174
  ref: mergeRefs__default.default([tabRef, ref])
134
175
  }));
@@ -147,7 +188,9 @@ const TabList = React__default.default.forwardRef((props, ref) => {
147
188
  }, props));
148
189
  }
149
190
  const tabListProps = tabsPropGetters.getTabListProps();
150
- return React__default.default.createElement(StyledTabList, Object.assign({}, tabListProps, props, {
191
+ return React__default.default.createElement(StyledTabList, Object.assign({
192
+ isVertical: tabsPropGetters.isVertical
193
+ }, tabListProps, props, {
151
194
  ref: ref
152
195
  }));
153
196
  });
@@ -168,7 +211,8 @@ const TabPanel = React__default.default.forwardRef((_ref, ref) => {
168
211
  value: item
169
212
  });
170
213
  return React__default.default.createElement(StyledTabPanel, Object.assign({
171
- "aria-hidden": tabsPropGetters.selectedValue !== item
214
+ "aria-hidden": tabsPropGetters.selectedValue !== item,
215
+ isVertical: tabsPropGetters.isVertical
172
216
  }, tabPanelProps, otherProps, {
173
217
  ref: ref
174
218
  }));
@@ -221,8 +265,12 @@ const Tabs = React.forwardRef((_ref, ref) => {
221
265
  }
222
266
  }
223
267
  });
268
+ const contextValue = React.useMemo(() => ({
269
+ isVertical,
270
+ ...tabsContextValue
271
+ }), [isVertical, tabsContextValue]);
224
272
  return React__default.default.createElement(TabsContext.Provider, {
225
- value: tabsContextValue
273
+ value: contextValue
226
274
  }, React__default.default.createElement(StyledTabs, Object.assign({
227
275
  isVertical: isVertical
228
276
  }, otherProps, {
@@ -7,11 +7,10 @@
7
7
  import { DefaultTheme } from 'styled-components';
8
8
  interface IStyledTabProps {
9
9
  isSelected?: boolean;
10
+ isVertical?: boolean;
10
11
  }
11
- /**
12
- * 1. Text truncation (requires `max-width`).
13
- * 2. Overflow compensation.
14
- * 3. Override default anchor styling
15
- */
16
- export declare const StyledTab: import("styled-components").StyledComponent<"div", DefaultTheme, IStyledTabProps, never>;
12
+ export declare const StyledTab: import("styled-components").StyledComponent<"div", DefaultTheme, {
13
+ 'data-garden-id': string;
14
+ 'data-garden-version': string;
15
+ } & IStyledTabProps, "data-garden-id" | "data-garden-version">;
17
16
  export {};
@@ -4,10 +4,12 @@
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
- /**
8
- * 1. List element reset.
9
- */
10
- export declare const StyledTabList: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
7
+ import { DefaultTheme } from 'styled-components';
8
+ interface IStyledTabListProps {
9
+ isVertical?: boolean;
10
+ }
11
+ export declare const StyledTabList: import("styled-components").StyledComponent<"div", DefaultTheme, {
11
12
  'data-garden-id': string;
12
13
  'data-garden-version': string;
13
- }, "data-garden-id" | "data-garden-version">;
14
+ } & IStyledTabListProps, "data-garden-id" | "data-garden-version">;
15
+ export {};
@@ -4,10 +4,12 @@
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
- /**
8
- * Accepts all `<div>` props
9
- */
10
- export declare const StyledTabPanel: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
7
+ import { DefaultTheme } from 'styled-components';
8
+ interface IStyledTabPanelProps {
9
+ isVertical?: boolean;
10
+ }
11
+ export declare const StyledTabPanel: import("styled-components").StyledComponent<"div", DefaultTheme, {
11
12
  'data-garden-id': string;
12
13
  'data-garden-version': string;
13
- }, "data-garden-id" | "data-garden-version">;
14
+ } & IStyledTabPanelProps, "data-garden-id" | "data-garden-version">;
15
+ export {};
@@ -4,15 +4,11 @@
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 { DefaultTheme } from 'styled-components';
8
7
  interface IStyledTabsProps {
9
- /**
10
- * Displays vertical TabList styling
11
- */
12
8
  isVertical?: boolean;
13
9
  }
14
10
  /**
15
11
  * Accepts all `<div>` props
16
12
  */
17
- export declare const StyledTabs: import("styled-components").StyledComponent<"div", DefaultTheme, IStyledTabsProps, never>;
13
+ export declare const StyledTabs: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, IStyledTabsProps, never>;
18
14
  export {};
@@ -6,5 +6,9 @@
6
6
  */
7
7
  /// <reference types="react" />
8
8
  import { IUseTabsReturnValue } from '@zendeskgarden/container-tabs';
9
- export declare const TabsContext: import("react").Context<IUseTabsReturnValue<any> | undefined>;
10
- export declare const useTabsContext: () => IUseTabsReturnValue<any> | undefined;
9
+ interface ITabsContext extends IUseTabsReturnValue<any> {
10
+ isVertical?: boolean;
11
+ }
12
+ export declare const TabsContext: import("react").Context<ITabsContext | undefined>;
13
+ export declare const useTabsContext: () => ITabsContext | undefined;
14
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-tabs",
3
- "version": "8.76.1",
3
+ "version": "8.76.3",
4
4
  "description": "Components and render prop containers relating to the Garden Design System.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -21,9 +21,9 @@
21
21
  "sideEffects": false,
22
22
  "types": "dist/typings/index.d.ts",
23
23
  "dependencies": {
24
- "@zendeskgarden/container-tabs": "^2.0.1",
24
+ "@zendeskgarden/container-tabs": "^2.0.10",
25
25
  "@zendeskgarden/container-utilities": "^2.0.0",
26
- "polished": "^4.0.0",
26
+ "polished": "^4.3.1",
27
27
  "prop-types": "^15.5.7",
28
28
  "react-merge-refs": "^1.1.0"
29
29
  },
@@ -34,7 +34,7 @@
34
34
  "styled-components": "^4.2.0 || ^5.0.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@zendeskgarden/react-theming": "^8.76.1"
37
+ "@zendeskgarden/react-theming": "^8.76.3"
38
38
  },
39
39
  "keywords": [
40
40
  "components",
@@ -46,5 +46,5 @@
46
46
  "access": "public"
47
47
  },
48
48
  "zendeskgarden:src": "src/index.ts",
49
- "gitHead": "8351e305688a65273cb18741c0800be8027cf878"
49
+ "gitHead": "0740a0cc72d929a711f34e9201bae270a2752784"
50
50
  }