@bitrise/bitkit 12.23.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "12.23.3",
4
+ "version": "12.23.5",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -229,6 +229,9 @@ function useDropdown<T>({
229
229
  if (currentOption) {
230
230
  setFormLabel(currentOption.label);
231
231
  setSelectedIndex(currentOption.index);
232
+ } else {
233
+ setFormLabel(null);
234
+ setSelectedIndex(null);
232
235
  }
233
236
  }, [refdChildren, formValue]);
234
237
  return {
@@ -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 ContentSwitcherContextType {
4
+ export interface SegmentedControlContextType {
5
5
  getRadioProps: UseRadioGroupReturn['getRadioProps'];
6
6
  isGroupDisabled?: boolean;
7
7
  }
8
- export const [ContentSwitcherContext, useContentSwitcherContext] = createContext<ContentSwitcherContextType>();
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 ContentSwitcherTheme = itemHelpers.defineMultiStyleConfig({
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: 'purple.10',
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
- fontWeight: 'demiBold',
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.60',
55
+ color: 'neutral.70',
54
56
  },
55
57
  },
56
58
  },
57
59
  });
58
60
 
59
- export default ContentSwitcherTheme;
61
+ export default SegmentedControlTheme;
@@ -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 { ContentSwitcherContext, ContentSwitcherContextType } from './ContentSwitcher.context';
4
+ import { SegmentedControlContext, SegmentedControlContextType } from './SegmentedControl.context';
5
5
 
6
- export type ContentSwitcherProps = BoxProps & UseRadioGroupProps;
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 ContentSwitcher = forwardRef<ContentSwitcherProps, 'div'>((props, ref) => {
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<ContentSwitcherContextType>(
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('ContentSwitcher');
32
+ const theme = useMultiStyleConfig('SegmentedControl');
33
33
 
34
34
  return (
35
- <ContentSwitcherContext value={ctx}>
35
+ <SegmentedControlContext value={ctx}>
36
36
  <Box __css={theme.container} ref={ref} {...group} {...rest} />
37
- </ContentSwitcherContext>
37
+ </SegmentedControlContext>
38
38
  );
39
39
  });
40
40
 
41
- export default ContentSwitcher;
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 { useContentSwitcherContext } from './ContentSwitcher.context';
3
+ import { useSegmentedControlContext } from './SegmentedControl.context';
4
4
 
5
- export interface ContentSwitcherItemProps {
5
+ export interface SegmentedControlItemProps {
6
6
  children: string;
7
7
  isDisabled?: boolean;
8
8
  value: string;
9
9
  }
10
10
 
11
- const ContentSwitcherItem = (props: ContentSwitcherItemProps) => {
12
- const { getRadioProps, isGroupDisabled } = useContentSwitcherContext();
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('ContentSwitcher');
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 ContentSwitcherItem;
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 { ContentSwitcherProps } from './Components/ContentSwitcher/ContentSwitcher';
271
- export { default as ContentSwitcher } from './Components/ContentSwitcher/ContentSwitcher';
270
+ export type { SegmentedControlProps } from './Components/SegmentedControl/SegmentedControl';
271
+ export { default as SegmentedControl } from './Components/SegmentedControl/SegmentedControl';
272
272
 
273
- export type { ContentSwitcherItemProps } from './Components/ContentSwitcher/ContentSwitcherItem';
274
- export { default as ContentSwitcherItem } from './Components/ContentSwitcher/ContentSwitcherItem';
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 ContentSwitcher from './Components/ContentSwitcher/ContentSwitcher.theme';
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
- ContentSwitcher,
120
+ SegmentedControl,
121
121
  Tag,
122
122
  },
123
123
  };