@bitrise/bitkit 12.23.4 → 12.23.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/package.json +1 -1
- package/src/Components/{ContentSwitcher/ContentSwitcher.context.ts → SegmentedControl/SegmentedControl.context.ts} +2 -2
- package/src/Components/{ContentSwitcher/ContentSwitcher.theme.ts → SegmentedControl/SegmentedControl.theme.ts} +8 -6
- package/src/Components/{ContentSwitcher/ContentSwitcher.tsx → SegmentedControl/SegmentedControl.tsx} +8 -8
- package/src/Components/{ContentSwitcher/ContentSwitcherItem.tsx → SegmentedControl/SegmentedControlItem.tsx} +6 -6
- package/src/index.ts +4 -4
- package/src/theme.ts +2 -2
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UseRadioGroupReturn } from '@chakra-ui/react';
|
|
2
2
|
import { createContext } from '@chakra-ui/react-utils';
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface SegmentedControlContextType {
|
|
5
5
|
getRadioProps: UseRadioGroupReturn['getRadioProps'];
|
|
6
6
|
isGroupDisabled?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export const [
|
|
8
|
+
export const [SegmentedControlContext, useSegmentedControlContext] = createContext<SegmentedControlContextType>();
|
|
@@ -2,7 +2,7 @@ import { createMultiStyleConfigHelpers } from '@chakra-ui/styled-system';
|
|
|
2
2
|
|
|
3
3
|
const itemHelpers = createMultiStyleConfigHelpers(['container', 'item']);
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const SegmentedControlTheme = itemHelpers.defineMultiStyleConfig({
|
|
6
6
|
baseStyle: {
|
|
7
7
|
container: {
|
|
8
8
|
display: 'flex',
|
|
@@ -18,14 +18,14 @@ const ContentSwitcherTheme = itemHelpers.defineMultiStyleConfig({
|
|
|
18
18
|
cursor: 'pointer',
|
|
19
19
|
fontSize: '3',
|
|
20
20
|
lineHeight: '2.375rem',
|
|
21
|
-
color: '
|
|
21
|
+
color: 'neutral.40',
|
|
22
22
|
textAlign: 'center',
|
|
23
|
+
fontWeight: 'demiBold',
|
|
23
24
|
border: '1px solid',
|
|
24
25
|
borderColor: 'transparent',
|
|
25
26
|
borderRadius: '4',
|
|
26
27
|
_checked: {
|
|
27
|
-
|
|
28
|
-
color: 'purple.40',
|
|
28
|
+
color: 'purple.10',
|
|
29
29
|
backgroundColor: 'neutral.100',
|
|
30
30
|
borderColor: 'separator.primary',
|
|
31
31
|
_hover: {
|
|
@@ -43,17 +43,19 @@ const ContentSwitcherTheme = itemHelpers.defineMultiStyleConfig({
|
|
|
43
43
|
_hover: {
|
|
44
44
|
backgroundColor: 'neutral.93',
|
|
45
45
|
borderColor: 'neutral.93',
|
|
46
|
+
color: 'neutral.10',
|
|
46
47
|
_disabled: {
|
|
47
48
|
backgroundColor: 'transparent',
|
|
48
49
|
borderColor: 'transparent',
|
|
50
|
+
color: 'neutral.70',
|
|
49
51
|
},
|
|
50
52
|
},
|
|
51
53
|
_disabled: {
|
|
52
54
|
cursor: 'not-allowed',
|
|
53
|
-
color: 'neutral.
|
|
55
|
+
color: 'neutral.70',
|
|
54
56
|
},
|
|
55
57
|
},
|
|
56
58
|
},
|
|
57
59
|
});
|
|
58
60
|
|
|
59
|
-
export default
|
|
61
|
+
export default SegmentedControlTheme;
|
package/src/Components/{ContentSwitcher/ContentSwitcher.tsx → SegmentedControl/SegmentedControl.tsx}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useMultiStyleConfig, useRadioGroup, UseRadioGroupProps, forwardRef } from '@chakra-ui/react';
|
|
3
3
|
import Box, { BoxProps } from '../Box/Box';
|
|
4
|
-
import {
|
|
4
|
+
import { SegmentedControlContext, SegmentedControlContextType } from './SegmentedControl.context';
|
|
5
5
|
|
|
6
|
-
export type
|
|
6
|
+
export type SegmentedControlProps = BoxProps & UseRadioGroupProps;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* This is a custom radio button group, based on: https://chakra-ui.com/docs/components/radio/usage#custom-radio-buttons.
|
|
10
10
|
*/
|
|
11
|
-
const
|
|
11
|
+
const SegmentedControl = forwardRef<SegmentedControlProps, 'div'>((props, ref) => {
|
|
12
12
|
const { defaultValue, isDisabled, name, onChange, value, ...rest } = props;
|
|
13
13
|
|
|
14
14
|
const { getRootProps, getRadioProps } = useRadioGroup({
|
|
@@ -19,7 +19,7 @@ const ContentSwitcher = forwardRef<ContentSwitcherProps, 'div'>((props, ref) =>
|
|
|
19
19
|
value,
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
const ctx = useMemo<
|
|
22
|
+
const ctx = useMemo<SegmentedControlContextType>(
|
|
23
23
|
() => ({
|
|
24
24
|
getRadioProps,
|
|
25
25
|
isGroupDisabled: isDisabled,
|
|
@@ -29,13 +29,13 @@ const ContentSwitcher = forwardRef<ContentSwitcherProps, 'div'>((props, ref) =>
|
|
|
29
29
|
|
|
30
30
|
const group = getRootProps();
|
|
31
31
|
|
|
32
|
-
const theme = useMultiStyleConfig('
|
|
32
|
+
const theme = useMultiStyleConfig('SegmentedControl');
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<
|
|
35
|
+
<SegmentedControlContext value={ctx}>
|
|
36
36
|
<Box __css={theme.container} ref={ref} {...group} {...rest} />
|
|
37
|
-
</
|
|
37
|
+
</SegmentedControlContext>
|
|
38
38
|
);
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
export default
|
|
41
|
+
export default SegmentedControl;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { useMultiStyleConfig, useRadio } from '@chakra-ui/react';
|
|
2
2
|
import Box from '../Box/Box';
|
|
3
|
-
import {
|
|
3
|
+
import { useSegmentedControlContext } from './SegmentedControl.context';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface SegmentedControlItemProps {
|
|
6
6
|
children: string;
|
|
7
7
|
isDisabled?: boolean;
|
|
8
8
|
value: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
const { getRadioProps, isGroupDisabled } =
|
|
11
|
+
const SegmentedControlItem = (props: SegmentedControlItemProps) => {
|
|
12
|
+
const { getRadioProps, isGroupDisabled } = useSegmentedControlContext();
|
|
13
13
|
|
|
14
14
|
const { children, isDisabled, value } = props;
|
|
15
15
|
|
|
16
16
|
const { getInputProps, getCheckboxProps } = useRadio(getRadioProps({ value }));
|
|
17
17
|
|
|
18
|
-
const theme = useMultiStyleConfig('
|
|
18
|
+
const theme = useMultiStyleConfig('SegmentedControl');
|
|
19
19
|
|
|
20
20
|
const isItemDisabled = isGroupDisabled || isDisabled;
|
|
21
21
|
|
|
@@ -27,4 +27,4 @@ const ContentSwitcherItem = (props: ContentSwitcherItemProps) => {
|
|
|
27
27
|
);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export default
|
|
30
|
+
export default SegmentedControlItem;
|
package/src/index.ts
CHANGED
|
@@ -267,11 +267,11 @@ export {
|
|
|
267
267
|
export { default as SidebarItem } from './Components/Sidebar/SidebarItem';
|
|
268
268
|
export { SidebarItemIcon, SidebarItemLabel, SidebarItemDateExtra } from './Components/Sidebar/SidebarItem';
|
|
269
269
|
|
|
270
|
-
export type {
|
|
271
|
-
export { default as
|
|
270
|
+
export type { SegmentedControlProps } from './Components/SegmentedControl/SegmentedControl';
|
|
271
|
+
export { default as SegmentedControl } from './Components/SegmentedControl/SegmentedControl';
|
|
272
272
|
|
|
273
|
-
export type {
|
|
274
|
-
export { default as
|
|
273
|
+
export type { SegmentedControlItemProps } from './Components/SegmentedControl/SegmentedControlItem';
|
|
274
|
+
export { default as SegmentedControlItem } from './Components/SegmentedControl/SegmentedControlItem';
|
|
275
275
|
|
|
276
276
|
export type { DrawerProps } from './Components/Drawer/Drawer';
|
|
277
277
|
export { default as Drawer } from './Components/Drawer/Drawer';
|
package/src/theme.ts
CHANGED
|
@@ -34,7 +34,7 @@ import ProgressBar from './Components/ProgressBar/ProgressBar.theme';
|
|
|
34
34
|
import Slider from './Components/Slider/Slider.theme';
|
|
35
35
|
import Sidebar from './Components/Sidebar/Sidebar.theme';
|
|
36
36
|
import SidebarItem from './Components/Sidebar/SidebarItem.theme';
|
|
37
|
-
import
|
|
37
|
+
import SegmentedControl from './Components/SegmentedControl/SegmentedControl.theme';
|
|
38
38
|
import Tag from './Components/Tag/Tag.theme';
|
|
39
39
|
|
|
40
40
|
import breakpoints from './Foundations/Breakpoints/Breakpoints';
|
|
@@ -117,7 +117,7 @@ const theme = {
|
|
|
117
117
|
SidebarItem,
|
|
118
118
|
Progress: ProgressBar,
|
|
119
119
|
Slider,
|
|
120
|
-
|
|
120
|
+
SegmentedControl,
|
|
121
121
|
Tag,
|
|
122
122
|
},
|
|
123
123
|
};
|