@bitrise/bitkit 13.275.0 → 13.277.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 +1 -1
- package/src/Components/Filter/Filter.types.ts +2 -0
- package/src/Components/Filter/FilterSwitch/FilterSwitch.theme.ts +3 -3
- package/src/Components/Filter/FilterSwitch/FilterSwitch.tsx +3 -2
- package/src/Components/Filter/FilterSwitchAdapter/FilterSwitchAdapter.tsx +7 -2
- package/src/Components/Table/CheckableRow.tsx +12 -4
package/package.json
CHANGED
|
@@ -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
|
|
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
|
))}
|
|
@@ -8,6 +8,7 @@ import Tr, { RowProps } from './Tr';
|
|
|
8
8
|
export interface CheckableRowProps extends RowProps {
|
|
9
9
|
id: string;
|
|
10
10
|
isDisabled?: boolean;
|
|
11
|
+
isReversed?: boolean;
|
|
11
12
|
label: ReactNode;
|
|
12
13
|
name: string;
|
|
13
14
|
tooltipProps?: Omit<TooltipProps, 'children' | 'shouldWrapChildren'>;
|
|
@@ -15,7 +16,7 @@ export interface CheckableRowProps extends RowProps {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const CheckableRow = (props: CheckableRowProps) => {
|
|
18
|
-
const { children, id, isDisabled, label, name, tooltipProps, value, ...rest } = props;
|
|
19
|
+
const { children, id, isDisabled, isReversed, label, name, tooltipProps, value, ...rest } = props;
|
|
19
20
|
|
|
20
21
|
return (
|
|
21
22
|
<Tooltip isDisabled={!tooltipProps} placement="right" {...tooltipProps}>
|
|
@@ -35,15 +36,22 @@ const CheckableRow = (props: CheckableRowProps) => {
|
|
|
35
36
|
transform="scale(1)"
|
|
36
37
|
{...rest}
|
|
37
38
|
>
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
39
|
+
{!isReversed && (
|
|
40
|
+
<Td>
|
|
41
|
+
<Checkbox id={id} isDisabled={isDisabled} name={name} value={value} zIndex="1" />
|
|
42
|
+
</Td>
|
|
43
|
+
)}
|
|
41
44
|
<Td>
|
|
42
45
|
<LinkOverlay as="label" cursor={isDisabled ? 'not-allowed' : 'pointer'} htmlFor={id}>
|
|
43
46
|
{label}
|
|
44
47
|
</LinkOverlay>
|
|
45
48
|
</Td>
|
|
46
49
|
{children}
|
|
50
|
+
{!!isReversed && (
|
|
51
|
+
<Td textAlign="right">
|
|
52
|
+
<Checkbox id={id} isDisabled={isDisabled} name={name} value={value} zIndex="1" />
|
|
53
|
+
</Td>
|
|
54
|
+
)}
|
|
47
55
|
</LinkBox>
|
|
48
56
|
</Tooltip>
|
|
49
57
|
);
|