@bitrise/bitkit 13.276.0 → 13.278.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,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "13.276.0",
4
+ "version": "13.278.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -8,6 +8,7 @@ export type FilterOptions = string[];
8
8
  export type FilterValue = string[];
9
9
  export type FilterOptionsMap = Record<string, string>;
10
10
  export type FilterIconsMap = Record<string, TypeIconName>;
11
+ export type FilterIconColorsMap = Record<string, string>;
11
12
 
12
13
  export type FilterSearchCallback = (
13
14
  category: string,
@@ -20,6 +21,7 @@ export type FilterCategoryProps = {
20
21
  unfilteredLabel?: string;
21
22
  dependsOn?: Record<string, string>;
22
23
  iconsMap?: FilterIconsMap;
24
+ iconColorsMap?: FilterIconColorsMap;
23
25
  hasNotFilteredOption?: boolean;
24
26
  preserveOptionOrder?: boolean;
25
27
  isInitialLoading?: boolean;
@@ -1,7 +1,7 @@
1
1
  import { rem } from '../../../utils/utils';
2
2
 
3
3
  const FilterSwitch = {
4
- baseStyle: ({ isChecked }: { isChecked: boolean }) => {
4
+ baseStyle: ({ isChecked, iconColor }: { isChecked: boolean; iconColor?: string }) => {
5
5
  return {
6
6
  container: {
7
7
  background: 'neutral.95',
@@ -10,7 +10,7 @@ const FilterSwitch = {
10
10
  display: 'flex',
11
11
  },
12
12
  icon: {
13
- color: isChecked ? 'icon/secondary' : 'icon/tertiary',
13
+ color: isChecked ? iconColor || 'icon/secondary' : 'icon/tertiary',
14
14
  },
15
15
  item: {
16
16
  borderRadius: '4',
@@ -23,7 +23,7 @@ const FilterSwitch = {
23
23
  color: 'text/primary',
24
24
 
25
25
  '> svg': {
26
- color: 'icon/secondary',
26
+ color: isChecked && iconColor ? iconColor : 'icon/secondary',
27
27
  },
28
28
  },
29
29
  _active: {
@@ -20,6 +20,7 @@ type RadioInputProps = ChakraRadioProps['inputProps'] & {
20
20
 
21
21
  export interface FilterSwitchProps extends Omit<ChakraRadioProps, 'inputProps'> {
22
22
  iconName?: TypeIconName;
23
+ iconColor?: string;
23
24
  inputProps?: RadioInputProps;
24
25
  }
25
26
 
@@ -32,11 +33,11 @@ export const [FilterSwitchContextProvider, useFilterSwitchContext] = createConte
32
33
 
33
34
  const FilterSwitch = forwardRef<FilterSwitchProps, 'input'>((props, ref) => {
34
35
  const group = useRadioGroupContext();
35
- const { value: valueProp } = props;
36
+ const { value: valueProp, iconColor } = props;
36
37
 
37
38
  const isChecked = group.value === valueProp;
38
39
 
39
- const styles = useMultiStyleConfig('FilterSwitch', { isChecked });
40
+ const styles = useMultiStyleConfig('FilterSwitch', { isChecked, iconColor });
40
41
 
41
42
  const ownProps = omitThemingProps(props);
42
43
 
@@ -12,7 +12,7 @@ type FilterSwitchAdapterProps = {
12
12
  const FilterSwitchAdapter = (props: FilterSwitchAdapterProps) => {
13
13
  const { category } = props;
14
14
  const { data, onFilterChange, state } = useFilterContext();
15
- const { allOptionLabel, iconsMap, options, optionsMap } = data[category] as FilterCategoryProps & {
15
+ const { allOptionLabel, iconsMap, iconColorsMap, options, optionsMap } = data[category] as FilterCategoryProps & {
16
16
  allOptionLabel?: string;
17
17
  };
18
18
 
@@ -34,7 +34,12 @@ const FilterSwitchAdapter = (props: FilterSwitchAdapterProps) => {
34
34
  {allOptionLabel || 'All items'}
35
35
  </FilterSwitch>
36
36
  {options.map((opt) => (
37
- <FilterSwitch key={opt} value={opt} iconName={iconsMap && iconsMap[opt]}>
37
+ <FilterSwitch
38
+ key={opt}
39
+ value={opt}
40
+ iconName={iconsMap && iconsMap[opt]}
41
+ iconColor={iconColorsMap && iconColorsMap[opt]}
42
+ >
38
43
  {getOptionLabel(opt, optionsMap)}
39
44
  </FilterSwitch>
40
45
  ))}
@@ -31,13 +31,14 @@ const SidebarDivider = () => {
31
31
  return <Divider {...margins} w="auto" />;
32
32
  };
33
33
 
34
- const SidebarGroupHeader = ({ label }: { label: string }) => {
34
+ const SidebarGroupHeader = ({ label, badge }: { label: string; badge: ReactNode }) => {
35
35
  return (
36
36
  <Box alignItems="center" display="flex" gap="16" marginBottom="12" marginTop="24" mx="32">
37
37
  <Text as="h6" textStyle="heading/h6" textColor="neutral.60">
38
38
  {label}
39
39
  </Text>
40
40
  <Divider flexGrow="1" w="auto" />
41
+ {badge}
41
42
  </Box>
42
43
  );
43
44
  };