@bitrise/bitkit 12.70.0-alpha-filter-2.2 → 12.70.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": "12.70.0-alpha-filter-2.2",
4
+ "version": "12.70.0",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -66,13 +66,13 @@
66
66
  "@testing-library/user-event": "^14.5.1",
67
67
  "@types/jest": "^29.5.11",
68
68
  "@types/luxon": "^3.3.7",
69
- "@types/react": "^18.2.43",
69
+ "@types/react": "^18.2.45",
70
70
  "@types/react-dom": "^18.2.17",
71
71
  "@typescript-eslint/eslint-plugin": "^6.14.0",
72
72
  "@typescript-eslint/parser": "^6.14.0",
73
73
  "axios": "^1.6.2",
74
74
  "eslint": "^8.55.0",
75
- "eslint-plugin-import": "^2.29.0",
75
+ "eslint-plugin-import": "^2.29.1",
76
76
  "eslint-plugin-jest": "^27.6.0",
77
77
  "eslint-plugin-jsx-a11y": "^6.8.0",
78
78
  "eslint-plugin-prettier": "^5.0.1",
@@ -85,7 +85,7 @@
85
85
  "jest-environment-jsdom": "^29.7.0",
86
86
  "jsdom": "^23.0.1",
87
87
  "prettier": "^3.1.1",
88
- "react-hook-form": "^7.49.0",
88
+ "react-hook-form": "^7.49.2",
89
89
  "semantic-release": "^22.0.12",
90
90
  "storybook": "^7.6.4",
91
91
  "ts-jest": "^29.1.1",
@@ -4,9 +4,6 @@ const { defineMultiStyleConfig } = createMultiStyleConfigHelpers(['button', 'che
4
4
 
5
5
  const ExpandableCardTheme = defineMultiStyleConfig({
6
6
  baseStyle: ({ isOpen }) => ({
7
- box: {
8
- zIndex: 1,
9
- },
10
7
  button: {
11
8
  borderTopStartRadius: '8',
12
9
  borderTopEndRadius: '8',
@@ -60,7 +60,7 @@ export const FILTER_STORY_DATA: FilterData = {
60
60
  console.log('onAsyncSearch', { category, q });
61
61
  return new Promise((resolve) => {
62
62
  setTimeout(() => {
63
- resolve(['found 1', 'found 2']);
63
+ resolve({ options: ['found 1', 'found 2'] });
64
64
  }, 2000);
65
65
  });
66
66
  },
@@ -8,7 +8,10 @@ export type FilterValue = string[];
8
8
  export type FilterOptionsMap = Record<string, string>;
9
9
  export type FilterIconsMap = Record<string, TypeIconName>;
10
10
 
11
- export type FilterSearchCallback = (category: string, q: string) => Promise<FilterValue>;
11
+ export type FilterSearchCallback = (
12
+ category: string,
13
+ q: string,
14
+ ) => Promise<{ iconsMap?: FilterIconsMap; options: FilterOptions; optionsMap?: FilterOptionsMap }>;
12
15
 
13
16
  export type FilterCategoryProps = {
14
17
  categoryName?: string;
@@ -91,13 +91,15 @@ const FilterForm = (props: FilterFormProps) => {
91
91
  if (onAsyncSearch) {
92
92
  const response = await onAsyncSearch(category, searchValue);
93
93
  setLoading(false);
94
- setFoundOptions(response);
94
+ setFoundOptions(response.options);
95
95
  }
96
96
  };
97
97
 
98
98
  useEffect(() => {
99
99
  if (debouncedSearchValue.length > 0) {
100
100
  getAsyncList();
101
+ } else {
102
+ setLoading(false);
101
103
  }
102
104
  }, [debouncedSearchValue]);
103
105
 
@@ -1,3 +1,5 @@
1
+ import { Fragment } from 'react';
2
+ import { Portal } from '@chakra-ui/react';
1
3
  import IconButton, { IconButtonProps } from '../IconButton/IconButton';
2
4
  import Menu, { MenuProps } from '../Menu/Menu';
3
5
  import MenuButton from '../Menu/MenuButton';
@@ -7,9 +9,11 @@ export interface OverflowMenuProps extends MenuProps {
7
9
  children: MenuListProps['children'];
8
10
  buttonSize?: IconButtonProps['size'];
9
11
  triggerLabel?: string;
12
+ withPortal?: boolean;
10
13
  }
11
14
 
12
- const OverflowMenu = ({ buttonSize = 'small', children, triggerLabel }: OverflowMenuProps) => {
15
+ const OverflowMenu = ({ buttonSize = 'small', children, triggerLabel, withPortal }: OverflowMenuProps) => {
16
+ const Wrapper = withPortal ? Portal : Fragment;
13
17
  return (
14
18
  <Menu isLazy>
15
19
  <MenuButton
@@ -20,13 +24,16 @@ const OverflowMenu = ({ buttonSize = 'small', children, triggerLabel }: Overflow
20
24
  size={buttonSize}
21
25
  variant="tertiary"
22
26
  />
23
- <MenuList>{children}</MenuList>
27
+ <Wrapper>
28
+ <MenuList>{children}</MenuList>
29
+ </Wrapper>
24
30
  </Menu>
25
31
  );
26
32
  };
27
33
 
28
34
  OverflowMenu.defaultProps = {
29
35
  triggerLabel: 'Open menu',
36
+ withPortal: false,
30
37
  };
31
38
 
32
39
  export default OverflowMenu;