@bitrise/bitkit 13.94.0 → 13.96.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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode, useMemo, useState } from 'react';
|
|
2
2
|
import { Modal, ModalOverlay, useMultiStyleConfig } from '@chakra-ui/react';
|
|
3
3
|
import { isEqual } from '../../utils/utils';
|
|
4
4
|
import Box, { BoxProps } from '../Box/Box';
|
|
@@ -28,6 +28,7 @@ export interface FilterProps extends Omit<BoxProps, 'onChange'> {
|
|
|
28
28
|
filtersDependOn?: string[];
|
|
29
29
|
isLoading?: boolean;
|
|
30
30
|
onChange: (state: FilterState) => void;
|
|
31
|
+
searchTooltip?: ReactNode;
|
|
31
32
|
showAdd?: boolean;
|
|
32
33
|
showFilterIcon?: boolean;
|
|
33
34
|
showSearch?: boolean;
|
|
@@ -41,6 +42,7 @@ const Filter = (props: FilterProps) => {
|
|
|
41
42
|
filtersDependOn,
|
|
42
43
|
isLoading,
|
|
43
44
|
onChange,
|
|
45
|
+
searchTooltip,
|
|
44
46
|
showAdd = true,
|
|
45
47
|
showFilterIcon = true,
|
|
46
48
|
showSearch,
|
|
@@ -61,7 +63,7 @@ const Filter = (props: FilterProps) => {
|
|
|
61
63
|
}
|
|
62
64
|
});
|
|
63
65
|
|
|
64
|
-
const stateToRestore =
|
|
66
|
+
const stateToRestore = useMemo<FilterState>(() => defaultState || cleanState, [defaultState, cleanState]);
|
|
65
67
|
|
|
66
68
|
const [isPopoverOpen, setPopoverOpen] = useState<boolean>(false);
|
|
67
69
|
|
|
@@ -99,7 +101,7 @@ const Filter = (props: FilterProps) => {
|
|
|
99
101
|
};
|
|
100
102
|
|
|
101
103
|
const onClearFilters = () => {
|
|
102
|
-
onChange(stateToRestore
|
|
104
|
+
onChange(stateToRestore || {});
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
const filters = {
|
|
@@ -114,7 +116,7 @@ const Filter = (props: FilterProps) => {
|
|
|
114
116
|
filters[value.type || 'tag'][category] = value;
|
|
115
117
|
});
|
|
116
118
|
|
|
117
|
-
const showClearFilters = !isEqual(stateToRestore
|
|
119
|
+
const showClearFilters = !isEqual(stateToRestore, state);
|
|
118
120
|
|
|
119
121
|
const contextValue: FilterContextType = useMemo(
|
|
120
122
|
() => ({
|
|
@@ -175,7 +177,11 @@ const Filter = (props: FilterProps) => {
|
|
|
175
177
|
{showSearch && (
|
|
176
178
|
<>
|
|
177
179
|
<Divider flexShrink="0" orientation="vertical" size="1" variant="solid" />
|
|
178
|
-
<FilterSearch
|
|
180
|
+
<FilterSearch
|
|
181
|
+
onChange={onFilterChange}
|
|
182
|
+
value={cleanState.search?.length ? cleanState.search[0] : ''}
|
|
183
|
+
searchTooltip={searchTooltip}
|
|
184
|
+
/>
|
|
179
185
|
</>
|
|
180
186
|
)}
|
|
181
187
|
</Box>
|
|
@@ -6,7 +6,6 @@ import Box from '../../Box/Box';
|
|
|
6
6
|
import DatePicker, { DateRange, useDateRange } from '../../DatePicker/DatePicker';
|
|
7
7
|
import Icon from '../../Icon/Icon';
|
|
8
8
|
import Text from '../../Text/Text';
|
|
9
|
-
import Tooltip from '../../Tooltip/Tooltip';
|
|
10
9
|
import { useFilterContext } from '../Filter.context';
|
|
11
10
|
import { FilterStyle } from '../Filter.theme';
|
|
12
11
|
|
|
@@ -65,12 +64,10 @@ const FilterDate = (props: FilterDateProps) => {
|
|
|
65
64
|
mode="range"
|
|
66
65
|
>
|
|
67
66
|
<Box position={isOpen ? 'relative' : undefined} sx={filterStyle.item} zIndex={isOpen ? 'dialog' : undefined}>
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
</Text>
|
|
73
|
-
</Tooltip>
|
|
67
|
+
<Text as="button" disabled={isLoading} onClick={onToggle} size="2" sx={filterStyle.tagEdit}>
|
|
68
|
+
<Icon color="neutral.60" name="Calendar" size="16" /> {label}
|
|
69
|
+
<Icon name="ChevronDown" size="16" />
|
|
70
|
+
</Text>
|
|
74
71
|
</Box>
|
|
75
72
|
</DatePicker>
|
|
76
73
|
);
|
|
@@ -67,7 +67,7 @@ const FilterItem = (props: FilterItemProps) => {
|
|
|
67
67
|
<Popover isLazy isOpen={isOpen} onClose={onClose}>
|
|
68
68
|
<PopoverTrigger>
|
|
69
69
|
<Box position={isOpen ? 'relative' : undefined} sx={filterStyle.item} zIndex={isOpen ? 'dialog' : undefined}>
|
|
70
|
-
<Tooltip isDisabled={isLoading} label="Edit">
|
|
70
|
+
<Tooltip isDisabled={isLoading || type !== 'tag'} label="Edit">
|
|
71
71
|
<Text as="button" disabled={isLoading} onClick={onToggle} size="2" sx={filterStyle.tagEdit}>
|
|
72
72
|
{getText()}
|
|
73
73
|
{type === 'select' && <Icon name="ChevronDown" size="16" />}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEvent, useEffect, useState } from 'react';
|
|
1
|
+
import { ChangeEvent, ReactNode, useEffect, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Input,
|
|
4
4
|
InputGroup,
|
|
@@ -9,16 +9,18 @@ import {
|
|
|
9
9
|
} from '@chakra-ui/react';
|
|
10
10
|
import Icon from '../../Icon/Icon';
|
|
11
11
|
import IconButton from '../../IconButton/IconButton';
|
|
12
|
+
import Tooltip from '../../Tooltip/Tooltip';
|
|
12
13
|
import { FilterStyle } from '../Filter.theme';
|
|
13
14
|
import { FilterValue } from '../Filter.types';
|
|
14
15
|
|
|
15
16
|
export interface FilterSearchProps extends Omit<InputProps, 'onChange' | 'value'> {
|
|
16
17
|
onChange: (category: string, selected: FilterValue) => void;
|
|
18
|
+
searchTooltip?: ReactNode;
|
|
17
19
|
value: string;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
const FilterSearch = (props: FilterSearchProps) => {
|
|
21
|
-
const { onChange, value, ...rest } = props;
|
|
23
|
+
const { onChange, placeholder, searchTooltip, value, ...rest } = props;
|
|
22
24
|
const filterStyle = useMultiStyleConfig('Filter') as FilterStyle;
|
|
23
25
|
|
|
24
26
|
const [searchValue, setSearchValue] = useState(value);
|
|
@@ -44,7 +46,7 @@ const FilterSearch = (props: FilterSearchProps) => {
|
|
|
44
46
|
|
|
45
47
|
const inputProps: InputProps = {
|
|
46
48
|
onChange: onInputChange,
|
|
47
|
-
placeholder: 'Search...',
|
|
49
|
+
placeholder: placeholder || 'Search...',
|
|
48
50
|
sx: filterStyle.searchInput,
|
|
49
51
|
value: searchValue,
|
|
50
52
|
...rest,
|
|
@@ -54,7 +56,9 @@ const FilterSearch = (props: FilterSearchProps) => {
|
|
|
54
56
|
<InputLeftElement margin="8">
|
|
55
57
|
<Icon color="neutral.60" name="Magnifier" size="16" />
|
|
56
58
|
</InputLeftElement>
|
|
57
|
-
<
|
|
59
|
+
<Tooltip isDisabled={!searchTooltip} label={searchTooltip}>
|
|
60
|
+
<Input {...inputProps} />
|
|
61
|
+
</Tooltip>
|
|
58
62
|
{!!searchValue && (
|
|
59
63
|
<InputRightElement>
|
|
60
64
|
<IconButton aria-label="Clear" iconName="CloseSmall" onClick={onClearClick} size="sm" variant="tertiary" />
|