@bitrise/bitkit 13.88.0 → 13.89.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.88.0",
4
+ "version": "13.89.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -1,3 +1,5 @@
1
+ import { DateTime } from 'luxon';
2
+ import { DateRange } from '../DatePicker/useDateRange';
1
3
  import { FilterContextType, FilterData, FilterOptions, FilterState } from './Filter.types';
2
4
 
3
5
  export const FILTER_STORY_OPTIONS: FilterOptions =
@@ -53,6 +55,8 @@ export const FILTER_STORY_DATA: FilterData = {
53
55
  date_range: {
54
56
  categoryName: 'Date',
55
57
  categoryNamePlural: 'dates',
58
+ isMultiple: true,
59
+ selectable: new DateRange(DateTime.now().minus({ days: 15 }), DateTime.now()),
56
60
  type: 'dateRange',
57
61
  },
58
62
  pipeline: {
@@ -1,5 +1,6 @@
1
1
  import { Dispatch, SetStateAction } from 'react';
2
2
  import { TypeIconName } from '../Icon/Icon';
3
+ import { DateRange } from '../DatePicker/DatePicker';
3
4
 
4
5
  export type FilterType = 'dateRange' | 'search' | 'select' | 'switch' | 'tag';
5
6
 
@@ -23,8 +24,17 @@ export type FilterCategoryProps = {
23
24
  onAsyncSearch?: FilterSearchCallback;
24
25
  options?: FilterOptions;
25
26
  optionsMap?: FilterOptionsMap;
26
- type?: FilterType;
27
- };
27
+ } & (
28
+ | {
29
+ type: 'dateRange';
30
+ selectable?: DateRange;
31
+ isMultiple: true;
32
+ }
33
+ | {
34
+ type?: Exclude<FilterType, 'dateRange'>;
35
+ selectable?: never;
36
+ }
37
+ );
28
38
 
29
39
  export type FilterData = Record<string, FilterCategoryProps>;
30
40
  export type FilterState = Record<string, FilterValue>;
@@ -18,7 +18,7 @@ const FilterDate = (props: FilterDateProps) => {
18
18
  const { category } = props;
19
19
  const filterStyle = useMultiStyleConfig('Filter') as FilterStyle;
20
20
 
21
- const { isLoading, onFilterChange, onFilterClear, setPopoverOpen, state } = useFilterContext();
21
+ const { isLoading, onFilterChange, onFilterClear, setPopoverOpen, state, data } = useFilterContext();
22
22
 
23
23
  const { isOpen, onClose, onToggle } = useDisclosure();
24
24
 
@@ -55,12 +55,13 @@ const FilterDate = (props: FilterDateProps) => {
55
55
 
56
56
  return (
57
57
  <DatePicker
58
+ selectable={data.date_range.selectable || selectable}
58
59
  onApply={onDateRangeApply}
59
60
  onClear={value?.length ? onClearClick : undefined}
60
61
  onClose={onClose}
61
- selectable={selectable}
62
62
  selected={selectedRange}
63
63
  visible={isOpen}
64
+ mode="range"
64
65
  >
65
66
  <Box position={isOpen ? 'relative' : undefined} sx={filterStyle.item} zIndex={isOpen ? 'dialog' : undefined}>
66
67
  <Tooltip isDisabled={isLoading} label="Edit">