@zendeskgarden/react-tabs 9.0.0-next.3 → 9.0.0-next.5
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.
- package/README.md +10 -10
- package/dist/index.cjs.js +15 -11
- package/dist/index.esm.js +16 -12
- package/dist/typings/elements/Tab.d.ts +2 -0
- package/dist/typings/elements/TabList.d.ts +2 -0
- package/dist/typings/elements/TabPanel.d.ts +2 -0
- package/dist/typings/elements/Tabs.d.ts +9 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm install react react-dom styled-components @zendeskgarden/react-theming
|
|
|
17
17
|
```jsx
|
|
18
18
|
import React, { useState } from 'react';
|
|
19
19
|
import { ThemeProvider } from '@zendeskgarden/react-theming';
|
|
20
|
-
import { Tabs
|
|
20
|
+
import { Tabs } from '@zendeskgarden/react-tabs';
|
|
21
21
|
|
|
22
22
|
const Example = () => {
|
|
23
23
|
const [selectedTab, setSelectedTab] = useState('tab-1');
|
|
@@ -28,15 +28,15 @@ const Example = () => {
|
|
|
28
28
|
return (
|
|
29
29
|
<ThemeProvider>
|
|
30
30
|
<Tabs selectedItem={selectedTab} onChange={setSelectedTab}>
|
|
31
|
-
<TabList>
|
|
32
|
-
<Tab item="tab-1">Tab 1</Tab>
|
|
33
|
-
<Tab item="tab-2">Tab 2</Tab>
|
|
34
|
-
<Tab disabled>Disabled Tab</Tab>
|
|
35
|
-
<Tab item="tab-3">Tab 3</Tab>
|
|
36
|
-
</TabList>
|
|
37
|
-
<TabPanel item="tab-1">Tab 1 content</TabPanel>
|
|
38
|
-
<TabPanel item="tab-2">Tab 2 content</TabPanel>
|
|
39
|
-
<TabPanel item="tab-3">Tab 3 content</TabPanel>
|
|
31
|
+
<Tabs.TabList>
|
|
32
|
+
<Tabs.Tab item="tab-1">Tab 1</Tabs.Tab>
|
|
33
|
+
<Tabs.Tab item="tab-2">Tab 2</Tabs.Tab>
|
|
34
|
+
<Tabs.Tab disabled>Disabled Tab</Tabs.Tab>
|
|
35
|
+
<Tabs.Tab item="tab-3">Tab 3</Tabs.Tab>
|
|
36
|
+
</Tabs.TabList>
|
|
37
|
+
<Tabs.TabPanel item="tab-1">Tab 1 content</Tabs.TabPanel>
|
|
38
|
+
<Tabs.TabPanel item="tab-2">Tab 2 content</Tabs.TabPanel>
|
|
39
|
+
<Tabs.TabPanel item="tab-3">Tab 3 content</Tabs.TabPanel>
|
|
40
40
|
</Tabs>
|
|
41
41
|
</ThemeProvider>
|
|
42
42
|
);
|
package/dist/index.cjs.js
CHANGED
|
@@ -43,7 +43,7 @@ const colorStyles = _ref => {
|
|
|
43
43
|
theme,
|
|
44
44
|
isSelected
|
|
45
45
|
} = _ref;
|
|
46
|
-
const selectedColor = reactTheming.
|
|
46
|
+
const selectedColor = reactTheming.getColorV8('primaryHue', 600, theme);
|
|
47
47
|
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({
|
|
48
48
|
theme,
|
|
49
49
|
inset: true,
|
|
@@ -53,7 +53,7 @@ const colorStyles = _ref => {
|
|
|
53
53
|
styles: {
|
|
54
54
|
color: selectedColor
|
|
55
55
|
}
|
|
56
|
-
}), selectedColor, props => reactTheming.
|
|
56
|
+
}), selectedColor, props => reactTheming.getColorV8('neutralHue', 400, props.theme));
|
|
57
57
|
};
|
|
58
58
|
const sizeStyles = _ref2 => {
|
|
59
59
|
let {
|
|
@@ -66,7 +66,7 @@ const sizeStyles = _ref2 => {
|
|
|
66
66
|
};
|
|
67
67
|
const StyledTab = styled__default.default.div.attrs({
|
|
68
68
|
'data-garden-id': COMPONENT_ID$3,
|
|
69
|
-
'data-garden-version': '9.0.0-next.
|
|
69
|
+
'data-garden-version': '9.0.0-next.5'
|
|
70
70
|
}).withConfig({
|
|
71
71
|
displayName: "StyledTab",
|
|
72
72
|
componentId: "sc-x2pbow-0"
|
|
@@ -78,11 +78,11 @@ StyledTab.defaultProps = {
|
|
|
78
78
|
const COMPONENT_ID$2 = 'tabs.tablist';
|
|
79
79
|
const StyledTabList = styled__default.default.div.attrs({
|
|
80
80
|
'data-garden-id': COMPONENT_ID$2,
|
|
81
|
-
'data-garden-version': '9.0.0-next.
|
|
81
|
+
'data-garden-version': '9.0.0-next.5'
|
|
82
82
|
}).withConfig({
|
|
83
83
|
displayName: "StyledTabList",
|
|
84
84
|
componentId: "sc-wa5aaj-0"
|
|
85
|
-
})(["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.
|
|
85
|
+
})(["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));
|
|
86
86
|
StyledTabList.defaultProps = {
|
|
87
87
|
theme: reactTheming.DEFAULT_THEME
|
|
88
88
|
};
|
|
@@ -90,7 +90,7 @@ StyledTabList.defaultProps = {
|
|
|
90
90
|
const COMPONENT_ID$1 = 'tabs.tabpanel';
|
|
91
91
|
const StyledTabPanel = styled__default.default.div.attrs({
|
|
92
92
|
'data-garden-id': COMPONENT_ID$1,
|
|
93
|
-
'data-garden-version': '9.0.0-next.
|
|
93
|
+
'data-garden-version': '9.0.0-next.5'
|
|
94
94
|
}).withConfig({
|
|
95
95
|
displayName: "StyledTabPanel",
|
|
96
96
|
componentId: "sc-7lhrmp-0"
|
|
@@ -108,7 +108,7 @@ const verticalStyling = _ref => {
|
|
|
108
108
|
};
|
|
109
109
|
const StyledTabs = styled__default.default.div.attrs({
|
|
110
110
|
'data-garden-id': COMPONENT_ID,
|
|
111
|
-
'data-garden-version': '9.0.0-next.
|
|
111
|
+
'data-garden-version': '9.0.0-next.5'
|
|
112
112
|
}).withConfig({
|
|
113
113
|
displayName: "StyledTabs",
|
|
114
114
|
componentId: "sc-1qaor65-0"
|
|
@@ -210,7 +210,7 @@ const toTabs = children => React.Children.toArray(children).reduce((_items, chil
|
|
|
210
210
|
return retVal;
|
|
211
211
|
}, []);
|
|
212
212
|
|
|
213
|
-
const
|
|
213
|
+
const TabsComponent = React.forwardRef((_ref, ref) => {
|
|
214
214
|
let {
|
|
215
215
|
isVertical,
|
|
216
216
|
children,
|
|
@@ -244,15 +244,19 @@ const Tabs = React.forwardRef((_ref, ref) => {
|
|
|
244
244
|
ref: ref
|
|
245
245
|
}), children));
|
|
246
246
|
});
|
|
247
|
-
|
|
247
|
+
TabsComponent.propTypes = {
|
|
248
248
|
isVertical: PropTypes__default.default.bool,
|
|
249
249
|
selectedItem: PropTypes__default.default.any,
|
|
250
250
|
onChange: PropTypes__default.default.func
|
|
251
251
|
};
|
|
252
|
-
|
|
252
|
+
TabsComponent.defaultProps = {
|
|
253
253
|
isVertical: false
|
|
254
254
|
};
|
|
255
|
-
|
|
255
|
+
TabsComponent.displayName = 'Tabs';
|
|
256
|
+
const Tabs = TabsComponent;
|
|
257
|
+
Tabs.Tab = Tab;
|
|
258
|
+
Tabs.TabList = TabList;
|
|
259
|
+
Tabs.TabPanel = TabPanel;
|
|
256
260
|
|
|
257
261
|
exports.Tab = Tab;
|
|
258
262
|
exports.TabList = TabList;
|
package/dist/index.esm.js
CHANGED
|
@@ -9,7 +9,7 @@ import React, { createContext, useContext, Children, isValidElement, forwardRef,
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import { mergeRefs } from 'react-merge-refs';
|
|
11
11
|
import styled, { css, ThemeContext } from 'styled-components';
|
|
12
|
-
import { retrieveComponentStyles, DEFAULT_THEME,
|
|
12
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8, focusStyles } from '@zendeskgarden/react-theming';
|
|
13
13
|
import { stripUnit } from 'polished';
|
|
14
14
|
import { useTabs } from '@zendeskgarden/container-tabs';
|
|
15
15
|
import { getControlledValue } from '@zendeskgarden/container-utilities';
|
|
@@ -35,7 +35,7 @@ const colorStyles = _ref => {
|
|
|
35
35
|
theme,
|
|
36
36
|
isSelected
|
|
37
37
|
} = _ref;
|
|
38
|
-
const selectedColor =
|
|
38
|
+
const selectedColor = getColorV8('primaryHue', 600, theme);
|
|
39
39
|
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({
|
|
40
40
|
theme,
|
|
41
41
|
inset: true,
|
|
@@ -45,7 +45,7 @@ const colorStyles = _ref => {
|
|
|
45
45
|
styles: {
|
|
46
46
|
color: selectedColor
|
|
47
47
|
}
|
|
48
|
-
}), selectedColor, props =>
|
|
48
|
+
}), selectedColor, props => getColorV8('neutralHue', 400, props.theme));
|
|
49
49
|
};
|
|
50
50
|
const sizeStyles = _ref2 => {
|
|
51
51
|
let {
|
|
@@ -58,7 +58,7 @@ const sizeStyles = _ref2 => {
|
|
|
58
58
|
};
|
|
59
59
|
const StyledTab = styled.div.attrs({
|
|
60
60
|
'data-garden-id': COMPONENT_ID$3,
|
|
61
|
-
'data-garden-version': '9.0.0-next.
|
|
61
|
+
'data-garden-version': '9.0.0-next.5'
|
|
62
62
|
}).withConfig({
|
|
63
63
|
displayName: "StyledTab",
|
|
64
64
|
componentId: "sc-x2pbow-0"
|
|
@@ -70,11 +70,11 @@ StyledTab.defaultProps = {
|
|
|
70
70
|
const COMPONENT_ID$2 = 'tabs.tablist';
|
|
71
71
|
const StyledTabList = styled.div.attrs({
|
|
72
72
|
'data-garden-id': COMPONENT_ID$2,
|
|
73
|
-
'data-garden-version': '9.0.0-next.
|
|
73
|
+
'data-garden-version': '9.0.0-next.5'
|
|
74
74
|
}).withConfig({
|
|
75
75
|
displayName: "StyledTabList",
|
|
76
76
|
componentId: "sc-wa5aaj-0"
|
|
77
|
-
})(["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 =>
|
|
77
|
+
})(["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$2, props));
|
|
78
78
|
StyledTabList.defaultProps = {
|
|
79
79
|
theme: DEFAULT_THEME
|
|
80
80
|
};
|
|
@@ -82,7 +82,7 @@ StyledTabList.defaultProps = {
|
|
|
82
82
|
const COMPONENT_ID$1 = 'tabs.tabpanel';
|
|
83
83
|
const StyledTabPanel = styled.div.attrs({
|
|
84
84
|
'data-garden-id': COMPONENT_ID$1,
|
|
85
|
-
'data-garden-version': '9.0.0-next.
|
|
85
|
+
'data-garden-version': '9.0.0-next.5'
|
|
86
86
|
}).withConfig({
|
|
87
87
|
displayName: "StyledTabPanel",
|
|
88
88
|
componentId: "sc-7lhrmp-0"
|
|
@@ -100,7 +100,7 @@ const verticalStyling = _ref => {
|
|
|
100
100
|
};
|
|
101
101
|
const StyledTabs = styled.div.attrs({
|
|
102
102
|
'data-garden-id': COMPONENT_ID,
|
|
103
|
-
'data-garden-version': '9.0.0-next.
|
|
103
|
+
'data-garden-version': '9.0.0-next.5'
|
|
104
104
|
}).withConfig({
|
|
105
105
|
displayName: "StyledTabs",
|
|
106
106
|
componentId: "sc-1qaor65-0"
|
|
@@ -202,7 +202,7 @@ const toTabs = children => Children.toArray(children).reduce((_items, child) =>
|
|
|
202
202
|
return retVal;
|
|
203
203
|
}, []);
|
|
204
204
|
|
|
205
|
-
const
|
|
205
|
+
const TabsComponent = forwardRef((_ref, ref) => {
|
|
206
206
|
let {
|
|
207
207
|
isVertical,
|
|
208
208
|
children,
|
|
@@ -236,14 +236,18 @@ const Tabs = forwardRef((_ref, ref) => {
|
|
|
236
236
|
ref: ref
|
|
237
237
|
}), children));
|
|
238
238
|
});
|
|
239
|
-
|
|
239
|
+
TabsComponent.propTypes = {
|
|
240
240
|
isVertical: PropTypes.bool,
|
|
241
241
|
selectedItem: PropTypes.any,
|
|
242
242
|
onChange: PropTypes.func
|
|
243
243
|
};
|
|
244
|
-
|
|
244
|
+
TabsComponent.defaultProps = {
|
|
245
245
|
isVertical: false
|
|
246
246
|
};
|
|
247
|
-
|
|
247
|
+
TabsComponent.displayName = 'Tabs';
|
|
248
|
+
const Tabs = TabsComponent;
|
|
249
|
+
Tabs.Tab = Tab;
|
|
250
|
+
Tabs.TabList = TabList;
|
|
251
|
+
Tabs.TabPanel = TabPanel;
|
|
248
252
|
|
|
249
253
|
export { Tab, TabList, TabPanel, Tabs };
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ITabProps } from '../types';
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated use `Tabs.Tab` instead
|
|
11
|
+
*
|
|
10
12
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
11
13
|
*/
|
|
12
14
|
export declare const Tab: React.ForwardRefExoticComponent<ITabProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
/**
|
|
9
|
+
* @deprecated use `Tabs.TabList` instead
|
|
10
|
+
*
|
|
9
11
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
10
12
|
*/
|
|
11
13
|
export declare const TabList: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ITabPanelProps } from '../types';
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated use `Tabs.TabPanel` instead
|
|
11
|
+
*
|
|
10
12
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
11
13
|
*/
|
|
12
14
|
export declare const TabPanel: React.ForwardRefExoticComponent<ITabPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -6,7 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { ITabsProps } from '../types';
|
|
9
|
+
import { Tab } from './Tab';
|
|
10
|
+
import { TabList } from './TabList';
|
|
11
|
+
import { TabPanel } from './TabPanel';
|
|
12
|
+
export declare const TabsComponent: React.ForwardRefExoticComponent<ITabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
13
|
/**
|
|
10
14
|
* @extends HTMLAttributes<HTMLDivElement>
|
|
11
15
|
*/
|
|
12
|
-
export declare const Tabs: React.ForwardRefExoticComponent<ITabsProps & React.RefAttributes<HTMLDivElement
|
|
16
|
+
export declare const Tabs: React.ForwardRefExoticComponent<ITabsProps & React.RefAttributes<HTMLDivElement>> & {
|
|
17
|
+
Tab: typeof Tab;
|
|
18
|
+
TabList: typeof TabList;
|
|
19
|
+
TabPanel: typeof TabPanel;
|
|
20
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-tabs",
|
|
3
|
-
"version": "9.0.0-next.
|
|
3
|
+
"version": "9.0.0-next.5",
|
|
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>",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"@zendeskgarden/react-theming": "^8.67.0",
|
|
32
32
|
"react": ">=16.8.0",
|
|
33
33
|
"react-dom": ">=16.8.0",
|
|
34
|
-
"styled-components": "^5.1
|
|
34
|
+
"styled-components": "^5.3.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@zendeskgarden/react-theming": "^9.0.0-next.
|
|
37
|
+
"@zendeskgarden/react-theming": "^9.0.0-next.5"
|
|
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": "
|
|
49
|
+
"gitHead": "806fa33feb06142c3f69b6a87b53628469117e4d"
|
|
50
50
|
}
|