@zendeskgarden/react-tabs 9.0.0-next.11 → 9.0.0-next.13

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
  }));
@@ -43,8 +43,12 @@ const TabsComponent = forwardRef((_ref, ref) => {
43
43
  }
44
44
  }
45
45
  });
46
+ const contextValue = useMemo(() => ({
47
+ isVertical,
48
+ ...tabsContextValue
49
+ }), [isVertical, tabsContextValue]);
46
50
  return React.createElement(TabsContext.Provider, {
47
- value: tabsContextValue
51
+ value: contextValue
48
52
  }, React.createElement(StyledTabs, Object.assign({
49
53
  isVertical: isVertical
50
54
  }, 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': '9.0.0-next.11'
53
+ 'data-garden-version': '9.0.0-next.13'
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{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{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': '9.0.0-next.11'
32
+ 'data-garden-version': '9.0.0-next.13'
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': '9.0.0-next.11'
21
+ 'data-garden-version': '9.0.0-next.13'
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{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': '9.0.0-next.11'
13
+ 'data-garden-version': '9.0.0-next.13'
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
@@ -22,13 +22,15 @@ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
22
22
  var styled__default = /*#__PURE__*/_interopDefault(styled);
23
23
 
24
24
  const COMPONENT_ID$3 = 'tabs.tab';
25
- const colorStyles = _ref => {
25
+ const colorStyles$1 = _ref => {
26
26
  let {
27
27
  theme,
28
- isSelected
28
+ isSelected,
29
+ isVertical
29
30
  } = _ref;
31
+ const borderColor = isSelected ? 'currentcolor' : 'transparent';
30
32
  const selectedColor = reactTheming.getColorV8('primaryHue', 600, theme);
31
- 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({
33
+ 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({
32
34
  theme,
33
35
  inset: true,
34
36
  spacerWidth: null,
@@ -39,64 +41,101 @@ const colorStyles = _ref => {
39
41
  }
40
42
  }), selectedColor, props => reactTheming.getColorV8('neutralHue', 400, props.theme));
41
43
  };
42
- const sizeStyles = _ref2 => {
44
+ const sizeStyles$2 = _ref2 => {
43
45
  let {
44
- theme
46
+ theme,
47
+ isVertical
45
48
  } = _ref2;
46
- const paddingTop = theme.space.base * 2.5;
47
- const paddingHorizontal = theme.space.base * 7;
48
- const paddingBottom = paddingTop - polished.stripUnit(theme.borderWidths.md) - polished.stripUnit(theme.borderWidths.sm);
49
- return styled.css(["padding:", "px ", "px ", "px;"], paddingTop, paddingHorizontal, paddingBottom);
49
+ const borderWidth = theme.borderWidths.md;
50
+ const focusHeight = `${theme.space.base * 5}px`;
51
+ let marginBottom;
52
+ let padding;
53
+ if (isVertical) {
54
+ marginBottom = `${theme.space.base * 5}px`;
55
+ padding = `${theme.space.base}px ${theme.space.base * 2}px`;
56
+ } else {
57
+ const paddingTop = theme.space.base * 2.5;
58
+ const paddingHorizontal = theme.space.base * 7;
59
+ const paddingBottom = paddingTop - polished.stripUnit(theme.borderWidths.md) - polished.stripUnit(theme.borderWidths.sm);
60
+ padding = `${paddingTop}px ${paddingHorizontal}px ${paddingBottom}px`;
61
+ }
62
+ 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);
50
63
  };
51
64
  const StyledTab = styled__default.default.div.attrs({
52
65
  'data-garden-id': COMPONENT_ID$3,
53
- 'data-garden-version': '9.0.0-next.11'
66
+ 'data-garden-version': '9.0.0-next.13'
54
67
  }).withConfig({
55
68
  displayName: "StyledTab",
56
69
  componentId: "sc-x2pbow-0"
57
- })(["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{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));
70
+ })(["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{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 => {
71
+ if (props.isVertical) {
72
+ return props.theme.rtl ? 'right' : 'left';
73
+ }
74
+ return 'center';
75
+ }, 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));
58
76
  StyledTab.defaultProps = {
59
77
  theme: reactTheming.DEFAULT_THEME
60
78
  };
61
79
 
62
80
  const COMPONENT_ID$2 = 'tabs.tablist';
81
+ const colorStyles = _ref => {
82
+ let {
83
+ theme
84
+ } = _ref;
85
+ const borderColor = reactTheming.getColorV8('neutralHue', 300, theme);
86
+ const foregroundColor = reactTheming.getColorV8('neutralHue', 600, theme);
87
+ return styled.css(["border-bottom-color:", ";color:", ";"], borderColor, foregroundColor);
88
+ };
89
+ const sizeStyles$1 = _ref2 => {
90
+ let {
91
+ theme,
92
+ isVertical
93
+ } = _ref2;
94
+ const marginBottom = isVertical ? 0 : `${theme.space.base * 5}px`;
95
+ const borderBottom = isVertical ? undefined : theme.borderWidths.sm;
96
+ const fontSize = theme.fontSizes.md;
97
+ const lineHeight = reactTheming.getLineHeight(theme.space.base * 5, fontSize);
98
+ return styled.css(["margin-top:0;margin-bottom:", ";border-bottom-width:", ";padding:0;line-height:", ";font-size:", ";"], marginBottom, borderBottom, lineHeight, fontSize);
99
+ };
63
100
  const StyledTabList = styled__default.default.div.attrs({
64
101
  'data-garden-id': COMPONENT_ID$2,
65
- 'data-garden-version': '9.0.0-next.11'
102
+ 'data-garden-version': '9.0.0-next.13'
66
103
  }).withConfig({
67
104
  displayName: "StyledTabList",
68
105
  componentId: "sc-wa5aaj-0"
69
- })(["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));
106
+ })(["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));
70
107
  StyledTabList.defaultProps = {
71
108
  theme: reactTheming.DEFAULT_THEME
72
109
  };
73
110
 
74
111
  const COMPONENT_ID$1 = 'tabs.tabpanel';
112
+ const sizeStyles = _ref => {
113
+ let {
114
+ theme,
115
+ isVertical
116
+ } = _ref;
117
+ const margin = isVertical ? `${theme.space.base * 8}px` : undefined;
118
+ return styled.css(["margin-", ":", ";"], theme.rtl ? 'right' : 'left', margin);
119
+ };
75
120
  const StyledTabPanel = styled__default.default.div.attrs({
76
121
  'data-garden-id': COMPONENT_ID$1,
77
- 'data-garden-version': '9.0.0-next.11'
122
+ 'data-garden-version': '9.0.0-next.13'
78
123
  }).withConfig({
79
124
  displayName: "StyledTabPanel",
80
125
  componentId: "sc-7lhrmp-0"
81
- })(["display:block;&[aria-hidden='true']{display:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
126
+ })(["display:block;vertical-align:", ";", ";&[aria-hidden='true']{display:none;}", ";"], props => props.isVertical && 'top', sizeStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
82
127
  StyledTabPanel.defaultProps = {
83
128
  theme: reactTheming.DEFAULT_THEME
84
129
  };
85
130
 
86
131
  const COMPONENT_ID = 'tabs.tabs';
87
- const verticalStyling = _ref => {
88
- let {
89
- theme
90
- } = _ref;
91
- 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{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);
92
- };
93
132
  const StyledTabs = styled__default.default.div.attrs({
94
133
  'data-garden-id': COMPONENT_ID,
95
- 'data-garden-version': '9.0.0-next.11'
134
+ 'data-garden-version': '9.0.0-next.13'
96
135
  }).withConfig({
97
136
  displayName: "StyledTabs",
98
137
  componentId: "sc-1qaor65-0"
99
- })(["display:block;overflow:hidden;direction:", ";", ";", ";"], props => props.theme.rtl && 'rtl', props => props.isVertical && verticalStyling(props), props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
138
+ })(["display:", ";overflow:hidden;direction:", ";", ";"], props => props.isVertical ? 'table' : 'block', props => props.theme.rtl && 'rtl', props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
100
139
  StyledTabs.defaultProps = {
101
140
  theme: reactTheming.DEFAULT_THEME
102
141
  };
@@ -117,7 +156,8 @@ const Tab = React__default.default.forwardRef((_ref, ref) => {
117
156
  return React__default.default.createElement(StyledTab, Object.assign({
118
157
  role: "tab",
119
158
  "aria-disabled": disabled,
120
- ref: ref
159
+ ref: ref,
160
+ isVertical: tabsPropGetters?.isVertical
121
161
  }, otherProps));
122
162
  }
123
163
  const {
@@ -127,7 +167,8 @@ const Tab = React__default.default.forwardRef((_ref, ref) => {
127
167
  value: item
128
168
  });
129
169
  return React__default.default.createElement(StyledTab, Object.assign({
130
- isSelected: item === tabsPropGetters.selectedValue
170
+ isSelected: item === tabsPropGetters.selectedValue,
171
+ isVertical: tabsPropGetters.isVertical
131
172
  }, tabProps, otherProps, {
132
173
  ref: reactMergeRefs.mergeRefs([tabRef, ref])
133
174
  }));
@@ -146,7 +187,9 @@ const TabList = React__default.default.forwardRef((props, ref) => {
146
187
  }, props));
147
188
  }
148
189
  const tabListProps = tabsPropGetters.getTabListProps();
149
- return React__default.default.createElement(StyledTabList, Object.assign({}, tabListProps, props, {
190
+ return React__default.default.createElement(StyledTabList, Object.assign({
191
+ isVertical: tabsPropGetters.isVertical
192
+ }, tabListProps, props, {
150
193
  ref: ref
151
194
  }));
152
195
  });
@@ -167,7 +210,8 @@ const TabPanel = React__default.default.forwardRef((_ref, ref) => {
167
210
  value: item
168
211
  });
169
212
  return React__default.default.createElement(StyledTabPanel, Object.assign({
170
- "aria-hidden": tabsPropGetters.selectedValue !== item
213
+ "aria-hidden": tabsPropGetters.selectedValue !== item,
214
+ isVertical: tabsPropGetters.isVertical
171
215
  }, tabPanelProps, otherProps, {
172
216
  ref: ref
173
217
  }));
@@ -220,8 +264,12 @@ const TabsComponent = React.forwardRef((_ref, ref) => {
220
264
  }
221
265
  }
222
266
  });
267
+ const contextValue = React.useMemo(() => ({
268
+ isVertical,
269
+ ...tabsContextValue
270
+ }), [isVertical, tabsContextValue]);
223
271
  return React__default.default.createElement(TabsContext.Provider, {
224
- value: tabsContextValue
272
+ value: contextValue
225
273
  }, React__default.default.createElement(StyledTabs, Object.assign({
226
274
  isVertical: isVertical
227
275
  }, 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": "9.0.0-next.11",
3
+ "version": "9.0.0-next.13",
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": "^2.0.0"
29
29
  },
@@ -34,7 +34,7 @@
34
34
  "styled-components": "^5.3.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@zendeskgarden/react-theming": "^9.0.0-next.11"
37
+ "@zendeskgarden/react-theming": "^9.0.0-next.13"
38
38
  },
39
39
  "keywords": [
40
40
  "components",
@@ -45,6 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "zendeskgarden:src": "src/index.ts",
49
- "gitHead": "0de1cc664807bd993ccd3beeb78e8fd1f3828320"
48
+ "zendeskgarden:src": "src/index.ts"
50
49
  }
package/LICENSE.md DELETED
@@ -1,176 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS