@bitrise/bitkit 9.17.0-alpha-chakra.5 → 9.17.0
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/package.json
CHANGED
|
@@ -1,10 +1,49 @@
|
|
|
1
1
|
const schemeColors = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
blue: {
|
|
3
|
+
color: 'blue.40',
|
|
4
|
+
_active: {
|
|
5
|
+
backgroundColor: 'blue.90',
|
|
6
|
+
},
|
|
7
|
+
_hover: {
|
|
8
|
+
backgroundColor: 'blue.93',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
red: {
|
|
12
|
+
color: 'red.40',
|
|
13
|
+
_active: {
|
|
14
|
+
backgroundColor: 'red.90',
|
|
15
|
+
},
|
|
16
|
+
_hover: {
|
|
17
|
+
backgroundColor: 'red.93',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
green: {
|
|
21
|
+
color: 'green.50',
|
|
22
|
+
_active: {
|
|
23
|
+
backgroundColor: 'green.90',
|
|
24
|
+
},
|
|
25
|
+
_hover: {
|
|
26
|
+
backgroundColor: 'green.93',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
yellow: {
|
|
30
|
+
color: 'yellow.40',
|
|
31
|
+
_active: {
|
|
32
|
+
backgroundColor: 'yellow.90',
|
|
33
|
+
},
|
|
34
|
+
_hover: {
|
|
35
|
+
backgroundColor: 'yellow.93',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
purple: {
|
|
39
|
+
color: 'purple.40',
|
|
40
|
+
_active: {
|
|
41
|
+
backgroundColor: 'purple.90',
|
|
42
|
+
},
|
|
43
|
+
_hover: {
|
|
44
|
+
backgroundColor: 'purple.93',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
8
47
|
};
|
|
9
48
|
|
|
10
49
|
const ColorButtonTheme = {
|
|
@@ -13,8 +52,8 @@ const ColorButtonTheme = {
|
|
|
13
52
|
display: 'inline-flex',
|
|
14
53
|
alignItems: 'center',
|
|
15
54
|
justifyContent: 'center',
|
|
16
|
-
|
|
17
|
-
|
|
55
|
+
backgroundColor: 'transparent',
|
|
56
|
+
...schemeColors[c || 'blue'],
|
|
18
57
|
};
|
|
19
58
|
},
|
|
20
59
|
};
|
|
@@ -24,15 +24,19 @@ const badge = {
|
|
|
24
24
|
|
|
25
25
|
export const WithDefaults: ComponentStory<typeof Tabs> = (props) => {
|
|
26
26
|
return (
|
|
27
|
-
<Tabs
|
|
27
|
+
<Tabs defaultTab="selected-as-default" {...props}>
|
|
28
28
|
<TabList>
|
|
29
29
|
<Tab id="basic">Basic</Tab>
|
|
30
30
|
<Tab id="selected-as-default">Selected as default</Tab>
|
|
31
|
-
<Tab leftIconName="Bell">
|
|
31
|
+
<Tab id="with-left-icon" leftIconName="Bell">
|
|
32
|
+
With left icon
|
|
33
|
+
</Tab>
|
|
32
34
|
<Tab id="with-badge" badge={badge}>
|
|
33
35
|
With badge
|
|
34
36
|
</Tab>
|
|
35
|
-
<Tab isDisabled>
|
|
37
|
+
<Tab id="disabled" isDisabled>
|
|
38
|
+
Disabled
|
|
39
|
+
</Tab>
|
|
36
40
|
<Tab id="with-right-icon" rightIconName="ArrowForward">
|
|
37
41
|
With right icon
|
|
38
42
|
</Tab>
|
|
@@ -3,6 +3,7 @@ import { Tabs as ChakraTabs, TabsProps as ChakraTabsProps, forwardRef } from '@c
|
|
|
3
3
|
import { useHistory } from '../../hooks';
|
|
4
4
|
|
|
5
5
|
export interface TabsProps extends ChakraTabsProps {
|
|
6
|
+
defaultTab?: string;
|
|
6
7
|
onChange?: (index: number, tabId?: string) => void;
|
|
7
8
|
withHistory?: boolean;
|
|
8
9
|
}
|
|
@@ -20,12 +21,13 @@ const getTabIds = (props: TabsProps) => {
|
|
|
20
21
|
* An accessible tabs component that provides keyboard interactions and ARIA attributes described in the WAI-ARIA Tabs Design Pattern.
|
|
21
22
|
*/
|
|
22
23
|
const Tabs = forwardRef<TabsProps, 'div'>((props, ref) => {
|
|
23
|
-
const {
|
|
24
|
+
const { defaultTab = '', onChange, withHistory, ...rest } = props;
|
|
25
|
+
const tabIds = getTabIds(props);
|
|
26
|
+
const defaultIndex = tabIds.indexOf(defaultTab) > -1 ? tabIds.indexOf(defaultTab) : 0;
|
|
27
|
+
|
|
24
28
|
const { searchParams, replace } = useHistory();
|
|
25
29
|
const [actualIndex, setActualIndex] = useState(defaultIndex);
|
|
26
30
|
|
|
27
|
-
const tabIds = getTabIds(props);
|
|
28
|
-
|
|
29
31
|
useEffect(() => {
|
|
30
32
|
if (withHistory && searchParams.get('tab')) {
|
|
31
33
|
const tabName = searchParams.get('tab') || '';
|